From a259e771e9e9f15e134665a638f6d330cf6b15cb Mon Sep 17 00:00:00 2001
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Sat, 11 Jan 2014 21:31:28 +0100
Subject: [PATCH] gluon-core: fixup WAN interface MAC address setting

---
 .../lib/gluon/upgrade/core/initial/011-gluon-network | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

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 776ae459c..400cb40dc 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
@@ -3,6 +3,8 @@
 
 . /lib/functions.sh
 . /lib/gluon/functions/sysconfig.sh
+. /lib/ar71xx.sh
+
 
 uci_remove network lan
 
@@ -10,14 +12,14 @@ uci_set network wan type 'bridge'
 uci_set network wan proto 'dhcp'
 
 
-mainaddr=$(sysconfig primary_mac)
-oIFS="$IFS"; IFS=":"; set -- $mainaddr; IFS="$oIFS"
-b2mask=0x02
-
-case "$board" in
+case "$(ar71xx_board_name)" in
 tl-wr1043nd|\
 tl-wdr3600|\
 tl-wdr4300) # fix up duplicate mac addresses
+	local mainaddr=$(sysconfig primary_mac)
+	local oIFS="$IFS"; IFS=":"; set -- $mainaddr; IFS="$oIFS"
+	local b2mask=0x02
+
 	local wanaddr=$(printf "%02x:%s:%s:%02x:%s:%02x" $(( 0x$1 | $b2mask )) $2 $3 $(( (0x$4 + 1) % 0x100 )) $5 $(( (0x$6 + 1) % 0x100 )) )
 
 	uci_set network wan macaddr "$wanaddr"
-- 
GitLab