e279cdd8f6bf4f17e4ff7bdb918966e09fac7fe8
[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/functions/system.sh
9
10 board_config_update
11
12 board=$(board_name)
13
14 case "$board" in
15 linksys,ea8500)
16 hw_mac_addr=$(mtd_get_mac_ascii devinfo hw_mac_addr)
17 ucidef_add_switch "switch0" \
18 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan"
19 ucidef_set_interface_macaddr "lan" "$hw_mac_addr"
20 ucidef_set_interface_macaddr "wan" "$hw_mac_addr"
21 ;;
22 netgear,d7800 |\
23 netgear,r7500 |\
24 netgear,r7500v2 |\
25 netgear,r7800 |\
26 qcom,ipq8064-ap148 |\
27 tplink,vr2600v)
28 ucidef_add_switch "switch0" \
29 "1:lan" "2:lan" "3:lan" "4:lan" "6@eth1" "5:wan" "0@eth0"
30 ;;
31 qcom,ipq8064-db149)
32 ucidef_set_interface_lan "eth1 eth2 eth3"
33 ucidef_add_switch "switch0" \
34 "1:lan" "2:lan" "3:lan" "4:lan" "6u@eth1" "5:wan" "0u@eth0"
35 ;;
36 tplink,c2600)
37 ucidef_add_switch "switch0" \
38 "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "6@eth1" "5:wan" "0@eth0"
39 ;;
40 zyxel,nbg6817)
41 hw_mac_addr=$(mtd_get_mac_ascii 0:APPSBLENV ethaddr)
42 ucidef_add_switch "switch0" \
43 "1:lan" "2:lan" "3:lan" "4:lan" "6@eth1" "5:wan" "0@eth0"
44 ucidef_set_interface_macaddr "lan" "$(macaddr_add $hw_mac_addr 2)"
45 ucidef_set_interface_macaddr "wan" "$(macaddr_add $hw_mac_addr 3)"
46 ;;
47 *)
48 echo "Unsupported hardware. Network interfaces not intialized"
49 ;;
50 esac
51
52 board_config_flush
53
54 exit 0