#!/bin/sh
export DATE="1.3.2010";SCRIPT=${0#/rom}
export TITLE="Admin: PPPoE"
. ${SCRIPT%/*}/cgi-bin-pre.sh
cat<Admin: PPPoE
EOF
if [ "$REQUEST_METHOD" = "POST" ]; then
read QUERY_STRING
fi
if [ -z "$QUERY_STRING" ]; then
#Speedups
wan_proto="$(nvram get wan_proto)"
cat<
EOF
if [ -n "$(ip -f inet addr show dev ppp0 2>&-)" ]; then
eval $(ip -f inet addr show dev ppp0|sed -n '
2{
h
s/.*inet \+\([0-9\.]*\).*/ADDR=\1/
p
g
s/.*peer \+\([0-9\.]*\).*/PEER=\1/
p
}
')
cat< State: The PPPoE connection is
active. The interface address is $ADDR and the peer address is $PEER.
EOF
else
cat<
State: The PPPoE connection is not active.
EOF
fi
else
IFS=\&;set $QUERY_STRING;unset IFS;eval $*
DIRTY=
if [ -n "$post_pppoecd" ]; then
for V in wan_ifname wan_device wan_mtu ppp_passwd ppp_username ppp_demand ppp_ac ppp_idletime ppp_redialperiod ppp_service ppp_static ppp_static_ip; do
eval "C=\$$V"
C=$(unescape $C)
if [ "$C" != "$(nvram get $V)" ]; then
DIRTY=1
nvram set $V="$C"
fi
done
fi
if [ -n "$DIRTY" ]; then
nvram commit>/dev/null 2>&1
cat<
The changed settings are committed. The
settings are active after the next Restart. |
EOF
else
cat<
No
settings are changed. |
EOF
fi
fi
. ${SCRIPT%/*}/cgi-bin-post.sh