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
14 find_all_uci_sections wireless wifi-device "hwmode=11a" "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  # use all outdoor channels except 128 (used by the local weather station)
26  uci set "${device_uci_prefix}.chanlist=$indoor_channel 100-124 132-140"
27  uci commit "$device_uci_prefix"
28 done
set eu on function print_services services log for dir in etc on services d var on services volatile d
Definition: services:13
done
Definition: core.sh:85