We can't request dh-autoreconf and have a buggy dh_installinit at the
same time. Let's remove this code about upstart. This only needs to be
fixed in backports.
Vincent Bernat [Sun, 31 Mar 2013 16:33:33 +0000 (18:33 +0200)]
lldpd: enforce TTL on remote chassis
Remote chassis were not expired in a timely manner. They were only
expired when a change happened on an interface. To fix this, we
maintain a timer that will be triggered when an interface is about to
expire. The timer is updated when a change happens and rescheduled
once it is run.
Vincent Bernat [Sun, 31 Mar 2013 10:59:09 +0000 (12:59 +0200)]
lldpd: limit the maximum of neighbors per port and per protocol
lldpd memory can be exhausted by adding too many neighbors. Moreover,
the communication with lldpcli is limited to a fixed number of
neighbors (packets may not exceed 1 << 19 in size). Therefore, we put
a hard limit to the number of neighbors accepted for a given port, for
a given protocol.
Vincent Bernat [Sat, 30 Mar 2013 14:42:51 +0000 (15:42 +0100)]
lib: fix sync_recv to handle segmentation
While it should not happen with Unix sockets, a read() can return only
partial data. Therefore, we continue to poll until we get the
appropriate length.
Vincent Bernat [Mon, 4 Feb 2013 07:38:08 +0000 (08:38 +0100)]
build: check if libevent as provided by pkg-config is working
If a user installs both libevent 2.0.x and libevent 1.4.x, pkg-config
may report libevent 2.0.x where it really is 1.4.x. The system is
broken in this case but we work-around this by using the shipped
libevent.
Vincent Bernat [Sun, 3 Feb 2013 08:38:19 +0000 (09:38 +0100)]
interfaces: whitelist an interface before being checking lower
Some whitelisted interfaces, like dsa, have a lower interface in
managed mode but we still want to advertise on it. Move the check for
lower interface after whitelisting.
Vincent Bernat [Tue, 29 Jan 2013 20:42:37 +0000 (21:42 +0100)]
libevent: produce smaller binaries when shipping libevent
When shipping libevent, we try to build smaller binaries by disabling
unneeded stuff (openssl, threading, malloc replacement, debug stuff)
and enabling `--gc-sections`. On various tests, this remove 80K from
lldpd size (stripping excluded).
Vincent Bernat [Sat, 19 Jan 2013 15:13:50 +0000 (16:13 +0100)]
lldpd: invoke lldpcli at start
To configure itself, lldpd now invokes lldpcli when
starting. Currently, it does not really check if everything works as
expected but in the future, lldpcli will ask lldpd to "start".
The configuration files are:
- ${sysconfdir}/lldpd.conf
- ${sysconfdir}/lldpd.d/*.conf
Vincent Bernat [Thu, 17 Jan 2013 21:01:34 +0000 (22:01 +0100)]
priv: add ability to lock filter on Linux
This is a new feature which should be available in Linux 3.9. See:
http://git.kernel.org/?p=linux/kernel/git/davem/net-next.git;a=commit;h=d59577b6ffd313d0ab3be39cb1ab47e29bdc9182
Vincent Bernat [Thu, 17 Jan 2013 08:02:48 +0000 (09:02 +0100)]
priv: create chroot if it does not exist
This is not the ideal situation since the chroot should maybe contain
some additional stuff (like `/etc/localtime` with GNU libc) to make it
work properly, but this is more convenient that leaving the user does
exactly the same things. Packagers are still expected to populate the
chroot correctly before starting lldpd.
Vincent Bernat [Mon, 14 Jan 2013 09:21:13 +0000 (10:21 +0100)]
priv: lock BPF interface on BSD
We move all BPF setup in the monitor process. When the socket is
configured, we lock it. This works for both OpenBSD and FreeBSD. This
feature does not seem to exist on Linux. However, for consistency, we
also move BPF filter setup in priv.c for Linux.
Vincent Bernat [Sun, 13 Jan 2013 12:15:52 +0000 (13:15 +0100)]
snmp: workaround unknown value for RONLY
This happens when Net-SNMP has been compiled with
NETSNMP_NO_LEGACY_DEFINITIONS defined. For example, on Mac OS X. This
seems a good way to deprecate an API still widely used just because it
is not used internally... <grin>
Vincent Bernat [Sun, 13 Jan 2013 01:53:37 +0000 (02:53 +0100)]
Small fixes detected by clang analyzer.
- log: mark `fatal*()` function as noreturn
- event: insert client in the list after its creation
- lldpcli: avoid confusion by initializing cargc to 0
- lldpd: avoid ambiguous use of strlen() in initialization
- lldp/edp: fix memory leaks
- tokenizer: fix a memory leak in low memory condition
- cdp: don't accept too short TLV for port description
Vincent Bernat [Sat, 12 Jan 2013 23:23:53 +0000 (00:23 +0100)]
build: more changelog drama
We need ChangeLog to be listed in `dist_doc_DATA` or
`doc_DATA`. Therefore, we list it in the former and if we happen to
install from git, we just ship an empty ChangeLog.
Vincent Bernat [Fri, 11 Jan 2013 00:25:32 +0000 (01:25 +0100)]
build: fix changelog generation
We really only want to generate changelog when building the dist
tarball. We force its generation using a fake PHONY target. We don't
list it as a dist_* something since it does not exist yet. Therefore,
we don't have to clean it.
Vincent Bernat [Thu, 10 Jan 2013 19:23:57 +0000 (20:23 +0100)]
Mac OS X support.
This includes bond, VLAN and bridge support. Mac OS X is pretty
similar to FreeBSD except for bonding which is different. Bonding code
is stolen from ifconfig.c. Header files from XNU are
shipped because they are missing from Mac OS X developer tools.
Still missing:
- integration into launchd
- homebrew formula
- DMI part (through ioreg)
Vincent Bernat [Mon, 7 Jan 2013 20:59:32 +0000 (21:59 +0100)]
priv: mirror the exit status of the child
When exiting because the child has exited, the privileged processus
will mirror the exit status and the signal that killed the child if
any. This allows monitoring daemon like systemd to detect an
unexpected exit.
Vincent Bernat [Sun, 6 Jan 2013 23:24:31 +0000 (00:24 +0100)]
debian: provide an upstart job
lldpd daemonization seems to confuse upstart (I think this is because
it also forks the monitor process, otherwise the daemonization is
pretty classic). Therefore, when we detect we are run by
upstart (because of UPSTART_JOB variable), we raise the SIGSTOP signal
instead of daemonizing. Upstart notices it and will resume us and
consider we are ready. No more misleading fork.
Vincent Bernat [Sun, 6 Jan 2013 13:45:53 +0000 (14:45 +0100)]
build: fix generation of ChangeLog
We must be able to have one when git is not present because we include
it in dist, but we also must generate it on each release. The previous
fix would keep the ChangeLog empty or not updated. We use a PHONY
target instead (and not a real PHONY target since we cannot add it
because automake doesn't like it).
Vincent Bernat [Sun, 6 Jan 2013 10:43:33 +0000 (11:43 +0100)]
lldpcli: make readline library optional.
And improve compatibility. We should be compatible with BSD
libedit. However, we are not compatible with older versions that lack
`rl_insert_text()` and `rl_delete_text()`.
Vincent Bernat [Sun, 6 Jan 2013 09:47:21 +0000 (10:47 +0100)]
lldpcli: switch to GNU Readline.
libedit is not available on old versions of Linux distro. We try to
use Readline API instead which may be compatible with the libedit
version available in BSD.
This means that we have to write our own tokenizer. This also means
that we can make Readline optional.