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]

Re: Difference in behaviour between getifaddrs() and ioctl(SIOCGIFCONF)


Jason Curl <jcurlnews <at> arcor.de> writes:

> Corinna Vinschen <corinna-cygwin <at> cygwin.com> writes:
> > So, for the above interface we get
> > 
> >   371D57D9-0FF3-402C-AB69-E88FF9D85BC3:f36e.1
> > 
> > as the unique alias name for the given IPv4 address.
> > 
> 
> 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.
> 
> That is, you might very well see:
> * en0, AF_INET, 192.168.0.1
> * en0, AF_INET, 169.254.123.45
> * en0, AF_INET6, <address>
> * lo, AF_INET, 127.0.0.1

On the way home, I realised the current behaviour deviates from Linux also. 

Linux getifaddrs():
* eth0 -> AF_INET
* eth0 -> AF_INET6

Cygwin getifaddrs():
* {xxx} -> AF_INET6
* {xxx}:1 -> AF_INET

This is another reason why I think it could be architecturally simpler to just
have multiple records and to drop the interface indices all together of the form
":1".

Thanks,
Jason.



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