system: move argument to where it matters

This commit is contained in:
Franco Fichtner 2025-01-08 11:39:14 +01:00
parent 99b2480dd5
commit 8258239148

View File

@ -751,16 +751,17 @@ function system_routing_configure($verbose = false, $interface_map = null, $moni
/* XXX some day we might want to convert to safer mwexecf() */
$cmd = " -{$ipproto} {$blackhole} " . escapeshellarg($rtent['network']) . " ";
if (is_ipaddrv6($gatewayip) && $ipproto == 'inet') {
/* rfc5549: gateway protocol differs, so we need to define it as well */
$cmd .= ' -inet6 ';
}
if (!empty($rtent['disabled'])) {
mwexec("/sbin/route delete {$cmd}", true);
} else {
if (is_ipaddr($gatewayip)) {
mwexec("/sbin/route delete {$cmd}", true);
if (ipproto == 'inet' && is_ipaddrv6($gatewayip)) {
/* RFC 5549: gateway protocol differs */
$cmd .= ' -inet6 ';
}
if ($fargw) {
mwexecf('/sbin/route delete -%s %s -interface %s ', [$ipproto, $gatewayip, $interfacegw], true);
mwexecf('/sbin/route add -%s %s -interface %s', [$ipproto, $gatewayip, $interfacegw]);