All of lore.kernel.org
 help / color / mirror / Atom feed
From: ebiederm@xmission.com (Eric W. Biederman)
To: "Serge E. Hallyn" <serue@us.ibm.com>
Cc: Greg Kroah-Hartman <gregkh@suse.de>,
	Kay Sievers <kay.sievers@vrfy.org>,
	linux-kernel@vger.kernel.org, Tejun Heo <tj@kernel.org>,
	Cornelia Huck <cornelia.huck@de.ibm.com>,
	Eric Dumazet <eric.dumazet@gmail.com>,
	Benjamin LaHaise <bcrl@lhnet.ca>,
	netdev@vger.kernel.org, David Miller <davem@davemloft.net>
Subject: Re: [PATCH 2/6] netns: Teach network device kobjects which namespace they are in.
Date: Wed, 05 May 2010 12:56:41 -0700	[thread overview]
Message-ID: <m14oim2kcm.fsf@fess.ebiederm.org> (raw)
In-Reply-To: <20100505151746.GA15654@us.ibm.com> (Serge E. Hallyn's message of "Wed\, 5 May 2010 10\:17\:46 -0500")

"Serge E. Hallyn" <serue@us.ibm.com> writes:

> Quoting Eric W. Biederman (ebiederm@xmission.com):
>> diff --git a/net/Kconfig b/net/Kconfig
>> index 041c35e..265e33b 100644
>> --- a/net/Kconfig
>> +++ b/net/Kconfig
>> @@ -45,6 +45,14 @@ config COMPAT_NETLINK_MESSAGES
>> 
>>  menu "Networking options"
>> 
>> +config NET_NS
>> +	bool "Network namespace support"
>> +	default n
>> +	depends on EXPERIMENTAL && NAMESPACES
>> +	help
>> +	  Allow user space to create what appear to be multiple instances
>> +	  of the network stack.
>> +
>
> Hi Eric,
>
> I'm confused - NET_NS is defined in init/Kconfig right now.  Is the tree
> you're working from very different from mine, or is this the unfortunate
> rekult of the patches sitting so long?

Old patches, nothing that complains when you make a mistake like this,
and apparently I have a blind spot in my personal code review.

At one point it was not possible to enable the network namespace until
the sysfs stuff was enabled, but things have been going on long enough
that we worked around that restriction.

>>  source "net/packet/Kconfig"
>>  source "net/unix/Kconfig"
>>  source "net/xfrm/Kconfig"
>> diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c
>> index 099c753..1b98e36 100644
>> --- a/net/core/net-sysfs.c
>> +++ b/net/core/net-sysfs.c
>> @@ -13,7 +13,9 @@
>>  #include <linux/kernel.h>
>>  #include <linux/netdevice.h>
>>  #include <linux/if_arp.h>
>> +#include <linux/nsproxy.h>
>>  #include <net/sock.h>
>> +#include <net/net_namespace.h>
>>  #include <linux/rtnetlink.h>
>>  #include <linux/wireless.h>
>>  #include <net/wext.h>
>> @@ -466,6 +468,37 @@ static struct attribute_group wireless_group = {
>>  };
>>  #endif
>> 
>> +static const void *net_current_ns(void)
>> +{
>> +	return current->nsproxy->net_ns;
>> +}
>> +
>> +static const void *net_initial_ns(void)
>> +{
>> +	return &init_net;
>> +}
>> +
>> +static const void *net_netlink_ns(struct sock *sk)
>> +{
>> +	return sock_net(sk);
>> +}
>> +
>> +static struct kobj_ns_type_operations net_ns_type_operations = {
>> +	.type = KOBJ_NS_TYPE_NET,
>> +	.current_ns = net_current_ns,
>> +	.netlink_ns = net_netlink_ns,
>> +	.initial_ns = net_initial_ns,
>> +};
>> +
>> +static void net_kobj_ns_exit(struct net *net)
>> +{
>> +	kobj_ns_exit(KOBJ_NS_TYPE_NET, net);
>> +}
>> +
>> +static struct pernet_operations sysfs_net_ops = {
>> +	.exit = net_kobj_ns_exit,
>> +};
>> +
>>  #endif /* CONFIG_SYSFS */
>
> ...
>
>>  int netdev_kobject_init(void)
>>  {
>> +	kobj_ns_type_register(&net_ns_type_operations);
>> +#ifdef CONFIG_SYSFS
>> +	register_pernet_subsys(&sysfs_net_ops);
>> +#endif
>>  	return class_register(&net_class);
>
> I think the kobj_ns_type_register() needs to be under
> ifdef CONFIG_SYSFS as well, bc net_ns_type_operations is defined
> under ifdef CONFIG_SYSFS.

kobj_ns_type_register should not be under CONFIG_SYSFS.  Which means
that kobj_ns_type_operations needs not to be under CONFIG_SYSFS as
well.  That you for spotting that bug.

Grr.

Eric

  reply	other threads:[~2010-05-05 19:56 UTC|newest]

Thread overview: 83+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-30 18:30 [PATCH 0/6] tagged sysfs support Eric W. Biederman
2010-03-30 18:31 ` [PATCH 1/6] sysfs: Basic support for multiple super blocks Eric W. Biederman
2010-03-30 19:23   ` Eric Dumazet
2010-03-30 23:50     ` [PATCH 7/6] sysfs: Remove double free sysfs_get_sb Eric W. Biederman
2010-03-31  5:01   ` [PATCH 1/6] sysfs: Basic support for multiple super blocks Serge E. Hallyn
2010-03-31  5:01     ` Serge E. Hallyn
2010-03-31  5:41   ` Tejun Heo
2010-03-31  5:51     ` Eric W. Biederman
2010-03-31 13:47       ` Serge E. Hallyn
2010-03-31 14:02         ` Eric W. Biederman
2010-04-05  7:45       ` Tejun Heo
2010-04-29 20:29   ` patch sysfs-basic-support-for-multiple-super-blocks.patch added to gregkh-2.6 tree gregkh
2010-03-30 18:31 ` [PATCH 2/6] kobj: Add basic infrastructure for dealing with namespaces Eric W. Biederman
2010-04-29 20:29   ` patch kobj-add-basic-infrastructure-for-dealing-with-namespaces.patch added to gregkh-2.6 tree gregkh
2010-03-30 18:31 ` [PATCH 3/6] sysfs: Implement sysfs tagged directory support Eric W. Biederman
2010-03-31  2:43   ` Serge E. Hallyn
2010-03-31  3:38     ` Eric W. Biederman
2010-03-31  4:02       ` Serge E. Hallyn
2010-03-31  4:23         ` Eric W. Biederman
2010-03-31  4:53           ` Serge E. Hallyn
2010-03-31  6:49   ` Tejun Heo
2010-03-31  7:43     ` Eric W. Biederman
2010-03-31  8:17       ` Tejun Heo
2010-03-31  8:22         ` Tejun Heo
2010-03-31  9:39           ` Eric W. Biederman
2010-04-05  8:17             ` Tejun Heo
2010-04-29 20:29   ` patch sysfs-implement-sysfs-tagged-directory-support.patch added to gregkh-2.6 tree gregkh
2010-04-30  4:18     ` Tejun Heo
2010-04-30  4:45       ` Greg KH
2010-04-30  5:24         ` Eric W. Biederman
2010-04-30  5:37           ` Tejun Heo
2010-04-30  6:12             ` Tejun Heo
2010-04-30 14:29             ` Serge E. Hallyn
2010-04-30 15:22               ` Tejun Heo
2010-04-30 15:43                 ` Serge E. Hallyn
2010-04-30 15:58                   ` Greg KH
2010-03-30 18:31 ` [PATCH 4/6] sysfs: Add support for tagged directories with untagged members Eric W. Biederman
2010-04-29 20:29   ` patch sysfs-add-support-for-tagged-directories-with-untagged-members.patch added to gregkh-2.6 tree gregkh
2010-03-30 18:31 ` [PATCH 5/6] sysfs: Implement sysfs_delete_link Eric W. Biederman
2010-04-29 20:29   ` patch sysfs-implement-sysfs_delete_link.patch added to gregkh-2.6 tree gregkh
2010-03-30 18:31 ` [PATCH 6/6] driver core: Implement ns directory support for device classes Eric W. Biederman
2010-04-29 20:29   ` patch driver-core-implement-ns-directory-support-for-device-classes.patch added to gregkh-2.6 tree gregkh
2010-03-30 18:53 ` [PATCH 0/6] tagged sysfs support Kay Sievers
2010-03-30 23:04   ` Eric W. Biederman
2010-03-31  5:51     ` Kay Sievers
2010-03-31  6:25       ` Tejun Heo
2010-03-31  6:52       ` Eric W. Biederman
2010-04-03  0:58       ` Ben Hutchings
2010-04-03  8:35         ` Kay Sievers
2010-04-03 16:05           ` Ben Hutchings
2010-04-03 16:35             ` Kay Sievers
2010-04-03 16:35               ` Kay Sievers
2010-03-31 17:21 ` Serge E. Hallyn
2010-03-31 18:09   ` Eric W. Biederman
2010-05-05  0:35 ` [PATCH 0/6] netns support in the kobject layer Eric W. Biederman
2010-05-06 20:04   ` Greg KH
2010-05-16  6:26     ` David Miller
2010-05-17 18:11       ` Greg KH
2010-05-17 20:58         ` Eric W. Biederman
2010-05-17 21:03           ` Greg KH
2010-05-17 22:37             ` Eric W. Biederman
2010-05-17 22:54               ` Greg KH
2010-05-17 23:48             ` David Miller
2010-05-18  4:08               ` Greg KH
2010-05-18  4:21                 ` David Miller
2010-05-05  0:36 ` [PATCH 1/6] kobject: Send hotplug events in all network namespaces Eric W. Biederman
2010-05-20 18:10   ` patch kobject-send-hotplug-events-in-all-network-namespaces.patch added to gregkh-2.6 tree gregkh
2010-05-05  0:36 ` [PATCH 2/6] netns: Teach network device kobjects which namespace they are in Eric W. Biederman
2010-05-05 15:17   ` Serge E. Hallyn
2010-05-05 19:56     ` Eric W. Biederman [this message]
2010-05-05 22:01       ` Serge E. Hallyn
2010-05-17  4:59         ` [PATCH 7/6] net/sysfs: Fix the bitrot in network device kobject namespace support Eric W. Biederman
2010-05-17  5:07           ` David Miller
2010-05-20 18:10   ` patch netns-teach-network-device-kobjects-which-namespace-they-are-in.patch added to gregkh-2.6 tree gregkh
2010-05-05  0:36 ` [PATCH 3/6] netlink: Implment netlink_broadcast_filtered Eric W. Biederman
2010-05-20 18:10   ` patch netlink-implment-netlink_broadcast_filtered.patch added to gregkh-2.6 tree gregkh
2010-05-05  0:36 ` [PATCH 4/6] kobj: Send hotplug events in the proper namespace Eric W. Biederman
2010-05-20 18:10   ` patch kobj-send-hotplug-events-in-the-proper-namespace.patch added to gregkh-2.6 tree gregkh
2010-05-05  0:36 ` [PATCH 5/6] hotplug: netns aware uevent_helper Eric W. Biederman
2010-05-20 18:10   ` patch hotplug-netns-aware-uevent_helper.patch added to gregkh-2.6 tree gregkh
2010-05-05  0:36 ` [PATCH 6/6] net: Expose all network devices in a namespaces in sysfs Eric W. Biederman
2010-05-20 18:10   ` patch net-expose-all-network-devices-in-a-namespaces-in-sysfs.patch added to gregkh-2.6 tree gregkh
2010-05-20 17:47 ` [PATCH 0/6] tagged sysfs support Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m14oim2kcm.fsf@fess.ebiederm.org \
    --to=ebiederm@xmission.com \
    --cc=bcrl@lhnet.ca \
    --cc=cornelia.huck@de.ibm.com \
    --cc=davem@davemloft.net \
    --cc=eric.dumazet@gmail.com \
    --cc=gregkh@suse.de \
    --cc=kay.sievers@vrfy.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=serue@us.ibm.com \
    --cc=tj@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.