mirror of
https://github.com/9001/copyparty.git
synced 2026-11-24 07:32:36 +00:00
ifaddr: winxp fix
This commit is contained in:
1 parent
f445bfa862
commit
107dec9ed1
1 file changed
+8
-1
@@ -2,6 +2,7 @@
|
|||||||
from __future__ import print_function, unicode_literals
|
from __future__ import print_function, unicode_literals
|
||||||
|
|
||||||
import ctypes
|
import ctypes
|
||||||
|
import sys
|
||||||
from ctypes import wintypes
|
from ctypes import wintypes
|
||||||
|
|
||||||
if True: # pylint: disable=using-constant-test
|
if True: # pylint: disable=using-constant-test
|
||||||
@@ -9,6 +10,9 @@ if True: # pylint: disable=using-constant-test
|
|||||||
|
|
||||||
from . import _shared as shared
|
from . import _shared as shared
|
||||||
|
|
||||||
|
WINVER = sys.getwindowsversion()
|
||||||
|
LE_XP = WINVER.major < 6
|
||||||
|
|
||||||
NO_ERROR = 0
|
NO_ERROR = 0
|
||||||
ERROR_BUFFER_OVERFLOW = 111
|
ERROR_BUFFER_OVERFLOW = 111
|
||||||
MAX_ADAPTER_NAME_LENGTH = 256
|
MAX_ADAPTER_NAME_LENGTH = 256
|
||||||
@@ -83,7 +87,10 @@ def enumerate_interfaces_of_adapter(
|
|||||||
t = "sockaddr_to_ip({}) returned None"
|
t = "sockaddr_to_ip({}) returned None"
|
||||||
raise Exception(t.format(address.Address.lpSockaddr))
|
raise Exception(t.format(address.Address.lpSockaddr))
|
||||||
|
|
||||||
network_prefix = address.OnLinkPrefixLength
|
if LE_XP:
|
||||||
|
network_prefix = 16 if str(ip).startswith("169.254") else 24
|
||||||
|
else:
|
||||||
|
network_prefix = address.OnLinkPrefixLength
|
||||||
yield shared.IP(ip, network_prefix, nice_name)
|
yield shared.IP(ip, network_prefix, nice_name)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user