diff --git a/ifupdown2/addons/bond.py b/ifupdown2/addons/bond.py index bfd40d2..924fe09 100644 --- a/ifupdown2/addons/bond.py +++ b/ifupdown2/addons/bond.py @@ -381,6 +381,10 @@ class bond(Addon, moduleBase): if clag_bond or ifaceobj.link_privflags & ifaceLinkPrivFlags.ES_BOND: try: self.netlink.link_set_protodown_on(slave) + if clag_bond: + self.iproute2.link_set_protodown_reason_clag_on(slave) + else: + self.iproute2.link_set_protodown_reason_frr_on(slave) except Exception as e: self.logger.error('%s: %s' % (ifaceobj.name, str(e))) @@ -406,13 +410,14 @@ class bond(Addon, moduleBase): for s in runningslaves: # make sure that slaves are not in protodown since we are not in the clag-bond or es-bond case if not clag_bond and not ifaceobj.link_privflags & ifaceLinkPrivFlags.ES_BOND and self.cache.get_link_protodown(s): + self.iproute2.link_set_protodown_reason_clag_off(s) self.netlink.link_set_protodown_off(s) - if s not in slaves: self.sysfs.bond_remove_slave(ifaceobj.name, s) removed_slave.append(s) if clag_bond: try: + self.iproute2.link_set_protodown_reason_clag_off(s) self.netlink.link_set_protodown_off(s) except Exception as e: self.logger.error('%s: %s' % (ifaceobj.name, str(e))) diff --git a/ifupdown2/lib/iproute2.py b/ifupdown2/lib/iproute2.py index f7f762a..868b91f 100644 --- a/ifupdown2/lib/iproute2.py +++ b/ifupdown2/lib/iproute2.py @@ -427,6 +427,18 @@ class IPRoute2(Cache, Requirements): def link_add_openvswitch(self, ifname, kind): self.__update_cache_after_link_creation(ifname, kind) + def link_set_protodown_reason_clag_on(self, ifname): + utils.exec_command("%s link set dev %s protodown_reason clag on" % (utils.ip_cmd, ifname)) + + def link_set_protodown_reason_clag_off(self, ifname): + utils.exec_command("%s link set dev %s protodown_reason clag off" % (utils.ip_cmd, ifname)) + + def link_set_protodown_reason_frr_on(self, ifname): + utils.exec_command("%s link set dev %s protodown_reason frr on" % (utils.ip_cmd, ifname)) + + def link_set_protodown_reason_frr_off(self, ifname): + utils.exec_command("%s link set dev %s protodown_reason frr off" % (utils.ip_cmd, ifname)) + ############################################################################ # TUNNEL ############################################################################