Commit 96656176 authored by Martín Ferrari's avatar Martín Ferrari

Fix bug which caused an infinite loop when creating a NodeInterface with an invalid parameter

parent 168ed41e
...@@ -56,7 +56,17 @@ class NSInterface(Interface): ...@@ -56,7 +56,17 @@ class NSInterface(Interface):
# some black magic to automatically get/set interface attributes # some black magic to automatically get/set interface attributes
def __getattr__(self, name): def __getattr__(self, name):
iface = self._slave.get_if_data(self.index) # If name starts with _, it must be a normal attr
if name[0] == '_':
return super(Interface, self).__getattribute__(name)
try:
slave = super(Interface, self).__getattribute__("_slave")
except:
# Not initialised yet
return super(Interface, self).__getattribute__(name)
iface = slave.get_if_data(self.index)
return getattr(iface, name) return getattr(iface, name)
def __setattr__(self, name, value): def __setattr__(self, name, value):
...@@ -349,9 +359,6 @@ class Switch(ExternalInterface): ...@@ -349,9 +359,6 @@ class Switch(ExternalInterface):
setattr(iface, name, value) setattr(iface, name, value)
netns.iproute.set_bridge(iface) netns.iproute.set_bridge(iface)
def __del__(self):
self.destroy()
def destroy(self): def destroy(self):
if not self.index: if not self.index:
return return
......
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