diff --git a/includes/internetRoute.php b/includes/internetRoute.php new file mode 100644 index 00000000..b91e15c2 --- /dev/null +++ b/includes/internetRoute.php @@ -0,0 +1,36 @@ + $route) { + $prop=explode(' ',$route); + $rInfo[$i]["interface"]=$prop[0]; + $rInfo[$i]["ip-address"]=$prop[1]; + $rInfo[$i]["gateway"]=$prop[2]; + // resolve the name of the gateway (if possible) + unset($host); + exec('host '.$prop[2].' | sed -rn "s/.*domain name pointer (.*)\./\1/p" | head -n 1',$host); + if (empty($host)) $host[0]="*"; + $rInfo[$i]["gw-name"] = $host[0]; + if (isset($checkAccess) && $checkAccess) { + // check internet connectivity w/ and w/o DNS resolution + unset($okip); + exec('ping -W1 -c 1 -I '.$prop[0].' '.ACCESS_CHECK_IP.' | sed -rn "s/.*icmp_seq=1.*time=.*/\&check\;/p"',$okip); + if (empty($okip)) $okip[0]="failed"; + $rInfo[$i]["access-ip"] = $okip[0]; + unset($okdns); + exec('ping -W1 -c 1 -I '.$prop[0].' '.ACCESS_CHECK_DNS.' | sed -rn "s/.*icmp_seq=1.*time=.*/\&check\;/p"',$okdns); + if (empty($okdns)) $okdns[0]="failed"; + $rInfo[$i]["access-dns"] = $okdns[0]; + } + } + } else { + $rInfo = array("error"=>"No route to the internet found"); + } + $rInfo_json = json_encode($rInfo); +?> diff --git a/templates/networking.php b/templates/networking.php index 7723733b..a08fa884 100755 --- a/templates/networking.php +++ b/templates/networking.php @@ -28,6 +28,46 @@
+ | + | + | + | No route to the internet found | "; + } else { + foreach($rInfo as $route) { + echo "
---|---|---|---|---|
".$route["interface"]." | "; + echo "".$route["ip-address"]." | "; + echo "".$route["gateway"]." ".$route["gw-name"]." | ";
+ echo "".$route["access-ip"]." ".ACCESS_CHECK_IP." | ";
+ echo "".$route["access-dns"]." ".ACCESS_CHECK_DNS." | ";
+ echo "