From 7b56575ebdcda00aae3c67b697cda3b66a88589c Mon Sep 17 00:00:00 2001 From: Julien Fortin Date: Mon, 1 Jun 2020 18:12:29 +0200 Subject: [PATCH] nlcache: force_add_slave: don't update internal data-structure if not needed force_add_slave was designed to be called right after the link_set_master call to override our internal cache and not wait for the kernel and register the slave/master relationship in our internal data-structures. It turns out the kernel can be faster than us here. So an additional check is needed to make sure we don't do duplicate operations that would result in the slave being removed from an internal data-structure. Signed-off-by: Julien Fortin --- ifupdown2/lib/nlcache.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ifupdown2/lib/nlcache.py b/ifupdown2/lib/nlcache.py index b836f21..df425b4 100644 --- a/ifupdown2/lib/nlcache.py +++ b/ifupdown2/lib/nlcache.py @@ -1424,7 +1424,7 @@ class _NetlinkCache: # structure as well. old_master = self._slaves_master.get(slave) - if old_master: + if old_master and old_master != master: try: self._masters_and_slaves.get(old_master, []).remove(slave) except: