From: Alexandru Ardelean Date: Wed, 15 Apr 2015 12:44:09 +0000 (+0300) Subject: daemon: implement client interface for custom TLVs X-Git-Tag: 0.7.15~25^2~4 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6cff1e665e72960cecdb50edb2d78b8827185343;p=thirdparty%2Flldpd.git daemon: implement client interface for custom TLVs Signed-off-by: Alexandru Ardelean --- 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; }