fff-wireless: add layer3 option for channel bandwidth #281

Closed
fbl wants to merge 1 commits from fbl:l3wifibw into master
1 changed files with 28 additions and 2 deletions

View File

@ -5,6 +5,22 @@ configure() {
essid=$(uci -q get gateway.@client[0].essid)
chan2ghz=$(uci -q get gateway.@client[0].chan2ghz)
chan5ghz=$(uci -q get gateway.@client[0].chan5ghz)
width2ghz=$(uci -q get gateway.@client[0].width2ghz || echo 20)
width5ghz=$(uci -q get gateway.@client[0].width5ghz || echo 20)
if [ "$width2ghz" != 20 ] && [ "$width2ghz" != 40 ]; then
echo "ERROR: Invalid 2.4 GHz channel width: $width2ghz. Only 20 and 40 MHz are possible."
return 1
fi
if [ "$width5ghz" != 20 ] && [ "$width5ghz" != 40 ] && [ "$width5ghz" != 80 ]; then
echo "ERROR: Invalid 5 GHz channel width: $width5ghz. Only 20, 40 and 80 MHz are possible."
return 1
fi
if [ "$width2ghz" == 40 ]; then
echo "WARNING: Using 40 MHz channel width on 2.4 GHz is highly discouraged and will probably result in worse throughput"
fi
if [ -z "$essid" ]; then
echo "WARNING: No ESSID set! WiFi AP is disabled"
@ -18,23 +34,33 @@ configure() {
uci -q del wireless.w${freq}mesh
uci -q del wireless.w${freq}configap
# Get htmode
ht=$(uci -q get wireless.${radio}.htmode)
if [ -n "$essid" ]; then
# set channel for 5ghz
# set channel and bandwidth for 5ghz
if [ "$freq" = "5" ]; then
if ! echo "$ht" | grep -q VHT && [ "$width5ghz" == 80 ]; then
echo "ERROR: 5 GHz radio does not support 80 MHz channel width"
return 1
fi
if [ -z "$chan5ghz" ]; then
echo "WARNING: No 5 GHz channel set! Disabling AP on $radio"
else
uci set wireless.${radio}.channel="$chan5ghz"
uci set wireless.${radio}.htmode="${ht%%HT*}HT${width5ghz}"
disabled=0
fi
fi
# set channel for 2.4ghz
# set channel and bandwidth for 2.4ghz
if [ "$freq" = "2" ]; then
if [ -z "$chan2ghz" ]; then
echo "WARNING: No 2.4 GHz channel set! Disabling AP on $radio"
else
uci set wireless.${radio}.channel="$chan2ghz"
uci set wireless.${radio}.htmode="${ht%%HT*}HT${width2ghz}"
disabled=0
fi
fi