mirror of
https://github.com/Ysurac/openmptcprouter-feeds.git
synced 2025-03-09 15:40:03 +00:00
Fix gateway detection in some case
This commit is contained in:
parent
83ff408cf9
commit
2acf3a2b41
1 changed files with 6 additions and 0 deletions
|
@ -101,12 +101,18 @@ interface_multipath_settings() {
|
||||||
[ -z "$gateway" ] && gateway=$(ip -4 r list dev $iface | grep -v default | awk '/proto static/ {print $1}' | tr -d "\n")
|
[ -z "$gateway" ] && gateway=$(ip -4 r list dev $iface | grep -v default | awk '/proto static/ {print $1}' | tr -d "\n")
|
||||||
[ -z "$gateway" ] && gateway=$(uci -q get "network.$config.gateway")
|
[ -z "$gateway" ] && gateway=$(uci -q get "network.$config.gateway")
|
||||||
[ -z "$gateway" ] && gateway=$(ubus call network.interface.$config status | jsonfilter -q -e '@.route[0].nexthop' | tr -d "\n")
|
[ -z "$gateway" ] && gateway=$(ubus call network.interface.$config status | jsonfilter -q -e '@.route[0].nexthop' | tr -d "\n")
|
||||||
|
if [ -z "$gateway" ] || [ "$( valid_subnet4 $gateway )" != "ok" ]; then
|
||||||
|
gateway=$(ubus call network.interface.$config status | jsonfilter -q -e '@.route[1].nexthop' | tr -d "\n")
|
||||||
|
fi
|
||||||
if [ -z "$gateway" ] || [ "$( valid_subnet4 $gateway )" != "ok" ]; then
|
if [ -z "$gateway" ] || [ "$( valid_subnet4 $gateway )" != "ok" ]; then
|
||||||
gateway=$(ubus call network.interface.$config status | jsonfilter -q -e '@.inactive.route[0].nexthop' | tr -d "\n")
|
gateway=$(ubus call network.interface.$config status | jsonfilter -q -e '@.inactive.route[0].nexthop' | tr -d "\n")
|
||||||
fi
|
fi
|
||||||
if [ -z "$gateway" ] || [ "$( valid_subnet4 $gateway )" != "ok" ]; then
|
if [ -z "$gateway" ] || [ "$( valid_subnet4 $gateway )" != "ok" ]; then
|
||||||
gateway=$(ubus call network.interface.${config}_4 status 2>/dev/null | jsonfilter -q -e '@.inactive.route[0].nexthop' | tr -d "\n")
|
gateway=$(ubus call network.interface.${config}_4 status 2>/dev/null | jsonfilter -q -e '@.inactive.route[0].nexthop' | tr -d "\n")
|
||||||
fi
|
fi
|
||||||
|
if [ -z "$gateway" ] || [ "$( valid_subnet4 $gateway )" != "ok" ]; then
|
||||||
|
gateway=$(ubus call network.interface.${config}_4 status 2>/dev/null | jsonfilter -q -e '@.route[0].nexthop' | tr -d "\n")
|
||||||
|
fi
|
||||||
network_get_subnet netmask $config
|
network_get_subnet netmask $config
|
||||||
[ -z "$netmask" ] && netmask=$(ip -4 addr show dev $iface | grep peer | awk '{print $4}' | cut -d/ -f2 | tr -d "\n")
|
[ -z "$netmask" ] && netmask=$(ip -4 addr show dev $iface | grep peer | awk '{print $4}' | cut -d/ -f2 | tr -d "\n")
|
||||||
[ -z "$netmask" ] && netmask=$(ip -4 addr show dev $iface | grep inet | awk '{print $2}' | cut -d/ -f2 | tr -d "\n")
|
[ -z "$netmask" ] && netmask=$(ip -4 addr show dev $iface | grep inet | awk '{print $2}' | cut -d/ -f2 | tr -d "\n")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue