f13d1e3643f25ad57534b068925322860d91b6f3
[openwrt/openwrt.git] / target / linux / ipq806x / base-files / etc / board.d / 02_network
1 #!/bin/sh
2 #
3 # Copyright (c) 2015 The Linux Foundation. All rights reserved.
4 # Copyright (c) 2011-2015 OpenWrt.org
5 #
6
7 . /lib/functions/uci-defaults.sh
8 . /lib/ipq806x.sh
9 . /lib/functions/system.sh
10
11 board_config_update
12
13 board=$(ipq806x_board_name)
14
15 case "$board" in
16 ap148 |\
17 d7800 |\
18 r7500 |\
19 r7500v2 |\
20 r7800 |\
21 vr2600v)
22 ucidef_add_switch "switch0" \
23 "1:lan" "2:lan" "3:lan" "4:lan" "6@eth1" "5:wan" "0@eth0"
24 ;;
25 c2600)
26 ucidef_add_switch "switch0" \
27 "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "6@eth1" "5:wan" "0@eth0"
28 ;;
29 db149)
30 ucidef_set_interface_lan "eth1 eth2 eth3"
31 ucidef_add_switch "switch0" \
32 "1:lan" "2:lan" "3:lan" "4:lan" "6@eth1" "5:wan" "0@eth0"
33 ;;
34 ea8500)
35
36 hw_mac_addr=$(mtd_get_mac_ascii devinfo hw_mac_addr)
37 ucidef_add_switch "switch0" \
38 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan"
39 ucidef_set_interface_macaddr "lan" "$hw_mac_addr"
40 ucidef_set_interface_macaddr "wan" "$hw_mac_addr"
41 ;;
42 nbg6817)
43 hw_mac_addr=$(mtd_get_mac_ascii 0:APPSBLENV ethaddr)
44 ucidef_add_switch "switch0" \
45 "1:lan" "2:lan" "3:lan" "4:lan" "6@eth1" "5:wan" "0@eth0"
46 ucidef_set_interface_macaddr "lan" "$hw_mac_addr"
47 ucidef_set_interface_macaddr "wan" "$(macaddr_add $hw_mac_addr 1)"
48 ;;
49 *)
50 echo "Unsupported hardware. Network interfaces not intialized"
51 ;;
52 esac
53
54 board_config_flush
55
56 exit 0