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).
Vincent Bernat [Wed, 29 Feb 2012 22:14:41 +0000 (23:14 +0100)]
lldpd: do not stay stuck in the receive loop
On some corner case conditions, we can stay stuck in the receive loop
because we did not send packets for more than 30 seconds. In this
case, we keep reset the timeout to 30 seconds and we cannot exit the
loop (since the first condition to exit the loop is to have reached
the timeout).
Therefore, we invert the condition. If we have stay too long in the
loop, just exit. We know for sure that we will hit lldpd_send_all()
soon and get back to a sane state.
Also, in receive only state, we are also stuck in the loop. This
forbids us to update data about local chassis and interfaces. We also
fix this.
Vincent Bernat [Sat, 25 Feb 2012 08:06:31 +0000 (09:06 +0100)]
redhat: make the init script compatible with RHEL < 5
On RHEL < 5, killproc, daemon and status does not allow to take a
pidfile as argument. We detect this and omit it to provide such an
argument if needed.
Vincent Bernat [Thu, 26 Jan 2012 22:52:13 +0000 (23:52 +0100)]
marshal: circumvent cast alignment problems using memcpy
gcc was issuing warnings like this:
marshal.c:290:5: warning: cast increases required alignment of target type [-Wcast-align]
They are harmless because for one of them, the target has been
malloced (and therefore is safely aligned to 8 bytes) and for the
other because we know that the target location is the location of a
pointer. For those later cases, assignment is replaced by memcpy().
Vincent Bernat [Thu, 26 Jan 2012 22:14:28 +0000 (23:14 +0100)]
Use %zu for printf() when argument is of kind size_t.
%zu is valid in C99 and is supported by GNU LibC. We'll see if there
exists a portability issue. In this case, %lu and a cast to unsigned
long should be used instead.
Vincent Bernat [Tue, 24 Jan 2012 09:59:39 +0000 (10:59 +0100)]
Change the way Chassis ID is assigned.
By default, chassis ID is assigned the chassis name. Once an
appropriate interface is discovered, the chassis ID is changed to the
MAC address of this interface. In most configurations, the chassis ID
is always set to the MAC address of the first interface, like this was
before this patch.
Vincent Bernat [Mon, 23 Jan 2012 18:55:49 +0000 (19:55 +0100)]
marshal: fix list marshalling and various other changes
Since last element and previous element are a pointer to a pointer, we
should handle this case differently. Unit tests are not failing
because the original memory space is still available on the stack. We
just ignore last and previous. This still allows to use the list for
the most useful operations: TAILQ_EMPTY, TAILQ_FOREACH and
TAILQ_REMOVE. We can't use TAILQ_INSERT_TAIL!
Another important change is that by default, macros will declare an
external structure. MARSHAL_EXPORT variable should be defined only for
one module. Otherwise, marshal structures will be defined several
times.
We also rename `_marshal_*` to `marshal_*_`. This enables more
graceful logging messages.
Vincent Bernat [Sat, 21 Jan 2012 13:42:42 +0000 (14:42 +0100)]
Add a new serialization engine.
The chosen approach is totally different compared to the existing
packing mechanism. Instead of describing the struct with some string
and trying to decode the structure like the compiler would do (with
alignments problem), the structure is now described by its size and
the list of pointers in it. Macros are provided to make this
easy. Here is an example:
This enables the use of pointers, with detection of circular
references and therefore support of lists.
While only pointers need to be described, it is also possible to add
sub structure to avoid specifying (again) its list of pointers if it
has already been specified.
The use of this mechanism should simplify the client/server code.
Vincent Bernat [Mon, 2 Jan 2012 07:27:43 +0000 (08:27 +0100)]
core: optimize BPF filter
When monitoring high trafic interfaces, the BPF filter can become
quite important. We optimize it a bit by first checking if the
ethernet address is a multicast one. If it is not, we only have to
check for EDP.
Vincent Bernat [Sat, 31 Dec 2011 09:52:03 +0000 (10:52 +0100)]
configure: check more SNMP stuff.
First, we check that netsnmp_enable_subagent() exists. Otherwise, this
means that Net-SNMP has been compiled without this feature.
Second, we check if <net-snmp/agent/util_funcs.h> header is
usable. There was incomplete installation of files required by this
header with NetSNMP 5.4 and situation got worse with NetSNMP 5.7. If
the header is not usable, we fallback to define the two functions that
we need.
Vincent Bernat [Fri, 2 Dec 2011 06:35:02 +0000 (07:35 +0100)]
Export TZ=/etc/localtime to fix timestamps.
While chrooted, syslog timestamps does not respect the configured
timezone despite the copy of /etc/localtime inside the chroot. Setting
TZ variable seems to fix this problem.
Vincent Bernat [Thu, 3 Nov 2011 21:44:54 +0000 (22:44 +0100)]
Extend whitelist with possibility to blacklist.
It is possible to specify patterns like "*,!eth1" to blacklist "eth1"
or something like "eth*,wlan*,!wlan*master" to listen to all eth
interfaces and wlan interfaces with the exception of interfaces like
"wlan0master".
Vincent Bernat [Wed, 26 Oct 2011 13:56:07 +0000 (15:56 +0200)]
Don't pack struct hmsg since we are not able to do unaligned access on some archs.
Packing was used because data was cast as a pointer and therefore,
header was padded excessively. Since we don't use it as a pointer, we
cast it as an incomplete array of chars. We don't need its size.
Michael Tremer [Sat, 28 May 2011 12:29:33 +0000 (14:29 +0200)]
Add support to read /etc/os-release for system information.
/etc/os-release is introduced with systemd which will be in all the
major distributions, soon. For backwards-compatibility, the lsb_release
method is still there and will be used if no /etc/os-release is available.