Commit ba7f4697 authored by Ad Schellevis's avatar Ad Schellevis Committed by Franco Fichtner

(interfaces.inc) cleanup interface_proxyarp_configure and actually use...

(interfaces.inc) cleanup interface_proxyarp_configure and actually use provided pid, closes https://github.com/opnsense/core/issues/981

(cherry picked from commit 6e4b9c4f)
parent 9a1d7dc7
......@@ -1961,12 +1961,9 @@ function interface_proxyarp_configure($interface = '')
{
global $config;
/* kill any running choparp */
/* kill any running choparp, on restart "all" */
if (empty($interface)) {
killbyname('choparp');
} else {
$vipif = get_real_interface($interface);
killbypid("/var/run/choparp_{$vipif}.pid");
}
$paa = array();
......@@ -1974,57 +1971,32 @@ function interface_proxyarp_configure($interface = '')
/* group by interface */
foreach ($config['virtualip']['vip'] as $vipent) {
if ($vipent['mode'] === "proxyarp") {
if ($vipent['interface']) {
$proxyif = $vipent['interface'];
} else {
$proxyif = "wan";
}
if (!empty($interface) && $interface != $proxyif) {
continue;
}
if (!isset($paa[$proxyif]) || !is_array($paa[$proxyif])) {
if (empty($interface) || $interface == $vipent['interface']) {
if (empty($paa[$vipent['interface']])) {
$paa[$proxyif] = array();
}
$paa[$proxyif][] = $vipent;
}
}
$paa[$vipent['interface']][] = $vipent;
}
if (!empty($interface)) {
if (isset($paa[$interface]) && is_array($paa[$interface])) {
$paaifip = get_interface_ip($interface);
if (!is_ipaddr($paaifip)) {
return;
}
$args = get_real_interface($interface) . " auto";
foreach ($paa[$interface] as $paent) {
if (isset($paent['subnet'])) {
$args .= " " . escapeshellarg("{$paent['subnet']}/{$paent['subnet_bits']}");
} elseif (isset($paent['range'])) {
$args .= " " . escapeshellarg($paent['range']['from'] . "-" . $paent['range']['to']);
}
}
mwexec_bg("/usr/local/sbin/choparp " . $args);
}
} elseif (count($paa) > 0) {
foreach ($paa as $paif => $paents) {
$paaifip = get_interface_ip($paif);
if (!is_ipaddr($paaifip)) {
continue;
}
$args = get_real_interface($paif) . " auto";
$vipif = get_real_interface($paif);
$pid_filename = "/var/run/choparp_{$vipif}.pid";
$args = "-p {$pid_filename} {$vipif} auto";
foreach ($paents as $paent) {
if (isset($paent['subnet'])) {
$args .= " " . escapeshellarg("{$paent['subnet']}/{$paent['subnet_bits']}");
} elseif (isset($paent['range'])) {
$args .= " " . escapeshellarg($paent['range']['from'] . "-" . $paent['range']['to']);
}
if (!empty($interface)) {
killbypid($pid_filename);
}
mwexec_bg("/usr/local/sbin/choparp " . $args);
}
}
}
function interface_ipalias_cleanup($interface, $inet = 'inet4')
......
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