#!/bin/sh echo Content-type: text/html echo cat< $(n=$(uname -n);echo ${n:-Freifunk.Net}) - Status: OLSR
Home
 %FFVER%
Contents
EOF WLDEV=$(l=$(grep : /proc/net/wireless);l=${l%:*};echo ${l##* }) ff_httpinfo=$(nvram get ff_httpinfo) if [ "$REQUEST_METHOD" = "POST" ]; then read QUERY_STRING fi if [ "$QUERY_STRING" != "${QUERY_STRING#*post_olsr=}" ]; then cat<Status: OLSR
# s/./&/ tn c\ <\/TABLE> p } ' cat<
    EOF if [ "$(nvram get wl0_mode)" != "ap" ];then cat< EOF fi if [ "$ff_httpinfo" != "0" ];then cat< EOF fi cat<
 
EOF wget -q -O - http://127.0.0.1:2006/|sed -ne' /^Table:/,/^$/{ s#^Table: \(.*\)#

\1

<\TABLE BORDER="1" CELLSPACING="0" CELLPADDING="0" WIDTH="100%"># :n p n s#[0-9]\+\.[0-9]\+\.[0-9]\+\.[0-9]\+#&#g s/ / - /g s/ $// s# #
#g s#.\+#
&
EOF elif [ "$QUERY_STRING" != "${QUERY_STRING#*post_route=}" ]; then cat<Status: Routes
\ \ \ # s#\([0-9]\+\.[0-9]\+\.[0-9]\+\.[0-9]\+\)\([ <]\)#\1\2#g ' echo '<''/TABLE>' cat<
    EOF if [ "$(nvram get wl0_mode)" != "ap" ];then cat< EOF fi if [ "$ff_httpinfo" != "0" ];then cat< EOF fi cat<
 
EOF echo '<''TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" WIDTH="400">' for i in olsr main dyngw;do ip ro ls table $i;done|sed -e' s#^\([^ ]\+\)\(.*\)#
\1\2
EOF elif [ "$QUERY_STRING" != "${QUERY_STRING#*post_scan=}" ]; then cat<Status: WLAN Scan
' (/rom/usr/sbin/wl -i $WLDEV scan 2>&- && (sleep 2;/rom/usr/sbin/wl -i $WLDEV scanresults 2>&-|sed -ne' /^$/d /^WSEC/d /^SSID:/{ s/[\$\`"\\]//g s/: \(.*\)/="\1"/ h d } /^Supported Rates:/{ s/.* \([0-9]\+\).*/RATE="\1"/ H g s/\n/ /g p } s/ dBm//g s/: \+\([^ ]\+\)/="\1"/g s/ \+"/"/g s/Mode="Ad Hoc"/ADHOC="yes"/ s/Mode="[^"]\+"/ADHOC="no"/ s/Capability=".* WEP .*/OPEN="no"/ s/Capability.*/OPEN="yes"/g H ') || iwlist $WLDEV scanning 2>&-|sed -ne' 1{ s/.*/ignore/ h d } /Address:/{ s/^[^:]*: *\([0-9A-F:]*\)/BSSID="\1" IWTOOLS=1/ x s/\n/ /g tx :x s/^ignore$// t p } ${ x s/\n/ /g p } /ESSID:/{ s/^[^:]*:"// s/.$// s/[\$\`"\\]//g s/.*/SSID="&"/g H } /Mode:/{ s/^[^:]*:Ad-Hoc/ADHOC="yes"/ s/^[^:]*:.*/ADHOC="no"/ H } /Frequency:/{ s/^[^(]*(Channel *\([0-9]*\).*/Channel="\1"/ H } /Channel:/{ s/^[^:]*:\([0-9]*\).*/Channel="\1"/ H } /Quality[:=]/{ s/^.*Signal level[:=]\([-0-9]*\).*Noise level[:=]\([-0-9]*\).*/RSSI="\1" noise="\2"/ H } /Encryption key:/{ s/^[^:]*:off/OPEN="yes"/ s/^[^:]*:.*/OPEN="no"/ H } ')|while read line; do RSSI= eval $line test -z "$noise" && noise=-95 test -z "$RSSI" && test "1" = "$IWTOOLS" && eval $(iwlist $WLDEV ap 2>&-|sed -ne" /$BSSID/s/^.*Signal level[:=]\\([-0-9]*\\).*Noise level[:=]\\([-0-9]*\\).*/RSSI=\"\\1\" noise=\"\\2\"/p ") gif=$(( $RSSI - $noise )) gif=$(( $gif / 5 )) test $gif -gt 5 && gif=5 test $gif -lt 0 && gif=0 cat< EOF done echo '
    EOF if [ "$(nvram get wl0_mode)" != "ap" ];then cat< EOF fi if [ "$ff_httpinfo" != "0" ];then cat< EOF fi cat<
 
SSID Channel Ad-Hoc Open Signal Max. BSSID
EOF echo '
$SSID$Channel ad hoc $OPEN P=$gif $RATE$BSSID
 ' cat<
EOF else cat<Status: Overview
# s/./&/ tn c\ <\/TABLE> p } ' fi cat<
    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 dev $WLDEV label $WLDEV |sed -ne'2{s# \+inet \([0-9\.\/]\+\).*#\1#;p}') cat<
 
IP Address: IP: $(ip -f inet addr show dev $WLDEV label $WLDEV |sed -ne'2{s/ \+inet \([0-9\.]\+\).*/\1/;p}'), Mask: $(test -n "$WLMASK" && ipcalc -m $WLMASK|cut -d'=' -f2), MAC: $(ip link show dev $WLDEV|sed -ne'2{s/.*ether \+\([^ ]\+\).*/\1/;p}')
WLAN Status: EOF if /rom/usr/sbin/wl -i $WLDEV status 2>&-;then echo "
" /rom/usr/sbin/wl -i $WLDEV rate /rom/usr/sbin/wl -i $WLDEV mrate else iwconfig $WLDEV 2>&- fi cat<
Uptime: $(uptime)
Device Info: Boardtype: $(nvram get boardtype), Boardnum: $(nvram get boardnum)
Default Route: $(ip route list exact 0/0|sed '1q'|sed 's#\([0-9]\+\.[0-9]\+\.[0-9]\+\.[0-9]\+\)#\1#') EOF if [ "$ff_httpinfo" != "0" ];then cat<
Neighbours: EOF wget -q -O - http://127.0.0.1:2006/neighbours|sed -ne' /^Table: Links/{ s/.*/<\TABLE FRAME="VOID" BORDER="1" CELLSPACING="0" CELLPADDING="1" WIDTH="400">/ :n p n s/^[^ ]* // s/^remote // s#\([0-9]\+\.[0-9]\+\.[0-9]\+\.[0-9]\+\)\([^/]\)#\1\2#g s/ $// s# ##g s#.\+#
&
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 '' cat<
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 cat<
Changed: 13.1.2008
Top of page
EOF