diff --git a/src/etc/inc/plugins.inc.d/vxlan.inc b/src/etc/inc/plugins.inc.d/vxlan.inc index de847c044..ebad94e05 100644 --- a/src/etc/inc/plugins.inc.d/vxlan.inc +++ b/src/etc/inc/plugins.inc.d/vxlan.inc @@ -82,6 +82,7 @@ function vxlan_configure_do($verbose = false, $device = null) // (re)configure vxlan devices foreach ($vxlans as $vxlan) { $device_name = "vxlan{$vxlan->deviceId}"; + $isChanged = false; if ($device !== null && $device != $device_name) { $configured_devices[] = $device_name; @@ -101,7 +102,6 @@ function vxlan_configure_do($verbose = false, $device = null) mwexecf('/sbin/ifconfig vxlan create name %s', array($device_name)); $isChanged = true; } else { - $isChanged = false; $current_settings['vxlanid'] = $interfaces_details[$device_name]['vxlan']['vni']; foreach (['local', 'remote', 'group'] as $target) { if (!empty($interfaces_details[$device_name]['vxlan'][$target])) { @@ -111,6 +111,7 @@ function vxlan_configure_do($verbose = false, $device = null) } } } + // gather settings, detect changes $ifcnfcmd = '/sbin/ifconfig %s'; $ifcnfcmdp = array($device_name); @@ -135,13 +136,13 @@ function vxlan_configure_do($verbose = false, $device = null) $ifcnfcmdp[] = $value; } if (isset($current_settings[$param]) && $current_settings[$param] != $value) { + // need to bring existing down to apply changes + mwexecf('/sbin/ifconfig %s down', [$device_name]); $isChanged = true; } } - // The device will be busy, first bring it down, apply changes, then bring it back up if ($isChanged) { - mwexecf('/sbin/ifconfig %s down', [$device_name]); mwexecf($ifcnfcmd . ' up', $ifcnfcmdp); $changed_devices[] = $device_name; }