Commit cd55bbdf authored by Amit Kumar's avatar Amit Kumar
Browse files

mapagent: port add delete to bridge using uci ubus

parent ac7abe05
......@@ -14,24 +14,31 @@ al_brnet="${al_bridge:3}"
############## Dynamic Backhaul Daemon ##############
if [ -n "$(which dynbhd)" ]; then
pidof dynbhd >/dev/null && exit 0 # dynbhd is managing the links
device="br_$al_brnet"
if [ ! -f $conn_ports_file ]; then
touch $conn_ports_file
if [ "$LINK" = "up" ]; then
touch $conn_ports_file
echo "$PORT" > $conn_ports_file
brctl delif $al_bridge $PORT
#brctl delif $al_bridge $PORT
uci -q del_list network.${device}.ports="$PORT"
ubus call uci commit '{"config":"network"}'
#ubus call network.interface.lan remove_device "{\"name\":\"$PORT\"}"
fi
else
if [ "$LINK" = "up" ]; then
brctl delif $al_bridge $PORT
#brctl delif $al_bridge $PORT
uci -q del_list network.${device}.ports="$PORT"
ubus call uci commit '{"config":"network"}'
echo "$PORT" >> $conn_ports_file
#ubus call network.interface.lan remove_device "{\"name\":\"$PORT\"}"
else
sed -i -E "/(^|:)${PORT}(:|$)/d" $conn_ports_file
#ubus call network.interface.lan add_device "{\"name\":\"$PORT\"}"
brctl addif $al_bridge $PORT
#brctl addif $al_bridge $PORT
uci -q add_list network.${device}.ports="$PORT"
ubus call uci commit '{"config":"network"}'
[ "$(cat $conn_ports_file | wc -c)" = "0" ] && rm -f $conn_ports_file
fi
fi
......@@ -50,11 +57,14 @@ else
[ "$(uci -q get network.${al_brnet}.proto)" == "dhcp" ] || exit 0
if [ "$LINK" = "up" ]; then
brctl delif $al_bridge $PORT
device="br_$al_brnet"
uci -q del_list network.${device}.ports="$PORT"
ubus call uci commit '{"config":"network"}'
udhcpc -qnRoC -i $PORT >/dev/null 2>&1 && dhcp=1
brctl addif $al_bridge $PORT
uci -q add_list network.${device}.ports="$PORT"
ubus call uci commit '{"config":"network"}'
[ $dhcp -eq 1 ] || exit 0
else
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment