From bc1be30486a742f1fbcea14f3f075a8f04301867 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Wed, 22 Jan 2014 22:04:08 +0100 Subject: [PATCH] More fixes for strange network interface configurations --- .../files/lib/gluon/upgrade/core/initial/001-sysconfig | 7 ++++++- .../files/lib/gluon/upgrade/core/initial/011-gluon-network | 3 +++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/package/gluon-core/files/lib/gluon/upgrade/core/initial/001-sysconfig b/package/gluon-core/files/lib/gluon/upgrade/core/initial/001-sysconfig index 36cdffdb..9eed5ff9 100755 --- a/package/gluon-core/files/lib/gluon/upgrade/core/initial/001-sysconfig +++ b/package/gluon-core/files/lib/gluon/upgrade/core/initial/001-sysconfig @@ -15,10 +15,15 @@ get_primary_mac() { esac } +iface_exists() { + local name="$1" + ip link show dev "${name//.*/}" >/dev/null 2>&1 +} + lan_ifname="$(uci get network.lan.ifname)" wan_ifname="$(uci get network.wan.ifname)" -if [ -n "$wan_ifname" ]; then +if [ -n "$wan_ifname" ] && iface_exists "$wan_ifname"; then [ -z "$lan_ifname" ] || sysconfig_set lan_ifname "$lan_ifname" sysconfig_set wan_ifname "$wan_ifname" else diff --git a/package/gluon-core/files/lib/gluon/upgrade/core/initial/011-gluon-network b/package/gluon-core/files/lib/gluon/upgrade/core/initial/011-gluon-network index 400cb40d..b335913a 100755 --- a/package/gluon-core/files/lib/gluon/upgrade/core/initial/011-gluon-network +++ b/package/gluon-core/files/lib/gluon/upgrade/core/initial/011-gluon-network @@ -7,7 +7,10 @@ uci_remove network lan +uci_remove network wan +uci_add network interface wan +uci_set network wan ifname "$(sysconfig wan_ifname)" uci_set network wan type 'bridge' uci_set network wan proto 'dhcp'