From 026271d03c28b3b88e64afe04bd3d236971cfaf2 Mon Sep 17 00:00:00 2001
From: Jo-Philipp Wich <jow@openwrt.org>
Date: Mon, 6 May 2013 09:33:56 +0000
Subject: [PATCH] base-files: change network_find_wan() procedure to ignore
 default gateways in different routing tables

SVN-Revision: 36553
---
 package/base-files/Makefile                   |  2 +-
 .../base-files/files/lib/functions/network.sh | 24 +++++++++++--------
 2 files changed, 15 insertions(+), 11 deletions(-)

diff --git a/package/base-files/Makefile b/package/base-files/Makefile
index acd5e2e198..050cc77b51 100644
--- a/package/base-files/Makefile
+++ b/package/base-files/Makefile
@@ -11,7 +11,7 @@ include $(INCLUDE_DIR)/kernel.mk
 include $(INCLUDE_DIR)/version.mk
 
 PKG_NAME:=base-files
-PKG_RELEASE:=137
+PKG_RELEASE:=138
 
 PKG_FILE_DEPENDS:=$(PLATFORM_DIR)/ $(GENERIC_PLATFORM_DIR)/base-files/
 PKG_BUILD_DEPENDS:=opkg/host
diff --git a/package/base-files/files/lib/functions/network.sh b/package/base-files/files/lib/functions/network.sh
index 369fa3dbde..d86a504bf4 100644
--- a/package/base-files/files/lib/functions/network.sh
+++ b/package/base-files/files/lib/functions/network.sh
@@ -80,16 +80,20 @@ __network_parse_ifstatus()
 			while json_is_a "$__idx" object; do
 
 				json_select "$((__idx++))"
-				json_get_var __tmp target
-
-				case "${__tmp}" in
-					0.0.0.0)
-						__network_set_cache "${__key}_gateway4" nexthop
-					;;
-					::)
-						__network_set_cache "${__key}_gateway6" nexthop
-					;;
-				esac
+				json_get_var __tmp table
+
+				if [ -z "$__tmp" ]; then
+					json_get_var __tmp target
+
+					case "${__tmp}" in
+						0.0.0.0)
+							__network_set_cache "${__key}_gateway4" nexthop
+						;;
+						::)
+							__network_set_cache "${__key}_gateway6" nexthop
+						;;
+					esac
+				fi
 
 				json_select ".."
 
-- 
GitLab