]> git.ipfire.org Git - thirdparty/lldpd.git/commitdiff
netlink: fix non-updated management address
authorVincent Bernat <vincent@bernat.im>
Thu, 1 Mar 2018 07:02:12 +0000 (08:02 +0100)
committerVincent Bernat <vincent@bernat.im>
Thu, 1 Mar 2018 07:04:09 +0000 (08:04 +0100)
NEWS
src/daemon/netlink.c
tests/integration/test_basic.py

diff --git a/NEWS b/NEWS
index 48db878dc1ea31a3f55f8685a06e41b4d2928cdc..f40ba0f34bd192eb26eceecdf0ff63cfcb63aab1 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -4,6 +4,7 @@ lldpd (1.0.0)
       chassisid".
   * Fix:
     + Ensure chassis-related changes are propagated immediately.
+    + Ensure management address change is correctly detected.
 
 lldpd (0.9.9)
   * Changes:
index 36696139c23c1eb1e1418277362edc2ca9d7d2bb..fdb01001939323ad1596e06f2341ef8ff549761a 100644 (file)
@@ -606,7 +606,7 @@ retry:
                                        TAILQ_FOREACH(ifaold, ifas, next) {
                                                if ((ifaold->index == ifanew->index) &&
                                                    !memcmp(&ifaold->address, &ifanew->address,
-                                                       sizeof(ifaold->address))) continue;
+                                                       sizeof(ifaold->address))) break;
                                        }
                                        if (getnameinfo((struct sockaddr *)&ifanew->address,
                                                sizeof(ifanew->address),
index 1ff7f4b728f77ea5b6f75cd8c2e88e958216d189..d26f8c884e7ea59ef830cd2a7439527c5d655e12 100644 (file)
@@ -164,6 +164,27 @@ def test_management_address(lldpd1, lldpd, lldpcli, links, namespaces):
         assert out["lldp.eth0.chassis.mgmt-ip"] == "172.25.21.47"
 
 
+def test_change_management_address(lldpd1, lldpd, lldpcli, links, namespaces):
+    with namespaces(2):
+        ipr = pyroute2.IPRoute()
+        idx = ipr.link_lookup(ifname="eth1")[0]
+        ipr.addr('add', index=idx, address="192.168.14.2", mask=24)
+        lldpd("-m", "192.168.*")
+        # We need a short TX interval as updating the IP address
+        # doesn't trigger a resend.
+        lldpcli("configure", "lldp", "tx-interval", "2")
+    with namespaces(1):
+        out = lldpcli("-f", "keyvalue", "show", "neighbors")
+        assert out["lldp.eth0.chassis.mgmt-ip"] == "192.168.14.2"
+    with namespaces(2):
+        ipr.addr('del', index=idx, address="192.168.14.2", mask=24)
+        ipr.addr('add', index=idx, address="192.168.14.5", mask=24)
+        time.sleep(5)
+    with namespaces(1):
+        out = lldpcli("-f", "keyvalue", "show", "neighbors")
+        assert out["lldp.eth0.chassis.mgmt-ip"] == "192.168.14.5"
+
+
 def test_portid_subtype_ifname(lldpd1, lldpd, lldpcli, namespaces):
     with namespaces(2):
         lldpd()