netifd: update to Git HEAD (2024-09-03)
[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 dlink,dns320l|\
23 globalscale,sheevaplug|\
24 iom,iconnect-1.1|\
25 iom,ix2-200|\
26 iptime,nas1|\
27 netgear,readynas-duo-v2|\
28 netgear,stora|\
29 raidsonic,ib-nas62x0|\
30 seagate,blackarmor-nas220|\
31 seagate,dockstar|\
32 seagate,goflexhome|\
33 seagate,goflexnet|\
34 zyxel,nsa310b|\
35 zyxel,nsa310s|\
36 zyxel,nsa325)
37 ucidef_set_interface_lan "eth0" "dhcp"
38 ;;
39 endian,4i-edge-200)
40 ucidef_set_interface_lan "port1 port2 port3 port4 eth1"
41 ;;
42 iom,ix4-200d)
43 ucidef_set_interface_lan "eth0 eth1" "dhcp"
44 ;;
45 linksys,e4200-v2|\
46 linksys,ea3500|\
47 linksys,ea4500)
48 ucidef_set_interfaces_lan_wan "ethernet1 ethernet2 ethernet3 ethernet4" "internet"
49 ;;
50 *)
51 ucidef_set_interface_lan "eth0"
52 ;;
53 esac
54 }
55
56 kirkwood_setup_macs()
57 {
58 local board="$1"
59 local lan_mac=""
60 local wan_mac=""
61 local label_mac=""
62
63 case "$board" in
64 dlink,dns320l)
65 lan_mac=$(mtd_get_mac_text "mini firmware")
66 ;;
67 iptime,nas1)
68 lan_mac=$(mtd_get_mac_binary u-boot 0x3ffa8)
69 label_mac=$lan_mac
70 ;;
71 linksys,e4200-v2|\
72 linksys,ea3500|\
73 linksys,ea4500)
74 wan_mac=$(mtd_get_mac_ascii u_env eth1addr)
75 ;;
76 zyxel,nsa310b|\
77 zyxel,nsa325)
78 lan_mac=$(mtd_get_mac_ascii uboot_env ethaddr)
79 ;;
80 esac
81
82 [ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" $lan_mac
83 [ -n "$wan_mac" ] && ucidef_set_interface_macaddr "wan" $wan_mac
84 [ -n "$label_mac" ] && ucidef_set_label_macaddr $label_mac
85 }
86
87 board_config_update
88 board=$(board_name)
89 kirkwood_setup_interfaces $board
90 kirkwood_setup_macs $board
91 board_config_flush
92
93 exit 0