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:from:to:subject:date:message-id:references :in-reply-to:mime-version:content-type :content-transfer-encoding; q=dns; s=default; b=szpM2+PUbiJJnYkE HiWK/MnS3srWpIuS5f65B3fvtDo51RLQzgBe0fY9IpitBmRUodKKQPIDpf1Ojj7r pbnHdFPed/ehqArFJw3QTiO9r7/5d+y0wdT1kbLB/nPTSjXHKRNU58/c2xuMp2Lm rURhTjEX+jd0fuCUHiljbVJgN9s= 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:from:to:subject:date:message-id:references :in-reply-to:mime-version:content-type :content-transfer-encoding; s=default; bh=G6QnW0jCJnR7jxsvilJDfk +O1uw=; b=Fa+L9OQpOYX/YR0uH3tT0G9cggbTUTbHTCl5yBYd+aOXAxgwmVrprF ZumpkHTxjaQuft4DuQbNFzW82zKx7HNNj+SMJ3kogwbAw2K880DD7z2iCOMaZ5wR EVhzrSQ8AyqX5CgoT0Nvi1U+qHJQJNj3reSPDdlj4MRvciQdR2bFY= 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=-6.0 required=5.0 tests=AWL,BAYES_00,FORGED_HOTMAIL_RCVD2,FREEMAIL_FROM,GIT_PATCH_1,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.1 spammy=Help, hunting, H*c:alternative, H*c:HHH X-HELO: NAM02-BL2-obe.outbound.protection.outlook.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Qz6g9ZNESuXEWJAp+l87X9JlgluuDS654Efya0e7CaeXlIF0KGyFH/l1xfunplxM5tiCkj1lfbx7mxXOESA5Ff37CV4EAkPWw6QaImf08Wi0FT4dH2OYpewzHWdQejoj3wxrlbz4NhMluG7N6pc8tqD1HKAa4UjwLv3u0ew7ujXqPhN+xReeWcv2JWnxqMYe0QkvJESa1seNqrCY4CGHAPiDJoYzj7KzVpsdqwWcbU5j9uDCrVKh59ZayByP52JeJ68PKT/NPzn7cowUUPcTzVHpRPfktYQvoHMOBffxA38lCJpkN53f0n62lk2HKZk4+yqCPWWcvkpEo0X+V+HXlw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=4i1mKmPbPjqTybM+3xTlPCSHhDZfZ67ycDvZWYzVWsw=; b=MrBTv1vm4+iKyGmz3ZkYeoESwyFmPCEC+bLHzYzeWiVmn9EYtGRwxJibo1AEtPZTFti10yIWltXAYpHwaliyMnkt9/NfL51H/UPqH9z6CSJ5BDX9dYMBqClTvfd8OFF8d6BE8tOohDT97WG8vzVT5EEoTzCkLBlRPU6NufkXrA//wM3R+9gGgRdL51WjOKySmde52R4sdn2kEYsKra05y+RJCSFShPv8/54bV8O/2pz7XcTo3QbTFPwP2bJx6F88oakUlDdNGHQhCFLAoaZ+5/Vl98UQ5PhLT61BxoudJb6+JjU6HzcHxU/XvXVZWcmiITutxQ6ma9cQn6OGtBUjeA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hotmail.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=4i1mKmPbPjqTybM+3xTlPCSHhDZfZ67ycDvZWYzVWsw=; b=MGqy+ivZ+k+B5B9IiWL/YCR+9Wgi6GEBzdhcDHpU5uJTYYHM735rC6P4q/pH2Gre4sKkrAdjEIIxgLVmoprtwpUBOkI1lTw0biDORT1M+xWMCqXRjJ1h0lWedBaDLFh+13hDLfDfIy9imwqKKw/ScfcpT++lwBt81FTB0hs0PT3aqYMtKJbrvBArtEmk/mkeR0PgnrvtpbrXPmoIOdVhg6CIhFO/F8GW5biPSxO+00kUrnAplj9yjBFlNlD3E2VmWaYt4DJbCHbQtsUOAak9HnIIuh3oeLg8wfDf9rkWSyF3B8xSvqjpBevGPyu6oKYNzMTJDCX6H1jZQnYp6/Pw1w== From: David Bean To: "cygwin AT cygwin DOT com" Subject: Re: Possible bug retrieving IfIndex in newlib - winsup/cygwin/net.cc Date: Tue, 22 Oct 2019 18:19:26 +0000 Message-ID: References: ,<20191022173950 DOT GT16240 AT calimero DOT vinschen DOT de> In-Reply-To: <20191022173950.GT16240@calimero.vinschen.de> x-ms-exchange-transport-forked: True MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id x9MIK5xg028116 Hello Corrina, 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. Have a good one, David Bean ________________________________ From: Corinna Vinschen Sent: Tuesday, October 22, 2019 2:39 PM To: David Bean Cc: cygwin AT cygwin DOT com Subject: Re: Possible bug retrieving IfIndex in newlib - winsup/cygwin/net.cc Hi David, 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 = pap->IfIndex; > > I think it should be: ifp->ifa_hwdata.ifa_ifindex = (sa->sa_family == AF_INET > ? pap->IfIndex : pap->Ipv6Index); > > 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. 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 -- Corinna Vinschen Cygwin Maintainer -- 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