diff --git a/lnxrouter b/lnxrouter index 7d6da9c..8a44c32 100755 --- a/lnxrouter +++ b/lnxrouter @@ -89,6 +89,7 @@ Options: for both Internet and AP --virt-name Set name of virtual interface -c Channel number (default: 1) + --force_channel Force the use of channel provided by -c flag --country Set two-letter country code for regularity (example: US) --freq-band Set frequency band: 2.4 or 5 (default: 2.4) @@ -179,6 +180,7 @@ define_global_variables(){ HIDDEN=0 # hidden wifi hotspot WIFI_IFACE= CHANNEL=default + FORCECHANNEL=0 WPA_VERSION=2 MAC_FILTER=0 MAC_FILTER_ACCEPT=/etc/hostapd/hostapd.accept @@ -373,6 +375,10 @@ parse_user_options(){ CHANNEL="$1" shift ;; + --force_channel) + shift + FORCECHANNEL=1 + ;; -w) shift WPA_VERSION="$1" @@ -1648,7 +1654,7 @@ prepare_wifi_interface() { if [[ $NO_VIRT -eq 0 ]]; then ## Will generate virtual wifi interface - if is_interface_wifi_connected ${WIFI_IFACE}; then + if is_interface_wifi_connected ${WIFI_IFACE} && [[ FORCECHANNEL -eq 0 ]]; then WIFI_IFACE_FREQ=$(iw dev ${WIFI_IFACE} link | grep -i freq | awk '{print $2}') WIFI_IFACE_CHANNEL=$(ieee80211_frequency_to_channel ${WIFI_IFACE_FREQ}) echo "${WIFI_IFACE} already in channel ${WIFI_IFACE_CHANNEL} (${WIFI_IFACE_FREQ} MHz)"