WIFI-2059 Handle br-wan/br-lan ip address conflict

Signed-off-by: Rick Sommerville <rick.sommerville@netexperience.com>
This commit is contained in:
Rick Sommerville
2021-05-20 13:00:12 -04:00
parent 94bcfaf93f
commit aea505ddf9
2 changed files with 27 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
#!/bin/sh
[ "$ACTION" = ifup -o "$ACTION" = ifupdate ] || exit 0
[ "$INTERFACE" = wan ] || exit 0
conflict=0
wan_ipaddr="$(ubus call network.interface.wan status | grep \"address\" | grep -oE '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}')"
lan_ipaddr="$(ubus call network.interface.lan status | grep \"address\" | grep -oE '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}')"
logger -t hotplug "$ACTION of $INTERFACE ($DEVICE) $wan_ipaddr"
[ "$wan_ipaddr" = "192.168.1" ] && [ "$lan_ipaddr" = "192.168.1" ] && {
conflict=1
dest_ip="192.168.0.1"
}
[ "$wan_ipaddr" = "192.168.0" ] && [ "$lan_ipaddr" = "192.168.0" ] && {
conflict=1
dest_ip="192.168.1.1"
}
[ $conflict = 1 ] && {
logger -t hotplug "IP conflict with br-wan. Switch br-lan to $dest_ip"
uci set network.lan.ipaddr="$dest_ip"
uci_commit
reload_config
}
exit 0

View File

@@ -2,6 +2,8 @@
uci set network.wan.type=bridge
uci set network.wan6.ifname=@wan
uci set network.wan.metric=1
uci set network.lan.metric=10
uci set network.wan.vlan_filtering=1
uci set network.lan.vlan_filtering=1
exit 0