6 if [ ! -x /usr
/sbin
/maccalc
]; then
7 echo "$0: maccalc not found!"
14 set network.lan.ifname=eth0.1
15 set network.wan=interface
16 set network.wan.ifname=eth0.2
17 set network.wan.proto=dhcp
28 part
=$
(find_mtd_part
"$mtdname")
29 if [ -z "$part" ]; then
30 echo "get_mac_binary: partition $mtdname not found!" >&2
34 dd bs
=1 skip
=$seek count
=6 if=$part 2>/dev
/null |
/usr
/sbin
/maccalc bin2mac
44 part
=$
(find_mtd_part
"$mtdname")
45 if [ -z "$part" ]; then
46 echo "get_mac_nvram: partition $mtdname not found!" >&2
50 mac_dirty
=$
(strings "$part" |
sed -n 's/'"$key"'=//p')
52 maccalc add
"$mac_dirty" 0
60 echo "Setting LAN mac address to: $lan_mac" >&2
61 echo "Setting WAN mac address to: $wan_mac" >&2
64 set network.lan.macaddr='$lan_mac'
65 set network.wan.macaddr='$wan_mac'
75 wan_mac
=$
(/usr
/sbin
/maccalc add
"$lan_mac" 1)
77 set_macs
"$lan_mac" "$wan_mac"
80 set_macs_only_lan_from_mtd
()
86 lan_mac
=$
(get_mac_binary
"$mtdname" "$seek")
87 if [ -z $lan_mac ]; then
88 echo "set_macs_only_lan_from_mtd: can't extract mac address from $part" >&2
92 set_macs_only_lan
"$lan_mac"
95 set_macs_only_lan_from_nvram
()
101 lan_mac
=$
(get_mac_nvram
"$mtdname" "$key")
102 if [ -z $lan_mac ]; then
103 echo "set_macs_only_lan_from_nvram: can't extract mac address from $part" >&2
107 set_macs_only_lan
"$lan_mac"
110 ramips_setup_interfaces
()
123 RT3X5X
=`cat /proc/cpuinfo | grep RT3.5`
124 [ -z "${RT3X5X}" ] || create_lan_wan
135 set_macs_only_lan_from_mtd
"u-boot" 262148
141 set_macs_only_lan_from_mtd
"factory" 4
146 board
=$
(ramips_board_name
)
148 ramips_setup_interfaces
$board
149 ramips_setup_macs
$board