treewide: use the generic board_name function
[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 ap148 |\
16 c2600 |\
17 d7800 |\
18 r7500 |\
19 r7500v2 |\
20 r7800 |\
21 vr2600v)
22 ucidef_add_switch "switch0" \
23 "1:lan" "2:lan" "3:lan" "4:lan" "6@eth1" "5:wan" "0@eth0"
24 ;;
25 db149)
26 ucidef_set_interface_lan "eth1 eth2 eth3"
27 ucidef_add_switch "switch0" \
28 "1:lan" "2:lan" "3:lan" "4:lan" "6u@eth1" "5:wan" "0u@eth0"
29 ;;
30 ea8500)
31
32 hw_mac_addr=$(mtd_get_mac_ascii devinfo hw_mac_addr)
33 ucidef_add_switch "switch0" \
34 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan"
35 ucidef_set_interface_macaddr "lan" "$hw_mac_addr"
36 ucidef_set_interface_macaddr "wan" "$hw_mac_addr"
37 ;;
38 fritz4040)
39 ucidef_set_interfaces_lan_wan "eth0" "eth1"
40 ucidef_add_switch "switch0" \
41 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan"
42 ;;
43 nbg6817)
44 hw_mac_addr=$(mtd_get_mac_ascii 0:APPSBLENV ethaddr)
45 ucidef_add_switch "switch0" \
46 "1:lan" "2:lan" "3:lan" "4:lan" "6@eth1" "5:wan" "0@eth0"
47 ucidef_set_interface_macaddr "lan" "$hw_mac_addr"
48 ucidef_set_interface_macaddr "wan" "$(macaddr_add $hw_mac_addr 1)"
49 ;;
50 *)
51 echo "Unsupported hardware. Network interfaces not intialized"
52 ;;
53 esac
54
55 board_config_flush
56
57 exit 0