Problems with getifaddrs

Andrey Repin anrdaemon@yandex.ru
Mon Jul 26 23:04:08 GMT 2021


Greetings, Ken Brown!

> While investigating emacs test failures, I found two problems with the 
> interfaces returned by getifaddrs(3):

> 1. For an IPv6 interface, the netmask address family is always 0 instead of 
> AF_INET6.

> 2. For a disconnected interface, the IPv4 address and netmask are sometimes 0.

For a disconnected interface this could be true as

Configuration for interface "TAP12"
    DHCP enabled:                         Yes
    IP Address:                           172.16.40.6
    Subnet Prefix:                        172.16.40.0/24 (mask 255.255.255.0)
    InterfaceMetric:                      25

Configuration for interface "TAP55"
    DHCP enabled:                         Yes
    InterfaceMetric:                      25

Configuration for interface "TAP63"
    DHCP enabled:                         No
    IP Address:                           172.18.104.18
    Subnet Prefix:                        172.18.104.0/22 (mask 255.255.252.0)
    InterfaceMetric:                      25

There's actually no IP address assigned to TAP55, which could be reported as 0/0.
Can you please cross-check with

    netsh interface ipv4 show addr

> I will be sending patches to fix these problems later today, but I wanted to
> report them here for reference.

> I don't know enough about this to be sure that problem 2 is really a Cygwin bug.
>   Are there cases where a 0 IP address is appropriate?  Or should it be up to 
> the caller of getifaddrs to handle that case?


-- 
With best regards,
Andrey Repin
Tuesday, July 27, 2021 1:57:57

Sorry for my terrible english...



More information about the Cygwin mailing list