]> git.proxmox.com Git - mirror_ifupdown2.git/blobdiff - ifupdown2/addons/bridge.py
ifupdown2 loses interfaces on second down of swp port
[mirror_ifupdown2.git] / ifupdown2 / addons / bridge.py
index ebc9fbf18402bf747978f678d4f8fa882792f28b..2a54fb2e4166c056a7b812770d62373dbfdf6585 100644 (file)
@@ -15,6 +15,9 @@ import itertools
 import re
 import time
 
+class bridgeFlags:
+    PORT_PROCESSED = 0x1
+
 class bridge(moduleBase):
     """  ifupdown2 addon module to configure linux bridges """
 
@@ -190,14 +193,10 @@ class bridge(moduleBase):
                           'example' : ['bridge-port-pvids bond0=100 bond1=200']},
                      }}
 
-    # declare some ifaceobj priv_flags.
-    # XXX: This assumes that the priv_flags is owned by this module
-    # which it is not.
-    _BRIDGE_PORT_PROCESSED = 0x1
-
     def __init__(self, *args, **kargs):
         moduleBase.__init__(self, *args, **kargs)
         self.ipcmd = None
+        self.name = self.__class__.__name__
         self.brctlcmd = None
         self._running_vidinfo = {}
         self._running_vidinfo_valid = False
@@ -787,7 +786,8 @@ class bridge(moduleBase):
                continue
             for bportifaceobj in bportifaceobjlist:
                 # Dont process bridge port if it already has been processed
-                if bportifaceobj.priv_flags & self._BRIDGE_PORT_PROCESSED:
+                if (bportifaceobj.module_flags.get(self.name,0x0) & \
+                    bridgeFlags.PORT_PROCESSED):
                     continue
                 try:
                     # Add attributes specific to the vlan aware bridge
@@ -816,7 +816,8 @@ class bridge(moduleBase):
                                                               bridge_vids,
                                                               bridge_pvid)
            self._apply_bridge_port_settings(ifaceobj, bridgename=bridgename)
-           ifaceobj.priv_flags |= self._BRIDGE_PORT_PROCESSED
+           ifaceobj.module_flags[self.name] = ifaceobj.module_flags.setdefault(self.name,0) | \
+                                              bridgeFlags.PORT_PROCESSED
            return
         if not self._is_bridge(ifaceobj):
             return