]> bbs.cooldavid.org Git - net-next-2.6.git/commitdiff
cfg80211: support sysfs namespaces
authorJohannes Berg <johannes.berg@intel.com>
Thu, 5 Aug 2010 15:45:15 +0000 (17:45 +0200)
committerJohn W. Linville <linville@tuxdriver.com>
Mon, 16 Aug 2010 19:26:40 +0000 (15:26 -0400)
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>
Acked-by: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
include/linux/netdevice.h
net/core/net-sysfs.c
net/wireless/core.c
net/wireless/sysfs.c

index 46c36ffe20eed83f4be29dfd4b75bc694c110c68..a4b14fd81c6a1e4c0771b13cf9c86dd062ad3c26 100644 (file)
@@ -2171,6 +2171,8 @@ extern void dev_seq_stop(struct seq_file *seq, void *v);
 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);
index af4dfbadf2a09ea496653990ae8e1da823a059e1..7d748542d97ea4dc75551cce986b331bf5419020 100644 (file)
@@ -789,12 +789,13 @@ static const void *net_netlink_ns(struct sock *sk)
        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)
 {
index 541e2fff5e9c5a0fab346fa55ac9f078630dcf43..c70909c3eae452ca205591dedd660951fa781131 100644 (file)
@@ -253,11 +253,16 @@ int cfg80211_switch_netns(struct cfg80211_registered_device *rdev,
                        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)
index 9f2cef3e0ca0cd21640127a27fd72edba88434a5..74a9e3cce45249a4ab21a909fa28806127409f7f 100644 (file)
@@ -110,6 +110,13 @@ static int wiphy_resume(struct device *dev)
        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)