From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2178) id 4999B3858C60; Thu, 3 Feb 2022 19:29:15 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4999B3858C60 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Florian Weimer To: glibc-cvs@sourceware.org Subject: [glibc/release/2.33/master] hurd if_index: Explicitly use AF_INET for if index discovery X-Act-Checkin: glibc X-Git-Author: Samuel Thibault X-Git-Refname: refs/heads/release/2.33/master X-Git-Oldrev: 78d25827aeee4bc14f434e659a25261a90e9a496 X-Git-Newrev: 9495d729f6bb177d64cd124f0fa3b8891310670c Message-Id: <20220203192915.4999B3858C60@sourceware.org> Date: Thu, 3 Feb 2022 19:29:15 +0000 (GMT) X-BeenThere: glibc-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Glibc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Feb 2022 19:29:15 -0000 https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=9495d729f6bb177d64cd124f0fa3b8891310670c commit 9495d729f6bb177d64cd124f0fa3b8891310670c Author: Samuel Thibault Date: Mon Oct 18 01:39:02 2021 +0200 hurd if_index: Explicitly use AF_INET for if index discovery 5bf07e1b3a74 ("Linux: Simplify __opensock and fix race condition [BZ #28353]") made __opensock try NETLINK then UNIX then INET. On the Hurd, only INET knows about network interfaces, so better actually specify that in if_index. (cherry picked from commit 1d3decee997ba2fc24af81803299b2f4f3c47063) Diff: --- sysdeps/mach/hurd/if_index.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sysdeps/mach/hurd/if_index.c b/sysdeps/mach/hurd/if_index.c index 56e63a4a92..5e566da820 100644 --- a/sysdeps/mach/hurd/if_index.c +++ b/sysdeps/mach/hurd/if_index.c @@ -32,7 +32,7 @@ unsigned int __if_nametoindex (const char *ifname) { struct ifreq ifr; - int fd = __opensock (); + int fd = __socket (AF_INET, SOCK_DGRAM, 0); if (fd < 0) return 0; @@ -84,7 +84,7 @@ __if_nameindex (void) error_t err = 0; char data[2048]; file_t server; - int fd = __opensock (); + int fd = __socket (AF_INET, SOCK_DGRAM, 0); struct ifconf ifc; unsigned int nifs, i; struct if_nameindex *idx = NULL; @@ -169,7 +169,7 @@ char * __if_indextoname (unsigned int ifindex, char *ifname) { struct ifreq ifr; - int fd = __opensock (); + int fd = __socket (AF_INET, SOCK_DGRAM, 0); if (fd < 0) return NULL;