Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752469AbYJWEOe (ORCPT ); Thu, 23 Oct 2008 00:14:34 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751086AbYJWEOV (ORCPT ); Thu, 23 Oct 2008 00:14:21 -0400 Received: from rv-out-0506.google.com ([209.85.198.234]:31658 "EHLO rv-out-0506.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750999AbYJWEOU (ORCPT ); Thu, 23 Oct 2008 00:14:20 -0400 Message-ID: Date: Thu, 23 Oct 2008 00:14:19 -0400 From: "Kyle Moffett" To: "Eric W. Biederman" Subject: Re: [PATCH 0/4][RFC] netns: sysfs: add a netns suffix to net device sysfs entries Cc: "Stephen Hemminger" , "Serge E. Hallyn" , "Benjamin Thery" , netdev , "Dave Miller" , "Greg Kroah-Hartman" , "Al Viro" , "Daniel Lezcano" , linux-kernel@vger.kernel.org, "Tejun Heo" , "Denis Lunev" , "Linux Containers" In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <20081022152144.351965414@theryb.frec.bull.fr> <20081022203045.GA4633@us.ibm.com> <20081022145507.2d1ea86c@extreme> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2335 Lines: 56 On Wed, Oct 22, 2008 at 6:54 PM, Eric W. Biederman wrote: > Stephen Hemminger writes: >>> The well-known user space tools don't use /sys at all. Modern >>> network tools use rtnetlink (ip) old network tools use /proc/net. >>> >>> Very few things actually use /sys and for those things lo@1 or >>> eth0@1 are completely useless except for implementing a FUSE >>> mock up of sysfs. But you don't need anything in sysfs to do >>> that as all of the interesting information is available through >>> /proc/net or rtnetlink. >> >> Lots of scripts are starting use /sys for things. It is easier to >> parse /sys/class/net than the output of ifconfig or ip > > Yes. So we need the correct values in /sys/class/net. > > Which is why sysfs and network namespaces do not coexist currently. I definitely agree that "eth0@1" is a bad ide. I know for sure that a relatively large number of system init scripts poke about in /sys/class/net/$IFACE, as well as a number of the system installation scripts. Those scripts include some that my company has written for internal use and others supplied by distributions. Daemons and such mostly use netlink, but for anything written in shell it's much easier to do things like this: for devpath in /sys/class/net/*; do dev="${dev##/sys/class/net/}" case "${dev}" in [....] esac if [ "x${mac}" = "x$(cat ${devpath}/address)" ]; then echo "Found MAC '${mac}': ${dev}" fi done If I wanted to perform similar things with the output of ifconfig, it would involve some much more fragile manual text parsing of the output of the "ip" or "ifconfig" commands. And sometimes the "ifconfig" command is outright wrong. If you have an interface name longer than 7 characters or so then some versions of ifconfig will truncate it internally and display garbage. While the "show only the root namespace" interim solution is problematic for processes in network namespaces, I think it's more important not to break things for admin tools in the root namespace. Cheers, Kyle Moffett -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/