This is the mail archive of the cygwin mailing list for the Cygwin project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
On Dec 2 14:23, Jason Curl wrote:One of my use cases is to test a particular interface if it has an IP address or not (due to DHCP, AutoIP, etc.). Then on definition of an address, I can trigger a process. This assumes that the interface names remains constant. So a dynamically changing interface name is something I'd like to NOT see.
Huh? My proposal does exactly that. It would always return unique interface names.
The solution that I do prefer, is one similar to QNX. QNX behaves differently to Linux, but could be the simplest implementation for Cygwin. If an interface has aliases, it simply has multiple records in getifaddrs(). The ioctl() interface returns the main/preferred address. Cygwin could return the first AF_INET record in this case.
Here's the problem. Windows does not mark an IPv4 address as preferred address, nor does it always return the addresses in the order you'd expect. Actually, it appears as if the addresses of an interface are always returned in ascending order (on W7, at least).
So, following your proposal, if you add an address which is numerically lower than the other addresses, the next call to ioctl(SIOCGIFADDR) would return the new address. If you remove the address again it would return the old address again. From my POV this is as much surprising as the current behaviour. Hence my proposal.
-- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |