diff --git a/usr/local/www/diag_routes.php b/usr/local/www/diag_routes.php index e4a364f756..0edcba8758 100644 --- a/usr/local/www/diag_routes.php +++ b/usr/local/www/diag_routes.php @@ -42,6 +42,32 @@ include('guiconfig.inc'); +if (isset($_REQUEST['isAjax'])) { + $netstat = "/usr/bin/netstat -rW"; + if (isset($_REQUEST['IPv6'])) { + $netstat .= " -f inet6"; + echo "IPv6\n"; + } else { + $netstat .= " -f inet"; + echo "IPv4\n"; + } + $netstat .= (isset($_REQUEST['IPv6']) ? " -f inet6" : " -f inet"); + if (!isset($_REQUEST['resolve'])) + $netstat .= " -n"; + + if (!empty($_REQUEST['filter'])) + $netstat .= " | /usr/bin/sed -e '1,3d; 5,\$ { /" . escapeshellarg(htmlspecialchars($_REQUEST['filter'])) . "/!d; };'"; + else + $netstat .= " | /usr/bin/sed -e '1,3d'"; + + if (is_numeric($_REQUEST['limit']) && $_REQUEST['limit'] > 0) + $netstat .= " | /usr/bin/head -n {$_REQUEST['limit']}"; + + echo htmlspecialchars_decode(shell_exec($netstat)); + + exit; +} + $pgtitle = array(gettext("Diagnostics"),gettext("Routing tables")); $shortcut_section = "routing"; @@ -49,8 +75,92 @@ include('head.inc'); ?> + + + + +
@@ -58,16 +168,40 @@ include('head.inc'); + + + + + + + + + +
-> +>
+ +
+ +
+ +
+ +
  -" /> +" />

@@ -77,54 +211,21 @@ include('head.inc');
- $table) { - $elements = ($tabindex == 0 ? 8 : 8); - $name = ($tabindex == 0 ? 'IPv4' : 'IPv6'); -?> - - - - $line) { - if ($i == 0) continue; - if ($line == "") continue; - - if ($i == 1) - $class = 'listhdrr'; - else - $class = 'listlr'; - - if ($i == 1) - print("\n"); - else - print("\n"); - - $j = 0; - foreach (explode(' ', $line) as $entry) { - if ($entry == '') continue; - if ($i == 1 && $j == $elements - 1) - $class = 'listhdr'; - print("\n"); - if ($i > 1) - $class = 'listr'; - $j++; - } - // The 'Expire' field might be blank - if ($j == $elements - 1) - print('' . "\n"); - print("\n"); - if ($i == 1) - print("\n"); - } - print("
$entry 
\n"); - } - -?> + + + + + + + +
IPv4
+ + + + + + +
IPv6