]> git.ipfire.org Git - thirdparty/lldpd.git/commitdiff
lldpcli: fix display of LLDP-MED POE TLV
authorVincent Bernat <vincent@bernat.im>
Fri, 11 Mar 2016 23:58:34 +0000 (00:58 +0100)
committerVincent Bernat <vincent@bernat.im>
Fri, 11 Mar 2016 23:59:17 +0000 (00:59 +0100)
NEWS
src/client/display.c

diff --git a/NEWS b/NEWS
index 837833d10a854e09aed3b6903a4a761e3acee94d..fce3e93f70e2dc99c3b35d09e486638a47e41b17 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,8 @@ lldpd (0.9.2)
   * Change:
     + Ability to add/remove/replace custom TLV from lldpcli.
     + LLDP-MED capabilities are displayed differently in lldpcli.
+  * Fix:
+    + LLDP-MED POE TLV are now displayed in lldpcli.
 
 lldpd (0.9.1)
   * Change:
index 6373bbd65a71452c26939902a996402a027e6b39..5101371e044d92312d6a92a7a390eeeca842d82e 100644 (file)
@@ -61,6 +61,7 @@ display_med(struct writer *w, lldpctl_atom_t *port, lldpctl_atom_t *chassis)
        lldpctl_atom_t *medpolicies, *medpolicy;
        lldpctl_atom_t *medlocations, *medlocation;
        lldpctl_atom_t *caelements, *caelement;
+       lldpctl_atom_t *medpower;
        long int cap = lldpctl_atom_get_int(chassis, lldpctl_k_chassis_med_cap);
        const char *type;
 
@@ -180,18 +181,22 @@ display_med(struct writer *w, lldpctl_atom_t *port, lldpctl_atom_t *chassis)
        lldpctl_atom_dec_ref(medlocations);
 
        /* LLDP MED power */
-       if (lldpctl_atom_get_int(port, lldpctl_k_med_power_type) > 0) {
+       medpower = lldpctl_atom_get(port, lldpctl_k_port_med_power);
+       if (lldpctl_atom_get_int(medpower, lldpctl_k_med_power_type) > 0) {
                tag_start(w, "poe", "Extended Power-over-Ethernet");
 
                tag_datatag(w, "device-type", "Power Type & Source",
-                   lldpctl_atom_get_str(port, lldpctl_k_med_power_type));
+                   lldpctl_atom_get_str(medpower, lldpctl_k_med_power_type));
                tag_datatag(w, "source", "Power Source",
-                   lldpctl_atom_get_str(port, lldpctl_k_med_power_source));
+                   lldpctl_atom_get_str(medpower, lldpctl_k_med_power_source));
                tag_datatag(w, "priority", "Power priority",
-                   lldpctl_atom_get_str(port, lldpctl_k_med_power_priority));
+                   lldpctl_atom_get_str(medpower, lldpctl_k_med_power_priority));
                tag_datatag(w, "power", "Power Value",
-                   lldpctl_atom_get_str(port, lldpctl_k_med_power_val));
+                   lldpctl_atom_get_str(medpower, lldpctl_k_med_power_val));
+
+               tag_end(w);
        }
+       lldpctl_atom_dec_ref(medpower);
 
        /* LLDP MED inventory */
        do {