#!/bin/sh export DATE="12.2.2006";SCRIPT=${0#/rom} export TITLE="Status: OLSR" . ${SCRIPT%/*}/cgi-bin-pre.sh WLDEV=$(awk 'sub(":","") {print $1}' /proc/net/wireless) ff_httpinfo=$(nvram get ff_httpinfo) if [ "$REQUEST_METHOD" = "POST" ]; then read QUERY_STRING fi if [ -n "$QUERY_STRING" ]; then eval $(echo "$QUERY_STRING"|awk -F'&' '{for(i=1;i<=NF;i++){print $i}}') fi if [ -n "$post_olsr" ]; then cat<Status: OLSR
    EOF if [ "$(nvram get wl0_mode)" != "ap" ];then cat< EOF fi if [ "$ff_httpinfo" != "0" ];then cat< EOF fi cat<
 
EOF wget -O - http://127.0.0.1:8080/all|awk ' /

/, /<\/div>/ { gsub("border=0", "border=1 cellspacing=0 cellpadding=0") gsub("BORDER=0", "BORDER=1") gsub("

EOF elif [ -n "$post_route" ]; then cat<Status: Routes
" } function ip(s) { if(!/\//&&s!="default") { td(sprintf("%s", s, s)) } else { td(s) } } BEGIN { print "<""TABLE BORDER=\"0\" CELLPADDING=\"0\" CELLSPACING=\"0\">" } { print "" ip($1) s="" for(i=2;i<=NF;i++) s=s" "$i td(s) print "" } END { print "<""/TABLE>" }' cat<
    EOF if [ "$(nvram get wl0_mode)" != "ap" ];then cat< EOF fi if [ "$ff_httpinfo" != "0" ];then cat< EOF fi cat<
 
EOF ip route ls|awk ' function td(s) { print ""s"
EOF elif [ -n "$post_scan" ]; then cat<Status: WLAN Scan
"; } /^SSID:/ { ssid=substr($2, 2, length($2) - 2); chan=" "; adhoc="no"; open="yes"; rssi="0"; titl=" "; rate=" "; bssid=" "; do { if(!(getline))break; if (/Channel:/) { chan=$NF; } if (/Mode:/) { adhoc=($2~/Managed/?"no":"yes"); } if (/RSSI:/) { rssi=int(($(4+($3~/Hoc/))-$(7+($3~/Hoc/)))/4); for(i=3; i<=8; i++) { titl=titl$(i+($3~/Hoc/))" "; } if (0 > rssi) rssi = 0; if (5 < rssi) rssi = 5; } if (/Capability:/) { for(i = 4; i <= NF; i++) { if ($i~/^WEP/) open="no"; } } if (/Supported Rates:/) { rate=$(NF - 1); } if (/BSSID:/) { bssid=$2; } } while(/\S/); print "" print "" print "" print "" print "" print "" print "" print "" print ""; } END { print "
    EOF if [ "$(nvram get wl0_mode)" != "ap" ];then cat< EOF fi if [ "$ff_httpinfo" != "0" ];then cat< EOF fi cat<
 
SSIDChannel Ad-HocOpenSignalMax.BSSID
EOF wl -i $WLDEV scan sleep 2 wl -i $WLDEV scanresults|awk ' BEGIN { print "
"ssid""chan"\""adhoc"\"\""open"\""rate""bssid"
 " }' cat<
EOF else cat<Status: Overview
[^>]+", "") sub("
    EOF if [ "$(nvram get wl0_mode)" != "ap" ];then cat< EOF fi if [ "$ff_httpinfo" != "0" ];then cat< EOF fi WLMASK=$(ip -f inet addr show $WLDEV label $WLDEV |awk 'sub("inet","") {print $1}') cat<
 
IP Address:IP: $(ip -f inet addr show $WLDEV label $WLDEV |awk 'sub("inet","") {sub("/.*","",$1);print $1}'), Mask: $(test -n "$WLMASK" && ipcalc -m $WLMASK|cut -d'=' -f2), MAC: $(ip link show $WLDEV|awk 'sub("ether","") {print $2}')
WLAN Status: $(wl -i $WLDEV status 2>&1)
Uptime: $(uptime)
Device Info:Boardtype: $(nvram get boardtype), Boardnum: $(nvram get boardnum) EOF if [ "$ff_httpinfo" != "0" ];then cat<
Neighbours: EOF wget -O - http://127.0.0.1:8080/nodes|awk ' /

/,/<\/div>/ { if ($1~/

/) { prnt=($1~/Links/) } else if (prnt) { sub("<""table[^>]+>", "<""table frame=void border=1 cellspacing=0 cellpadding=1 width=100%>") sub("

remote IP", "IP") sub("[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+", "&") print } }' fi cat<
Kernel Log: Show / Hide
EOF echo -n '' if pidof syslogd>/dev/null;then cat<
System Log: Show / Hide
EOF echo -n '' fi cat<
IP NAT: Show / Hide
EOF echo -n '' cat<
Interface Config: Show / Hide
EOF echo -n '' cat<
NVRAM Config: Show / Hide
EOF echo -n '' cat<
Active Connections: Show / Hide
EOF echo -n '
EOF if [ "00:90:96:00:00:00" = "$(nvram get et0macaddr)" ] || [ "00:90:96:00:00:02" = "$(nvram get il0macaddr)" ]; then cat< Warning: This SE505 device does not have the correct MAC address. Read the MAC address from the bottom of the device and correct manually on the command line shell, e.g. with nvram set et0macaddr=xx:xx:xx:xx:xx:xx, nvram set il0macaddr=xx:xx:xx:xx:xx:[xx+1], nvram commit and reboot

EOF fi fi . ${SCRIPT%/*}/cgi-bin-post.sh