ramips: fix Belkin F5D8235-v2 VLAN setup
[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 wcr-150gn)
47 ucidef_set_interface_lan_wan "eth0.2" "eth0.1"
48 ;;
49
50 wl-351)
51 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
52 ucidef_add_switch "rtl8366rb" "1" "1"
53 ucidef_add_switch_vlan "rtl8366rb" "1" "0 1 2 3 5t"
54 ucidef_add_switch_vlan "rtl8366rb" "2" "4 5t"
55 ;;
56
57 wli-tx4-ag300n)
58 ucidef_set_interface_lan "eth0"
59 ;;
60
61 *)
62 RT3X5X=`cat /proc/cpuinfo | grep RT3.5`
63 if [ -n "${RT3X5X}" ]; then
64 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
65 else
66 ucidef_set_interfaces_lan_wan "eth0" "eth1"
67 fi
68 ;;
69 esac
70 }
71
72 ramips_setup_macs()
73 {
74 local board="$1"
75 local lan_mac=""
76 local wan_mac=""
77
78 case $board in
79 all0256n)
80 lan_mac=$(ramips_get_mac_binary factory 40)
81 ;;
82
83 argus-atp52b | \
84 b2c | \
85 f5d8235-v1 | \
86 nw718 | \
87 rt-n15 | \
88 wl-351)
89 lan_mac=$(ramips_get_mac_binary factory 4)
90 wan_mac=$(/usr/sbin/maccalc add "$lan_mac" 1)
91 ;;
92
93 dir-300-b1 |\
94 dir-300-b2 |\
95 dir-600-b1)
96 lan_mac=$(ramips_get_mac_binary devdata 16388)
97 wan_mac=$(/usr/sbin/maccalc add "$lan_mac" 1)
98 ;;
99
100 esr-9753 | \
101 nbg-419n | \
102 wcr-150gn)
103 lan_mac=$(ramips_get_mac_binary factory 4)
104 wan_mac=$(ramips_get_mac_binary factory 40)
105 ;;
106
107 f5d8235-v2)
108 lan_mac=$(ramips_get_mac_binary "u-boot" 262148)
109 wan_mac=$(/usr/sbin/maccalc add "$lan_mac" 1)
110 ;;
111
112 w502u)
113 lan_mac=$(ramips_get_mac_binary factory 40)
114 wan_mac=$(ramips_get_mac_binary factory 46)
115 ;;
116
117 wl341v3)
118 lan_mac=$(ramips_get_mac_binary board-nvram 65440)
119 wan_mac=$(/usr/sbin/maccalc add "$lan_mac" 1)
120 ;;
121
122 wli-tx4-ag300n)
123 lan_mac=$(ramips_get_mac_binary factory 4)
124 ;;
125
126 esac
127
128 [ -n "$lan_mac" ] && ucidef_set_interface_macaddr lan $lan_mac
129 [ -n "$wan_mac" ] && ucidef_set_interface_macaddr wan $wan_mac
130 }
131
132 [ -e /etc/config/network ] && exit 0
133
134 touch /etc/config/network
135
136 board=$(ramips_board_name)
137
138 ramips_setup_interfaces $board
139 ramips_setup_macs $board
140
141 uci commit network
142
143 exit 0
This page took 0.049598 seconds and 5 git commands to generate.