]> git.ipfire.org Git - thirdparty/lldpd.git/commitdiff
daemon: implement client interface for custom TLVs
authorAlexandru Ardelean <ardeleanalex@gmail.com>
Wed, 15 Apr 2015 12:44:09 +0000 (15:44 +0300)
committerAlexandru Ardelean <ardeleanalex@gmail.com>
Tue, 19 May 2015 06:54:48 +0000 (09:54 +0300)
Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
src/daemon/client.c

index e4485e122c0472dd84ec06764df7882f79514dc2..2f98c393e563df513a1516efacc917fdf9a5b33b 100644 (file)
@@ -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;
 }