From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Ahern Subject: Re: [RFC PATCH 2/3] netdev: kernel-only IFF_HIDDEN netdevice Date: Sun, 1 Apr 2018 10:11:29 -0600 Message-ID: <8b589cd2-1abc-59c2-99f1-96df8174bb6b@gmail.com> References: <1522573990-5242-1-git-send-email-si-wei.liu@oracle.com> <1522573990-5242-3-git-send-email-si-wei.liu@oracle.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit To: Si-Wei Liu , mst@redhat.com, jiri@resnulli.us, stephen@networkplumber.org, alexander.h.duyck@intel.com, davem@davemloft.net, jesse.brandeburg@intel.com, kubakici@wp.pl, jasowang@redhat.com, sridhar.samudrala@intel.com, netdev@vger.kernel.org, virtualization@lists.linux-foundation.org, virtio-dev@lists.oasis-open.org Return-path: Received: from mail-pg0-f66.google.com ([74.125.83.66]:46120 "EHLO mail-pg0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753607AbeDAQLd (ORCPT ); Sun, 1 Apr 2018 12:11:33 -0400 Received: by mail-pg0-f66.google.com with SMTP id t12so7536666pgp.13 for ; Sun, 01 Apr 2018 09:11:33 -0700 (PDT) In-Reply-To: <1522573990-5242-3-git-send-email-si-wei.liu@oracle.com> Content-Language: en-US Sender: netdev-owner@vger.kernel.org List-ID: On 4/1/18 3:13 AM, Si-Wei Liu wrote: > Hidden netdevice is not visible to userspace such that > typical network utilites e.g. ip, ifconfig and et al, > cannot sense its existence or configure it. Internally > hidden netdev may associate with an upper level netdev > that userspace has access to. Although userspace cannot > manipulate the lower netdev directly, user may control > or configure the underlying hidden device through the > upper-level netdev. For identification purpose, the > kobject for hidden netdev still presents in the sysfs > hierarchy, however, no uevent message will be generated > when the sysfs entry is created, modified or destroyed. > > For that end, a separate namescope needs to be carved > out for IFF_HIDDEN netdevs. As of now netdev name that > starts with colon i.e. ':' is invalid in userspace, > since socket ioctls such as SIOCGIFCONF use ':' as the > separator for ifname. The absence of namescope started > with ':' can rightly be used as the namescope for > the kernel-only IFF_HIDDEN netdevs. > > Signed-off-by: Si-Wei Liu > --- > include/linux/netdevice.h | 12 ++ > include/net/net_namespace.h | 2 + > net/core/dev.c | 281 ++++++++++++++++++++++++++++++++++++++------ > net/core/net_namespace.c | 1 + > 4 files changed, 263 insertions(+), 33 deletions(-) > There are other use cases that want to hide a device from userspace. I would prefer a better solution than playing games with name prefixes and one that includes an API for users to list all devices -- even ones hidden by default. https://github.com/dsahern/linux/commit/48a80a00eac284e58bae04af10a5a932dd7aee00 https://github.com/dsahern/iproute2/commit/7563f5b26f5539960e99066e34a995d22ea908ed Also, why are you suggesting that the device should still be visible via /sysfs? That leads to inconsistent views of networking state - /sys shows a device but a link dump does not.