atheros: configure eth1 as wan interface by default, if present
[openwrt/svn-archive/archive.git] / target / linux / atheros / base-files / etc / uci-defaults / network
1 #!/bin/sh
2 if [ -e "/sys/bus/mdio_bus/drivers/Infineon ADM6996/0:00" -o \
3 -e "/sys/bus/mdio_bus/drivers/IC+ IP175C/0:00" -o \
4 -e "/sys/bus/mdio_bus/drivers/Marvell 88E6060/0:10" ]; then
5 uci batch <<EOF
6 set network.lan.ifname=eth0.1
7 set network.wan=interface
8 set network.wan.ifname=eth0.2
9 set network.wan.proto=dhcp
10 EOF
11 HAS_SWITCH=1
12 fi
13
14 if [ -e "/sys/bus/mdio_bus/drivers/IC+ IP175C/0:00" ]; then
15 uci batch <<EOF
16 set network.eth0=switch
17 set network.eth0.reset=1
18 set network.eth0.enable_vlan=1
19 set network.eth0_1=switch_vlan
20 set network.eth0_1.device=eth0
21 set network.eth0_1.vlan=1
22 set network.eth0_1.ports="0 1 2 3 5t"
23 set network.eth0_2=switch_vlan
24 set network.eth0_2.device=eth0
25 set network.eth0_2.vlan=2
26 set network.eth0_2.ports="4 5t"
27 EOF
28 HAS_SWITCH=1
29 fi
30
31 [ -z "$HAS_SWITCH" -a -d /sys/class/net/eth1 ] && {
32 uci batch <<EOF
33 set network.wan=interface
34 set network.wan.ifname=eth1
35 set network.wan.proto=dhcp
36 EOF
37 }
38
39 uci commit network