interfaces: static handling is the same as dynamic

Tiptoeing around interface_configure() when the resulting
work is the same is counter-intuitive and the static ARP
case probably has some more side effects since we do not
check for static ARP flag?!

filter_configure() can take a long time.  Skip alias stuff.
This commit is contained in:
Franco Fichtner 2022-08-15 09:11:36 +02:00
parent e005e0371e
commit 46ca0aff06

View File

@ -58,48 +58,24 @@ function handle_argument_group($action, $realif)
return;
}
$ipaddr = '0.0.0.0';
$ip6addr = '::';
if (isset($config['interfaces'][$interface]['ipaddr'])) {
$ipaddr = $config['interfaces'][$interface]['ipaddr'];
}
if (isset($config['interfaces'][$interface]['ipaddrv6'])) {
$ip6addr = $config['interfaces'][$interface]['ipaddrv6'];
}
$is_static = is_ipaddrv4($ipaddr) && is_ipaddrv6($ip6addr);
switch ($action) {
case 'stop':
log_error(sprintf(
"DEVD: Ethernet detached event for %s %s(%s)",
$is_static ? 'static' : 'dynamic',
"DEVD: Ethernet detached event for %s(%s)",
$interface,
$realif
));
if ($is_static) {
interfaces_staticarp_configure($interface);
} else {
interface_bring_down($interface);
filter_configure();
}
interface_bring_down($interface);
filter_configure(false, false);
break;
case 'start':
log_error(sprintf(
"DEVD: Ethernet attached event for %s %s(%s)",
$is_static ? 'static' : 'dynamic',
"DEVD: Ethernet attached event for %s(%s)",
$interface,
$realif
));
if ($is_static) {
interfaces_staticarp_configure($interface);
configdp_run('interface newip', array($realif));
} else {
interface_configure(false, $interface, true, true);
filter_configure();
}
interface_configure(false, $interface, true, true);
filter_configure(false, false);
break;
default:
log_error("DEVD: The action parameter passed is wrong ($action)");