From: Vincent Bernat Date: Sat, 30 Dec 2017 12:21:33 +0000 (+0100) Subject: daemon: ensure chassis-related changes are updated immediately X-Git-Tag: 1.0.0~21^2~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e6f64ed93e6c223e7e7fab3ad994d85497d8e1e7;p=thirdparty%2Flldpd.git daemon: ensure chassis-related changes are updated immediately --- diff --git a/NEWS b/NEWS index b1f9c298..c2f89ca4 100644 --- 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 diff --git a/src/daemon/client.c b/src/daemon/client.c index cb59ffbd..05d6ae65 100644 --- a/src/daemon/client.c +++ b/src/daemon/client.c @@ -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)) { diff --git a/src/daemon/lldpd.c b/src/daemon/lldpd.c index 3f3f8f90..83368425 100644 --- a/src/daemon/lldpd.c +++ b/src/daemon/lldpd.c @@ -1128,7 +1128,7 @@ lldpd_routing_enabled(struct lldpd *cfg) return routing; } -static void +void lldpd_update_localchassis(struct lldpd *cfg) { struct utsname un; diff --git a/src/daemon/lldpd.h b/src/daemon/lldpd.h index 5d2924f2..55fcfa38 100644 --- a/src/daemon/lldpd.h +++ b/src/daemon/lldpd.h @@ -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 */ diff --git a/tests/integration/test_basic.py b/tests/integration/test_basic.py index 1b92ef10..5c762c65 100644 --- a/tests/integration/test_basic.py +++ b/tests/integration/test_basic.py @@ -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")