2 # Copyright (c) 2015 The Linux Foundation. All rights reserved.
3 # Copyright (c) 2011-2015 OpenWrt.org
6 . /lib/functions/uci-defaults.sh
7 . /lib/functions/system.sh
9 ipq40xx_setup_interfaces()
16 alfa-network,ap120c-ac|\
23 ucidef_set_interfaces_lan_wan "eth0" "eth1"
27 avm,fritzrepeater-1200|\
37 ucidef_set_interface_lan "eth0"
41 ucidef_set_interfaces_lan_wan "eth0" "eth1"
42 ucidef_add_switch "switch0" \
43 "0u@eth0" "2:lan:1" "3:lan:2" "4:lan:3" "0u@eth1" "5:wan"
51 ucidef_set_interfaces_lan_wan "eth1" "eth0"
59 ucidef_set_interfaces_lan_wan "eth0" "eth1"
60 ucidef_add_switch "switch0" \
61 "0u@eth0" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1"
67 ucidef_set_interfaces_lan_wan "eth0" "eth1"
68 ucidef_add_switch "switch0" \
69 "0u@eth0" "1:lan" "2:lan" "3:lan" "4:lan"
72 ucidef_add_switch "switch0" \
73 "0u@eth0" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1"
75 avm,fritzrepeater-3000)
76 ucidef_add_switch "switch0" \
77 "0u@eth0" "4:lan:1" "5:lan:2"
82 ucidef_set_interface_lan "eth0 eth1"
85 ucidef_set_interfaces_lan_wan "eth0" "eth1"
86 ucidef_add_switch "switch0" \
87 "0u@eth0" "2:lan:3" "3:lan:2" "4:lan:1"
90 ucidef_set_interface_lan "eth0"
91 ucidef_add_switch "switch0" \
92 "0u@eth0" "3:lan" "4:lan"
94 devolo,magic-2-wifi-next)
95 ucidef_set_interface_lan "eth0 eth1 eth2"
97 ezviz,cs-w3-wd1200g-eup)
98 ucidef_set_interfaces_lan_wan "eth0" "eth1"
99 ucidef_add_switch "switch0" \
100 "0u@eth0" "2:lan:3" "3:lan:2" "4:lan:1" "0u@eth1" "5:wan"
105 ucidef_set_interfaces_lan_wan "eth0" "eth1"
106 ucidef_add_switch "switch0" \
107 "0u@eth0" "3:lan" "4:lan"
110 ucidef_add_switch "switch0" \
111 "0u@eth0" "3:lan:2" "4:lan:1"
112 ucidef_set_interface_wan "eth1"
118 ucidef_add_switch "switch0" \
119 "0u@eth0" "2:lan" "3:lan" "4:lan"
120 ucidef_set_interface_wan "eth1"
124 ucidef_set_interfaces_lan_wan "eth0" "eth1"
125 ucidef_add_switch "switch0" \
126 "0u@eth0" "3:lan" "4:lan" "0u@eth1" "5:wan"
129 ucidef_set_interfaces_lan_wan "eth0" "eth1"
130 ucidef_add_switch "switch0" \
131 "0u@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "0u@eth1" "5:wan"
134 echo "Unsupported hardware. Network interfaces not initialized"
148 label_mac=$(mtd_get_mac_binary "ART" 0x1006)
152 wan_mac=$(mtd_get_mac_binary_ubi Factory 0x1006)
153 lan_mac=$(mtd_get_mac_binary_ubi Factory 0x5006)
157 label_mac=$(mtd_get_mac_binary "ART" 0x1006)
159 devolo,magic-2-wifi-next)
160 lan_mac=$(mtd_get_mac_ascii APPSBLENV MacAddress0)
164 lan_mac=$(mtd_get_mac_ascii bdcfg lanmac)
169 lan_mac=$(mtd_get_mac_ascii 0:APPSBLENV ethaddr)
173 wan_mac=$(mtd_get_mac_ascii 0:APPSBLENV wanaddr)
174 lan_mac=$(mtd_get_mac_ascii 0:APPSBLENV ethaddr)
178 wan_mac=$(mtd_get_mac_ascii u-boot-env ethaddr)
179 lan_mac=$(macaddr_add "$wan_mac" 1)
181 ezviz,cs-w3-wd1200g-eup)
182 label_mac=$(mtd_get_mac_binary "ART" 0x6)
185 wan_mac=$(mtd_get_mac_ascii devinfo hw_mac_addr)
186 lan_mac=$(macaddr_add "$wan_mac" 1)
190 wan_mac=$(cat /sys/firmware/mikrotik/hard_config/mac_base)
191 lan_mac=$(macaddr_add $wan_mac 1)
196 lan_mac=$(cat /sys/firmware/mikrotik/hard_config/mac_base)
201 [ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" $lan_mac
202 [ -n "$wan_mac" ] && ucidef_set_interface_macaddr "wan" $wan_mac
203 [ -n "$label_mac" ] && ucidef_set_label_macaddr $label_mac
208 ipq40xx_setup_interfaces $board
209 ipq40xx_setup_macs $board