Remove TCP Vegas support (ARM7)
[tomato.git] / release / src-rt-6.x.4708 / router / others / ethstate
blob339c85c577558263668c04632c8cebc8065bba68
1 #!/bin/sh
3 if [ -f /tmp/ethernet.state1 ]; then
4 rm /tmp/ethernet.state1
5 fi
6 if [ -f /tmp/ethernet.state2 ]; then
7 rm /tmp/ethernet.state2
8 fi
9 if [ -f /tmp/ethernet.state3 ]; then
10 rm /tmp/ethernet.state3
13 # WANMAC=`nvram get wan_hwaddr` # wan mac addr
14 # VWAN=`ifconfig | grep vlan | grep "$WANMAC" | awk '{print $1}' | grep -v ":" | tail -1` # tail SORT/UNIQ
15 VWAN=`nvram get wan_ifname` # wan vlan from nvram, this fix bug on disabled WAN state and same LAN/WAN MAC
17 VPORT=`nvram get $VWAN'ports' | awk '{print $1}' | sed 's/[^0-9]*//g'`
18 if [ -z "$VPORT" ]; then
19 VPORT="0"
22 /usr/sbin/robocfg showports | grep Port | awk '{print $1" "$2" "$3}' > /tmp/ethernet.state.tmp
24 #Search WAN port
25 SWAN=`cat /tmp/ethernet.state.tmp | grep "Port $VPORT" | awk '{print $3}'`
26 echo "Port 0: $SWAN" > /tmp/ethernet.state
27 sed -n -e "/Port $VPORT:/!p" /tmp/ethernet.state.tmp > /tmp/ethernet.state1
29 MODEL=`nvram get model`
30 if [ "$MODEL" == "R1D" ]; then
31 sed -i '/Port 1/d' /tmp/ethernet.state1
32 sed -i '/Port 3/d' /tmp/ethernet.state1
35 sed -i '/Port 5/d' /tmp/ethernet.state1
36 sed -i '/Port 8/d' /tmp/ethernet.state1
38 NUM="1"
39 REVERT=`nvram get lan_invert`
40 if [ "$REVERT" == "1" ]; then
41 cat /tmp/ethernet.state1 | sort -r >> /tmp/ethernet.state2
42 exec 0< /tmp/ethernet.state2
43 while read line
44 test -n "$line"
46 STATE=`echo $line | awk '{print $3}'`
47 echo "Port $NUM: $STATE" >> /tmp/ethernet.state3
48 NUM=$((NUM+1))
49 done
51 else
52 exec 0< /tmp/ethernet.state1
53 while read line
54 test -n "$line"
56 STATE=`echo $line | awk '{print $3}'`
57 echo "Port $NUM: $STATE" >> /tmp/ethernet.state3
58 NUM=$((NUM+1))
59 done
62 cat /tmp/ethernet.state3 >> /tmp/ethernet.state
64 if [ -f /tmp/ethernet.state1 ]; then
65 rm /tmp/ethernet.state1
67 if [ -f /tmp/ethernet.state2 ]; then
68 rm /tmp/ethernet.state2
70 if [ -f /tmp/ethernet.state3 ]; then
71 rm /tmp/ethernet.state3