[PATCH] wireless: fix mode checking in for_each_interface

jpt.7196 at gmail.com jpt.7196 at gmail.com
Wed Oct 27 06:10:46 PDT 2021


From: Jean-Pierre Tosoni <jp.tosoni at acksys.fr>

When searching through wifi-ifaces for specific modes, the mode string
must be compared as a full word.

Else, adding a future new mode like "newap" or "apdetector" which embed
an existing "ap" mode string, will end in detecting the wrong interface.

This was found while trying to create a new detection service for WIDS.

Signed-off-by: Jean-Pierre Tosoni <jp.tosoni at acksys.fr>
---
 scripts/netifd-wireless.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/netifd-wireless.sh b/scripts/netifd-wireless.sh
index 80fbf75..9dd5431 100644
--- a/scripts/netifd-wireless.sh
+++ b/scripts/netifd-wireless.sh
@@ -321,7 +321,7 @@ for_each_interface() {
 			json_get_var _w_type mode
 			json_select ..
 			_w_types=" $_w_types "
-			[[ "${_w_types%$_w_type*}" = "$_w_types" ]] && {
+			[[ "${_w_types% $_w_type *}" = "$_w_types" ]] && {
 				json_select ..
 				continue
 			}
-- 
2.17.1




More information about the openwrt-devel mailing list