From 6cff1e665e72960cecdb50edb2d78b8827185343 Mon Sep 17 00:00:00 2001 From: Alexandru Ardelean Date: Wed, 15 Apr 2015 15:44:09 +0300 Subject: [PATCH] daemon: implement client interface for custom TLVs Signed-off-by: Alexandru Ardelean --- src/daemon/client.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/daemon/client.c b/src/daemon/client.c index e4485e12..2f98c393 100644 --- a/src/daemon/client.c +++ b/src/daemon/client.c @@ -369,6 +369,20 @@ client_handle_set_port(struct lldpd *cfg, enum hmsg_type *type, sizeof(struct lldpd_dot3_power)); } #endif + if (set->custom_list_clear) { + log_debug("rpc", "requested custom TLVs clear"); + lldpd_custom_list_cleanup(port); + } else + if (set->custom) { + struct lldpd_custom *custom; + log_debug("rpc", "requested custom TLV add"); + if ((custom = malloc(sizeof(struct lldpd_custom)))) { + memcpy(custom, set->custom, sizeof(struct lldpd_custom)); + TAILQ_INSERT_TAIL(&port->p_custom_list, custom, next); + } else + log_warn("rpc", "could not allocate memory for custom TLV"); + } + ret = 1; break; } @@ -391,6 +405,9 @@ set_port_finished: #endif #ifdef ENABLE_DOT3 free(set->dot3_power); +#endif +#ifdef ENABLE_CUSTOM + free(set->custom); #endif return 0; } -- 2.39.5