bsp: wr841n9: configure network

Make the network config more dynamically.

Signed-off-by: Tim Niemeyer <tim.niemeyer@mastersword.de>
This commit is contained in:
Tim Niemeyer 2014-04-11 22:17:34 +02:00
parent 637b96ded1
commit ec81a2e441
5 changed files with 87 additions and 50 deletions

View File

@ -4,7 +4,8 @@
# collect environment info and write to dot-script
/etc/environment.sh > /tmp/environment
. /etc/rc.local.board
BOARD=$(cat /var/sysinfo/board_name)
. /etc/rc.local.$BOARD
# Starting NTP-Client Daemon
ntpd -p ${NTPD_IP}

View File

@ -1,41 +1,27 @@
config interface 'loopback'
option ifname 'lo'
option proto 'static'
option ipaddr '127.0.0.1'
option netmask '255.0.0.0'
config 'interface' 'loopback'
option 'ifname' 'lo'
option 'proto' 'static'
option 'ipaddr' '127.0.0.1'
option 'netmask' '255.0.0.0'
config 'interface' 'wlanmesh'
option 'ifname' 'wlan1'
option 'mtu' '1528'
config 'interface' 'mesh'
option 'type' 'bridge'
option 'ifname' 'eth1.1 wlan0 bat0 tap0'
option 'auto' '1'
config 'interface' 'wan'
option 'ifname' 'eth0'
option 'proto' 'dhcp'
config 'interface' 'ethmesh'
option 'ifname' 'eth1.3'
option 'mtu' '1528'
config 'switch'
option 'name' 'eth1'
option 'reset' '1'
option 'enable_vlan' '1'
#1. und 2. LAN Port
config 'switch_vlan'
option 'device' 'eth1'
option 'vlan' '1'
option 'ports' '1 4 0t'
#3. und 4. LAN Port
config 'switch_vlan'
option 'device' 'eth1'
option 'vlan' '3'
option 'ports' '3 2 0t'
config interface 'wlanmesh'
option mtu '1532'
option proto 'batadv'
option mesh 'bat0'
config interface 'mesh'
option type 'bridge'
option auto '1'
config interface 'wan'
option proto 'dhcp'
option ifname 'eth1'
config interface 'ethmesh'
option mtu '1532'
option proto 'batadv'
option mesh 'bat0'
config interface 'bat'
option ifname 'bat0'
option mtu '1500'

View File

@ -6,4 +6,3 @@ config 'script'
config 'network'
option 'mesh_interface' 'br-mesh'
option 'client_interfaces' 'wlan0 eth1.1'

View File

@ -1,9 +0,0 @@
#Set Mac-Addr of wr1043nd wifi interface if not right
WLAN0_MACADDR=$(cat /sys/class/net/wlan0/address)
BRMESH_MACADDR=$(cat /sys/class/net/br-mesh/address)
batctl if add wlan0-1
batctl if add eth1.3

View File

@ -0,0 +1,60 @@
if ! uci get nodewatcher.@network[0].client_interfaces; then
IF="eth0.1 wlan0-1"
echo "Setting nodewatchers client interfaces to: $IF"
uci set nodewatcher.@network[0].client_interfaces="$IF"
uci commit
fi
WANDEV=eth1
SWITCHDEV=eth0
CLIENT_PORTS="1 2 0t"
WAN_PORTS=
BATMAN_PORTS="3 4 0t"
if ! uci get network.$SWITCHDEV.ifname; then
uci set network.$SWITCHDEV=switch
uci set network.$SWITCHDEV.enable=1
uci set network.$SWITCHDEV.reset=1
uci set network.$SWITCHDEV.enable_vlan=1
uci set network.${SWITCHDEV}_1=switch_vlan
uci set network.${SWITCHDEV}_1.device=$SWITCHDEV
uci set network.${SWITCHDEV}_1.vlan=1
uci set network.${SWITCHDEV}_1.ports="$CLIENT_PORTS"
if [[ "$WANDEV" = "$SWITCHDEV" ]]; then
uci set network.${SWITCHDEV}_2=switch_vlan
uci set network.${SWITCHDEV}_2.device=$SWITCHDEV
uci set network.${SWITCHDEV}_2.vlan=2
uci set network.${SWITCHDEV}_2.ports="$WAN_PORTS"
fi
uci set network.${SWITCHDEV}_3=switch_vlan
uci set network.${SWITCHDEV}_3.device=$SWITCHDEV
uci set network.${SWITCHDEV}_3.vlan=3
uci set network.${SWITCHDEV}_3.ports="$BATMAN_PORTS"
uci set network.mesh.ifname="$SWITCHDEV.1 bat0"
uci set network.ethmesh.ifname="$SWITCHDEV.3"
uci set network.wan.ifname=$WANDEV
uci commit
/etc/init.d/network reload
fi
if uci get network.ethmesh.macaddr
then
echo "MAC for ethmesh is set already"
else
echo "Fixing MAC on eth0.3 (ethmesh)"
NEW_MACADDR=$(cat /sys/class/net/eth1/address)
uci set network.ethmesh.macaddr=$NEW_MACADDR
uci commit
ifconfig eth0.3 down
ifconfig eth0.3 hw ether $NEW_MACADDR
ifconfig eth0.3 up
/etc/init.d/network reload
fi