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