2 # Copyright (C) 2006 OpenWrt.org
10 echo "0 1 2 3 4 5u*" > /proc
/switch
/eth
0/vlan
/0/ports
13 [ -x "/usr/sbin/nvram" ] && {
14 [ "$(nvram get boot_wait)" != "on" ] && {
15 nvram
set boot_wait
=on
20 netmsg
192.168.1.255 "Entering Failsafe!"
21 telnetd
-l /bin
/login
<> /dev
/null
2>&1
24 lock
-u /tmp
/.failsafe
27 export PATH
=/bin
:/sbin
:/usr
/bin
:/usr
/sbin
28 mount none
/proc
-t proc
29 size
=$
(awk '/Mem:/ {l=5242880;print((s=$2/2)<l)?$2-l:s}' /proc
/meminfo
)
30 mount none
/tmp
-t tmpfs
-o size
=$size
34 trap 'FAILSAFE=true' USR1
35 echo '/sbin/hotplug.failsafe' > /proc
/sys
/kernel
/hotplug
39 # hardware specific overrides
40 case "$(cat /proc/diag/model)" in
41 "Linksys WAP54G V1") ifname
=eth1
;;
42 "ASUS WL-HDD") ifname
=eth1
;;
43 "ASUS WL-300g") ifname
=eth1
;;
44 "ASUS (unknown, BCM4702)") ifname
=eth1
;;
48 insmod switch-robo || insmod switch-adm || rmmod switch-core
50 ifconfig
$ifname 192.168.1.1 netmask
255.255.255.0 broadcast
192.168.1.255 up
52 [ -d /proc
/switch
/eth0
] && {
53 echo 1 > /proc
/switch
/eth
0/reset
55 # this would be easier if we blasted the message across all ports
56 # but we don't want packets leaking across interfaces
57 for port
in $
(seq 0 4); do {
58 echo "$port 5u*" > /proc
/switch
/eth
0/vlan
/0/ports
59 netmsg
192.168.1.255 "Press reset now, to enter Failsafe!"
61 } || netmsg
192.168.1.255 "Press reset now, to enter Failsafe!"
65 eval ${FAILSAFE:+failsafe}
67 lock
-w /tmp
/.failsafe
69 echo /sbin
/hotplug
> /proc
/sys
/kernel
/hotplug
71 ifconfig
$ifname 0.0.0.0 down