mirror of
https://github.com/novatiq/packages.git
synced 2026-04-30 15:38:40 +01:00
mwan3: fix empty gateway when creating routing table
Interfaces of some PtP protocols do not have a real gateway. In that case ubus may fill them with '0.0.0.0' or even leave it blank. This will cause error when adding new routing rule. Signed-off-by: David Yang <mmyangfl@gmail.com>
This commit is contained in:
@@ -26,24 +26,20 @@ if [ "$ACTION" == "ifup" ]; then
|
||||
if [ "$family" = "ipv4" ]; then
|
||||
ubus call network.interface.${INTERFACE}_4 status &>/dev/null
|
||||
if [ "$?" -eq "0" ]; then
|
||||
network_get_gateway gateway ${INTERFACE}_4
|
||||
network_get_ipaddr src_ip ${INTERFACE}_4
|
||||
else
|
||||
network_get_gateway gateway $INTERFACE
|
||||
network_get_ipaddr src_ip ${INTERFACE}
|
||||
fi
|
||||
elif [ "$family" = "ipv6" ]; then
|
||||
ubus call network.interface.${INTERFACE}_6 status &>/dev/null
|
||||
if [ "$?" -eq "0" ]; then
|
||||
network_get_gateway6 gateway ${INTERFACE}_6
|
||||
network_get_ipaddr6 src_ip ${INTERFACE}_6
|
||||
else
|
||||
network_get_gateway6 gateway ${INTERFACE}
|
||||
network_get_ipaddr6 src_ip ${INTERFACE}
|
||||
fi
|
||||
fi
|
||||
|
||||
[ -n "$gateway" ] || exit 9
|
||||
[ -n "$src_ip" ] || exit 9
|
||||
fi
|
||||
|
||||
if [ "$initial_state" = "offline" ]; then
|
||||
|
||||
Reference in New Issue
Block a user