]> git.ipfire.org Git - thirdparty/lldpd.git/commitdiff
cdp: force CDPv2 protocol with `-ccc` argument
authorVincent Bernat <bernat@luffy.cx>
Fri, 12 Apr 2013 06:32:25 +0000 (08:32 +0200)
committerVincent Bernat <bernat@luffy.cx>
Fri, 12 Apr 2013 06:33:10 +0000 (08:33 +0200)
NEWS
src/daemon/lldpd.8
src/daemon/lldpd.c

diff --git a/NEWS b/NEWS
index 27ac150eb296220357eb0cb5a74aac54265d39d9..508821eb9f8ea86e8cfd4acd2b8d5767c1f13fc6 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,7 @@ lldpd (0.7.2)
     + Lock BPF interfaces before handing them to chrooted process on
       BSD.
     + Limit the number of neighbors for each port to 4 (per protocol).
+    + Force CDPv2 protocol with argument `-ccc`.
   * Fixes:
     + Driver whitelisting is done before checking if an interface has
       a lower interface in Linux.
index f2a2dfba41b5817ecc5de4fd329075569f3cc918..cfb0191fb5a238fe76165faadf6b767c0726db03 100644 (file)
@@ -154,7 +154,8 @@ using a TCP or UDP socket.
 .It Fl c
 Enable the support of CDP protocol to deal with Cisco routers that do
 not speak LLDP. If repeated, CDPv1 packets will be sent even when
-there is no CDP peer detected.
+there is no CDP peer detected. If repeated once again, CDPv2 packets
+will be sent even when there is no CDP peer detected.
 .It Fl f
 Enable the support of FDP protocol to deal with Foundry routers that do
 not speak LLDP. If repeated, FDP packets will be sent even when there
index bbeafc39442e01ded2869a913e48813a9712583f..952587ac2f3939b96fc0bfbb5a994392aeab2341 100644 (file)
@@ -1288,14 +1288,11 @@ lldpd_main(int argc, char *argv[])
                        found = 0;
                        for (i=0; protos[i].mode != 0; i++) {
                                if (ch == protos[i].arg) {
-                                       protos[i].enabled++;
-                                       protos[i].enabled %= 3;
-                                       /* When an argument enable
-                                          several protocols, only the
-                                          first one can be forced. */
-                                       if (found && protos[i].enabled > 1)
-                                               protos[i].enabled = 1;
-                                       found = 1;
+                                       if (protos[i].enabled < 3) {
+                                               found = 1;
+                                               if (protos[i].enabled++ == 1)
+                                                       break;
+                                       }
                                }
                        }
                        if (!found)