From patchwork Tue Nov 14 10:40:35 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: fff-network: Evaluate ETH0MAC based on ROUTERMAC From: Adrian Schmutzler X-Patchwork-Id: 688 Message-Id: <1510656035-1989-1-git-send-email-freifunk@adrianschmutzler.de> To: franken-dev@freifunk.net Date: Tue, 14 Nov 2017 11:40:35 +0100 All ONE_PORT devices except mr3020 use phy0 (w2mesh) for the ROUTERMAC. Thus, instead of evaluating w2ap's MAC address, we can just use the flipped ROUTERMAC for ETH0MAC. This should also work for the mr3020, which uses eth0. Signed-off-by: Adrian Schmutzler Tested-by: Adrian Schmutzler --- UNTESTED. This is an alternative to the other ETH0MAC, without having to store another MAC in the network.* files. --- src/packages/fff/fff-network/files/usr/sbin/configurenetwork | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/packages/fff/fff-network/files/usr/sbin/configurenetwork b/src/packages/fff/fff-network/files/usr/sbin/configurenetwork index 89dd239..8df7655 100755 --- a/src/packages/fff/fff-network/files/usr/sbin/configurenetwork +++ b/src/packages/fff/fff-network/files/usr/sbin/configurenetwork @@ -150,7 +150,7 @@ if [ "$ONE_PORT" = "YES" ] && ( ! uci -q get network.$SWITCHDEV.ifname || [ "$FO uci set network.mesh.ifname="bat0" uci set network.wan.ifname="eth1" #eth1 because it is default in config file uci set network.ethmesh.ifname="$SWITCHDEV" - ETH0MAC="w2ap" + ETH0MAC=1 fi uci commit fi @@ -196,7 +196,7 @@ fi if [[ -n "$ETH0MAC" ]]; then echo "Fixing MAC on eth0" sleep 10 - NEW_MACADDR=$(cat "/sys/class/net/${ETH0MAC}/address") + NEW_MACADDR=$(macFlipLocalBit "$ROUTERMAC") uci set network.eth0.macaddr=$NEW_MACADDR uci commit ifconfig eth0 down