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 <tim.niemeyer@mastersword.de>
This commit is contained in:
Tim Niemeyer 2013-03-30 00:10:52 +01:00
parent fb277ed060
commit 192dd3765c
11 changed files with 85 additions and 82 deletions

View File

@ -1,5 +1,5 @@
config 'mesh' 'bat0'
option 'interfaces' 'wlanmesh ethmesh1 ethmesh2'
option 'interfaces' 'wlanmesh ethmesh'
option 'aggregated_ogms'
option 'ap_isolation'
option 'bonding'

View File

@ -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'

View File

@ -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"

View File

@ -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'

View File

@ -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"

View File

@ -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'

View File

@ -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"

View File

@ -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'

View File

@ -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"

View File

@ -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'

View File

@ -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"