X-Recipient: archive-cygwin@delorie.com
X-Spam-Check-By: sourceware.org
Date: Thu, 2 Dec 2010 19:02:08 +0100
From: Corinna Vinschen <corinna-cygwin@cygwin.com>
To: cygwin@cygwin.com
Subject: Re: Difference in behaviour between getifaddrs() and ioctl(SIOCGIFCONF)
Message-ID: <20101202180208.GP30913@calimero.vinschen.de>
Reply-To: cygwin@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
References: <id6eq6$un5$1@dough.gmane.org> <20101202114036.GG30913@calimero.vinschen.de> <20101202133251.GL30913@calimero.vinschen.de> <loom.20101202T145411-365@post.gmane.org> <loom.20101202T184932-130@post.gmane.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
In-Reply-To: <loom.20101202T184932-130@post.gmane.org>
User-Agent: Mutt/1.5.20 (2009-06-14)
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
Precedence: bulk
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie.com@cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com

On Dec  2 17:54, Jason Curl wrote:
> 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

That's already fixed in CVS:

  Cygwin getifaddrs():
  * {xxx} -> AF_INET6
  * {xxx} -> AF_INET   (for the first address)
  * {xxx}:x -> AF_INET (for each following address)

Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

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

