All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] nl80211: announce radios/interfaces when switching namespaces
@ 2018-10-27  7:31 Martin Willi
  0 siblings, 0 replies; only message in thread
From: Martin Willi @ 2018-10-27  7:31 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linux-wireless

When a wiphy changes its namespace, all interfaces are moved to the
new namespace as well. The network interfaces are properly announced
as leaving on the old and as appearing on the new namespace through
RTM_NEWLINK/RTM_DELLINK. On nl80211, however, these events are missing
for radios and their interfaces.

Add netlink announcements through nl80211 when switching namespaces,
so userspace can rely on these events to discover radios properly.

Signed-off-by: Martin Willi <martin@strongswan.org>
---
 net/wireless/core.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/net/wireless/core.c b/net/wireless/core.c
index 5bd01058b9e6..286617396d14 100644
--- a/net/wireless/core.c
+++ b/net/wireless/core.c
@@ -190,11 +190,25 @@ int cfg80211_switch_netns(struct cfg80211_registered_device *rdev,
 		return err;
 	}
 
+	list_for_each_entry(wdev, &rdev->wiphy.wdev_list, list) {
+		if (!wdev->netdev)
+			continue;
+		nl80211_notify_iface(rdev, wdev, NL80211_CMD_DEL_INTERFACE);
+	}
+	nl80211_notify_wiphy(rdev, NL80211_CMD_DEL_WIPHY);
+
 	wiphy_net_set(&rdev->wiphy, net);
 
 	err = device_rename(&rdev->wiphy.dev, dev_name(&rdev->wiphy.dev));
 	WARN_ON(err);
 
+	nl80211_notify_wiphy(rdev, NL80211_CMD_NEW_WIPHY);
+	list_for_each_entry(wdev, &rdev->wiphy.wdev_list, list) {
+		if (!wdev->netdev)
+			continue;
+		nl80211_notify_iface(rdev, wdev, NL80211_CMD_NEW_INTERFACE);
+	}
+
 	return 0;
 }
 
-- 
2.17.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2018-10-27  7:31 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-27  7:31 [PATCH] nl80211: announce radios/interfaces when switching namespaces Martin Willi

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.