[OpenWrt-Devel] [PATCH v3] base-files: make wifi report unknown command

Thibaut VARÈNE hacks at slashdirt.org
Thu Aug 9 12:49:11 EDT 2018


Avoid having /sbin/wifi silently ignore unknown keywords and execute
"enable"; instead display the help message and exit with an error.

Spell out the 'enable' keyword and preserve the implicit assumption
that runing /sbin/wifi without argument performs "enable".

Signed-off-by: Thibaut VARÈNE <hacks at slashdirt.org>
---
 package/base-files/files/sbin/wifi | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/package/base-files/files/sbin/wifi b/package/base-files/files/sbin/wifi
index 83befc0d6f..68536ed25f 100755
--- a/package/base-files/files/sbin/wifi
+++ b/package/base-files/files/sbin/wifi
@@ -241,5 +241,6 @@ case "$1" in
 	reload) wifi_reload "$2";;
 	reload_legacy) wifi_reload_legacy "$2";;
 	--help|help) usage;;
-	*) ubus call network reload; wifi_updown "enable" "$2";;
+	''|enable) ubus call network reload; wifi_updown "enable" "$2";;
+	*) usage; exit 1;;
 esac
-- 
2.14.3 (Apple Git-98)


_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


More information about the openwrt-devel mailing list