mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-15 00:54:41 +00:00
system: simplify slightly #5989
In theory we should be able to move the host routes for 6rd and 6to4 easily without repercussion, unless some part of the system tries to reload the interface without calling system_routing_configure().
This commit is contained in:
parent
422b68f6c2
commit
39f8a1b6b1
@ -2575,10 +2575,8 @@ function interface_6rd_configure($interface, $wancfg, $update = false)
|
||||
mwexecf('/usr/local/sbin/ifctl -i %s -6rd -a %s', [$stfiface, $rd6brgw]);
|
||||
|
||||
$gateways = new \OPNsense\Routing\Gateways(legacy_interfaces_details());
|
||||
$ip4gateway = $gateways->getInterfaceGateway($interface, "inet");
|
||||
if (is_ipaddrv4($ip4gateway)) {
|
||||
system_host_route($wancfg['gateway-6rd'], $ip4gateway);
|
||||
}
|
||||
$ip4gateway = $gateways->getInterfaceGateway($interface, 'inet');
|
||||
system_host_route($wancfg['gateway-6rd'], $ip4gateway);
|
||||
|
||||
link_interface_to_track6($interface, $update);
|
||||
}
|
||||
@ -2663,10 +2661,8 @@ function interface_6to4_configure($interface, $wancfg, $update = false)
|
||||
mwexecf('/usr/local/sbin/ifctl -i %s -6rd -a %s', [$stfiface, $stfbrgw]);
|
||||
|
||||
$gateways = new \OPNsense\Routing\Gateways(legacy_interfaces_details());
|
||||
$ip4gateway = $gateways->getInterfaceGateway($interface, "inet");
|
||||
if (is_ipaddrv4($ip4gateway)) {
|
||||
system_host_route('192.88.99.1', $ip4gateway);
|
||||
}
|
||||
$ip4gateway = $gateways->getInterfaceGateway($interface, 'inet');
|
||||
system_host_route('192.88.99.1', $ip4gateway);
|
||||
|
||||
link_interface_to_track6($interface, $update);
|
||||
}
|
||||
|
||||
@ -498,7 +498,7 @@ function system_hostname_configure($verbose = false)
|
||||
service_log("{$hostname}\n", $verbose);
|
||||
}
|
||||
|
||||
function system_host_route($host, $gateway, $delete = true, $add = true)
|
||||
function system_host_route($host, $gateway)
|
||||
{
|
||||
if (is_ipaddrv4($gateway)) {
|
||||
$family = 'inet';
|
||||
@ -508,11 +508,9 @@ function system_host_route($host, $gateway, $delete = true, $add = true)
|
||||
return;
|
||||
}
|
||||
|
||||
if ($delete) {
|
||||
mwexecf('/sbin/route delete -host -%s %s', [$family, $host], true);
|
||||
}
|
||||
mwexecf('/sbin/route delete -host -%s %s', [$family, $host], true);
|
||||
|
||||
if ($add && $host != $gateway) {
|
||||
if ($host != $gateway) {
|
||||
mwexecf('/sbin/route add -host -%s %s %s', [$family, $host, $gateway]);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user