[PATCH] nl80211: take ownership of dynamically added interfaces

Ilan Peer ilan.peer
Wed Apr 23 22:45:33 PDT 2014


Indicate to cfg80211 that interfaces created by the wpa_supplicant
or hostapd are owned by them, and that in case that the socket that
created them closes, these interfaces should be removed.

Signed-off-by: Ilan Peer <ilan.peer at intel.com>

---
Requires update nl80211.h from mac80211-next

 src/drivers/driver_nl80211.c |    6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index ad5cc4d..d22be48 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -7704,6 +7704,12 @@ static int nl80211_create_iface_once(struct wpa_driver_nl80211_data *drv,
 		NLA_PUT_U8(msg, NL80211_ATTR_4ADDR, wds);
 	}
 
+	/*
+	 * tell cfg80211 that the interface belongs to the socket that created
+	 * it, and the interface should be deleted when the socket is closed.
+	 */
+	NLA_PUT_FLAG(msg, NL80211_ATTR_IFACE_SOCKET_OWNER);
+
 	ret = send_and_recv_msgs(drv, msg, handler, arg);
 	msg = NULL;
 	if (ret) {
-- 
1.7.10.4




More information about the Hostap mailing list