From patchwork Fri Dec 22 17:03:05 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [2/2] fff-network: Replace ETH0MAC by replacement based on ROUTERMAC From: Adrian Schmutzler X-Patchwork-Id: 717 Message-Id: <1513962185-3621-2-git-send-email-freifunk@adrianschmutzler.de> To: franken-dev@freifunk.net Date: Fri, 22 Dec 2017 18:03:05 +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 --- This replaces the patches - fff-network: Evaluate ETH0MAC based on ROUTERMAC - fff-network: Move ETH0MAC to network.* In contrast to the former, we now use the newly introduced function and can start the MAC replacement immediately (without the ETH0MAC being set). --- .../fff/fff-network/files/usr/sbin/configurenetwork | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/src/packages/fff/fff-network/files/usr/sbin/configurenetwork b/src/packages/fff/fff-network/files/usr/sbin/configurenetwork index 7f34d6f..272da13 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" + fixMac "$(macFlipLocalBit "$ROUTERMAC")" "eth0" "eth0" "1" fi uci commit network fi @@ -165,18 +165,6 @@ if [ -n "$ROUTERMAC" ]; then fixMac "$ROUTERMAC" "br-mesh" "mesh" fi -if [[ -n "$ETH0MAC" ]]; then - echo "Fixing MAC on eth0" - sleep 10 - NEW_MACADDR=$(cat "/sys/class/net/${ETH0MAC}/address") - uci set network.eth0.macaddr=$NEW_MACADDR - uci commit network - ifconfig eth0 down - ifconfig eth0 hw ether $NEW_MACADDR - ifconfig eth0 up - /etc/init.d/network restart -fi - if uci get network.mesh.ip6addr then echo "IPv6 for mesh is set already"