]> git.ipfire.org Git - people/stevee/network.git/commitdiff
wireless: Allow setting the channel when creating a device
authorMichael Tremer <michael.tremer@ipfire.org>
Tue, 15 Aug 2017 21:03:27 +0000 (21:03 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Tue, 15 Aug 2017 21:03:27 +0000 (21:03 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/functions/functions.wireless

index 581bdbfedfcfdd50a53f9bb135540275b615c556..f219a1f76ae359cad3092f8f7f94f440cf221267 100644 (file)
@@ -31,6 +31,7 @@ wireless_create() {
        shift
 
        local address
+       local channel
        local phy
        local type="managed"
 
@@ -39,6 +40,9 @@ wireless_create() {
                        --address=*)
                                address=$(cli_get_val ${1})
                                ;;
+                       --channel=*)
+                               channel=$(cli_get_val "${1}")
+                               ;;
                        --phy=*)
                                phy=$(cli_get_val ${1})
                                phy=$(phy_get ${phy})
@@ -74,6 +78,11 @@ wireless_create() {
                log ERROR "could not create wireless device '${device}' (${type}): ${ret}"
        fi
 
+       # Set the channel
+       if isset channel; then
+               wireless_set_channel "${device}" "${channel}" || return $?
+       fi
+
        return ${ret}
 }