Compare commits

...

2 Commits

Author SHA1 Message Date
Janusz Dziedzic
004bbc3d3b uci-defaults: l2mode dedicated wanport
Signed-off-by: Janusz Dziedzic <janusz.dziedzic@iopsys.eu>
2025-06-05 10:54:53 +02:00
Janusz Dziedzic
1847d587a3 map-agent: update map-dynamic-backhaul
- fix wpa_cli network_id
 - add/remove eth uplink from bridge
 - don't require dedicated wanport to be part of bridge
2025-06-05 10:54:53 +02:00
2 changed files with 29 additions and 9 deletions

View File

@@ -17,12 +17,6 @@ for port_bridge_sec in $port_bridge_sec_list; do
fi
done
# Exit if the PORT Bridge Name is empty
[ -z "$port_bridge_name" ] && exit 0
# Exit if the PORT is not member of the AL Bridge
[ "$port_bridge_name" = "$al_bridge" ] || exit 0
# Exit if the device is not operating in extender/repeater mode
al_brnet="${al_bridge:3}"
[ "$(uci -q get network.${al_brnet}.proto)" == "dhcp" ] || exit 0
@@ -36,9 +30,16 @@ fi
################ Dedicated ETH WAN Port ################
wanport="$(jsonfilter -i /etc/board.json -e @.network.wan.device)"
if [ -n "$wanport" ]; then
# Don't require wanport to be part of port bridge
[ "$wanport" = "$PORT" ] || exit 0
########################################################
else
# Exit if the PORT Bridge Name is empty
[ -z "$port_bridge_name" ] && exit 0
# Exit if the PORT is not member of the AL Bridge
[ "$port_bridge_name" = "$al_bridge" ] || exit 0
#################### DHCP Discovery ####################
if [ "$LINK" = "up" ]; then
brctl delif $al_bridge $PORT
@@ -61,6 +62,14 @@ remove_from_bridge() {
[ -n "$ifname" ] && brctl delif ${al_bridge} ${ifname}
}
get_network_id() {
local ifname=$1
[ -n "$ifname" ] || return
network_id=$(wpa_cli -i $ifname list_n|tail -n 1 | awk '{print $1}')
echo ${network_id}
}
update_bstas() {
section="$1"
action="$2"
@@ -68,16 +77,19 @@ update_bstas() {
config_get ifname "$section" ifname
config_get_bool enabled "$section" enabled 0
network_id=$(get_network_id $ifname)
if [ "$action" = "down" ]; then
wpa_cli -i "$ifname" disconnect > /dev/null 2>&1
wpa_cli -i "$ifname" disable_network 0 > /dev/null 2>&1
wpa_cli -i "$ifname" disable_network $network_id > /dev/null 2>&1
# wpa_cli -i "$ifname" save_config > /dev/null 2>&1
elif [ "$action" = "up" ]; then
[ "$enabled" -eq 0 ] && return
wpa_cli -i "$ifname" reconnect > /dev/null 2>&1
wpa_cli -i "$ifname" enable_network 0 > /dev/null 2>&1
wpa_cli -i "$ifname" enable_network $network_id > /dev/null 2>&1
# wpa_cli -i "$ifname" save_config > /dev/null 2>&1
fi
echo "wpa_cli -i $ifname $action id $network_id" > /dev/console
}
if [ "$LINK" = "up" ]; then
@@ -86,8 +98,12 @@ if [ "$LINK" = "up" ]; then
config_foreach remove_from_bridge bsta
config_foreach update_bstas bsta down
brctl addif $al_bridge $PORT
echo "brctl addif $al_bridge $PORT" > /dev/console
/lib/wifi/multiap set_uplink "eth" "$PORT"
else
brctl delif $al_bridge $PORT
echo "brctl delif $al_bridge $PORT" > /dev/console
/lib/wifi/multiap unset_uplink "eth"
#rm -f "$map_bh_file"
config_load "mapagent"

View File

@@ -80,7 +80,11 @@ l2_network_config() {
json_select ..
json_select wan 2>/dev/null
json_get_var device device
[ -n "$device" ] && uci add_list network.br_lan.ports="$device"
[ -n "$device" ] && {
# dedicated wan port - create uplink device
uci -q set network.l2wan=interface
uci -q set network.l2wan.device="$device"
}
json_cleanup
fi