[openwrt/openwrt] base-files: wifi: swap the order of some ubus calls

LEDE Commits lede-commits at lists.infradead.org
Mon Jun 28 08:24:34 PDT 2021


nbd pushed a commit to openwrt/openwrt.git, branch master:
https://git.openwrt.org/b82cc8071366b8e96904a1b52af503442069b20d

commit b82cc8071366b8e96904a1b52af503442069b20d
Author: Bob Cantor <coxede6557 at w3boats.com>
AuthorDate: Fri Jun 25 04:37:17 2021 +1000

    base-files: wifi:  swap the order of some ubus calls
    
    "/sbin/wifi up" makes three ubus calls:
    1. ubus call network reload
    2. ubus call network.wireless down
    3. ubus call network.wireless up
    
    The first and third ubus calls call drv_mac80211_setup,
    while the second ubus call triggers wireless_device_setup_cancel,
    so the call sequence becomes,
    
    1. drv_mac80211_setup
    2. wireless_device_setup_cancel
    3. drv_mac80211_setup
    
    This commit swaps the order of the first two ubus calls,
    1. ubus call network.wireless down
    2. ubus call network reload
    3. ubus call network.wireless up
    
    Consequently drv_mac80211_setup is only called once,
    and two related bugs (#FS3784 and #FS3902) are no longer triggered
    by /sbin/wifi.
    
    branches affected: trunk, 21.02
    
    Signed-off-by: Bob Cantor <coxede6557 at w3boats.com>
---
 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 75759b94f3..b2dde6f01c 100755
--- a/package/base-files/files/sbin/wifi
+++ b/package/base-files/files/sbin/wifi
@@ -130,6 +130,7 @@ wifi_updown() {
 		ubus_wifi_cmd "$cmd" "$2"
 		scan_wifi
 		cmd=up
+		ubus call network reload
 	}
 	[ reconf = "$1" ] && {
 		scan_wifi
@@ -247,6 +248,6 @@ case "$1" in
 	reload_legacy) wifi_reload_legacy "$2";;
 	--help|help) usage;;
 	reconf) ubus call network reload; wifi_updown "reconf" "$2";;
-	''|up) ubus call network reload; wifi_updown "enable" "$2";;
+	''|up) wifi_updown "enable" "$2";;
 	*) usage; exit 1;;
 esac



More information about the lede-commits mailing list