From bbd8ee677236562dce31a33fdbb8fc36d2fedaa7 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Fri, 28 Feb 2014 13:30:18 +0100 Subject: [PATCH] gluon-core: switch LAN and WAN on nanostation-m --- .../gluon/upgrade/core/initial/001-sysconfig | 29 ++++++++++++------- 1 file changed, 19 insertions(+), 10 deletions(-) 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 9eed5ff9..afabb2df 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 @@ -5,14 +5,14 @@ get_primary_mac() { - case "$(ar71xx_board_name)" in - tl-wdr3600|tl-wdr4300) - cat /sys/class/ieee80211/phy1/macaddress - ;; - *) - cat /sys/class/ieee80211/phy0/macaddress - ;; - esac + case "$(ar71xx_board_name)" in + tl-wdr3600|tl-wdr4300) + cat /sys/class/ieee80211/phy1/macaddress + ;; + *) + cat /sys/class/ieee80211/phy0/macaddress + ;; + esac } iface_exists() { @@ -20,8 +20,17 @@ iface_exists() { ip link show dev "${name//.*/}" >/dev/null 2>&1 } -lan_ifname="$(uci get network.lan.ifname)" -wan_ifname="$(uci get network.wan.ifname)" +case "$(ar71xx_board_name)" in + nanostation-m) + # It's more convenient to swap the ports for these devices so WAN is the PoE port + lan_ifname="$(uci get network.wan.ifname)" + wan_ifname="$(uci get network.lan.ifname)" + ;; + *) + lan_ifname="$(uci get network.lan.ifname)" + wan_ifname="$(uci get network.wan.ifname)" + ;; +esac if [ -n "$wan_ifname" ] && iface_exists "$wan_ifname"; then [ -z "$lan_ifname" ] || sysconfig_set lan_ifname "$lan_ifname"