5 . /lib/functions/uci-defaults.sh
7 if [ ! -x /usr/sbin/maccalc ]; then
8 echo "$0: maccalc not found!"
12 ramips_setup_interfaces()
16 ucidef_set_interface_loopback
20 ucidef_set_interface_lan "eth0.1"
29 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
34 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
35 ucidef_add_switch "rtl8366s" "1" "1"
36 ucidef_add_switch_vlan "rtl8366s" "1" "1 2 3 4 5t"
37 ucidef_add_switch_vlan "rtl8366s" "2" "0 5t"
41 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
42 ucidef_add_switch "rtl8366rb" "1" "1"
43 ucidef_add_switch_vlan "rtl8366rb" "1" "1 2 3 4 5t"
44 ucidef_add_switch_vlan "rtl8366rb" "2" "0 5t"
48 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
49 ucidef_add_switch "switch0" "1" "1"
50 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 8t"
51 ucidef_add_switch_vlan "switch0" "2" "4 8t"
55 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
56 ucidef_add_switch "switch0" "1" "1"
57 ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 5t"
58 ucidef_add_switch_vlan "switch0" "2" "0 5t"
62 ucidef_set_interface_lan_wan "eth0.2" "eth0.1"
66 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
67 ucidef_add_switch "rtl8366rb" "1" "1"
68 ucidef_add_switch_vlan "rtl8366rb" "1" "0 1 2 3 5t"
69 ucidef_add_switch_vlan "rtl8366rb" "2" "4 5t"
73 ucidef_set_interface_lan "eth0"
77 RT3X5X=`cat /proc/cpuinfo | grep RT3.5`
78 if [ -n "${RT3X5X}" ]; then
79 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
81 ucidef_set_interfaces_lan_wan "eth0" "eth1"
95 lan_mac=$(ramips_get_mac_binary factory 40)
105 lan_mac=$(ramips_get_mac_binary factory 4)
106 wan_mac=$(/usr/sbin/maccalc add "$lan_mac" 1)
112 lan_mac=$(ramips_get_mac_binary devdata 16388)
113 wan_mac=$(/usr/sbin/maccalc add "$lan_mac" 1)
119 lan_mac=$(ramips_get_mac_binary factory 4)
120 wan_mac=$(ramips_get_mac_binary factory 40)
124 lan_mac=$(ramips_get_mac_binary "u-boot" 262148)
125 wan_mac=$(/usr/sbin/maccalc add "$lan_mac" 1)
129 lan_mac=$(ramips_get_mac_binary factory 4)
130 wan_mac=$(ramips_get_mac_binary factory 32772)
134 lan_mac=$(ramips_get_mac_binary factory 40)
135 wan_mac=$(ramips_get_mac_binary factory 46)
139 lan_mac=$(ramips_get_mac_binary board-nvram 65440)
140 wan_mac=$(/usr/sbin/maccalc add "$lan_mac" 1)
144 lan_mac=$(ramips_get_mac_binary factory 4)
149 [ -n "$lan_mac" ] && ucidef_set_interface_macaddr lan $lan_mac
150 [ -n "$wan_mac" ] && ucidef_set_interface_macaddr wan $wan_mac
153 [ -e /etc/config/network ] && exit 0
155 touch /etc/config/network
157 board=$(ramips_board_name)
159 ramips_setup_interfaces $board
160 ramips_setup_macs $board