aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/cfg.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2009-07-13 18:33:35 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-07-27 15:24:07 -0400
commit463d018323851a608eef52a9427b0585005c647f (patch)
treeb5ad2ee6115e6b780c264022cbc20b36d22fe80c /net/mac80211/cfg.c
parent5061b0c2b9066de426fbc63f1278d2210e789412 (diff)
cfg80211: make aware of net namespaces
In order to make cfg80211/nl80211 aware of network namespaces, we have to do the following things: * del_virtual_intf method takes an interface index rather than a netdev pointer - simply change this * nl80211 uses init_net a lot, it changes to use the sender's network namespace * scan requests use the interface index, hold a netdev pointer and reference instead * we want a wiphy and its associated virtual interfaces to be in one netns together, so - we need to be able to change ns for a given interface, so export dev_change_net_namespace() - for each virtual interface set the NETIF_F_NETNS_LOCAL flag, and clear that flag only when the wiphy changes ns, to disallow breaking this invariant * when a network namespace goes away, we need to reparent the wiphy to init_net * cfg80211 users that support creating virtual interfaces must create them in the wiphy's namespace, currently this affects only mac80211 The end result is that you can now switch an entire wiphy into a different network namespace with the new command iw phy#<idx> set netns <pid> and all virtual interfaces will follow (or the operation fails). Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211/cfg.c')
-rw-r--r--net/mac80211/cfg.c14
1 files changed, 2 insertions, 12 deletions
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 52928ad90570..4bbf5007799b 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -57,19 +57,9 @@ static int ieee80211_add_iface(struct wiphy *wiphy, char *name,
57 return 0; 57 return 0;
58} 58}
59 59
60static int ieee80211_del_iface(struct wiphy *wiphy, int ifindex) 60static int ieee80211_del_iface(struct wiphy *wiphy, struct net_device *dev)
61{ 61{
62 struct net_device *dev; 62 ieee80211_if_remove(IEEE80211_DEV_TO_SUB_IF(dev));
63 struct ieee80211_sub_if_data *sdata;
64
65 /* we're under RTNL */
66 dev = __dev_get_by_index(&init_net, ifindex);
67 if (!dev)
68 return -ENODEV;
69
70 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
71
72 ieee80211_if_remove(sdata);
73 63
74 return 0; 64 return 0;
75} 65}