diff options
author | David Yang <mmyangfl@gmail.com> | 2017-10-30 21:32:01 +0800 |
---|---|---|
committer | David Yang <mmyangfl@gmail.com> | 2017-11-08 16:14:46 +0800 |
commit | 5688f3e65a802bb41a84545a60fa31a73770f847 (patch) | |
tree | ac135408a2677cd57db03535c147b5aaf104f1ab /net | |
parent | 8a873362d83d370c4100df0f2356b87139150c92 (diff) |
mwan3: reduce unnecessary comparisons
Signed-off-by: David Yang <mmyangfl@gmail.com>
Diffstat (limited to 'net')
-rw-r--r-- | net/mwan3/files/lib/mwan3/mwan3.sh | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/net/mwan3/files/lib/mwan3/mwan3.sh b/net/mwan3/files/lib/mwan3/mwan3.sh index a92cb4687..32c9f7888 100644 --- a/net/mwan3/files/lib/mwan3/mwan3.sh +++ b/net/mwan3/files/lib/mwan3/mwan3.sh @@ -203,9 +203,7 @@ mwan3_create_iface_iptables() [ -n "$id" ] || return 0 if [ "$family" == "ipv4" ]; then - - ubus call network.interface.${1}_4 status &>/dev/null - if [ "$?" -eq "0" ]; then + if ubus call network.interface.${1}_4 status &>/dev/null; then network_get_ipaddr src_ip ${1}_4 else network_get_ipaddr src_ip $1 @@ -244,9 +242,7 @@ mwan3_create_iface_iptables() fi if [ "$family" == "ipv6" ]; then - - ubus call network.interface.${1}_6 status &>/dev/null - if [ "$?" -eq "0" ]; then + if ubus call network.interface.${1}_6 status &>/dev/null; then network_get_ipaddr6 src_ipv6 ${1}_6 else network_get_ipaddr6 src_ipv6 $1 @@ -322,8 +318,7 @@ mwan3_create_iface_route() [ -n "$id" ] || return 0 if [ "$family" == "ipv4" ]; then - ubus call network.interface.${1}_4 status &>/dev/null - if [ "$?" -eq "0" ]; then + if ubus call network.interface.${1}_4 status &>/dev/null; then network_get_gateway route_args ${1}_4 else network_get_gateway route_args $1 @@ -336,9 +331,7 @@ mwan3_create_iface_route() fi if [ "$family" == "ipv6" ]; then - - ubus call network.interface.${1}_6 status &>/dev/null - if [ "$?" -eq "0" ]; then + if ubus call network.interface.${1}_6 status &>/dev/null; then network_get_gateway6 route_args ${1}_6 else network_get_gateway6 route_args $1 |