delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2019/10/23/03:57:40

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:date:from:to:cc:subject:message-id:reply-to
:references:mime-version:content-type:in-reply-to; q=dns; s=
default; b=rtPlLmLDH5lq8LLYg0FcHapeCFqE/adOlBmRfvON/xhzkLRoF+iHM
L83f4lMs75rs4L6hjWcCiCueq404C4NyBovBkljEyH/ag64ZHgWLVAeMjHmOg2gM
dLasyezshEG25tDdX3kvNgsod8dzD9A01WdUGEqj8O/tsPWzytfzdw=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:date:from:to:cc:subject:message-id:reply-to
:references:mime-version:content-type:in-reply-to; s=default;
bh=4Aq7OXZvU6jO2hqKrgXa+iW7zGY=; b=BmNNVpkXOcZOxFGg3XqXpBFvueU/
q72JFSwwA1jpR+sestb7Dk6amFUv/amjLkutrHGxHL2FE9XUuZX0Ug0bbMai1Dx2
z8kaGYAEhy7U2wTizzBNCN5eB6g0Xo/82mMa8RdsoW4GZqpq5zVRWsH393yar5XQ
9Z2RtzbuZux8Qpc=
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
Authentication-Results: sourceware.org; auth=none
X-Spam-SWARE-Status: No, score=-107.0 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_1,GOOD_FROM_CORINNA_CYGWIN,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 spammy=H*F:D*cygwin.com, day
X-HELO: mout.kundenserver.de
Date: Wed, 23 Oct 2019 09:56:38 +0200
From: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
To: David Bean <d_bean AT hotmail DOT com>
Cc: cygwin AT cygwin DOT com
Subject: Re: Possible bug retrieving IfIndex in newlib - winsup/cygwin/net.cc
Message-ID: <20191023075638.GX16240@calimero.vinschen.de>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: David Bean <d_bean AT hotmail DOT com>, cygwin AT cygwin DOT com
References: <SN6PR02MB55990E9255A45B75BC35A318FC680 AT SN6PR02MB5599 DOT namprd02 DOT prod DOT outlook DOT com> <20191022173950 DOT GT16240 AT calimero DOT vinschen DOT de> <SN6PR02MB5599DE739EFE4D9DFDCDB322FC680 AT SN6PR02MB5599 DOT namprd02 DOT prod DOT outlook DOT com>
MIME-Version: 1.0
In-Reply-To: <SN6PR02MB5599DE739EFE4D9DFDCDB322FC680@SN6PR02MB5599.namprd02.prod.outlook.com>
User-Agent: Mutt/1.12.1 (2019-06-15)

--ZXzThk3vFZecBD04
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Hi David,

On Oct 22 18:19, David Bean wrote:
> Hello Corrina,

s/rrin/rinn/ ;)

>> From: Corinna Vinschen
>> Hi David,
>>=20
>> On Oct 22 15:56, David Bean wrote:
>> > Good Day,
>> >
>> > I have been working on porting Samba 4.11 to Cygwin for a few days
>> > and ran into an odd issue. Samba configures its interfaces in
>> > several steps, but it relies pretty heavily on getting information
>> > from the interface structures populated by Cygwin. While I was
>> > walking through the call map I noticed a lot of the data is
>> > populated by get_ifs and that routine may have a bug in its
>> > handling of IfIndex. Basically it seems to copy the IPv4 index at
>> > all times even though it may need Ipv6Index.
>> >
>> > the same code exists at line 1904 and 1808 as well. I believe the
>> > current code may fail to retrieve the correct adapter index if IPv6
>> > is enabled on the interface.
>> > this is current code:  ifp->ifa_hwdata.ifa_ifindex =3D pap->IfIndex;
>> >
>> > I think it should be:  ifp->ifa_hwdata.ifa_ifindex =3D (sa->sa_family =
=3D=3D AF_INET
>> >                                          ? pap->IfIndex : pap->Ipv6Ind=
ex);
>> >
>> > This is the model used by the lines retrieving the other elements
>> > with dual locations on the windows side.
>> >
>> > I am unable to debug this to confirm it, but please let me know if
>> > this is actually a bug or not.
>>=20
>> The code in line 1808 only handles AF_INET anyway, so it shouldn't
>> use IpV6IfIndex.  As for line 1904, I didn't perform this distinction
>> because in all my testing the indices were the same.
>>=20
>> Do you have proof that this isn't always the case?  If so, I check in
>> a patch.
>
> No I do not, it just stuck out while I was looking through the code
> hunting down another problem. I have had a long history of bumping
> into undocumented issues with Windows over the years and have become
> somewhat untrusting with the windows API. I was looking through net.cc
> because a samba call to if_nametoindex was failing to return an index,
> but it seems that Cygwin just passes that call through to the IP Help
> API.

I was just about to apply the patch nevertheless, when I remembered
another reason not to use IpV6IfIndex.  *Iff* IpV6IfIndex is different
from the default IfIndex, what does it keep from colliding with another,
already used IfIndex of another interface?  That would lead to two
interfaces having the same index in Cygwin.

> Have a good one,

Same to you,
Corinna

--=20
Corinna Vinschen
Cygwin Maintainer

--ZXzThk3vFZecBD04
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEEoVYPmneWZnwT6kwF9TYGna5ET6AFAl2wB7YACgkQ9TYGna5E
T6ChzQ/9Gn48bZMRzmxGk+EtIAYmk04jHkmBobW5juo6FOAmZutAclnxnRdaNr+q
o5eAKPt6p+JOp1xVz6rINjw3Nl+0XbjDp4rV13biFVouY2K924ZIuffVxUSbh0ww
t24OM1G+kFaEIvVjz3I9gKWxi2nk8ck5S3pwIVDgIL/NX5HodFWEhfDu0kvy3dQP
tYEjhL6ehe08hmVAwP8WEmJ/ft3CeuDEHP3DGKs+9I5Hzm4O8xvkh2EcunRsVSm1
qyRXJSUK3LrV4nHjBLugqC75DekG44QHHjfY0GwF/BBorsgOKEaLOF34wAjeoi+9
/2omRIUXCGNp98z46HiH653vMchTjSA0ldZOEyBAtvMadrxxNRV9puYsSBz0pbpC
H0AKIfyK1OCPZULI7lNcmPaEuIgRBkgeyXrW6xlwy6yRlYtNB99SNDo4ZLLmIyql
tioStfyybTcxI4huGVVnVzZTcP7ShFXTuomn0tAaPyx/qYbpTTYWrG5mSPyDSS+U
8s8pAY22L2b5hizm1B2mwJRWFngn+gHk+EWezXZS84aLK+Ak51/bwx4Yztc/B4Dz
3nUNVOBhgL9mi2GVhbKzAbXNypK26h0Un7SC3ypY0P0dm+j4b61F2k2YSdVqrSG6
r+K/CHXeuDhqzgy6cZUZI+FxKmoZieLpmGEuMAqi6RCmhlx1wVU=
=6ERJ
-----END PGP SIGNATURE-----

--ZXzThk3vFZecBD04--

- Raw text -


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