10a2cc8f63dcd7d30387b1a5947b7a490dd317f9
[openwrt/svn-archive/archive.git] / target / linux / mpc85xx / base-files / etc / uci-defaults / 02_network
1 #!/bin/sh
2 #
3 # Copyright (C) 2013 OpenWrt.org
4 #
5
6 tplink_set_mac()
7 {
8 local cfg=$1
9 local offset=$2
10 local mac
11
12 . /lib/functions.sh
13
14 mac=$(mtd_get_mac_binary u-boot 326656)
15 mac=$(macaddr_add $mac $offset)
16
17 ucidef_set_interface_macaddr $cfg $mac
18 }
19
20
21 [ -e /etc/config/network ] && exit 0
22
23 touch /etc/config/network
24
25 . /lib/functions/uci-defaults.sh
26 . /lib/mpc85xx.sh
27
28 ucidef_set_interface_loopback
29
30 board=$(mpc85xx_board_name)
31
32 case "$board" in
33 tl-wdr4900-v1)
34 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
35 ucidef_add_switch "switch0" "1" "1"
36 ucidef_add_switch_vlan "switch0" "1" "0t 2 3 4 5"
37 ucidef_add_switch_vlan "switch0" "2" "0t 1"
38 tplink_set_mac lan -2
39 tplink_set_mac wan 1
40 ;;
41
42 *)
43 ucidef_set_interfaces_lan_wan "eth0" "eth1"
44 ;;
45 esac
46
47 uci commit network
48
49 exit 0