|
|
|
|
@@ -43,10 +43,10 @@ brcm_sync_credentials() {
|
|
|
|
|
section=$(uci add ieee1905 ap)
|
|
|
|
|
[ "$section" == "" ] && return
|
|
|
|
|
|
|
|
|
|
uci set ieee1905.${section}.band=$band
|
|
|
|
|
uci set ieee1905.${section}.ssid="$ssid"
|
|
|
|
|
uci set ieee1905.${section}.encryption=$encryption
|
|
|
|
|
uci set ieee1905.${section}.key="$key"
|
|
|
|
|
uci -q set ieee1905.${section}.band=$band
|
|
|
|
|
uci -q set ieee1905.${section}.ssid="$ssid"
|
|
|
|
|
uci -q set ieee1905.${section}.encryption=$encryption
|
|
|
|
|
uci -q set ieee1905.${section}.key="$key"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
mapagent_process_radio() {
|
|
|
|
|
@@ -212,7 +212,7 @@ write_bsta_config() {
|
|
|
|
|
|
|
|
|
|
[ "$bsta" == "$ifname" ] || return
|
|
|
|
|
#echo setting diff = $diff > /dev/console
|
|
|
|
|
uci set wireless.${section}.bssid=$bssid
|
|
|
|
|
uci -q set wireless.${section}.bssid=$bssid
|
|
|
|
|
echo 1
|
|
|
|
|
}
|
|
|
|
|
config_load wireless
|
|
|
|
|
@@ -346,10 +346,16 @@ brcm_bsta_to_wireless() {
|
|
|
|
|
|
|
|
|
|
[ "$bsta" == "$ifname" ] || return
|
|
|
|
|
|
|
|
|
|
uci set wireless.${section}.ssid="$ssid"
|
|
|
|
|
uci set wireless.${section}.key="$key"
|
|
|
|
|
uci set wireless.${section}.encryption=$encryption
|
|
|
|
|
uci set wireless.${section}.disabled=$disabled
|
|
|
|
|
uci -q set wireless.${section}.ssid="$ssid"
|
|
|
|
|
uci -q set wireless.${section}.key="$key"
|
|
|
|
|
uci -q set wireless.${section}.encryption=$encryption
|
|
|
|
|
#uci -q set wireless.${section}.disabled=$disabled
|
|
|
|
|
|
|
|
|
|
[ "$disabled" != "1" ] && return
|
|
|
|
|
wpa_cli -i "$bsta" disconnect > /dev/null 2>&1
|
|
|
|
|
wpa_cli -i "$bsta" disable_network 0 > /dev/null 2>&1
|
|
|
|
|
wpa_cli -i "$bsta" save_config > /dev/null 2>&1
|
|
|
|
|
|
|
|
|
|
echo 1
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -371,7 +377,7 @@ brcm_bsta_to_wireless() {
|
|
|
|
|
config_get encryption $1 encryption
|
|
|
|
|
config_get enabled $1 enabled "0"
|
|
|
|
|
|
|
|
|
|
echo $(mapagent_apply_wl_bsta $2 "$ssid" "$key" $encryption $4) 2> /dev/null
|
|
|
|
|
echo $(mapagent_apply_wl_bsta $2 "$ssid" "$key" $encryption $4)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
config_get band $1 band
|
|
|
|
|
@@ -386,31 +392,30 @@ brcm_bsta_to_wireless() {
|
|
|
|
|
config_get key $1 key
|
|
|
|
|
config_get encryption $1 encryption
|
|
|
|
|
|
|
|
|
|
echo $(mapagent_apply_wl_bsta $ifname "$ssid" "$key" $encryption $enabled) 2> /dev/null
|
|
|
|
|
echo $(mapagent_apply_wl_bsta $ifname "$ssid" "$key" $encryption $enabled)
|
|
|
|
|
fi
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
best=$(mapagent_find_lowest_prio_onboarded)
|
|
|
|
|
|
|
|
|
|
[ -z "$best" ] && return
|
|
|
|
|
|
|
|
|
|
band=$1
|
|
|
|
|
sec=""
|
|
|
|
|
prio=""
|
|
|
|
|
|
|
|
|
|
config_foreach mapagent_enable_best bk-iface $best
|
|
|
|
|
uci commit mapagent
|
|
|
|
|
# best=$(mapagent_find_lowest_prio_onboarded)
|
|
|
|
|
#
|
|
|
|
|
# [ -z "$best" ] && return
|
|
|
|
|
#
|
|
|
|
|
# band=$1
|
|
|
|
|
# sec=""
|
|
|
|
|
# prio=""
|
|
|
|
|
#
|
|
|
|
|
# config_foreach mapagent_enable_best bk-iface $best
|
|
|
|
|
# uci commit mapagent
|
|
|
|
|
config_load mapagent
|
|
|
|
|
|
|
|
|
|
diff=$(config_foreach mapagent_bsta_to_wireless bk-iface)
|
|
|
|
|
|
|
|
|
|
[ "$diff" != "" ] && {
|
|
|
|
|
# [ "$diff" != "" ] && {
|
|
|
|
|
ubus call uci commit '{"config":"wireless"}'
|
|
|
|
|
}
|
|
|
|
|
# }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sync_mapcontroller_from_wireless() {
|
|
|
|
|
ubus -t 5 wait_for wifi
|
|
|
|
|
[ "$?" != "0" ] && return
|
|
|
|
|
@@ -471,18 +476,18 @@ sync_mapcontroller_from_wireless() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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}.vid="1"
|
|
|
|
|
uci set mapcontroller.${cntlr_section}.network="$network"
|
|
|
|
|
uci -q set mapcontroller.${cntlr_section}.ssid="$ssid"
|
|
|
|
|
uci -q set mapcontroller.${cntlr_section}.key="$key"
|
|
|
|
|
uci -q set mapcontroller.${cntlr_section}.encryption="$encryption"
|
|
|
|
|
uci -q set mapcontroller.${cntlr_section}.band="$band"
|
|
|
|
|
uci -q set mapcontroller.${cntlr_section}.vid="1"
|
|
|
|
|
uci -q set mapcontroller.${cntlr_section}.network="$network"
|
|
|
|
|
|
|
|
|
|
[ "$multi_ap" == "1" ] && map_type="backhaul" || map_type="fronthaul"
|
|
|
|
|
uci set mapcontroller.${cntlr_section}.type="$map_type"
|
|
|
|
|
uci -q set mapcontroller.${cntlr_section}.type="$map_type"
|
|
|
|
|
|
|
|
|
|
[ "$start_disabled" == "1" ] && enabled="0"
|
|
|
|
|
uci set mapcontroller.${cntlr_section}.enabled="$enabled"
|
|
|
|
|
uci -q set mapcontroller.${cntlr_section}.enabled="$enabled"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
mapcontroller_teardown() {
|
|
|
|
|
@@ -499,6 +504,122 @@ sync_mapcontroller_from_wireless() {
|
|
|
|
|
uci commit mapcontroller
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bsta_scan_on_enabled() {
|
|
|
|
|
config_load mapagent
|
|
|
|
|
|
|
|
|
|
mapagent_enable_bk() {
|
|
|
|
|
config_get ifname $1 ifname
|
|
|
|
|
config_get enabled $1 enabled
|
|
|
|
|
|
|
|
|
|
echo ifname $ifname enabled $enabled
|
|
|
|
|
|
|
|
|
|
[ "$enabled" = "0" ] && return
|
|
|
|
|
|
|
|
|
|
wpa_cli -i "$ifname" enable_network 0 > /dev/null 2>&1
|
|
|
|
|
wpa_cli -i "$ifname" reconnect > /dev/null 2>&1
|
|
|
|
|
wpa_cli -i "$ifname" save_config > /dev/null 2>&1
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
config_foreach mapagent_enable_bk bk-iface
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bsta_enable_all() {
|
|
|
|
|
mapagent_enable_bk() {
|
|
|
|
|
config_get ifname $1 ifname "2"
|
|
|
|
|
uci -q set mapagent.$1.enabled="1"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
config_load mapagent
|
|
|
|
|
|
|
|
|
|
config_foreach mapagent_enable_bk bk-iface
|
|
|
|
|
uci commit mapagent
|
|
|
|
|
bsta_scan_on_enabled
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bsta_disable_lower_priority() {
|
|
|
|
|
config_load mapagent
|
|
|
|
|
|
|
|
|
|
mapagent_get_priority() {
|
|
|
|
|
config_get ifname $1 ifname
|
|
|
|
|
|
|
|
|
|
[ "$ifname" != "$2" ] && return
|
|
|
|
|
|
|
|
|
|
config_get priority $1 priority "2"
|
|
|
|
|
|
|
|
|
|
echo "$priority"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
mapagent_disable_lower_bk() {
|
|
|
|
|
mapagent_apply_wl_bsta() {
|
|
|
|
|
apply_config() {
|
|
|
|
|
local section="$1"
|
|
|
|
|
local bsta="$2"
|
|
|
|
|
local enabled="$3"
|
|
|
|
|
|
|
|
|
|
config_get ifname $section ifname
|
|
|
|
|
|
|
|
|
|
[ "$bsta" == "$ifname" ] || return
|
|
|
|
|
|
|
|
|
|
[ "$enabled" != "0" ] && return
|
|
|
|
|
|
|
|
|
|
wpa_cli -i "$ifname" disconnect > /dev/null 2>&1
|
|
|
|
|
wpa_cli -i "$ifname" disable_network 0 > /dev/null 2>&1
|
|
|
|
|
wpa_cli -i "$ifname" save_config > /dev/null 2>&1
|
|
|
|
|
}
|
|
|
|
|
local ifname="$1"
|
|
|
|
|
local enabled="$2"
|
|
|
|
|
|
|
|
|
|
[ "$enabled" != "0" ] && return
|
|
|
|
|
|
|
|
|
|
config_load wireless
|
|
|
|
|
|
|
|
|
|
config_foreach apply_config wifi-iface $ifname $enabled
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
local enabled="1"
|
|
|
|
|
|
|
|
|
|
config_get ifname $1 ifname
|
|
|
|
|
config_get priority $1 priority
|
|
|
|
|
|
|
|
|
|
[ "$ifname" != "$2" -a "$priority" -gt "$3" ] && enabled="0"
|
|
|
|
|
|
|
|
|
|
uci -q set mapagent.$1.enabled="$enabled"
|
|
|
|
|
|
|
|
|
|
echo $(mapagent_apply_wl_bsta $ifname $enabled) > /dev/null
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
local bsta=$1
|
|
|
|
|
|
|
|
|
|
prio=$(config_foreach mapagent_get_priority bk-iface $bsta)
|
|
|
|
|
echo bsta $bsta has prio $prio > /dev/console
|
|
|
|
|
|
|
|
|
|
config_foreach mapagent_disable_lower_bk bk-iface $bsta $prio
|
|
|
|
|
uci commit mapagent
|
|
|
|
|
|
|
|
|
|
# ubus call uci commit '{"config":"wireless"}'
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bsta_use_link() {
|
|
|
|
|
config_load mapagent
|
|
|
|
|
|
|
|
|
|
mapagent_disable_bk() {
|
|
|
|
|
local bsta="$2"
|
|
|
|
|
|
|
|
|
|
config_get ifname $1 ifname
|
|
|
|
|
config_get enabled $1 enabled
|
|
|
|
|
|
|
|
|
|
[ "$bsta" = "$ifname" ] && return
|
|
|
|
|
|
|
|
|
|
wpa_cli -i "$ifname" disconnect > /dev/null 2>&1
|
|
|
|
|
wpa_cli -i "$ifname" disable_network 0 > /dev/null 2>&1
|
|
|
|
|
wpa_cli -i "$ifname" save_config > /dev/null 2>&1
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
local bsta=$1
|
|
|
|
|
|
|
|
|
|
config_foreach mapagent_disable_bk bk-iface $bsta
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func=$1
|
|
|
|
|
@@ -517,6 +638,10 @@ case "$func" in
|
|
|
|
|
bsta_to_wireless) brcm_bsta_to_wireless $@;;
|
|
|
|
|
sync_mapcontroller_from_wireless) sync_mapcontroller_from_wireless $@;;
|
|
|
|
|
ts) ts_sub $@;;
|
|
|
|
|
bsta_enable_all) bsta_enable_all $@;;
|
|
|
|
|
bsta_disable_lower_priority) bsta_disable_lower_priority $@;;
|
|
|
|
|
bsta_scan_on_enabled) bsta_scan_on_enabled $@;;
|
|
|
|
|
bsta_use_link) bsta_use_link $@;;
|
|
|
|
|
--help|help) usage;;
|
|
|
|
|
*) usage; exit 1;;
|
|
|
|
|
esac
|
|
|
|
|
|