From c512b8c2a57b2325762fee788daa325be3942521 Mon Sep 17 00:00:00 2001
From: Jan-Tarek Butt <tarek@ring0.de>
Date: Tue, 18 Apr 2017 14:01:20 +0200
Subject: [PATCH] hoodselector: delete all running wifi interfaces except ibss
 #103

---
 hoodselector/luasrc/usr/sbin/hoodselector | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/hoodselector/luasrc/usr/sbin/hoodselector b/hoodselector/luasrc/usr/sbin/hoodselector
index 377ba41..6a742be 100755
--- a/hoodselector/luasrc/usr/sbin/hoodselector
+++ b/hoodselector/luasrc/usr/sbin/hoodselector
@@ -748,7 +748,14 @@ local function get_batman_mesh_network(sorted_wlan_list, defaultHood)
     vpn_stop()
     -- remove the ap network because we cannot change
     -- the settings of the adhoc network if the ap network is still operating
-    os.execute("iw dev client0 del")
+    for iface in io.popen(string.format("iw dev"),'r'):lines() do
+      if iface:match("Interface") then
+	iface = trim(iface:split("Interface")[2])
+	if not iface:match("ibss") then
+	  os.execute("iw dev "..iface.." del")
+	end
+      end
+    end
     for _, wireless in pairs(sorted_wlan_list) do
       io.stderr:write("Testing "..wireless["bssid"].."...\n")
       local ifname = uci:get('wireless', 'ibss_' .. wireless["radio"], 'ifname')
-- 
GitLab