df38694f40ca00da931df3b2481888362238b251
[openwrt/openwrt.git] / target / linux / kirkwood / base-files / etc / board.d / 02_network
1 #
2 # Copyright (C) 2012-2015 OpenWrt.org
3 #
4
5 . /lib/functions/uci-defaults.sh
6 . /lib/functions/system.sh
7
8 kirkwood_setup_interfaces()
9 {
10 local board="$1"
11
12 case "$board" in
13 checkpoint,l-50)
14 ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4 lan5 lan6 lan7 lan8 dmz" "eth0"
15 ;;
16 cisco,on100)
17 ucidef_set_interface_lan "eth0 eth1"
18 ;;
19 cloudengines,pogoe02|\
20 cloudengines,pogoplugv4|\
21 ctera,c200-v1|\
22 globalscale,sheevaplug|\
23 iom,iconnect-1.1|\
24 iom,ix2-200|\
25 iptime,nas1|\
26 netgear,readynas-duo-v2|\
27 raidsonic,ib-nas62x0|\
28 seagate,blackarmor-nas220|\
29 seagate,dockstar|\
30 seagate,goflexhome|\
31 seagate,goflexnet|\
32 zyxel,nsa310b|\
33 zyxel,nsa310s|\
34 zyxel,nsa325)
35 ucidef_set_interface_lan "eth0" "dhcp"
36 ;;
37 endian,4i-edge-200)
38 ucidef_set_interface_lan "port1 port2 port3 port4 eth1"
39 ;;
40 linksys,e4200-v2|\
41 linksys,ea3500|\
42 linksys,ea4500)
43 ucidef_set_interfaces_lan_wan "ethernet1 ethernet2 ethernet3 ethernet4" "internet"
44 ;;
45 *)
46 ucidef_set_interface_lan "eth0"
47 ;;
48 esac
49 }
50
51 kirkwood_setup_macs()
52 {
53 local board="$1"
54 local lan_mac=""
55 local wan_mac=""
56 local label_mac=""
57
58 case "$board" in
59 iptime,nas1)
60 lan_mac=$(mtd_get_mac_binary u-boot 0x3ffa8)
61 label_mac=$lan_mac
62 ;;
63 linksys,e4200-v2|\
64 linksys,ea3500|\
65 linksys,ea4500)
66 wan_mac=$(mtd_get_mac_ascii u_env eth1addr)
67 ;;
68 zyxel,nsa310b|\
69 zyxel,nsa325)
70 lan_mac=$(mtd_get_mac_ascii uboot_env ethaddr)
71 ;;
72 esac
73
74 [ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" $lan_mac
75 [ -n "$wan_mac" ] && ucidef_set_interface_macaddr "wan" $wan_mac
76 [ -n "$label_mac" ] && ucidef_set_label_macaddr $label_mac
77 }
78
79 board_config_update
80 board=$(board_name)
81 kirkwood_setup_interfaces $board
82 kirkwood_setup_macs $board
83 board_config_flush
84
85 exit 0