15f75df6a8108ab1789b124984dc53bb3167ea55
[openwrt/staging/stintel.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 iom,ix4-200d)
41 ucidef_set_interface_lan "eth0 eth1" "dhcp"
42 ;;
43 linksys,e4200-v2|\
44 linksys,ea3500|\
45 linksys,ea4500)
46 ucidef_set_interfaces_lan_wan "ethernet1 ethernet2 ethernet3 ethernet4" "internet"
47 ;;
48 *)
49 ucidef_set_interface_lan "eth0"
50 ;;
51 esac
52 }
53
54 kirkwood_setup_macs()
55 {
56 local board="$1"
57 local lan_mac=""
58 local wan_mac=""
59 local label_mac=""
60
61 case "$board" in
62 iptime,nas1)
63 lan_mac=$(mtd_get_mac_binary u-boot 0x3ffa8)
64 label_mac=$lan_mac
65 ;;
66 linksys,e4200-v2|\
67 linksys,ea3500|\
68 linksys,ea4500)
69 wan_mac=$(mtd_get_mac_ascii u_env eth1addr)
70 ;;
71 zyxel,nsa310b|\
72 zyxel,nsa325)
73 lan_mac=$(mtd_get_mac_ascii uboot_env ethaddr)
74 ;;
75 esac
76
77 [ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" $lan_mac
78 [ -n "$wan_mac" ] && ucidef_set_interface_macaddr "wan" $wan_mac
79 [ -n "$label_mac" ] && ucidef_set_label_macaddr $label_mac
80 }
81
82 board_config_update
83 board=$(board_name)
84 kirkwood_setup_interfaces $board
85 kirkwood_setup_macs $board
86 board_config_flush
87
88 exit 0