]> git.proxmox.com Git - mirror_ifupdown2.git/commitdiff
addons: mstpctl: bridge vlan-unaware: check brport running config before setting...
authorJulien Fortin <julien@cumulusnetworks.com>
Tue, 3 Jul 2018 16:40:05 +0000 (18:40 +0200)
committerJulien Fortin <julien@cumulusnetworks.com>
Thu, 13 Dec 2018 22:43:57 +0000 (14:43 -0800)
when handling mstpctl attribute on vlan-unaware bridges we don't
check the running configuration of the bridge ports (cache) thus
misconfiguring some attributes on brports.

We first create a traditional bridge with:

auto bridge1
iface bridge1
    bridge-ports swp1 swp2
    bridge-vlan-aware no
We check the setting:

$ mstpctl showportdetail bridge1 swp1 | grep edge
  admin edge port    no                      auto edge port       yes
  oper edge port     yes                     topology change ack  no
We then add the setting for swp1:

auto swp1
iface swp1
    mstpctl-portautoedge no
We then do an ifreload -adv and we see two calls. First
info: executing /sbin/mstpctl setportautoedge bridge1 swp1 no

and then a little later
info: executing /sbin/mstpctl setportautoedge bridge1 swp1 yes

Reviewed-by: Roopa Prabhu <roopa@cumulusnetworks.com>
Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
ifupdown2/addons/mstpctl.py

index a13e8b6268088249b6354749abe586dc41e184ea..09093391d031fb08df5a84ff9647351d0c79ec6a 100644 (file)
@@ -423,9 +423,14 @@ class mstpctl(moduleBase):
                                 if not self.brctlcmd.is_bridge_port(port):
                                     continue
 
-                                bport_ifaceobj = ifaceobj_getfunc(port)
-                                if bport_ifaceobj:
-                                    default_val = self._get_default_val(attrname, bport_ifaceobj[0], ifaceobj)
+                                bport_ifaceobjs = ifaceobj_getfunc(port)
+                                if bport_ifaceobjs:
+                                    default_val = self._get_default_val(attrname, bport_ifaceobjs[0], ifaceobj)
+                                    for brport_ifaceobj in bport_ifaceobjs or []:
+                                        attr_value = brport_ifaceobj.get_attr_value_first(attrname)
+                                        if attr_value:
+                                            default_val = attr_value
+                                            break
 
                                 self.mstpctlcmd.set_bridge_port_attr(ifaceobj.name,
                                                                      port,