Commit 6a37f505 authored by Tomáš Peterka's avatar Tomáš Peterka

Disallow attaching non-bridges already in the constructor

parent 457e14c4
...@@ -940,7 +940,7 @@ class Interface(object): ...@@ -940,7 +940,7 @@ class Interface(object):
# Attach to TAP network interface, only if the interface interface does not # Attach to TAP network interface, only if the interface interface does not
# report carrier # report carrier
_, result = callAndRead(['ip', 'addr', 'list', self.name], raise_on_error=False) _, result = callAndRead(['ip', 'addr', 'list', self.name], raise_on_error=False)
self.attach_to_tap = 'DOWN' in result.split('\n', 1)[0] self.attach_to_tap = self.isBridge() and ('DOWN' in result.split('\n', 1)[0])
# XXX no __getinitargs__, as instances of this class are never deserialized. # XXX no __getinitargs__, as instances of this class are never deserialized.
...@@ -1022,7 +1022,7 @@ class Interface(object): ...@@ -1022,7 +1022,7 @@ class Interface(object):
if self.isBridge(): if self.isBridge():
callAndRead(['brctl', 'addif', self.name, tap.name]) callAndRead(['brctl', 'addif', self.name, tap.name])
else: else:
self.logger.warning("Interface slapos.cfg:interface_name={} is not a bridge." self.logger.warning("Interface slapos.cfg:interface_name={} is not a bridge. "
"TUN/TAP interface {} might not have internet connection." "TUN/TAP interface {} might not have internet connection."
"".format(self.name, tap.name)) "".format(self.name, tap.name))
......
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