]> git.ipfire.org Git - thirdparty/lldpd.git/commitdiff
Add a receive-only mode with "-r" switch.
authorVincent Bernat <bernat@luffy.cx>
Thu, 26 Aug 2010 13:35:32 +0000 (15:35 +0200)
committerVincent Bernat <bernat@luffy.cx>
Thu, 26 Aug 2010 13:35:32 +0000 (15:35 +0200)
CHANGELOG
man/lldpd.8
src/lldpd.c
src/lldpd.h

index bc30ad894765cb2e9ab60895ed670d2e5a3e5a41..a142b13afb19eea94afa08d84f05dc39bc14f0b2 100644 (file)
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,7 @@
 lldpd (0.5.2)
   * Features:
     + More flexible smart mode and new default. Manual page has been updated.
+    + Add a "receive-only" mode with "-r" switch.
 
 lldpd (0.5.1)
   * Features:
index ae3d8d246b41fd734d9dd237f7c07688e855bcc3..3df1d5d79c0882d3bda9f59dc6e3d608d299e524 100644 (file)
@@ -21,7 +21,7 @@
 .Nd LLDP daemon
 .Sh SYNOPSIS
 .Nm
-.Op Fl dxcseikl
+.Op Fl dxcseiklr
 .Op Fl S Ar description
 .Op Fl X Ar socket
 .Op Fl m Ar management
@@ -106,6 +106,10 @@ Force to send LLDP packets even when there is no LLDP peer detected
 but there is a peer speaking another protocol detected. By default,
 LLDP packets are sent when there is a peer speaking LLDP detected or
 when there is no peer at all.
+.It Fl r
+Receive-only mode. With this switch,
+.Nm
+will not send any frame. It will only listen to neighbors.
 .It Fl m Ar management
 Specify the management address of this system.
 .Nm
index 1c4b8ef1a1e8f70740022f648dec037bf9ab2f1d..3827a11c97b172a8399287e0bad2432ba5bffbcb 100644 (file)
@@ -987,7 +987,8 @@ lldpd_loop(struct lldpd *cfg)
        lldpd_update_localports(cfg);
        lldpd_cleanup(cfg);
        lldpd_update_localchassis(cfg);
-       lldpd_send_all(cfg);
+       if (!cfg->g_receiveonly)
+               lldpd_send_all(cfg);
        lldpd_recv_all(cfg);
 }
 
@@ -1066,7 +1067,7 @@ lldpd_main(int argc, char *argv[])
 #endif
        char *mgmtp = NULL;
        char *popt, opts[] = 
-               "H:hkdxX:m:p:M:S:i@                    ";
+               "H:hkrdxX:m:p:M:S:i@                    ";
        int i, found, advertise_version = 1;
 #ifdef ENABLE_LLDPMED
        int lldpmed = 0, noinventory = 0;
@@ -1074,6 +1075,7 @@ lldpd_main(int argc, char *argv[])
         char *descr_override = NULL;
        char *lsb_release = NULL;
        int smart = 15;
+       int receiveonly = 0;
 
        saved_argv = argv;
 
@@ -1092,6 +1094,9 @@ lldpd_main(int argc, char *argv[])
                case 'd':
                        debug++;
                        break;
+               case 'r':
+                       receiveonly = 1;
+                       break;
                case 'm':
                        mgmtp = optarg;
                        break;
@@ -1193,6 +1198,7 @@ lldpd_main(int argc, char *argv[])
 
        cfg->g_mgmt_pattern = mgmtp;
        cfg->g_smart = smart;
+       cfg->g_receiveonly = receiveonly;
 
        /* Get ioctl socket */
        if ((cfg->g_sock = socket(AF_INET, SOCK_DGRAM, 0)) == -1)
index 0a58b401426b53c24801f270450fbf903388a549..db1b4de9fc678b551f345e36b3a690b1b2c50e20 100644 (file)
@@ -310,6 +310,7 @@ struct lldpd {
        time_t                   g_lastsent;
        int                      g_lastrid;
        int                      g_smart;
+       int                      g_receiveonly;
 #ifdef USE_SNMP
        int                      g_snmp;
 #endif /* USE_SNMP */