]> git.ipfire.org Git - thirdparty/lldpd.git/commitdiff
daemon: ensure chassis-related changes are updated immediately
authorVincent Bernat <vincent@bernat.im>
Sat, 30 Dec 2017 12:21:33 +0000 (13:21 +0100)
committerVincent Bernat <vincent@bernat.im>
Sat, 30 Dec 2017 12:21:33 +0000 (13:21 +0100)
NEWS
src/daemon/client.c
src/daemon/lldpd.c
src/daemon/lldpd.h
tests/integration/test_basic.py

diff --git a/NEWS b/NEWS
index b1f9c298503c998dd5b91b12afbc7d44fa225cee..c2f89ca427d88b415732d8f468a1ea30352230ab 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,7 @@
+lldpd (1.0.0)
+  * Fix:
+    + Ensure chassis-related changes are propagated immediately.
+
 lldpd (0.9.9)
   * Changes:
     + lldpcli can now display local interfaces with LLDP data sent on
index cb59ffbd8c5634a143c74e624f6096f74d8bf976..05d6ae6521464186bd3959738aa953b0d064cf2b 100644 (file)
@@ -142,6 +142,7 @@ client_handle_set_configuration(struct lldpd *cfg, enum hmsg_type *type,
                    config->c_description?config->c_description:"(NULL)");
                free(cfg->g_config.c_description);
                cfg->g_config.c_description = xstrdup(config->c_description);
+               lldpd_update_localchassis(cfg);
                levent_update_now(cfg);
        }
        if (CHANGED_STR(c_platform)) {
@@ -149,6 +150,7 @@ client_handle_set_configuration(struct lldpd *cfg, enum hmsg_type *type,
                    config->c_platform?config->c_platform:"(NULL)");
                free(cfg->g_config.c_platform);
                cfg->g_config.c_platform = xstrdup(config->c_platform);
+               lldpd_update_localchassis(cfg);
                levent_update_now(cfg);
        }
        if (CHANGED_STR(c_hostname)) {
@@ -156,6 +158,7 @@ client_handle_set_configuration(struct lldpd *cfg, enum hmsg_type *type,
                    config->c_hostname?config->c_hostname:"(NULL)");
                free(cfg->g_config.c_hostname);
                cfg->g_config.c_hostname = xstrdup(config->c_hostname);
+               lldpd_update_localchassis(cfg);
                levent_update_now(cfg);
        }
        if (CHANGED(c_set_ifdescr)) {
index 3f3f8f90261814e823af5e13acd32e4815c4bd73..833684258ba02ba92f8b849473a69e912356140e 100644 (file)
@@ -1128,7 +1128,7 @@ lldpd_routing_enabled(struct lldpd *cfg)
        return routing;
 }
 
-static void
+void
 lldpd_update_localchassis(struct lldpd *cfg)
 {
        struct utsname un;
index 5d2924f29e66524b2bba1581288f2e80d7d51491..55fcfa3835736a54010290a07626c6281169f6eb 100644 (file)
@@ -114,6 +114,7 @@ void         lldpd_send(struct lldpd_hardware *);
 void    lldpd_loop(struct lldpd *);
 int     lldpd_main(int, char **, char **);
 void    lldpd_update_localports(struct lldpd *);
+void    lldpd_update_localchassis(struct lldpd *);
 void    lldpd_cleanup(struct lldpd *);
 
 /* frame.c */
index 1b92ef102c8e95ed5516f314bd81535ebe209c38..5c762c65cb6b0bdd6ab911bec4f8a44b3f14d407 100644 (file)
@@ -93,6 +93,17 @@ def test_overrided_description(lldpd1, lldpd, lldpcli, namespaces):
         assert out['lldp.eth0.chassis.descr'] == "Modified description"
 
 
+def test_overrided_description2(lldpd1, lldpd, lldpcli, namespaces):
+    with namespaces(2):
+        lldpd()
+        lldpcli("configure", "system", "description", "Modified description")
+        lldpcli("update")
+        time.sleep(1)
+    with namespaces(1):
+        out = lldpcli("-f", "keyvalue", "show", "neighbors")
+        assert out['lldp.eth0.chassis.descr'] == "Modified description"
+
+
 def test_hide_kernel(lldpd1, lldpd, lldpcli, namespaces):
     with namespaces(2):
         lldpd("-k")