Opennet Firmware
on-hostapd-channel-whitelist
gehe zur Dokumentation dieser Datei
1#!/bin/sh
2#
3# Dieses Skript wird nur ein einziges Mal nach einem Upgrade oder der Erstinstallation ausgefuehrt:
4# http://wiki.openwrt.org/doc/uci#defaults
5#
6
7# shellcheck source=opennet/packages/on-core/files/usr/lib/opennet/on-helper.sh
8. "${IPKG_INSTROOT:-}/usr/lib/opennet/on-helper.sh"
9
10
11# add channel whitelist for 5GHz devices to /etc/config/wireless
12# info: the additional option "chanlist" is enabled by one of our patches
13# TODO: move this adjustment to a future "configure as wifi master" web interface action
14find_all_uci_sections wireless wifi-device "band=5g" "channel=auto" | while read -r device_uci_prefix; do
15 # do not touch non-empty chanlists
16 [ -n "$(uci_get "${device_uci_prefix}.chanlist")" ] && continue
17 # the device name could be "radio0" or similar
18 device_name=$(echo "$device_uci_prefix" | cut -f 2 -d .)
19 # do not touch devices without a master interface
20 ap_interfaces=$(find_all_uci_sections wireless wifi-iface "device=$device_name" "mode=ap")
21 [ -z "$ap_interfaces" ] && continue
22 # Use one (random) indoor channel and multiple outdoor channels. This allows a usable
23 # fallback even under bad conditions.
24 indoor_channel=$(( 36 + 4 * $(get_random 4) ))
25 # remove TDWR channels + bandwidth
26 uci set "${device_uci_prefix}.chanlist=$indoor_channel 100-116 132-140"
27 oldhtmode=$(uci_get "${device_uci_prefix}.htmode")
28 # Fix 11ac default bandwidth
29 if [ "$oldhtmode" = "VHT80" ]; then
30 uci set "${device_uci_prefix}.htmode=VHT20"
31 fi
32 uci commit "$device_uci_prefix"
33done
done
Definition: core.sh:85
set eu on function print_services services log for dir in etc on services d var on services volatile d
Definition: services:13