a3aa0fce7071f6b9ce14f457d922b67080b88eb6
[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 buffalo,wxr-2533dhp |\
16 compex,wpq864 |\
17 netgear,d7800 |\
18 netgear,r7500 |\
19 netgear,r7500v2 |\
20 qcom,ipq8064-ap148 |\
21 tplink,vr2600v)
22 ucidef_add_switch "switch0" \
23 "1:lan" "2:lan" "3:lan" "4:lan" "6@eth1" "5:wan" "0@eth0"
24 ;;
25 qcom,ipq8064-ap161)
26 ucidef_set_interface_lan "eth1 eth2"
27 ucidef_add_switch "switch0" \
28 "0:lan" "1:lan" "2:lan" "3u@eth1" "6:wan" "4u@eth0"
29 ;;
30 linksys,ea8500)
31 hw_mac_addr=$(mtd_get_mac_ascii devinfo hw_mac_addr)
32 ucidef_add_switch "switch0" \
33 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan"
34 ucidef_set_interface_macaddr "lan" "$hw_mac_addr"
35 ucidef_set_interface_macaddr "wan" "$hw_mac_addr"
36 ;;
37 nec,wg2600hp)
38 ucidef_add_switch "switch0" \
39 "2:lan" "3:lan" "4:lan" "5:lan" "6@eth1" "1:wan" "0@eth0"
40 ;;
41 netgear,r7800 |\
42 tplink,c2600)
43 ucidef_add_switch "switch0" \
44 "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "6@eth1" "5:wan" "0@eth0"
45 ;;
46 qcom,ipq8064-db149)
47 ucidef_set_interface_lan "eth1 eth2 eth3"
48 ucidef_add_switch "switch0" \
49 "1:lan" "2:lan" "3:lan" "4:lan" "6u@eth1" "5:wan" "0u@eth0"
50 ;;
51 zyxel,nbg6817)
52 hw_mac_addr=$(mtd_get_mac_ascii 0:APPSBLENV ethaddr)
53 ucidef_add_switch "switch0" \
54 "1:lan" "2:lan" "3:lan" "4:lan" "6@eth1" "5:wan" "0@eth0"
55 ucidef_set_interface_macaddr "lan" "$(macaddr_add $hw_mac_addr 2)"
56 ucidef_set_interface_macaddr "wan" "$(macaddr_add $hw_mac_addr 3)"
57 ;;
58 *)
59 echo "Unsupported hardware. Network interfaces not intialized"
60 ;;
61 esac
62
63 board_config_flush
64
65 exit 0