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|\
36 ucidef_set_interface_lan "eth0"
39 ucidef_set_interfaces_lan_wan "eth0" "eth1"
40 ucidef_add_switch "switch0" \
41 "0u@eth0" "2:lan:1" "3:lan:2" "4:lan:3" "0u@eth1" "5:wan"
49 ucidef_set_interfaces_lan_wan "eth1" "eth0"
57 ucidef_set_interfaces_lan_wan "eth0" "eth1"
58 ucidef_add_switch "switch0" \
59 "0u@eth0" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1"
65 ucidef_set_interfaces_lan_wan "eth0" "eth1"
66 ucidef_add_switch "switch0" \
67 "0u@eth0" "1:lan" "2:lan" "3:lan" "4:lan"
70 ucidef_add_switch "switch0" \
71 "0u@eth0" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1"
73 avm,fritzrepeater-3000)
74 ucidef_add_switch "switch0" \
75 "0u@eth0" "4:lan:1" "5:lan:2"
80 ucidef_set_interface_lan "eth0 eth1"
83 ucidef_set_interfaces_lan_wan "eth0" "eth1"
84 ucidef_add_switch "switch0" \
85 "0u@eth0" "2:lan:3" "3:lan:2" "4:lan:1"
88 ucidef_set_interface_lan "eth0"
89 ucidef_add_switch "switch0" \
90 "0u@eth0" "3:lan" "4:lan"
92 devolo,magic-2-wifi-next)
93 ucidef_set_interface_lan "eth0 eth1 eth2"
95 ezviz,cs-w3-wd1200g-eup)
96 ucidef_set_interfaces_lan_wan "eth0" "eth1"
97 ucidef_add_switch "switch0" \
98 "0u@eth0" "2:lan:3" "3:lan:2" "4:lan:1" "0u@eth1" "5:wan"
103 ucidef_set_interfaces_lan_wan "eth0" "eth1"
104 ucidef_add_switch "switch0" \
105 "0u@eth0" "3:lan" "4:lan"
108 ucidef_add_switch "switch0" \
109 "0u@eth0" "3:lan:2" "4:lan:1"
110 ucidef_set_interface_wan "eth1"
116 ucidef_add_switch "switch0" \
117 "0u@eth0" "2:lan" "3:lan" "4:lan"
118 ucidef_set_interface_wan "eth1"
122 ucidef_set_interfaces_lan_wan "eth0" "eth1"
123 ucidef_add_switch "switch0" \
124 "0u@eth0" "3:lan" "4:lan" "0u@eth1" "5:wan"
127 ucidef_set_interfaces_lan_wan "eth0" "eth1"
128 ucidef_add_switch "switch0" \
129 "0u@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "0u@eth1" "5:wan"
132 echo "Unsupported hardware. Network interfaces not initialized"
146 label_mac=$(mtd_get_mac_binary "ART" 0x1006)
150 wan_mac=$(mtd_get_mac_binary_ubi Factory 0x1006)
151 lan_mac=$(mtd_get_mac_binary_ubi Factory 0x5006)
155 label_mac=$(mtd_get_mac_binary "ART" 0x1006)
157 devolo,magic-2-wifi-next)
158 lan_mac=$(mtd_get_mac_ascii APPSBLENV MacAddress0)
162 lan_mac=$(mtd_get_mac_ascii bdcfg lanmac)
167 lan_mac=$(mtd_get_mac_ascii 0:APPSBLENV ethaddr)
171 wan_mac=$(mtd_get_mac_ascii 0:APPSBLENV wanaddr)
172 lan_mac=$(mtd_get_mac_ascii 0:APPSBLENV ethaddr)
176 wan_mac=$(mtd_get_mac_ascii u-boot-env ethaddr)
177 lan_mac=$(macaddr_add "$wan_mac" 1)
179 ezviz,cs-w3-wd1200g-eup)
180 label_mac=$(mtd_get_mac_binary "ART" 0x6)
183 wan_mac=$(mtd_get_mac_ascii devinfo hw_mac_addr)
184 lan_mac=$(macaddr_add "$wan_mac" 1)
188 wan_mac=$(cat /sys/firmware/mikrotik/hard_config/mac_base)
189 lan_mac=$(macaddr_add $wan_mac 1)
193 lan_mac=$(cat /sys/firmware/mikrotik/hard_config/mac_base)
198 [ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" $lan_mac
199 [ -n "$wan_mac" ] && ucidef_set_interface_macaddr "wan" $wan_mac
200 [ -n "$label_mac" ] && ucidef_set_label_macaddr $label_mac
205 ipq40xx_setup_interfaces $board
206 ipq40xx_setup_macs $board