]> git.ipfire.org Git - people/ms/network.git/commitdiff
Configure wireless reg domain when wireless hardware is plugged in
authorMichael Tremer <michael.tremer@ipfire.org>
Tue, 26 Aug 2014 17:51:24 +0000 (19:51 +0200)
committerMichael Tremer <michael.tremer@ipfire.org>
Tue, 26 Aug 2014 17:51:24 +0000 (19:51 +0200)
src/functions/functions.wireless
src/udev/network-hotplug

index f32733acd8d34a43c826c5310d1a3566c7bd9f21..f33419e3018076ce23b27e1bbcc8ae5c4177df88 100644 (file)
@@ -23,8 +23,6 @@
 WIRELESS_REGULATORY_DOMAIN="00"
 NETWORK_CONFIG_FILE_PARAMS="${NETWORK_CONFIG_FILE_PARAMS} WIRELESS_REGULATORY_DOMAIN"
 
-init_register wireless_init_reg_domain
-
 function wireless_create() {
        local device=${1}
        assert isset device
@@ -110,15 +108,34 @@ function wireless_get_reg_domain() {
 function wireless_init_reg_domain() {
        local country_code="$(wireless_get_reg_domain)"
 
-       wireless_set_reg_domain "${country_code}"
+       wireless_set_reg_domain "${country_code}" --no-reset
 }
 
 function wireless_set_reg_domain() {
-       local country_code="${1}"
+       local country_code
+       local reset="true"
+
+       while [ $# -gt 0 ]; do
+               case "${1}" in
+                       --no-reset)
+                               reset="false"
+                               ;;
+                       -*)
+                               log ERROR "Ignoring invalid option: ${1}"
+                               ;;
+                       *)
+                               country_code="${1}"
+                               ;;
+               esac
+               shift
+       done
+
        assert isset country_code
 
        # Before the wireless reg domain is set, it helps to reset to 00 first.
-       iw reg set 00 &>/dev/null
+       if enabled reset; then
+               iw reg set 00 &>/dev/null
+       fi
 
        log INFO "Setting wireless regulatory domain country to '${country_code}'"
        iw reg set "${country_code}"
index 3d4809a5655eb3629b1ff61222ba2e8c0dac7725..1b79bd0aa0233062aaed0e39fc1c628e86f80693 100644 (file)
@@ -60,6 +60,9 @@ case "${ACTION}" in
 
                                # Handle batman-adv and wireless devices.
                                batman-adv|batman-adv-port|wireless)
+                                       # Load regulatory domain for wireless devices
+                                       wireless_init_reg_domain
+
                                        # Save the phy of this device for later.
                                        phy=$(phy_get ${INTERFACE})
                                        assert isset phy