; Fix recent change in w32.c
* src/w32.c (network_interface_list): Correct an embarrassing typo and cleanup the code.
This commit is contained in:
parent
4eb7db5d4b
commit
39b3bc0082
1 changed files with 9 additions and 10 deletions
19
src/w32.c
19
src/w32.c
|
@ -9642,8 +9642,7 @@ network_interface_list (bool full, unsigned short match)
|
|||
#else
|
||||
/* Kludge alert! OnLinkPrefixLength is only defined
|
||||
when compiling for Vista and later. */
|
||||
numbits = *(UINT8 *) (address->LeaseLifetime
|
||||
+ sizeof (address->LeaseLifetime));
|
||||
numbits = *(UINT8 *) (&address->LeaseLifetime + 1);
|
||||
#endif
|
||||
}
|
||||
else /* Windows XP */
|
||||
|
@ -9652,14 +9651,14 @@ network_interface_list (bool full, unsigned short match)
|
|||
numbits = 0;
|
||||
for ( ; prefix; prefix = prefix->Next)
|
||||
{
|
||||
/* We want the longest matching prefix. */
|
||||
if (prefix->Address.lpSockaddr->sa_family
|
||||
!= ifa_addr->sa_family
|
||||
|| prefix->PrefixLength <= numbits)
|
||||
continue;
|
||||
if (address_prefix_match (ifa_addr->sa_family, ifa_addr,
|
||||
prefix->Address.lpSockaddr,
|
||||
prefix->PrefixLength))
|
||||
/* We want the longest matching prefix. */
|
||||
if ((prefix->Address.lpSockaddr->sa_family
|
||||
== ifa_addr->sa_family)
|
||||
&& (prefix->PrefixLength > numbits)
|
||||
&& address_prefix_match (ifa_addr->sa_family,
|
||||
ifa_addr,
|
||||
prefix->Address.lpSockaddr,
|
||||
prefix->PrefixLength))
|
||||
numbits = prefix->PrefixLength;
|
||||
}
|
||||
if (!numbits)
|
||||
|
|
Loading…
Add table
Reference in a new issue