Vincent Bernat [Wed, 19 Dec 2012 21:15:27 +0000 (22:15 +0100)]
libevent: use a git submodule
Instead of shipping the whole tarball for libevent in git, just use a
submodule against the official repository. ./autogen.sh is also
updated to be able to compile it.
Vincent Bernat [Mon, 17 Dec 2012 06:48:02 +0000 (07:48 +0100)]
lldpctl: new JSON output
JSON output is done with "Jansson", a convenient JSON library. The
output may be a bit difficult to use when a multivalued field with
only one value is present. In this case, it is not put into an
array. For example, if there is only one neighbor, you get:
`{interface:{eth0: ...}}` while you will get this for two neighbors:
`{interface:[{eth0:...},{eth1:...}]}`.
Vincent Bernat [Mon, 12 Nov 2012 15:36:55 +0000 (16:36 +0100)]
lldpd: add possibility to disable LLDP
LLDP was mandatory. It is now possible to disable it entirely with
`-ll`. In this case, when no neighbor is detected, the first enabled
protocol will be used. For example, with `-ll -c`, lldpd will act as a
pure CDP daemon.
Vincent Bernat [Fri, 31 Aug 2012 09:52:20 +0000 (11:52 +0200)]
lldpd: move configuration stuff into a dedicated structure
Configuration stuff was mixed with runtime stuff in `struct lldpd`. We
put the configuration stuff into an appropriate structure to be able
to export it to lldpctl.
Vincent Bernat [Thu, 30 Aug 2012 12:53:27 +0000 (14:53 +0200)]
client: use libevent's bufferevent infrastructure to handle clients
Previously, lldpd would block if the unix socket with the client was
full (buggy client). This was not really a problem since a client
needs to output some data to get some other data and therefore only
evil clients may block lldpd. However, with (future) notifications, a
hang client could stop lldpd from working. We may still eat a lot of
memory if a client stay stuck.
Vincent Bernat [Tue, 14 Aug 2012 15:06:23 +0000 (17:06 +0200)]
Separate daemon and client code. Provide a client library.
In `daemon/`, we have what is exclusively used by lldpd. In `client/`,
we have what is exclusively used by lldpctl and in `lib/`, we have a
library that will talk to the daemon and can be used to build other
clients. lldpctl is using this library.
This is a mega commit.
There are also some extra little changes, notably, adding a line to
each file to set "openbsd" as the default C style.
Vincent Bernat [Wed, 30 May 2012 08:41:23 +0000 (10:41 +0200)]
lldpd: demote "unable to guess" to debug
This message can happen fairly often if some protocol is not enabled
in lldpd without being a problem. It fills system daemon logs. Send it
only to debug level.
Vincent Bernat [Fri, 4 May 2012 20:22:56 +0000 (22:22 +0200)]
automake: libevent.la is not a convenience library
Since libevent.la is not a convenience library, we cannot merge it
into liblldpd.la. Therefore, we link it to lldpd directly (and don't
try to build a convenience library from it).
Vincent Bernat [Fri, 4 May 2012 09:48:40 +0000 (11:48 +0200)]
marshal: use zero-sized array instead of flexible arrays
With gcc 2.96, flexible arrays are not supported, even with
-std=gnu99. And with gcc 3.x, zero-sized arrays cannot be statically
initialized (with more than one element).
Vincent Bernat [Tue, 1 May 2012 13:28:41 +0000 (15:28 +0200)]
configure: enable compilation of a libevent archive
README.md has been updated for those instructions. We still rely on
libtool to make this work. Unfortunately, the generated libtool comes
too late: we can't use it...
Vincent Bernat [Mon, 30 Apr 2012 23:33:42 +0000 (01:33 +0200)]
lldpd: switch to libevent loop
This is a major change. Instead of a custom loop, we switch to
libevent. Only `levent.c` is aware of the event loop. Other parts do
not manipulate events. Currently, we still have a loop triggered every
30 seconds. This could change to be a per port handling.
Vincent Bernat [Fri, 27 Jan 2012 11:30:41 +0000 (12:30 +0100)]
configure: upgrade to libevent 2.x
Also, when linking with a static version of libevent, we enforce the
use of libtool ".la" file instead of ".a" to get appropriate
dependencies automatically and avoid a warning when linking inside a
".la".
Vincent Bernat [Thu, 1 Jul 2010 09:29:48 +0000 (11:29 +0200)]
Integration of libevent into the build system.
"configure" will check that libevent is present. It is possible to use
--with-libevent option to tell where libevent lives. We include the
possibility to use a static copy of libevent but with the absence of a
.pc file, we are not sure to handle all the dependencies correctly.
README file is updated with instructions about libevent, including
steps to build libevent inside lldpd.
Vincent Bernat [Tue, 1 May 2012 08:54:05 +0000 (10:54 +0200)]
lldpd: fix chassis copy
When a chassis is already known, we copy the new one over the old one
and keep the old one. With the addition of management addresses as a
list, the copy was incorrect. We fix it. This is kludgy. A better way
would be to use marshaling but marshaling is not able to do inplace
copy and it is not able to restore full list (previous pointer is not
restored).
Vincent Bernat [Tue, 1 May 2012 08:16:10 +0000 (10:16 +0200)]
valgrind: initialize some buffers to make valgrind happy
Valgrind does not understand some ioctl and thinks we are using
unitialized buffers while the ioctl will initialize them. We get rid
of those warnings by initializing them ourselves.
Vincent Bernat [Mon, 30 Apr 2012 23:50:03 +0000 (01:50 +0200)]
When running on valgrind, don't chroot or drop privileges
Valgrind documentation says:
You are encouraged to copy the valgrind/*.h headers into your
project's include directory, so your program doesn't have a
compile-time dependency on Valgrind being installed. The Valgrind
headers, unlike most of the rest of the code, are under a BSD-style
license so you may include them without worrying about license
incompatibility.
I don't like copying headers around. Therefore, there is an autoconf
check for valgrind headers.
João Valverde [Tue, 6 Mar 2012 14:08:59 +0000 (14:08 +0000)]
Support for multiple IPv4/IPv6 management addresses.
This patch introduces a new 'struct lldpd_mgmt' to store IPv4/IPv6
management addresses. These addresses are stored in a tail queue.
For the local chassis we currently only use one IPv4 and one IPv6 address.
Options for IPv6 addresses are the same as IPv4 (use -6).