When a user configures veth pair with both veths under root namespace the infinite recursion is triggered.
Each device of veth pair stores a reference to it's peer in Device's _master["other"]. It means that LNST will have two veth devices each referencing the peer as master:
(veth1) (veth2) Device1._if_index == 10 Device2._if_index == 20 Device1._master["other"] = [20] Device2._master["other"] = [10]
On deconfiguration of the veth pair LNST will try to deconfigure first veth but since it references second veth as master it will start deconfiguring this master interface. The second interface references the first interface as master so it will attempt to deconfigure the first veth device again, and so on until max level of recursion is reached.
This patch adds a check if the device that is deconfigured is referenced by it's 'other' master. If the reference exists the deconfiguration of master device will be skipped.
Fixes #187
Signed-off-by: Jan Tluka jtluka@redhat.com --- lnst/Slave/InterfaceManager.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lnst/Slave/InterfaceManager.py b/lnst/Slave/InterfaceManager.py index 697119a..b21c962 100644 --- a/lnst/Slave/InterfaceManager.py +++ b/lnst/Slave/InterfaceManager.py @@ -563,7 +563,7 @@ class Device(object):
for m_id in self._master["other"]: m_dev = self._if_manager.get_device(m_id) - if m_dev: + if m_dev and self._if_index not in m_dev.get_master()["other"]: m_dev.clear_configuration()
if self._conf != None and self._configured: @@ -638,7 +638,7 @@ class Device(object):
for m_id in self._master["other"]: m_dev = self._if_manager.get_device(m_id) - if m_dev: + if m_dev and self._if_index not in m_dev.get_master()["other"]: m_dev.deconfigure()
if self._conf != None and self._configured:
On Thu, Apr 06, 2017 at 11:11:27AM +0200, Jan Tluka wrote:
When a user configures veth pair with both veths under root namespace the infinite recursion is triggered.
Each device of veth pair stores a reference to it's peer in Device's _master["other"]. It means that LNST will have two veth devices each referencing the peer as master:
(veth1) (veth2) Device1._if_index == 10 Device2._if_index == 20 Device1._master["other"] = [20] Device2._master["other"] = [10]
On deconfiguration of the veth pair LNST will try to deconfigure first veth but since it references second veth as master it will start deconfiguring this master interface. The second interface references the first interface as master so it will attempt to deconfigure the first veth device again, and so on until max level of recursion is reached.
This patch adds a check if the device that is deconfigured is referenced by it's 'other' master. If the reference exists the deconfiguration of master device will be skipped.
Fixes #187
Signed-off-by: Jan Tluka jtluka@redhat.com
lnst/Slave/InterfaceManager.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lnst/Slave/InterfaceManager.py b/lnst/Slave/InterfaceManager.py index 697119a..b21c962 100644 --- a/lnst/Slave/InterfaceManager.py +++ b/lnst/Slave/InterfaceManager.py @@ -563,7 +563,7 @@ class Device(object):
for m_id in self._master["other"]: m_dev = self._if_manager.get_device(m_id)
if m_dev:
if m_dev and self._if_index not in m_dev.get_master()["other"]: m_dev.clear_configuration() if self._conf != None and self._configured:
@@ -638,7 +638,7 @@ class Device(object):
for m_id in self._master["other"]: m_dev = self._if_manager.get_device(m_id)
if m_dev:
if m_dev and self._if_index not in m_dev.get_master()["other"]: m_dev.deconfigure() if self._conf != None and self._configured:
-- 2.7.4 _______________________________________________ LNST-developers mailing list -- lnst-developers@lists.fedorahosted.org To unsubscribe send an email to lnst-developers-leave@lists.fedorahosted.org
Acked-by: Ondrej Lichtner olichtne@redhat.com
Thu, Apr 06, 2017 at 11:11:27AM CEST, jtluka@redhat.com wrote:
When a user configures veth pair with both veths under root namespace the infinite recursion is triggered.
Each device of veth pair stores a reference to it's peer in Device's _master["other"]. It means that LNST will have two veth devices each referencing the peer as master:
(veth1) (veth2) Device1._if_index == 10 Device2._if_index == 20 Device1._master["other"] = [20] Device2._master["other"] = [10]
On deconfiguration of the veth pair LNST will try to deconfigure first veth but since it references second veth as master it will start deconfiguring this master interface. The second interface references the first interface as master so it will attempt to deconfigure the first veth device again, and so on until max level of recursion is reached.
This patch adds a check if the device that is deconfigured is referenced by it's 'other' master. If the reference exists the deconfiguration of master device will be skipped.
Fixes #187
Signed-off-by: Jan Tluka jtluka@redhat.com
Pushed.
-Jan
lnst-developers@lists.fedorahosted.org