From 984f8e7fc9ea41f82959203238593983b6f4f3fc Mon Sep 17 00:00:00 2001 From: oblique Date: Sun, 24 Nov 2013 18:37:39 +0200 Subject: [PATCH] If WiFi interface is already set to a channel, don't try to change it --- create_ap | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/create_ap b/create_ap index 45ab174..308c261 100755 --- a/create_ap +++ b/create_ap @@ -208,6 +208,12 @@ fi WIFI_IFACE=$1 VWIFI_IFACE=${WIFI_IFACE}ap +WIFI_IFACE_CHANNEL=$(iw ${WIFI_IFACE} info | grep channel | awk '{print $2}') + +if [[ -n $WIFI_IFACE_CHANNEL && $WIFI_IFACE_CHANNEL -ne $CHANNEL ]]; then + echo "hostapd will fail to use channel $CHANNEL because $WIFI_IFACE is already set to channel $WIFI_IFACE_CHANNEL, fallback to channel $WIFI_IFACE_CHANNEL." + CHANNEL=$WIFI_IFACE_CHANNEL +fi if [[ "$SHARE_METHOD" == "bridge" ]]; then BRIDGE_IFACE=$(get_avail_bridge)