Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.5 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS,URIBL_BLOCKED,USER_AGENT_MUTT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5B7D0C169C4 for ; Fri, 8 Feb 2019 12:09:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 34CDE2177B for ; Fri, 8 Feb 2019 12:09:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727134AbfBHMJF (ORCPT ); Fri, 8 Feb 2019 07:09:05 -0500 Received: from mx2.suse.de ([195.135.220.15]:48936 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726230AbfBHMJF (ORCPT ); Fri, 8 Feb 2019 07:09:05 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 69BA4B614; Fri, 8 Feb 2019 12:09:04 +0000 (UTC) Received: by unicorn.suse.cz (Postfix, from userid 1000) id 9B291E0142; Fri, 8 Feb 2019 13:09:03 +0100 (CET) Date: Fri, 8 Feb 2019 13:09:03 +0100 From: Michal Kubecek To: netdev@vger.kernel.org Cc: Phil Sutter , Stephen Hemminger , Roopa Prabhu Subject: Re: [iproute PATCH] ip-link: Fix listing of alias interfaces Message-ID: <20190208120903.GC7035@unicorn.suse.cz> References: <20190207130527.9439-1-phil@nwl.cc> <20190207162436.4452f7ad@hermes.lan> <20190208104057.GE26388@orbyte.nwl.cc> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190208104057.GE26388@orbyte.nwl.cc> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Fri, Feb 08, 2019 at 11:40:57AM +0100, Phil Sutter wrote: > On Thu, Feb 07, 2019 at 04:24:36PM -0800, Stephen Hemminger wrote: > > On Thu, 7 Feb 2019 14:05:27 +0100 > > Phil Sutter wrote: > > > > > Commit 50b9950dd9011 ("link dump filter") accidentally broke listing of > > > links in the old alias interface notation: > > > > > > | % ip link show eth0:1 > > > | RTNETLINK answers: No such device > > > | Cannot send link get request: No such device > > > > > > Prior to the above commit, link lookup was performed via ifindex > > > returned by if_nametoindex(). The latter uses SIOCGIFINDEX ioctl call > > > which on kernel side causes the colon-suffix to be dropped before doing > > > the interface lookup. Netlink API though doesn't care about that at all. > > > To keep things backward compatible, mimick ioctl API behaviour and drop > > > the colon-suffix prior to sending the RTM_GETLINK request. > > > > > > Fixes: 50b9950dd9011 ("link dump filter") > > > Signed-off-by: Phil Sutter > > > > What about mistaken usage where the text after the colon is not a number, > > or has additional colon? > > That's completely ignored in ioctl-case as well. See dev_ioctl() in > kernel sources: > > | colon = strchr(ifr->ifr_name, ':'); > | if (colon) > | *colon = 0; > > If you pass 'group 0' to link show command, ioctl code path is taken. It > allows (and drops) arbitrary input after the colon (as long as the total > name doesn't exceed 15 characters). Not only that, other ip link subcommands also use ioctl for interface lookup so that e.g. "ip link del dummy1:x" deletes dummy1 without any complaint. But as I mentioned earlier in http://patchwork.ozlabs.org/patch/1037934/ I'm not sure this behaviour is really desirable. Michal Kubecek