f38876b69f08df307e36d7853e97975f84b32e63
[openwrt/openwrt.git] / target / linux / ipq806x / base-files / etc / board.d / 02_network
1 #
2 # Copyright (c) 2015 The Linux Foundation. All rights reserved.
3 # Copyright (c) 2011-2015 OpenWrt.org
4 #
5
6 . /lib/functions/uci-defaults.sh
7 . /lib/functions/system.sh
8
9 board_config_update
10
11 board=$(board_name)
12
13 case "$board" in
14 arris,tr4400-v2)
15 ucidef_set_interfaces_lan_wan "eth1" "eth2"
16 ucidef_add_switch "switch0" \
17 "1:lan" "2:lan" "3:lan" "4:lan" "6u@eth1" "0u@eth0"
18 ;;
19 askey,rt4230w-rev6 |\
20 asrock,g10 |\
21 nec,wg2600hp)
22 ucidef_add_switch "switch0" \
23 "2:lan" "3:lan" "4:lan" "5:lan" "6@eth1" "1:wan" "0@eth0"
24 ;;
25 buffalo,wxr-2533dhp |\
26 compex,wpq864 |\
27 netgear,d7800 |\
28 netgear,r7500 |\
29 netgear,r7500v2 |\
30 qcom,ipq8064-ap148)
31 ucidef_add_switch "switch0" \
32 "1:lan" "2:lan" "3:lan" "4:lan" "6@eth1" "5:wan" "0@eth0"
33 ;;
34 edgecore,ecw5410)
35 ucidef_set_interfaces_lan_wan "eth1" "eth0"
36 ;;
37 linksys,ea7500-v1)
38 hw_mac_addr=$(mtd_get_mac_ascii devinfo hw_mac_addr)
39 ucidef_add_switch "switch0" \
40 "2:lan:1" "3:lan:2" "4:lan:3" "5:lan:4" "6@eth1" "1:wan" "0@eth0"
41 ucidef_set_interface_macaddr "lan" "$hw_mac_addr"
42 ucidef_set_interface_macaddr "wan" "$hw_mac_addr"
43 ;;
44 linksys,ea8500)
45 hw_mac_addr=$(mtd_get_mac_ascii devinfo hw_mac_addr)
46 ucidef_add_switch "switch0" \
47 "1:lan" "2:lan" "3:lan" "4:lan" "6@eth1" "5:wan" "0@eth0"
48 ucidef_set_interface_macaddr "lan" "$hw_mac_addr"
49 ucidef_set_interface_macaddr "wan" "$hw_mac_addr"
50 ;;
51 meraki,mr42)
52 ucidef_set_interface_lan "eth0"
53 ;;
54 meraki,mr52)
55 ucidef_set_interfaces_lan_wan "eth0" "eth1"
56 ;;
57 nec,wg2600hp3)
58 ucidef_add_switch "switch0" \
59 "2:lan" "3:lan" "4:lan" "5:lan" "0@eth1" "1:wan" "6@eth0"
60 ;;
61 netgear,r7800 |\
62 netgear,xr500 |\
63 tplink,c2600 |\
64 tplink,vr2600v)
65 ucidef_add_switch "switch0" \
66 "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "6@eth1" "5:wan" "0@eth0"
67 ;;
68 qcom,ipq8064-ap161)
69 ucidef_set_interface_lan "eth1 eth2"
70 ucidef_add_switch "switch0" \
71 "0:lan" "1:lan" "2:lan" "3u@eth1" "6:wan" "4u@eth0"
72 ;;
73 qcom,ipq8064-db149)
74 ucidef_set_interface_lan "eth1 eth2 eth3"
75 ucidef_add_switch "switch0" \
76 "1:lan" "2:lan" "3:lan" "4:lan" "6u@eth1" "5:wan" "0u@eth0"
77 ;;
78 tplink,ad7200)
79 ucidef_add_switch "switch0" \
80 "2:lan:1" "3:lan:2" "4:lan:3" "5:lan:4" "6@eth1" "1:wan" "0@eth0"
81 ;;
82 asus,onhub |\
83 tplink,onhub)
84 ucidef_set_interfaces_lan_wan "eth1" "eth0"
85 ucidef_add_switch "switch0" \
86 "1:lan" "6@eth1" "2:wan" "0@eth0"
87 ;;
88 ubnt,unifi-ac-hd)
89 ucidef_set_interface_lan "eth0 eth1"
90 ;;
91 zyxel,nbg6817)
92 hw_mac_addr=$(mtd_get_mac_ascii 0:appsblenv ethaddr)
93 ucidef_add_switch "switch0" \
94 "1:lan" "2:lan" "3:lan" "4:lan" "6@eth1" "5:wan" "0@eth0"
95 ucidef_set_interface_macaddr "lan" "$(macaddr_add $hw_mac_addr 2)"
96 ucidef_set_interface_macaddr "wan" "$(macaddr_add $hw_mac_addr 3)"
97 ;;
98 *)
99 echo "Unsupported hardware. Network interfaces not intialized"
100 ;;
101 esac
102
103 board_config_flush
104
105 exit 0