[lldp-devel] [PATCH 8/8] lldptool add support for VDP TLV

Thomas Richter tmricht at linux.vnet.ibm.com
Fri Apr 5 11:43:36 UTC 2013


Add support for the command 'lldptool -i ethx -t -gncb -V vdp'.
This patchs redirects the collection of the data and the
pretty print of the collected data to the vdp module.
This is a hack and a quick workaround. It overwrites
the lldp_mand module id by the lldp_vdp module id.

In a perfect world a vdptool command would exist to do this.
I will keep this todo on my backlog.

Signed-off-by: Thomas Richter <tmricht at linux.vnet.ibm.com>
---
 lldptool.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/lldptool.c b/lldptool.c
index 512811f..e1ff11f 100644
--- a/lldptool.c
+++ b/lldptool.c
@@ -524,6 +524,8 @@ static int request(struct clif *clif, int argc, char *argv[])
 			if (!command.tlvid || errno || *end != '\0' ||
 			    end == optarg) {
 				command.tlvid = lookup_tlvid(optarg);
+				if (!strcasecmp("vdp", optarg))
+					command.module_id = command.tlvid;
 			}
 
 			if (command.tlvid == INVALID_TLVID) {
@@ -584,6 +586,12 @@ static int request(struct clif *clif, int argc, char *argv[])
 			ret = -1;
 		}
 	}
+	/*
+	 * If -V vdp option is set together with -c option, use standard
+	 * module to retrieve data.
+	 */
+	if ((command.ops & op_config) && command.tlvid == command.module_id)
+		command.module_id = LLDP_MOD_MAND;
 
 	/* if no command was supplied via an option flag, then
 	 * the first remaining argument should be the command.
-- 
1.7.1



More information about the lldp-devel mailing list