* [PATCH] cfg80211: support sysfs namespaces
@ 2010-08-05 15:45 Johannes Berg
2010-08-05 19:46 ` Eric W. Biederman
0 siblings, 1 reply; 3+ messages in thread
From: Johannes Berg @ 2010-08-05 15:45 UTC (permalink / raw)
To: John Linville; +Cc: linux-wireless, netdev, Eric W. Biederman
From: Johannes Berg <johannes.berg@intel.com>
Enable using network namespaces with
wireless devices even when sysfs is
enabled using the same infrastructure
that was built for netdevs.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
NB: This generates a harmless gcc warning, I submitted
a patch to fix it here:
http://thread.gmane.org/gmane.linux.kernel/1019330
include/linux/netdevice.h | 2 ++
net/core/net-sysfs.c | 3 ++-
net/wireless/core.c | 7 ++++++-
net/wireless/sysfs.c | 9 +++++++++
4 files changed, 19 insertions(+), 2 deletions(-)
--- wireless-testing.orig/net/core/net-sysfs.c 2010-08-05 17:33:47.000000000 +0200
+++ wireless-testing/net/core/net-sysfs.c 2010-08-05 17:38:27.000000000 +0200
@@ -789,12 +789,13 @@ static const void *net_netlink_ns(struct
return sock_net(sk);
}
-static struct kobj_ns_type_operations net_ns_type_operations = {
+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,
};
+EXPORT_SYMBOL_GPL(net_ns_type_operations);
static void net_kobj_ns_exit(struct net *net)
{
--- wireless-testing.orig/net/wireless/sysfs.c 2010-08-05 17:33:47.000000000 +0200
+++ wireless-testing/net/wireless/sysfs.c 2010-08-05 17:39:11.000000000 +0200
@@ -110,6 +110,13 @@ static int wiphy_resume(struct device *d
return ret;
}
+static const void *wiphy_namespace(struct device *d)
+{
+ struct wiphy *wiphy = container_of(d, struct wiphy, dev);
+
+ return wiphy_net(wiphy);
+}
+
struct class ieee80211_class = {
.name = "ieee80211",
.owner = THIS_MODULE,
@@ -120,6 +127,8 @@ struct class ieee80211_class = {
#endif
.suspend = wiphy_suspend,
.resume = wiphy_resume,
+ .ns_type = &net_ns_type_operations,
+ .namespace = wiphy_namespace,
};
int wiphy_sysfs_init(void)
--- wireless-testing.orig/net/wireless/core.c 2010-08-05 17:33:47.000000000 +0200
+++ wireless-testing/net/wireless/core.c 2010-08-05 17:38:27.000000000 +0200
@@ -253,11 +253,16 @@ int cfg80211_switch_netns(struct cfg8021
WARN_ON(err);
wdev->netdev->features |= NETIF_F_NETNS_LOCAL;
}
+
+ return err;
}
wiphy_net_set(&rdev->wiphy, net);
- return err;
+ err = device_rename(&rdev->wiphy.dev, dev_name(&rdev->wiphy.dev));
+ WARN_ON(err);
+
+ return 0;
}
static void cfg80211_rfkill_poll(struct rfkill *rfkill, void *data)
--- wireless-testing.orig/include/linux/netdevice.h 2010-08-05 17:13:50.000000000 +0200
+++ wireless-testing/include/linux/netdevice.h 2010-08-05 17:39:02.000000000 +0200
@@ -2171,6 +2171,8 @@ extern void dev_seq_stop(struct seq_file
extern int netdev_class_create_file(struct class_attribute *class_attr);
extern void netdev_class_remove_file(struct class_attribute *class_attr);
+extern struct kobj_ns_type_operations net_ns_type_operations;
+
extern char *netdev_drivername(const struct net_device *dev, char *buffer, int len);
extern void linkwatch_run_queue(void);
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] cfg80211: support sysfs namespaces
2010-08-05 15:45 [PATCH] cfg80211: support sysfs namespaces Johannes Berg
@ 2010-08-05 19:46 ` Eric W. Biederman
2010-08-05 20:05 ` Johannes Berg
0 siblings, 1 reply; 3+ messages in thread
From: Eric W. Biederman @ 2010-08-05 19:46 UTC (permalink / raw)
To: Johannes Berg; +Cc: John Linville, linux-wireless, netdev
Johannes Berg <johannes@sipsolutions.net> writes:
> From: Johannes Berg <johannes.berg@intel.com>
>
> Enable using network namespaces with
> wireless devices even when sysfs is
> enabled using the same infrastructure
> that was built for netdevs.
Acked-by: "Eric W. Biederman" <ebiederm@xmission.com>
This looks reasonable. I assume you have tested this and it is
working now?
>
> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
> ---
> NB: This generates a harmless gcc warning, I submitted
> a patch to fix it here:
> http://thread.gmane.org/gmane.linux.kernel/1019330
>
> include/linux/netdevice.h | 2 ++
> net/core/net-sysfs.c | 3 ++-
> net/wireless/core.c | 7 ++++++-
> net/wireless/sysfs.c | 9 +++++++++
> 4 files changed, 19 insertions(+), 2 deletions(-)
>
> --- wireless-testing.orig/net/core/net-sysfs.c 2010-08-05 17:33:47.000000000 +0200
> +++ wireless-testing/net/core/net-sysfs.c 2010-08-05 17:38:27.000000000 +0200
> @@ -789,12 +789,13 @@ static const void *net_netlink_ns(struct
> return sock_net(sk);
> }
>
> -static struct kobj_ns_type_operations net_ns_type_operations = {
> +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,
> };
> +EXPORT_SYMBOL_GPL(net_ns_type_operations);
>
> static void net_kobj_ns_exit(struct net *net)
> {
> --- wireless-testing.orig/net/wireless/sysfs.c 2010-08-05 17:33:47.000000000 +0200
> +++ wireless-testing/net/wireless/sysfs.c 2010-08-05 17:39:11.000000000 +0200
> @@ -110,6 +110,13 @@ static int wiphy_resume(struct device *d
> return ret;
> }
>
> +static const void *wiphy_namespace(struct device *d)
> +{
> + struct wiphy *wiphy = container_of(d, struct wiphy, dev);
> +
> + return wiphy_net(wiphy);
> +}
> +
> struct class ieee80211_class = {
> .name = "ieee80211",
> .owner = THIS_MODULE,
> @@ -120,6 +127,8 @@ struct class ieee80211_class = {
> #endif
> .suspend = wiphy_suspend,
> .resume = wiphy_resume,
> + .ns_type = &net_ns_type_operations,
> + .namespace = wiphy_namespace,
> };
>
> int wiphy_sysfs_init(void)
> --- wireless-testing.orig/net/wireless/core.c 2010-08-05 17:33:47.000000000 +0200
> +++ wireless-testing/net/wireless/core.c 2010-08-05 17:38:27.000000000 +0200
> @@ -253,11 +253,16 @@ int cfg80211_switch_netns(struct cfg8021
> WARN_ON(err);
> wdev->netdev->features |= NETIF_F_NETNS_LOCAL;
> }
> +
> + return err;
> }
>
> wiphy_net_set(&rdev->wiphy, net);
>
> - return err;
> + err = device_rename(&rdev->wiphy.dev, dev_name(&rdev->wiphy.dev));
> + WARN_ON(err);
> +
> + return 0;
> }
>
> static void cfg80211_rfkill_poll(struct rfkill *rfkill, void *data)
> --- wireless-testing.orig/include/linux/netdevice.h 2010-08-05 17:13:50.000000000 +0200
> +++ wireless-testing/include/linux/netdevice.h 2010-08-05 17:39:02.000000000 +0200
> @@ -2171,6 +2171,8 @@ extern void dev_seq_stop(struct seq_file
> extern int netdev_class_create_file(struct class_attribute *class_attr);
> extern void netdev_class_remove_file(struct class_attribute *class_attr);
>
> +extern struct kobj_ns_type_operations net_ns_type_operations;
> +
> extern char *netdev_drivername(const struct net_device *dev, char *buffer, int len);
>
> extern void linkwatch_run_queue(void);
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] cfg80211: support sysfs namespaces
2010-08-05 19:46 ` Eric W. Biederman
@ 2010-08-05 20:05 ` Johannes Berg
0 siblings, 0 replies; 3+ messages in thread
From: Johannes Berg @ 2010-08-05 20:05 UTC (permalink / raw)
To: Eric W. Biederman; +Cc: John Linville, linux-wireless, netdev
On Thu, 2010-08-05 at 12:46 -0700, Eric W. Biederman wrote:
> Johannes Berg <johannes@sipsolutions.net> writes:
>
> > From: Johannes Berg <johannes.berg@intel.com>
> >
> > Enable using network namespaces with
> > wireless devices even when sysfs is
> > enabled using the same infrastructure
> > that was built for netdevs.
>
> Acked-by: "Eric W. Biederman" <ebiederm@xmission.com>
>
> This looks reasonable. I assume you have tested this and it is
> working now?
Yes, I tested it. Was missing the no-op device_rename() at first, but
now it works.
johannes
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-08-05 20:05 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-05 15:45 [PATCH] cfg80211: support sysfs namespaces Johannes Berg
2010-08-05 19:46 ` Eric W. Biederman
2010-08-05 20:05 ` Johannes Berg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).