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=wyk06TzeLGhZPOl6bHjQajBKkc6nTwxhHnoLY0nCnDMn6G85fEcuL BJtDUsSmI3dFsmKA47cv9tapJhmO+OC+mxbk4eJw4KXxUQuPT3jec7Cz1jnsXmR9 4HoE50uIei2LFv4TAHgjKtEddldhikMcDRiQ3mE4gj3BuWWuJMyiYQ= 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=OUV+EhWRQQSpoEVlH589KYnV42E=; b=DTuDRHNQPbd8Ho3c1+KnRrLDk980 1dFg4PMEilecd2Cz3jt1cF/19MnYNxPneZ06/55riQXT3k3V0Pco5Mp6JpCuz24N jPHPws6kdOP/zD5ibJn7QffX1UsNSxz8mymBiqht7lIFLJhK//CNorSEaptGrMO1 7wDPHqsHSZxzoTk= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , 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.4 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: Tue, 22 Oct 2019 19:39:50 +0200 From: Corinna Vinschen To: David Bean Cc: cygwin AT cygwin DOT com Subject: Re: Possible bug retrieving IfIndex in newlib - winsup/cygwin/net.cc Message-ID: <20191022173950.GT16240@calimero.vinschen.de> Reply-To: cygwin AT cygwin DOT com Mail-Followup-To: David Bean , cygwin AT cygwin DOT com References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="ftQmbtOmUf2cr8rB" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.12.1 (2019-06-15) --ftQmbtOmUf2cr8rB Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi David, On Oct 22 15:56, David Bean wrote: > Good Day, >=20 > I have been working on porting Samba 4.11 to Cygwin for a few days and ra= n into an odd issue. Samba configures its interfaces in several steps, but = it relies pretty heavily on getting information from the interface structur= es 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 i= n its handling of IfIndex. Basically it seems to copy the IPv4 index at all= times even though it may need Ipv6Index. >=20 > 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; >=20 > I think it should be: ifp->ifa_hwdata.ifa_ifindex =3D (sa->sa_family =3D= =3D AF_INET > ? pap->IfIndex : pap->Ipv6Index); >=20 > This is the model used by the lines retrieving the other elements with du= al locations on the windows side. >=20 > I am unable to debug this to confirm it, but please let me know if this i= s actually a bug or not. 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. Do you have proof that this isn't always the case? If so, I check in a patch. Thanks, Corinna --=20 Corinna Vinschen Cygwin Maintainer --ftQmbtOmUf2cr8rB Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEoVYPmneWZnwT6kwF9TYGna5ET6AFAl2vPuYACgkQ9TYGna5E T6DZPxAAllSGbxHRG6Arnf67v0UaatuIkDLU+a00ysJDds1ceDuCpSTugfChl4uM b6+CNy2bXwEwVlEoYfPV7U78fiqpB9Sz6SgsCgQTL9idosqrFg0n5QrOwa0EZTxy 2kIcpEY9qpJTMkD23Y0NKNW8S1QnObrIj1RwJkQHoy+nstiA1WCnQLqdxLxaNM3J KlBFg+rRS9VbAOaaeu9WKRyFbAT3HXcpl7NqiRVus23/omPNI9on4r6V+KrkGcCj aIUIGpx25WE5glAPns1mgAm6DtkbqPKLTGdWnUxqdsAyUrqq/L3W5zKPpGvV9I6A 9fsjJa8hE/MCxD5waVrUjizvVkfL/PAfIkdV5ErfQ0/+8HWpxYwOubCzhdJ4EOd5 Bv2qhb9ws0G77bgsPEQutQNWgnFT52sOzkMfDgMr0idnrPAtKBH/B9Szyw1/5HCU tTWADintKAT9PhukLr/2xNZZdVh/GFQSvOM9+s9H1JJAGJbVCPTJHN7TDFXCKK+t +gUP3En9rjZNk5+b2JpPEZb0KCRn6cSZbWsBMC7HvQ0j7cUvQLAHuWK/EMwjT/D/ VI/KSFpYH+5SIduC0KpgfdFPtPZBB8UWSVc35vV/xHscE0Q2lD16EIH8wgnYalnI jB6Sr9wvObkn1lW/c8DJvePO6mZvAyBH56tUjyHSD5itQXmliM4= =Xpy5 -----END PGP SIGNATURE----- --ftQmbtOmUf2cr8rB--