* Changes:
+ lldpcli can now display local interfaces with LLDP data sent on
each of them ("show interfaces").
+ * Fix:
+ + Don't remove interfaces when they are released from a bridge.
lldpd (0.9.8)
* Changes:
TAILQ_FOREACH(ifdold, ifs, next) {
if (ifdold->index == ifdnew->index) break;
}
+ if (msg->nlmsg_type == RTM_DELLINK && ifdnew->upper_idx != -1) {
+ /* This happens for bridges */
+ log_debug("netlink",
+ "removal request for %s, but has a master, convert it",
+ ifdnew->name);
+ ifdnew->upper_idx = -1;
+ msg->nlmsg_type = RTM_NEWLINK;
+ }
+
if (msg->nlmsg_type == RTM_NEWLINK) {
if (ifdold == NULL) {
log_debug("netlink", "interface %s is new",
if (ifdold == NULL) {
log_warnx("netlink",
"removal request for %s, but no knowledge of it",
- ifdnew->name);
+ ifdnew->name);
} else {
log_debug("netlink", "interface %s is to be removed",
ifdold->name);
idx = ipr.link_lookup(ifname=name)[0]
ipr.link('del', index=idx)
+ def nomaster(self, name):
+ ipr = pyroute2.IPRoute()
+ idx = ipr.link_lookup(ifname=name)[0]
+ ipr.link('set', index=idx, master=0)
+
@pytest.fixture
def links():
assert out['lldp.eth0.chassis.Bridge.enabled'] == 'on'
+def test_remove_bridge(lldpd, lldpcli, namespaces, links):
+ links(namespaces(1), namespaces(2))
+ links(namespaces(3), namespaces(1)) # Another link to setup a bridge
+ with namespaces(1):
+ links.bridge('br42', 'eth0', 'eth3')
+ lldpd("-r")
+ with namespaces(2):
+ lldpd()
+ time.sleep(2)
+ lldpcli("pause") # Prevent any updates
+ with namespaces(1):
+ out = lldpcli("-f", "keyvalue", "show", "neighbors", "details")
+ assert out['lldp.eth0.port.descr'] == 'eth1'
+ # Remove from bridge
+ links.nomaster('eth0')
+ time.sleep(1)
+ # Check if we still have eth0
+ out = lldpcli("-f", "keyvalue", "show", "neighbors", "details")
+ assert out['lldp.eth0.port.descr'] == 'eth1'
+
+
@pytest.mark.skipif('Dot1' not in pytest.config.lldpd.features,
reason="Dot1 not supported")
@pytest.mark.parametrize('when', ['before', 'after'])