From 192dd3765c43737998a968ff4b71718b1782abb4 Mon Sep 17 00:00:00 2001 From: Tim Niemeyer Date: Sat, 30 Mar 2013 00:10:52 +0100 Subject: [PATCH] Change BATMAN ethernet ports BATMAN couldn't handle devices with the same MAC, so this uses the internal switch to bridge the ports. It also changes the MAC to a localy unique address. Signed-off-by: Tim Niemeyer --- .../root_file_system/etc/config/batman-adv | 2 +- bsp/dir300/root_file_system/etc/config/network | 16 ++-------------- bsp/dir300/root_file_system/etc/rc.local | 16 ++++++++++++++-- .../root_file_system/etc/config/network | 17 +++-------------- bsp/wr1043nd/root_file_system/etc/rc.local | 16 ++++++++++++++-- .../root_file_system/etc/config/network | 17 +++-------------- bsp/wr741nd2/root_file_system/etc/rc.local | 16 ++++++++++++++-- .../root_file_system/etc/config/network | 18 +++--------------- bsp/wr741nd4/root_file_system/etc/rc.local | 16 ++++++++++++++-- .../root_file_system/etc/config/network | 17 +++-------------- bsp/wr841nd7/root_file_system/etc/rc.local | 16 ++++++++++++++-- 11 files changed, 85 insertions(+), 82 deletions(-) diff --git a/bsp/default/root_file_system/etc/config/batman-adv b/bsp/default/root_file_system/etc/config/batman-adv index 73c69ec..d222821 100644 --- a/bsp/default/root_file_system/etc/config/batman-adv +++ b/bsp/default/root_file_system/etc/config/batman-adv @@ -1,5 +1,5 @@ config 'mesh' 'bat0' - option 'interfaces' 'wlanmesh ethmesh1 ethmesh2' + option 'interfaces' 'wlanmesh ethmesh' option 'aggregated_ogms' option 'ap_isolation' option 'bonding' diff --git a/bsp/dir300/root_file_system/etc/config/network b/bsp/dir300/root_file_system/etc/config/network index 18d56e8..026bdb1 100644 --- a/bsp/dir300/root_file_system/etc/config/network +++ b/bsp/dir300/root_file_system/etc/config/network @@ -34,22 +34,10 @@ config 'switch_vlan' 'eth0_2' config 'switch_vlan' 'eth0_3' option 'device' 'eth0' option 'vlan' '3' - option 'ports' '2 5t' + option 'ports' '2 3 5t' -config 'switch_vlan' 'eth0_4' - option 'device' 'eth0' - option 'vlan' '4' - option 'ports' '3 5t' - -config 'interface' 'ethmesh1' - option 'type' 'bridge' +config 'interface' 'ethmesh' option 'ifname' 'eth0.3' - option 'mtu' '1528' - -config 'interface' 'ethmesh2' - option 'type' 'bridge' - option 'ifname' 'eth0.4' - option 'mtu' '1528' config 'interface' 'wan' option 'ifname' 'eth0.2' diff --git a/bsp/dir300/root_file_system/etc/rc.local b/bsp/dir300/root_file_system/etc/rc.local index 0effd21..28b4e4c 100755 --- a/bsp/dir300/root_file_system/etc/rc.local +++ b/bsp/dir300/root_file_system/etc/rc.local @@ -24,9 +24,21 @@ else fi fi +if uci get network.ethmesh.macaddr +then + echo "MAC for ETH-BATMAN is set already" +else + echo "Fixing MAC on eth0.3 (ethmesh)" + NEW=$(awk -F: '{ printf("%02x:%02x:%02x:%02x:%02x:%02x\n", ("0x"$1)+2, "0x"$2, "0x"$3, "0x"$4, "0x"$5, "0x"$6 ) }' /sys/class/net/eth0/address) + uci set network.ethmesh.macaddr=$NEW + uci commit + ifconfig eth0.3 hw ether $NEW + ifconfig eth0.3 down + ifconfig eth0.3 up +fi + batctl if add wlan0-1 -batctl if add br-ethmesh1 -batctl if add br-ethmesh2 +batctl if add eth0.3 # Starting NTP-Client Daemon ntpd -p "fe80::201:2ff:fe03:405%br-mesh" diff --git a/bsp/wr1043nd/root_file_system/etc/config/network b/bsp/wr1043nd/root_file_system/etc/config/network index f06d3f0..63f98e9 100644 --- a/bsp/wr1043nd/root_file_system/etc/config/network +++ b/bsp/wr1043nd/root_file_system/etc/config/network @@ -17,15 +17,9 @@ config 'interface' 'wan' option 'ifname' 'eth0.2' option 'proto' 'dhcp' -config 'interface' 'ethmesh1' - option 'type' 'bridge' +config 'interface' 'ethmesh' option 'ifname' 'eth0.3' option 'mtu' '1528' - -config 'interface' 'ethmesh2' - option 'type' 'bridge' - option 'ifname' 'eth0.4' - option 'mtu' '1528' config 'switch' option 'name' 'rtl8366rb' @@ -45,14 +39,9 @@ config 'switch_vlan' option 'ports' '0 5t' -#1. LAN Port +#1. und 2. LAN Port config 'switch_vlan' option 'device' 'rtl8366rb' option 'vlan' '3' - option 'ports' '1 5t' + option 'ports' '1 2 5t' -#2. LAN Port -config 'switch_vlan' - option 'device' 'rtl8366rb' - option 'vlan' '4' - option 'ports' '2 5t' diff --git a/bsp/wr1043nd/root_file_system/etc/rc.local b/bsp/wr1043nd/root_file_system/etc/rc.local index f8e5276..384a72d 100755 --- a/bsp/wr1043nd/root_file_system/etc/rc.local +++ b/bsp/wr1043nd/root_file_system/etc/rc.local @@ -15,9 +15,21 @@ # reboot #fi +if uci get network.ethmesh.macaddr +then + echo "MAC for ETH-BATMAN is set already" +else + echo "Fixing MAC on eth0.3 (ethmesh)" + NEW=$(awk -F: '{ printf("%02x:%02x:%02x:%02x:%02x:%02x\n", ("0x"$1)+2, "0x"$2, "0x"$3, "0x"$4, "0x"$5, "0x"$6 ) }' /sys/class/net/eth0/address) + uci set network.ethmesh.macaddr=$NEW + uci commit + ifconfig eth0.3 hw ether $NEW + ifconfig eth0.3 down + ifconfig eth0.3 up +fi + batctl if add wlan0-1 -batctl if add br-ethmesh1 -batctl if add br-ethmesh2 +batctl if add eth0.3 # Starting NTP-Client Daemon ntpd -p "fe80::201:2ff:fe03:405%br-mesh" diff --git a/bsp/wr741nd2/root_file_system/etc/config/network b/bsp/wr741nd2/root_file_system/etc/config/network index 1d8451a..218329f 100644 --- a/bsp/wr741nd2/root_file_system/etc/config/network +++ b/bsp/wr741nd2/root_file_system/etc/config/network @@ -18,15 +18,9 @@ config 'interface' 'wan' option 'ifname' 'eth1' option 'proto' 'dhcp' -config 'interface' 'ethmesh1' - option 'type' 'bridge' +config 'interface' 'ethmesh' option 'ifname' 'eth0.3' option 'mtu' '1528' - -config 'interface' 'ethmesh2' - option 'type' 'bridge' - option 'ifname' 'eth0.4' - option 'mtu' '1528' config 'switch' option 'name' 'eth0' @@ -39,14 +33,9 @@ config 'switch_vlan' option 'vlan' '1' option 'ports' '1 2 0t' -#1. LAN Port +#1. und 2. LAN Port config 'switch_vlan' option 'device' 'eth0' option 'vlan' '3' - option 'ports' '4 0t' + option 'ports' '4 3 0t' -#2. LAN Port -config 'switch_vlan' - option 'device' 'eth0' - option 'vlan' '4' - option 'ports' '3 0t' diff --git a/bsp/wr741nd2/root_file_system/etc/rc.local b/bsp/wr741nd2/root_file_system/etc/rc.local index 9051442..3e00dc3 100755 --- a/bsp/wr741nd2/root_file_system/etc/rc.local +++ b/bsp/wr741nd2/root_file_system/etc/rc.local @@ -15,9 +15,21 @@ if [[ "$WLAN0_MACADDR=" != "$BRMESH_MACADDR=" ]]; then ifconfig br-mesh up fi +if uci get network.ethmesh.macaddr +then + echo "MAC for ETH-BATMAN is set already" +else + echo "Fixing MAC on eth0.3 (ethmesh)" + NEW=$(awk -F: '{ printf("%02x:%02x:%02x:%02x:%02x:%02x\n", ("0x"$1)+2, "0x"$2, "0x"$3, "0x"$4, "0x"$5, "0x"$6 ) }' /sys/class/net/eth0/address) + uci set network.ethmesh.macaddr=$NEW + uci commit + ifconfig eth0.3 hw ether $NEW + ifconfig eth0.3 down + ifconfig eth0.3 up +fi + batctl if add wlan0-1 -batctl if add br-ethmesh1 -batctl if add br-ethmesh2 +batctl if add eth0.3 # Starting NTP-Client Daemon ntpd -p "fe80::201:2ff:fe03:405%br-mesh" diff --git a/bsp/wr741nd4/root_file_system/etc/config/network b/bsp/wr741nd4/root_file_system/etc/config/network index 4620642..fc482a6 100644 --- a/bsp/wr741nd4/root_file_system/etc/config/network +++ b/bsp/wr741nd4/root_file_system/etc/config/network @@ -18,16 +18,10 @@ config 'interface' 'wan' option 'ifname' 'eth1' option 'proto' 'dhcp' -config 'interface' 'ethmesh1' - option 'type' 'bridge' +config 'interface' 'ethmesh' option 'ifname' 'eth0.3' option 'mtu' '1528' -config 'interface' 'ethmesh2' - option 'type' 'bridge' - option 'ifname' 'eth0.4' - option 'mtu' '1528' - config 'switch' option 'name' 'eth0' option 'reset' '1' @@ -39,14 +33,8 @@ config 'switch_vlan' option 'vlan' '1' option 'ports' '1 4 0t' -#1. LAN Port +#1. und 2. LAN Port config 'switch_vlan' option 'device' 'eth0' option 'vlan' '3' - option 'ports' '2 0t' - -#2. LAN Port -config 'switch_vlan' - option 'device' 'eth0' - option 'vlan' '4' - option 'ports' '3 0t' + option 'ports' '2 3 0t' diff --git a/bsp/wr741nd4/root_file_system/etc/rc.local b/bsp/wr741nd4/root_file_system/etc/rc.local index 9051442..3e00dc3 100755 --- a/bsp/wr741nd4/root_file_system/etc/rc.local +++ b/bsp/wr741nd4/root_file_system/etc/rc.local @@ -15,9 +15,21 @@ if [[ "$WLAN0_MACADDR=" != "$BRMESH_MACADDR=" ]]; then ifconfig br-mesh up fi +if uci get network.ethmesh.macaddr +then + echo "MAC for ETH-BATMAN is set already" +else + echo "Fixing MAC on eth0.3 (ethmesh)" + NEW=$(awk -F: '{ printf("%02x:%02x:%02x:%02x:%02x:%02x\n", ("0x"$1)+2, "0x"$2, "0x"$3, "0x"$4, "0x"$5, "0x"$6 ) }' /sys/class/net/eth0/address) + uci set network.ethmesh.macaddr=$NEW + uci commit + ifconfig eth0.3 hw ether $NEW + ifconfig eth0.3 down + ifconfig eth0.3 up +fi + batctl if add wlan0-1 -batctl if add br-ethmesh1 -batctl if add br-ethmesh2 +batctl if add eth0.3 # Starting NTP-Client Daemon ntpd -p "fe80::201:2ff:fe03:405%br-mesh" diff --git a/bsp/wr841nd7/root_file_system/etc/config/network b/bsp/wr841nd7/root_file_system/etc/config/network index e46a95b..a70506f 100644 --- a/bsp/wr841nd7/root_file_system/etc/config/network +++ b/bsp/wr841nd7/root_file_system/etc/config/network @@ -18,15 +18,9 @@ config 'interface' 'wan' option 'ifname' 'eth1' option 'proto' 'dhcp' -config 'interface' 'ethmesh1' - option 'type' 'bridge' +config 'interface' 'ethmesh' option 'ifname' 'eth0.3' option 'mtu' '1528' - -config 'interface' 'ethmesh2' - option 'type' 'bridge' - option 'ifname' 'eth0.4' - option 'mtu' '1528' config 'switch' option 'name' 'eth0' @@ -39,14 +33,9 @@ config 'switch_vlan' option 'vlan' '1' option 'ports' '1 2 0t' -#3. LAN Port +#3. und 4. LAN Port config 'switch_vlan' option 'device' 'eth0' option 'vlan' '3' - option 'ports' '3 0t' + option 'ports' '3 4 0t' -#4. LAN Port -config 'switch_vlan' - option 'device' 'eth0' - option 'vlan' '4' - option 'ports' '4 0t' diff --git a/bsp/wr841nd7/root_file_system/etc/rc.local b/bsp/wr841nd7/root_file_system/etc/rc.local index 9051442..3e00dc3 100755 --- a/bsp/wr841nd7/root_file_system/etc/rc.local +++ b/bsp/wr841nd7/root_file_system/etc/rc.local @@ -15,9 +15,21 @@ if [[ "$WLAN0_MACADDR=" != "$BRMESH_MACADDR=" ]]; then ifconfig br-mesh up fi +if uci get network.ethmesh.macaddr +then + echo "MAC for ETH-BATMAN is set already" +else + echo "Fixing MAC on eth0.3 (ethmesh)" + NEW=$(awk -F: '{ printf("%02x:%02x:%02x:%02x:%02x:%02x\n", ("0x"$1)+2, "0x"$2, "0x"$3, "0x"$4, "0x"$5, "0x"$6 ) }' /sys/class/net/eth0/address) + uci set network.ethmesh.macaddr=$NEW + uci commit + ifconfig eth0.3 hw ether $NEW + ifconfig eth0.3 down + ifconfig eth0.3 up +fi + batctl if add wlan0-1 -batctl if add br-ethmesh1 -batctl if add br-ethmesh2 +batctl if add eth0.3 # Starting NTP-Client Daemon ntpd -p "fe80::201:2ff:fe03:405%br-mesh"