From: Julien Fortin Date: Tue, 3 Jul 2018 16:40:05 +0000 (+0200) Subject: addons: mstpctl: bridge vlan-unaware: check brport running config before setting... X-Git-Tag: 1.2.2-1~74 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=4b0b3fa3a0be98322a931b993c8609f15c94299a;p=mirror_ifupdown2.git addons: mstpctl: bridge vlan-unaware: check brport running config before setting attributes 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 Signed-off-by: Julien Fortin --- diff --git a/ifupdown2/addons/mstpctl.py b/ifupdown2/addons/mstpctl.py index a13e8b6..0909339 100644 --- a/ifupdown2/addons/mstpctl.py +++ b/ifupdown2/addons/mstpctl.py @@ -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,