Commit 093895e3 authored by Ad Schellevis's avatar Ad Schellevis

Networking, side affects. when an "other type" interface is configured it's...

Networking, side affects. when an "other type" interface is configured it's automatically created, but if the interface got unconfigured it's dropped,leading to broken laggs for example.

We should trust the "other type" create/drop to handle the interface itself and interface_bring_down() should only unconfigure it, so possible parent/child interfaces won't break for no reason.
Fixes part of https://github.com/opnsense/core/issues/1709
parent 9cf6655b
......@@ -1081,7 +1081,7 @@ function interface_vip_bring_down($vip)
}
}
function interface_bring_down($interface = "wan", $destroy = false, $ifacecfg = false)
function interface_bring_down($interface = "wan", $ifacecfg = false)
{
global $config;
......@@ -1263,12 +1263,6 @@ function interface_bring_down($interface = "wan", $destroy = false, $ifacecfg =
mwexec(kill_wpasupplicant($realif));
}
if ($destroy == true) {
if (preg_match("/^[a-z0-9]+^tun|^ovpn|^gif|^gre|^lagg|^bridge|vlan|_stf$/i", $realif)) {
legacy_interface_destroy($realif);
}
}
return;
}
......
......@@ -514,10 +514,10 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
$toapplylist = unserialize(file_get_contents('/tmp/.interfaces.apply'));
foreach ($toapplylist as $ifapply => $ifcfgo) {
if (isset($config['interfaces'][$ifapply]['enable'])) {
interface_bring_down($ifapply, false, $ifcfgo);
interface_bring_down($ifapply, $ifcfgo);
interface_configure($ifapply, true);
} else {
interface_bring_down($ifapply, true, $ifcfgo);
interface_bring_down($ifapply, $ifcfgo);
}
}
}
......
......@@ -170,7 +170,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
// no validation errors, delete entry
unset($config['interfaces'][$id]['enable']);
$realid = get_real_interface($id);
interface_bring_down($id, true); /* down the interface */
interface_bring_down($id); /* down the interface */
unset($config['interfaces'][$id]); /* delete the specified OPTn or LAN*/
......@@ -264,7 +264,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
if (!is_array($ifport) && ($ifname == 'lan' || $ifname == 'wan' || substr($ifname, 0, 3) == 'opt')) {
$reloadif = false;
if (!empty($config['interfaces'][$ifname]['if']) && $config['interfaces'][$ifname]['if'] <> $ifport) {
interface_bring_down($ifname, true);
interface_bring_down($ifname);
/* Mark this to be reconfigured in any case. */
$reloadif = true;
}
......
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