public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Problems with getifaddrs
@ 2021-07-26 15:15 Ken Brown
  2021-07-26 23:04 ` Andrey Repin
  0 siblings, 1 reply; 3+ messages in thread
From: Ken Brown @ 2021-07-26 15:15 UTC (permalink / raw)
  To: cygwin

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.

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?

Ken

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Problems with getifaddrs
  2021-07-26 15:15 Problems with getifaddrs Ken Brown
@ 2021-07-26 23:04 ` Andrey Repin
  2021-07-29 14:43   ` Ken Brown
  0 siblings, 1 reply; 3+ messages in thread
From: Andrey Repin @ 2021-07-26 23:04 UTC (permalink / raw)
  To: Ken Brown, cygwin

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...


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Problems with getifaddrs
  2021-07-26 23:04 ` Andrey Repin
@ 2021-07-29 14:43   ` Ken Brown
  0 siblings, 0 replies; 3+ messages in thread
From: Ken Brown @ 2021-07-29 14:43 UTC (permalink / raw)
  To: cygwin

On 7/26/2021 7:04 PM, Andrey Repin wrote:
> There's actually no IP address assigned to TAP55, which could be reported as 0/0.

Follow-up for the sake of the archives: The question I raised is whether 
getifaddrs *should* report an IP address of 0/0 in this case.  After checking 
what happens on Linux, Corinna agreed that it should not do this, and we've now 
changed it:

https://cygwin.com/git/?p=newlib-cygwin.git;a=commit;h=b88d686a68d7bf2ff22d857a28d37fe4fdbafdf2

Ken

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-07-29 14:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-26 15:15 Problems with getifaddrs Ken Brown
2021-07-26 23:04 ` Andrey Repin
2021-07-29 14:43   ` Ken Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).