Revert "map-controller: sync mapcontroller creds from wireless uci"

This reverts commit b1dbd89de8.
This commit is contained in:
Jakob Olsson
2021-08-26 12:23:19 +02:00
parent fa071854de
commit 03ab529375
2 changed files with 2 additions and 95 deletions

View File

@@ -7,7 +7,7 @@
# write_credentials - write bBSS credentials to fBSS
. /lib/functions.sh
. /usr/share/libubox/jshn.sh
diff=0
usage() {
@@ -280,94 +280,6 @@ brcm_teardown_iface() {
sync_mapcontroller_from_wireless() {
ubus -t 5 wait_for wifi
[ "$?" != "0" ] && return
[ ! -f "/etc/config/wireless" ] && return
status=$(ubus -S call wifi status)
device_to_band() {
local ifname=$1
json_load "$status"
json_select "radios"
json_get_keys keys
for key in $keys; do
json_select $key
json_get_var name name
if [ "$name" != "$ifname" ]; then
json_select ..
continue
fi
json_get_var band band
if [ "$band" == "5GHz" ]; then
echo "5"
elif [ "$band" == "2.4GHz" ]; then
echo "2"
fi
break
done
json_cleanup
}
wireless_process_iface() {
local section=$1
local type=""
config_get multi_ap $section multi_ap 0
[ "$multi_ap" == "0" ] && return
config_get mode $section mode "ap"
[ "$mode" != "ap" ] && return
if [ "$multi_ap" == "1" ]; then
type="bk-credentials"
else
type="fh-credentials"
fi
config_get ssid $section ssid
config_get key $section key
config_get encryption $section encryption
config_get device $section device
band=$(device_to_band $device)
[ "$band" == "" ] && return
cntlr_section=$(uci add mapcontroller ${type})
uci set mapcontroller.${cntlr_section}.ssid="$ssid"
uci set mapcontroller.${cntlr_section}.key="$key"
uci set mapcontroller.${cntlr_section}.encryption="$encryption"
uci set mapcontroller.${cntlr_section}.band="$band"
uci set mapcontroller.${cntlr_section}.vlan="1"
uci set mapcontroller.${cntlr_section}.multi_ap="$multi_ap"
}
mapcontroller_teardown() {
local section=$1
uci delete mapcontroller.$1
}
config_load mapcontroller
config_foreach mapcontroller_teardown bk-credentials
config_foreach mapcontroller_teardown fh-credentials
config_load wireless
config_foreach wireless_process_iface wifi-iface
uci commit mapcontroller
}
func=$1
shift
@@ -380,7 +292,6 @@ case "$func" in
bsta_steer) bsta_steer $@;;
write_bsta_config) write_bsta_config $@;;
teardown_iface) brcm_teardown_iface $@;;
sync_mapcontroller_from_wireless) sync_mapcontroller_from_wireless $@;;
--help|help) usage;;
*) usage; exit 1;;
esac

View File

@@ -19,8 +19,6 @@ start_service() {
config_get_bool enabled controller enabled 1
[ "$enabled" -eq 0 ] && return
/lib/wifi/multiap sync_mapcontroller_from_wireless
procd_open_instance
procd_set_param command "/usr/sbin/mapcontroller" "-d"
@@ -40,14 +38,12 @@ start_service() {
service_triggers()
{
procd_add_reload_trigger "mapcontroller" "wireless"
procd_add_reload_trigger "mapcontroller"
}
reload_service() {
local enabled
/lib/wifi/multiap sync_mapcontroller_from_wireless
config_load "mapcontroller"
config_get_bool enabled controller enabled 1
if [ "$enabled" -eq 0 ]; then