From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 55408 invoked by alias); 18 Jun 2018 14:25:42 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Received: (qmail 55398 invoked by uid 89); 18 Jun 2018 14:25:42 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-5.8 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_1,KAM_LAZY_DOMAIN_SECURITY,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=46, Mar, mar, unfortunate X-HELO: mx1.redhat.com Subject: Re: [PATCH] Linux: Implement opensock using Netlink sockets To: Adhemerval Zanella , libc-alpha@sourceware.org References: <20180618105015.5E8B340292859@oldenburg.str.redhat.com> From: Florian Weimer Message-ID: Date: Mon, 18 Jun 2018 14:25:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2018-06/txt/msg00491.txt.bz2 On 06/18/2018 03:56 PM, Adhemerval Zanella wrote: > > > On 18/06/2018 07:50, Florian Weimer wrote: >> inet/tst-inet6_scopeid_pton uses __opensock indirectly, to call ioctl >> with SIOCGIFINDEX, and it still works after this change. >> >> 2018-06-18 Florian Weimer >> >> * sysdeps/unix/sysv/linux/opensock.c (__opensock): Unconditionally >> return a Netlink socket. >> * sysdeps/unix/sysv/linux/s390/opensock.c: Remove file. > > Similar to a previous attempt to use AF_NETLINK sockets as default [1], > I am seeing some regression on testcases with Linux 4.4.0-116-generic: > > FAIL: inet/bug-if1 > FAIL: inet/test_ifindex > FAIL: inet/tst-inet6_scopeid_pton > > $ ./testrun.sh inet/bug-if1 > errno = 95 (Operation not supported), expected 6 (No such device or address) > > $ strace -f ./testrun.sh inet/bug-if1 --direct > [...] > socket(AF_NETLINK, SOCK_DGRAM|SOCK_CLOEXEC, NETLINK_ROUTE) = 3 > ioctl(3, SIOCGIFNAME, {ifr_index=0}) = -1 EOPNOTSUPP (Operation not supported) > [...] Huh. Any idea why this happens? I don't see how this is possible based on the kernel sources. Ahh, it's been fixed since then. Netlink sockets were one of the few which did not perform ENOIOCTLCMD fallback. This was changed in kernel 4.6: commit 025c68186e07afaededa84143f1a22f273cd3f67 Author: David Decotigny Date: Mon Mar 21 10:15:35 2016 -0700 netlink: add support for NIC driver ioctls By returning -ENOIOCTLCMD, sock_do_ioctl() falls back to calling dev_ioctl(), which provides support for NIC driver ioctls, which includes ethtool support. This is similar to the way ioctls are handled in udp.c or tcp.c. This removes the requirement that ethtool for example be tied to the support of a specific L3 protocol (ethtool uses an AF_INET socket today). It's unfortunate that it took that long to make this change. Thanks, Florian