70812a1013c9c3b1e6e0706dfbb841c35546c661
[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,xr450 |\
63 netgear,xr500 |\
64 tplink,c2600 |\
65 tplink,vr2600v)
66 ucidef_add_switch "switch0" \
67 "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "6@eth1" "5:wan" "0@eth0"
68 ;;
69 qcom,ipq8064-ap161)
70 ucidef_set_interface_lan "eth1 eth2"
71 ucidef_add_switch "switch0" \
72 "0:lan" "1:lan" "2:lan" "3u@eth1" "6:wan" "4u@eth0"
73 ;;
74 qcom,ipq8064-db149)
75 ucidef_set_interface_lan "eth1 eth2 eth3"
76 ucidef_add_switch "switch0" \
77 "1:lan" "2:lan" "3:lan" "4:lan" "6u@eth1" "5:wan" "0u@eth0"
78 ;;
79 tplink,ad7200)
80 ucidef_add_switch "switch0" \
81 "2:lan:1" "3:lan:2" "4:lan:3" "5:lan:4" "6@eth1" "1:wan" "0@eth0"
82 ;;
83 asus,onhub |\
84 tplink,onhub)
85 ucidef_set_interfaces_lan_wan "eth1" "eth0"
86 ucidef_add_switch "switch0" \
87 "1:lan" "6@eth1" "2:wan" "0@eth0"
88 ;;
89 nokia,ac400i |\
90 ubnt,unifi-ac-hd)
91 ucidef_set_interface_lan "eth0 eth1"
92 ;;
93 zyxel,nbg6817)
94 hw_mac_addr=$(mtd_get_mac_ascii 0:appsblenv ethaddr)
95 ucidef_add_switch "switch0" \
96 "1:lan" "2:lan" "3:lan" "4:lan" "6@eth1" "5:wan" "0@eth0"
97 ucidef_set_interface_macaddr "lan" "$(macaddr_add $hw_mac_addr 2)"
98 ucidef_set_interface_macaddr "wan" "$(macaddr_add $hw_mac_addr 3)"
99 ;;
100 *)
101 echo "Unsupported hardware. Network interfaces not intialized"
102 ;;
103 esac
104
105 board_config_flush
106
107 exit 0