mwan3: reduce unnecessary comparisons
Signed-off-by: David Yang <mmyangfl@gmail.com>
This commit is contained in:
parent
8a873362d8
commit
5688f3e65a
|
@ -203,9 +203,7 @@ mwan3_create_iface_iptables()
|
||||||
[ -n "$id" ] || return 0
|
[ -n "$id" ] || return 0
|
||||||
|
|
||||||
if [ "$family" == "ipv4" ]; then
|
if [ "$family" == "ipv4" ]; then
|
||||||
|
if ubus call network.interface.${1}_4 status &>/dev/null; then
|
||||||
ubus call network.interface.${1}_4 status &>/dev/null
|
|
||||||
if [ "$?" -eq "0" ]; then
|
|
||||||
network_get_ipaddr src_ip ${1}_4
|
network_get_ipaddr src_ip ${1}_4
|
||||||
else
|
else
|
||||||
network_get_ipaddr src_ip $1
|
network_get_ipaddr src_ip $1
|
||||||
|
@ -244,9 +242,7 @@ mwan3_create_iface_iptables()
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$family" == "ipv6" ]; then
|
if [ "$family" == "ipv6" ]; then
|
||||||
|
if ubus call network.interface.${1}_6 status &>/dev/null; then
|
||||||
ubus call network.interface.${1}_6 status &>/dev/null
|
|
||||||
if [ "$?" -eq "0" ]; then
|
|
||||||
network_get_ipaddr6 src_ipv6 ${1}_6
|
network_get_ipaddr6 src_ipv6 ${1}_6
|
||||||
else
|
else
|
||||||
network_get_ipaddr6 src_ipv6 $1
|
network_get_ipaddr6 src_ipv6 $1
|
||||||
|
@ -322,8 +318,7 @@ mwan3_create_iface_route()
|
||||||
[ -n "$id" ] || return 0
|
[ -n "$id" ] || return 0
|
||||||
|
|
||||||
if [ "$family" == "ipv4" ]; then
|
if [ "$family" == "ipv4" ]; then
|
||||||
ubus call network.interface.${1}_4 status &>/dev/null
|
if ubus call network.interface.${1}_4 status &>/dev/null; then
|
||||||
if [ "$?" -eq "0" ]; then
|
|
||||||
network_get_gateway route_args ${1}_4
|
network_get_gateway route_args ${1}_4
|
||||||
else
|
else
|
||||||
network_get_gateway route_args $1
|
network_get_gateway route_args $1
|
||||||
|
@ -336,9 +331,7 @@ mwan3_create_iface_route()
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$family" == "ipv6" ]; then
|
if [ "$family" == "ipv6" ]; then
|
||||||
|
if ubus call network.interface.${1}_6 status &>/dev/null; then
|
||||||
ubus call network.interface.${1}_6 status &>/dev/null
|
|
||||||
if [ "$?" -eq "0" ]; then
|
|
||||||
network_get_gateway6 route_args ${1}_6
|
network_get_gateway6 route_args ${1}_6
|
||||||
else
|
else
|
||||||
network_get_gateway6 route_args $1
|
network_get_gateway6 route_args $1
|
||||||
|
|
Loading…
Reference in New Issue