#!/bin/sh export DATE="29.11.2006";SCRIPT=${0#/rom} export TITLE="Status : OLSR" . ${SCRIPT%/*}/cgi-bin-pre.sh 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">' ip route ls|sed -e' s#^\([^ ]\+\)\(.*\)#
\1\2
EOF elif [ "$QUERY_STRING" != "${QUERY_STRING#*post_scan=}" ]; then cat<Status : Détection Sans Fil
' /usr/sbin/wl -i $WLDEV scanresults|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 '|while read line; do eval $line 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 Canal Ad-Hoc Open Signal Max. BSSID
EOF /usr/sbin/wl -i $WLDEV scan sleep 2 echo '
$SSID$Channel ad hoc $OPEN P=$gif $RATE$BSSID
 ' cat<
EOF else cat<Status : Configuration Générale
# 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<
 
Adresse IP : IP: $(ip -f inet addr show dev $WLDEV label $WLDEV |sed -ne'2{s/ \+inet \([0-9\.]\+\).*/\1/;p}'), Masque sous réseau: $(test -n "$WLMASK" && ipcalc -m $WLMASK|cut -d'=' -f2), MAC: $(ip link show dev $WLDEV|sed -ne'2{s/.*ether \+\([^ ]\+\).*/\1/;p}')
Etat sans fil : $(/usr/sbin/wl -i $WLDEV status 2>&1)
Temps de fonctionnement : $(uptime)
Informations sur l'AP : Boardtype: $(nvram get boardtype), Boardnum: $(nvram get boardnum)
Route par défaut : $(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<
Voisins : 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="100%">/ :n p n s/^[^ ]* // s/^remote // s#\([0-9]\+\.[0-9]\+\.[0-9]\+\.[0-9]\+\)\([^/]\)#\1\2#g s/ $// s# ##g s#.\+#
&
Kernel Log : Afficher / Masquer
EOF echo -n '' if pidof syslogd>/dev/null;then cat<
Système Log : Afficher / Masquer
EOF echo -n '' fi cat<
IP NAT : Afficher / Masquer
EOF echo -n '' cat<
Interface de Configuration : Afficher / Masquer
EOF echo -n '' cat<
NVRAM de Configuration : Afficher / Masquer
EOF echo -n '' cat<
Connexions Actives : Afficher / Masquer
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< Attention : Ce modèle de SE505 ne possède pas une adresse MAC correcte. Lire l'adresse MAC inscrite au dessous de l'équipement et corriger manuellement en ligne de commande shell, i.e. avec 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