Jo-Philipp Wich wrote:
> Here's my proposal:

I like the outcome but I find the logic a bit confusing. ${country_ie}
starts out as the value of the country parameter on the wifi-device
(empty or a country string), but then becomes either 0 or 1, a boolean
that controls enabling the feature in hostapd. Then, ${ieee80211d} is
introduced, which pretty much does the same thing as ${country_ie} in
that it acts as a boolean to determine whether hostapd should be
configured with ieee80211d after UCI is consulted. Why was
${country_ie} the repurposed variable instead of ${ieee80211d}?

This would have the same effect but wouldn’t recycle ${country_ie} and
would instead reuse ${ieee80211d} as both the default for
config_get_bool and the final variable to hold the result. In case
anyone needs access to country in the future, it remains available in
its own variable.

How about this (untested) version? I think it’s a little cleaner.

Index: package/hostapd/files/hostapd.sh
===================================================================
--- package/hostapd/files/hostapd.sh    (revision 26774)
+++ package/hostapd/files/hostapd.sh    (working copy)
@@ -136,9 +136,14 @@

        config_get ssid "$vif" ssid
        config_get bridge "$vif" bridge
-       config_get ieee80211d "$vif" ieee80211d
        config_get iapp_interface "$vif" iapp_interface

+       config_get country "$device" country
+       [ -n "$country" ] && ieee80211d=1 || ieee80211d=0
+
+       config_get_bool ieee80211d "$vif" ieee80211d "$ieee80211d"
+       [ "$ieee80211d" = 0 ] && ieee80211d=""
+
        config_get_bool wps_pbc "$vif" wps_pushbutton 0
        config_get_bool wps_label "$vif" wps_label 0

Index: package/mac80211/files/lib/wifi/mac80211.sh
===================================================================
--- package/mac80211/files/lib/wifi/mac80211.sh (revision 26774)
+++ package/mac80211/files/lib/wifi/mac80211.sh (working copy)
@@ -36,11 +36,6 @@
                }
        }

-       local country_ie=0
-       [ -n "$country" ] && country_ie=1
-       config_get_bool country_ie "$device" country_ie "$country_ie"
-       [ "$country_ie" -gt 0 ] && append base_cfg "ieee80211d=1" "$N"
-
        config_get macfilter "$vif" macfilter
        case "$macfilter" in
                allow)
_______________________________________________
openwrt-devel mailing list
[email protected]
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to