Commit 611d9722 authored by Franco Fichtner's avatar Franco Fichtner

system: add system_host_route(), later we also want system_default_route()

parent 2a2bca91
...@@ -985,15 +985,7 @@ function interface_gif_configure(&$gif, $gifkey = "") ...@@ -985,15 +985,7 @@ function interface_gif_configure(&$gif, $gifkey = "")
file_put_contents("/tmp/{$gifif}_routerv6", $gif['tunnel-remote-addr']); file_put_contents("/tmp/{$gifif}_routerv6", $gif['tunnel-remote-addr']);
} }
if (is_ipaddrv4($realifgw)) { system_host_route($gif['remote-addr'], $realifgw);
mwexec("/sbin/route delete -host " . escapeshellarg($gif['remote-addr']));
mwexec("/sbin/route add -host " . escapeshellarg($gif['remote-addr']) . " {$realifgw}");
}
if (is_ipaddrv6($realifgw)) {
mwexec("/sbin/route delete -host -inet6 " . escapeshellarg($gif['remote-addr']));
mwexec("/sbin/route add -host -inet6 " . escapeshellarg($gif['remote-addr']) . " {$realifgw}");
}
interfaces_bring_up($gifif); interfaces_bring_up($gifif);
return $gifif; return $gifif;
......
...@@ -425,6 +425,20 @@ function system_hostname_configure($verbose = false) ...@@ -425,6 +425,20 @@ function system_hostname_configure($verbose = false)
} }
} }
function system_host_route($host, $gateway)
{
if (is_ipaddrv4($realifgw)) {
$family = 'inet';
} elseif (is_ipaddrv6($realifgw)) {
$family = 'inet6';
} else {
return;
}
mwexecf('/sbin/route delete -host -%s %s', array($family, $host), true);
mwexecf('/sbin/route add -host -%s %s %s', array($family, $host, $gateway));
}
function system_routing_configure($interface = '', $verbose = false) function system_routing_configure($interface = '', $verbose = false)
{ {
global $config; global $config;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment