base-files: only consider enabled default routes when finding the wan iface (#11774)
authorJo-Philipp Wich <jow@openwrt.org>
Fri, 29 Jun 2012 11:58:35 +0000 (11:58 +0000)
committerJo-Philipp Wich <jow@openwrt.org>
Fri, 29 Jun 2012 11:58:35 +0000 (11:58 +0000)
SVN-Revision: 32525

package/base-files/files/lib/functions/network.sh

index 7475b00cba384afc7ef6f1e505b69ec7a8301286..c6b98e6e1c97076c2400ff25a77d67dfc43648cb 100644 (file)
@@ -49,6 +49,7 @@ __network_gateway()
 
        local __tmp="$(ubus call network.interface."$__iface" status 2>/dev/null)"
        local __idx=1
+       local __enabled
 
        json_load "${__tmp:-{}}"
 
@@ -60,9 +61,10 @@ __network_gateway()
 
                        json_select "$((__idx++))"
                        json_get_var __tmp target
+                       json_get_var __enabled enabled
 
-                       case "${__family}/${__tmp}" in
-                               4/0.0.0.0|6/::)
+                       case "${__enabled}/${__family}/${__tmp}" in
+                               1/4/0.0.0.0|1/6/::)
                                        json_get_var "$__var" nexthop
                                        return $?
                                ;;