#!/bin/sh . /www/cgi-bin/functions.sh . /www/cgi-bin/language.sh lock_cgiwait . /www/cgi-bin/info.sh gmode=$($nvram get wl_mode) #MBSSID guest_enable_1=$($nvram get wl_multi_ssid_endis_2) guest_enable_2=$($nvram get wl_multi_ssid_endis_3) guest_enable_3=$($nvram get wl_multi_ssid_endis_4) guest_enable_4=$($nvram get wl_multi_ssid_endis_5) guest_ssid_1=$($nvram get wl_ssid_2) guest_ssid_2=$($nvram get wl_ssid_3) guest_ssid_3=$($nvram get wl_ssid_4) guest_ssid_4=$($nvram get wl_ssid_5) guest_broad_1=$($nvram get endis_ssid_broadcast_2) guest_broad_2=$($nvram get endis_ssid_broadcast_3) guest_broad_3=$($nvram get endis_ssid_broadcast_4) guest_broad_4=$($nvram get endis_ssid_broadcast_5) guest_access_1=$($nvram get wl_guest_access_local_endis_2) guest_access_2=$($nvram get wl_guest_access_local_endis_3) guest_access_3=$($nvram get wl_guest_access_local_endis_4) guest_access_4=$($nvram get wl_guest_access_local_endis_5) #fireware version info_get_version=$(cat /firmware_version)$(cat /firmware_region) info_get_acname=$(cat /module_name) if [ "$info_get_acname" = "JWNR2000" ];then info_get_acname="JWNR2000" fi info_get_hardware=$(cat /hardware_version) #lan parameters info_get_ipaddr=$($nvram get lan_ipaddr) info_get_netmask=$($nvram get lan_netmask) info_get_gateway=$($nvram get lan_gateway) info_get_landhcp=$($nvram get lan_dhcp) internet_type=$($nvram get internet_type) internet_ppp_type=$($nvram get internet_ppp_type) wds_endis_fun=$($nvram get wds_endis_fun) wds_repeater_basic=$($nvram get wds_repeater_basic) #wan parameters port_status=$(cat /tmp/port_status) info_get_wanproto=$($nvram get wan_proto) lan_ifname=$($nvram get lan_ifname) wan_ifname=$($nvram get wan_hwifname) wan_if=$(get_wanif $info_get_wanproto) info_get_lanmac=$(ifconfig $lan_ifname | sed -n 1p | awk '{ print $5 }') info_get_wanmac=$($ifconfig $wan_ifname | grep $wan_ifname | sed 's/.*HWaddr//') if [ "x$info_get_wanmac" = "x" ];then info_get_wanmac="----" fi if [ "$info_get_wanproto" = "dhcp" ];then info_get_wanip=$($nvram get wan_dhcp_ipaddr) info_get_wanmask=$($nvram get wan_dhcp_netmask) info_get_gateway=$($nvram get wan_dhcp_gateway) if [ "$port_status" = "0" ];then info_get_wanip="0.0.0.0" fi if [ "x$info_get_wanip" = "x" -o "$info_get_wanip" = "0.0.0.0" ];then info_get_wanmask="0.0.0.0" info_get_gateway="0.0.0.0" fi info_get_wanproto="DHCP" info_get_dns_assign=$($nvram get wan_ether_dns_assign) elif [ "$info_get_wanproto" = "static" ];then info_get_wanip=$($nvram get wan_ipaddr) info_get_wanmask=$($nvram get wan_netmask) info_get_gateway=$($nvram get wan_gateway) if [ "$port_status" = "0" ];then info_get_wanip="0.0.0.0" fi if [ "x$info_get_wanip" = "x" -o "$info_get_wanip" = "0.0.0.0" ];then info_get_wanmask="0.0.0.0" info_get_gateway="0.0.0.0" fi info_get_wanproto="Static" info_get_dns_assign=$($nvram get wan_ether_dns_assign) elif [ "$info_get_wanproto" = "pppoe" ];then pppoe_status=/tmp/ppp/ppp0-status pppoe_get_wan_assign=$($nvram get wan_pppoe_wan_assign) pppoe_alive=0 if [ -f $pppoe_status ]; then status=$(cat $pppoe_status) if [ "x$status" = "x1" ]; then pppoe_alive=1 fi fi if [ "$pppoe_alive" = "1" ];then ppp0_value=`ifconfig | grep ^ppp0` if [ "x$ppp0_value" != "x" ];then info_get_wanip=`ifconfig ppp0 | sed 2p -n | awk '/inet/{print $2}' | awk -F: '{print $2}'` info_get_wanmask="255.255.255.255" info_get_gateway=$info_get_wanip elif [ "$pppoe_get_wan_assign" = "0" ];then info_get_wanip="0.0.0.0" info_get_wanmask="0.0.0.0" info_get_gateway="0.0.0.0" else info_get_wanip=$($nvram get wan_pppoe_ip) info_get_wanmask="0.0.0.0" info_get_gateway="0.0.0.0" fi else info_get_wanip="0.0.0.0" info_get_wanmask="0.0.0.0" info_get_gateway="0.0.0.0" fi info_get_wanproto="PPPoE" info_get_dns_assign=$($nvram get wan_pppoe_dns_assign) elif [ "$info_get_wanproto" = "pptp" ];then pptp_status=/tmp/ppp/ppp0-status pptp_get_wan_assign=$($nvram get wan_pptp_wan_assign) pptp_alive=0 if [ -f $pptp_status ]; then status=$(cat $pptp_status) if [ "x$status" = "x1" ]; then pptp_alive=1 fi fi if [ "$pptp_alive" = "1" ];then ppp0_value=`ifconfig | grep ^ppp0` if [ "x$ppp0_value" != "x" ];then info_get_wanip=`ifconfig ppp0 | sed 2p -n | awk '/inet/{print $2}' | awk -F: '{print $2}'` info_get_wanmask="255.255.255.255" info_get_gateway=$info_get_wanip elif [ "$pptp_get_wan_assign" = "0" ];then info_get_wanip="0.0.0.0" info_get_wanmask="0.0.0.0" info_get_gateway="0.0.0.0" else info_get_wanip=$($nvram get wan_pptp_local_ip) info_get_wanmask="0.0.0.0" info_get_gateway="0.0.0.0" fi else info_get_wanip="0.0.0.0" info_get_wanmask="0.0.0.0" info_get_gateway="0.0.0.0" fi info_get_wanproto="PPTP" info_get_dns_assign=$($nvram get wan_pptp_dns_assign) elif [ "$info_get_wanproto" = "bigpond" ];then info_get_wanproto="Telstra Bigpond" info_get_wanip=$($nvram get wan_dhcp_ipaddr) info_get_wanmask=$($nvram get wan_dhcp_netmask) info_get_gateway=$($nvram get wan_dhcp_gateway) if [ "x$info_get_wanip" = "x" -o "$info_get_wanip" = "0.0.0.0" ];then info_get_wanmask="0.0.0.0" info_get_gateway="0.0.0.0" fi info_get_dns_assign=$($nvram get wan_bpa_dns_assign) elif [ "$info_get_wanproto" = "mulpppoe1" ];then info_get_dns_assign=$($nvram get wan_mulpppoe1_dns_assign) #ppp1 IP_FILE0=/etc/ppp/pppoe1-ip PPP0_STATUS=/etc/ppp/pppoe1-status info_get_wanip="0.0.0.0" if [ -f $PPP0_STATUS ]; then status=$(cat $PPP0_STATUS) if [ "x$status" = "x1" -a -f $IP_FILE0 ]; then info_get_wanip=$(cat $IP_FILE0) fi fi info_get_wanmask="0.0.0.0" if [ -f $PPP0_STATUS ]; then status=$(cat $PPP0_STATUS) if [ "x$status" = "x1" ]; then info_get_wanmask="255.255.255.255" fi fi info_get_gateway=$info_get_wanip DNS_FIEL0=/etc/ppp/pppoe1-dns.conf mulppp_get_dns1="0.0.0.0" if [ -f $PPP0_STATUS ]; then status=$(cat $PPP0_STATUS) if [ "x$status" = "x1" -a -f $DNS_FIEL0 ]; then mulppp_get_dns1=`sed -n '1p' $DNS_FIEL0` fi fi #ppp2 IP_FILE1=/etc/ppp/pppoe2-ip PPP1_STATUS=/etc/ppp/pppoe2-status info_get_wanip2="0.0.0.0" if [ -f $PPP1_STATUS ]; then status=$(cat $PPP1_STATUS) if [ "x$status" = "x1" -a -f $IP_FILE1 ]; then info_get_wanip2=$(cat $IP_FILE1) fi fi info_get_wanmask2="0.0.0.0" if [ -f $PPP1_STATUS ]; then status=$(cat $PPP1_STATUS) if [ "x$status" = "x1" ]; then info_get_wanmask2="255.255.255.255" fi fi info_get_gateway2=$info_get_wanip DNS_FIEL1=/etc/ppp/pppoe2-dns.conf mulppp_get_dns2="0.0.0.0" if [ -f $PPP1_STATUS ]; then status=$(cat $PPP1_STATUS) if [ "x$status" = "x1" -a -f $DNS_FIEL1 ]; then mulppp_get_dns2=`sed -n '1p' $DNS_FIEL1` fi fi fi if [ -f /tmp/resolv.conf ];then info_get_dns1=$(cat /tmp/resolv.conf | awk '/nameserver/{printf $2 "\n"}' | sed -n 1p) info_get_dns2=$(cat /tmp/resolv.conf | awk '/nameserver/{printf $2 "\n"}' | sed -n 2p) else info_get_dns1="0.0.0.0" info_get_dns2="0.0.0.0" fi if [ "x$info_get_wanip" = "x" ];then info_get_wanip="0.0.0.0" fi if [ "x$info_get_wanip2" = "x" ];then info_get_wanip2="0.0.0.0" fi if [ "$info_get_wanip" = "0.0.0.0" -a "$info_get_dns_assign" = "0" -a "$info_get_wanproto" = "DHCP" ];then info_get_dns1="0.0.0.0" info_get_dns2="0.0.0.0" elif [ "$info_get_wanip" = "0.0.0.0" -a "$info_get_wanproto" = "Static" ];then info_get_dns1="0.0.0.0" info_get_dns2="0.0.0.0" fi if [ "$info_get_dns1" = "$info_get_dns2" ];then info_get_dns2="" fi #wireless parameters info_get_ssid=$($nvram get wl_ssid) country_code=$($nvram get wl_country_code) info_get_country=$(show_region ${country_code}) info_get_channel=$($nvram get wl_channel) if [ "$info_get_channel" = "0" ];then info_get_channel=`iwpriv wlan0 get_mib channel | cut -b 28-29` if [ "$info_get_channel" = "0" ];then info_get_channel=" " else info_get_channel="auto($info_get_channel)" fi fi info_get_mode=$(show_mode $gmode) info_get_security=$($nvram get wl_sectype) info_get_endis_wl_radio=$($nvram get endis_wl_radio) info_get_ssid_broadcast=$($nvram get endis_ssid_broadcast) #detwan_first_do=$($nvram get detwan_first_do) #if [ "x$detwan_first_do" = "x" ];then # gateway_addr=$($nvram get wan0_gateway) #else # gateway_addr=$($nvram get test_ping_addr) #fi # #if [ "x$gateway_addr" != "x" -a "x$detwan_first_do" = "x" ];then # ping -c 3 $gateway_addr > /tmp/cmd_result 2>&1 #fi # #ping_result=`cat /tmp/cmd_result` #if [ "x$ping_result" = "x" ] || [ ! -f /tmp/cmd_result ];then # ping_contents="No respones !" #else # ping_contents=`cat /tmp/cmd_result` #fi print_cgi_header print_ezhttp_header "/funcs.js" cat <
EOF print_table_header "" cat < ${info_get_acname} --> $info_get_wanmac $info_get_wanip EOF if [ "$info_get_wanproto" = "mulpppoe1" ];then echo "PPPoE" echo " PPPoE " elif [ "$info_get_wanproto" = "PPPoE" ];then echo "" echo " PPPoE " elif [ "$info_get_wanproto" = "DHCP" ];then echo "" echo " DHCPClient " elif [ "$info_get_wanproto" = "Static" ];then echo "" echo " Static IP " else echo "" echo "$info_get_wanproto" fi cat < $info_get_wanmask $info_get_dns1
$info_get_dns2 EOF print_http_footer