68 lines
1.5 KiB
Bash
68 lines
1.5 KiB
Bash
#!/bin/sh
|
|
. /bin/vs/cgi-bin/netenv.conf
|
|
. /bin/vs/cgi-bin/net_func.sh
|
|
|
|
IFCONF=/etc/network/ifattr
|
|
IFRESOLV=/etc/resolv.conf
|
|
NETDEV=/tmpfs/netdev
|
|
|
|
. $IFCONF
|
|
|
|
iface=`cat $NETDEV`
|
|
|
|
if [ ${dhcp} = "y" ];then
|
|
dhcpflag=on
|
|
elif [ ${dhcp} = "n" ];then
|
|
dhcpflag=off
|
|
fi
|
|
|
|
if [ ${dnstype} = "server" ] ; then
|
|
dnsstat=1
|
|
elif [ ${dnstype} = "specify" ] ; then
|
|
dnsstat=0
|
|
fi
|
|
|
|
|
|
|
|
DNS1=`grep nameserver $IFRESOLV | sed -n '1 s/^nameserver *//'p`
|
|
DNS2=`grep nameserver $IFRESOLV | sed -n '2 s/^nameserver *//'p`
|
|
|
|
#MAC=`ip address show eth0|awk '/link\/ether/ {print $2}'`
|
|
|
|
####BT ipinfo=`ifconfig $iface | grep "inet addr"`
|
|
####BT address=`echo $ipinfo | awk '{print $2}'| sed -n "s/addr://p"`
|
|
####BT netmask=`echo $ipinfo | awk '{print $4}'| sed -n "s/Mask://p"`
|
|
####BT gateway=`route | awk -v k="$iface" '{if ($1=="default" && $8==k) print $2}' `
|
|
|
|
|
|
if [ $iface = eth0 ];then
|
|
NETTYPE=LAN
|
|
else
|
|
NETTYPE=WIRELESS
|
|
fi
|
|
|
|
if [ "$1" != "nohead" ]
|
|
then
|
|
echo -e "Content-Type:text/plain\r"
|
|
echo -e "\r"
|
|
fi
|
|
|
|
####BT echo -e "var dhcpflag = \"$dhcpflag\" ;\r"
|
|
####BT echo -e "var ip = \"$address\" ;\r"
|
|
####BT echo -e "var netmask = \"$netmask\" ;\r"
|
|
####BT echo -e "var gateway = \"$gateway\" ;\r"
|
|
####BT echo -e "var macaddress = \"$MAC\" ;\r"
|
|
cat $ip_cache1
|
|
####BT -e "var dnsstat = \"$dnsstat\" ;\r"
|
|
echo -e "var fdnsip = \"$DNS1\" ;\r"
|
|
echo -e "var sdnsip = \"$DNS2\" ;\r"
|
|
|
|
####BTecho -e "var networktype = \"$NETTYPE\" ;\r"
|
|
##echo -e "var httpport = \"80\" ;\r"
|
|
if [ "$1" != "nohead" ]
|
|
then
|
|
echo -e "\r"
|
|
fi
|
|
|
|
|
|
|