mirror of
https://github.com/unraid/webgui.git
synced 2026-05-03 16:29:45 -05:00
Major network enhancements
This commit is contained in:
@@ -14,14 +14,15 @@
|
||||
$task = $_POST['task'];
|
||||
switch ($task) {
|
||||
case 'delete':
|
||||
$gateway = str_replace(' ','-',trim($_POST['gateway']));
|
||||
$gateway = str_replace(['via ',' '],['','-'],trim($_POST['gateway']));
|
||||
$route = trim($_POST['route']);
|
||||
if ($gateway && $route) exec("/etc/rc.d/rc.inet1 ".escapeshellarg("{$gateway}_{$route}_del"));
|
||||
$metric = trim($_POST['metric'] ?: "1");
|
||||
if ($gateway && $route) exec("/etc/rc.d/rc.inet1 ".escapeshellarg("{$gateway}_{$route}_{$metric}_del"));
|
||||
break;
|
||||
case 'Add Route':
|
||||
$gateway = str_replace(' ','-',trim($_POST['gateway']));
|
||||
$gateway = str_replace(['via ',' '],['','-'],trim($_POST['gateway']));
|
||||
$route = trim($_POST['route']);
|
||||
$metric = strlen($_POST['metric']) ? trim($_POST['metric']) : 1;
|
||||
$metric = trim($_POST['metric'] ?: "1");
|
||||
if ($gateway && $route) exec("/etc/rc.d/rc.inet1 ".escapeshellarg("{$gateway}_{$route}_{$metric}_add"));
|
||||
break;
|
||||
default:
|
||||
@@ -31,20 +32,20 @@ default:
|
||||
$cell = explode(' ',$info);
|
||||
$route = $cell[0];
|
||||
$gateway = $cell[2];
|
||||
$button = 'bt-'.preg_replace('/[\.:\/]/','',$gateway.$route);
|
||||
if ($route=='default') $gateway .= " via {$cell[4]}";
|
||||
$metric = '1';
|
||||
for ($i=3; $i<count($cell); $i++) if ($cell[$i] == 'metric') {$metric = $cell[$i+1]; break;}
|
||||
echo "<tr><td>IPv4</td><td>$route</td><td>$gateway</td><td>$metric</td><td style='text-align:center'><a id='$button' href='#' onclick='deleteRoute(\"#$button\",\"$gateway\",\"$route\");return false'><i class='fa fa-trash-o'></i></a></td></tr>";
|
||||
for ($i=5; $i<count($cell); $i++) if ($cell[$i]=='metric') {$metric = $cell[$i+1]; break;}
|
||||
echo "<tr><td>IPv4</td><td>$route</td><td>$gateway</td><td>$metric</td><td style='text-align:center'><a href='#' onclick='deleteRoute(\"$gateway\",\"$route\",\"$metric\");return false'><i class='fa fa-trash-o'></i></a></td></tr>";
|
||||
}
|
||||
if ($ipv6) echo "<tr class='tr_last'><td colspan='5'> </td></tr>";
|
||||
foreach ($ipv6 as $info) {
|
||||
$cell = explode(' ',$info);
|
||||
$route = $cell[0];
|
||||
$gateway = $route=='anycast' ? $cell[3] : $cell[2];
|
||||
$button = 'bt-'.preg_replace('/[\.:\/]/','',$gateway.$route);
|
||||
if ($route=='default') $gateway .= " via {$cell[4]}";
|
||||
$metric = '1';
|
||||
for ($i=3; $i<count($cell); $i++) if ($cell[$i] == 'metric') {$metric = $cell[$i+1]; break;}
|
||||
echo "<tr><td>IPv6</td><td>$route</td><td>$gateway</td><td>$metric</td><td style='text-align:center'><a id='$button' href='#' onclick='deleteRoute(\"#$button\",\"$gateway\",\"$route\");return false'><i class='fa fa-trash-o'></i></a></td></tr>";
|
||||
for ($i=5; $i<count($cell); $i++) if ($cell[$i]=='metric') {$metric = $cell[$i+1]; break;}
|
||||
echo "<tr><td>IPv6</td><td>$route</td><td>$gateway</td><td>$metric</td><td style='text-align:center'><a href='#' onclick='deleteRoute(\"$gateway\",\"$route\",\"$metric\");return false'><i class='fa fa-trash-o'></i></a></td></tr>";
|
||||
}
|
||||
echo "<tr class='tr_last'><td colspan='5'> </td></tr>";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user