add Ralink V11ST-FE board support
[openwrt/openwrt.git] / target / linux / ramips / base-files / etc / uci-defaults / network
1 #!/bin/sh
2
3 . /etc/functions.sh
4 . /lib/ramips.sh
5 . /lib/functions/uci-defaults.sh
6
7 if [ ! -x /usr/sbin/maccalc ]; then
8 echo "$0: maccalc not found!"
9 return
10 fi
11
12 ramips_setup_interfaces()
13 {
14 local board="$1"
15
16 ucidef_set_interface_loopback
17
18 case $board in
19 all0256n)
20 ucidef_set_interface_lan "eth0.1"
21 ;;
22
23 argus-atp52b | \
24 b2c | \
25 nw718 | \
26 w502u | \
27 wr6202)
28 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
29 ;;
30
31 f5d8235-v1 | \
32 rt-n15)
33 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
34 ucidef_add_switch "rtl8366s" "1" "1"
35 ucidef_add_switch_vlan "rtl8366s" "1" "1 2 3 4 5t"
36 ucidef_add_switch_vlan "rtl8366s" "2" "0 5t"
37 ;;
38
39 f5d8235-v2)
40 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
41 ucidef_add_switch "rtl8366rb" "1" "1"
42 ucidef_add_switch_vlan "rtl8366rb" "1" "1 2 3 4 5t"
43 ucidef_add_switch_vlan "rtl8366rb" "2" "0 5t"
44 ;;
45
46 rt-n56u)
47 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
48 ucidef_add_switch "switch0" "1" "1"
49 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 8t"
50 ucidef_add_switch_vlan "switch0" "2" "4 8t"
51 ;;
52
53 v11st-fe)
54 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
55 ucidef_add_switch "switch0" "1" "1"
56 ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 5t"
57 ucidef_add_switch_vlan "switch0" "2" "0 5t"
58 ;;
59
60 wcr-150gn)
61 ucidef_set_interface_lan_wan "eth0.2" "eth0.1"
62 ;;
63
64 wl-351)
65 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
66 ucidef_add_switch "rtl8366rb" "1" "1"
67 ucidef_add_switch_vlan "rtl8366rb" "1" "0 1 2 3 5t"
68 ucidef_add_switch_vlan "rtl8366rb" "2" "4 5t"
69 ;;
70
71 wli-tx4-ag300n)
72 ucidef_set_interface_lan "eth0"
73 ;;
74
75 *)
76 RT3X5X=`cat /proc/cpuinfo | grep RT3.5`
77 if [ -n "${RT3X5X}" ]; then
78 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
79 else
80 ucidef_set_interfaces_lan_wan "eth0" "eth1"
81 fi
82 ;;
83 esac
84 }
85
86 ramips_setup_macs()
87 {
88 local board="$1"
89 local lan_mac=""
90 local wan_mac=""
91
92 case $board in
93 all0256n)
94 lan_mac=$(ramips_get_mac_binary factory 40)
95 ;;
96
97 argus-atp52b | \
98 b2c | \
99 f5d8235-v1 | \
100 nw718 | \
101 rt-n15 | \
102 wl-351)
103 lan_mac=$(ramips_get_mac_binary factory 4)
104 wan_mac=$(/usr/sbin/maccalc add "$lan_mac" 1)
105 ;;
106
107 dir-300-b1 |\
108 dir-300-b2 |\
109 dir-600-b1)
110 lan_mac=$(ramips_get_mac_binary devdata 16388)
111 wan_mac=$(/usr/sbin/maccalc add "$lan_mac" 1)
112 ;;
113
114 esr-9753 | \
115 nbg-419n | \
116 wcr-150gn)
117 lan_mac=$(ramips_get_mac_binary factory 4)
118 wan_mac=$(ramips_get_mac_binary factory 40)
119 ;;
120
121 f5d8235-v2)
122 lan_mac=$(ramips_get_mac_binary "u-boot" 262148)
123 wan_mac=$(/usr/sbin/maccalc add "$lan_mac" 1)
124 ;;
125
126 rt-n56u)
127 lan_mac=$(ramips_get_mac_binary factory 4)
128 wan_mac=$(ramips_get_mac_binary factory 32772)
129 ;;
130
131 w502u)
132 lan_mac=$(ramips_get_mac_binary factory 40)
133 wan_mac=$(ramips_get_mac_binary factory 46)
134 ;;
135
136 wl341v3)
137 lan_mac=$(ramips_get_mac_binary board-nvram 65440)
138 wan_mac=$(/usr/sbin/maccalc add "$lan_mac" 1)
139 ;;
140
141 wli-tx4-ag300n)
142 lan_mac=$(ramips_get_mac_binary factory 4)
143 ;;
144
145 esac
146
147 [ -n "$lan_mac" ] && ucidef_set_interface_macaddr lan $lan_mac
148 [ -n "$wan_mac" ] && ucidef_set_interface_macaddr wan $wan_mac
149 }
150
151 [ -e /etc/config/network ] && exit 0
152
153 touch /etc/config/network
154
155 board=$(ramips_board_name)
156
157 ramips_setup_interfaces $board
158 ramips_setup_macs $board
159
160 uci commit network
161
162 exit 0