@@ -12,25 +12,25 @@ def get_internal_network():
1212 import socket
1313 import struct
1414
15- iface = "eth0"
15+ iface = b "eth0"
1616 sockfd = socket .socket (socket .AF_INET , socket .SOCK_DGRAM )
17- ifreq = struct .pack ("16sH14s" , iface , socket .AF_INET , b"\x00 " * 14 )
17+ ifreq = struct .pack (b "16sH14s" , iface , socket .AF_INET , b"\x00 " * 14 )
1818
1919 try :
2020 ip = struct .unpack (
21- "!I" , struct .unpack ("16sH2x4s8x" , fcntl .ioctl (sockfd , 0x8915 , ifreq ))[2 ]
21+ b "!I" , struct .unpack (b "16sH2x4s8x" , fcntl .ioctl (sockfd , 0x8915 , ifreq ))[2 ]
2222 )[0 ]
2323 netmask = socket .ntohl (
24- struct .unpack ("16sH2xI8x" , fcntl .ioctl (sockfd , 0x891B , ifreq ))[2 ]
24+ struct .unpack (b "16sH2xI8x" , fcntl .ioctl (sockfd , 0x891B , ifreq ))[2 ]
2525 )
2626 except IOError :
2727 return ()
28- base = socket .inet_ntoa (struct .pack ("!I" , ip & netmask ))
28+ base = socket .inet_ntoa (struct .pack (b "!I" , ip & netmask ))
2929 netmask_bits = 32 - int (round (math .log (ctypes .c_uint32 (~ netmask ).value + 1 , 2 ), 1 ))
30- return ( "{0:s}/{1:d}" .format (base , netmask_bits ), )
30+ return "{0:s}/{1:d}" .format (base , netmask_bits )
3131
3232
33- INTERNAL_SYSTEM_IPS = get_internal_network ()
33+ INTERNAL_SYSTEM_IPS = ( get_internal_network (), )
3434
3535
3636DATABASES = {
0 commit comments