delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2010/12/02/12:54:44

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-1.3 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,SPF_HELO_PASS,TW_RL,T_RP_MATCHES_RCVD,T_TO_NO_BRKTS_FREEMAIL
X-Spam-Check-By: sourceware.org
To: cygwin AT cygwin DOT com
From: Jason Curl <jcurlnews AT arcor DOT de>
Subject: Re: Difference in behaviour between getifaddrs() and ioctl(SIOCGIFCONF)
Date: Thu, 2 Dec 2010 17:54:13 +0000 (UTC)
Lines: 39
Message-ID: <loom.20101202T184932-130@post.gmane.org>
References: <id6eq6$un5$1 AT dough DOT gmane DOT org> <20101202114036 DOT GG30913 AT calimero DOT vinschen DOT de> <20101202133251 DOT GL30913 AT calimero DOT vinschen DOT de> <loom DOT 20101202T145411-365 AT post DOT gmane DOT org>
Mime-Version: 1.0
User-Agent: Loom/3.14 (http://gmane.org/)
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019