If a bridge device (t_br0) is removed and another device (e.g. t_vlan0)
references it as IFLA_MASTER (ie. the device was previously added to the bridge),
an RTM_DELLINK is sent by kernel to userspace for t_vlan0 device before the
bridge device is removed.
The InterfaceManager handles all RTM_DELLINK as a notification of removal of
a device. In this case however, the RTM_DELLINK has a special meaning that the
link between t_vlan0 and t_br0 does not exist anymore, and is indicated by
PF_BRIDGE (value 7) family in the RTM_DELLINK message.
Without this patch, upon delivery of such message, the t_vlan0 device is
removed from the InterfaceManager's device list and marked as deleted. Later
on during the deconfiguration, the actual removal (ip link delete) of the
device is skipped because LNST thinks it has been already deleted.
Signed-off-by: Jan Tluka <jtluka(a)redhat.com>
---
lnst/Slave/InterfaceManager.py | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/lnst/Slave/InterfaceManager.py b/lnst/Slave/InterfaceManager.py
index 858c32f1..221d386f 100644
--- a/lnst/Slave/InterfaceManager.py
+++ b/lnst/Slave/InterfaceManager.py
@@ -38,6 +38,7 @@ from pyroute2.netlink.rtnl import RTM_GETADDR
from pyroute2.netlink.rtnl import RTM_DELADDR
NL_GROUPS = RTMGRP_IPV4_IFADDR | RTMGRP_IPV6_IFADDR | RTMGRP_LINK
+PF_BRIDGE = 7
class InterfaceManager(object):
def __init__(self, server_handler):
@@ -127,6 +128,9 @@ class InterfaceManager(object):
dev._disable()
elif msg['header']['type'] == RTM_DELLINK:
+ if msg['family'] == PF_BRIDGE:
+ return
+
if msg['index'] in self._devices:
dev = self._devices[msg['index']]
dev._deleted = True
--
2.21.3