Vincent Bernat [Tue, 4 Nov 2014 19:51:00 +0000 (20:51 +0100)]
lib: bump versioning
Even if the ABI stays the same, the ability to pass NULL is an interface
change (backward compatible). We don't want new versions of lldpcli to
interact with an old version of the library.
Vincent Bernat [Sun, 2 Nov 2014 15:25:21 +0000 (16:25 +0100)]
client: fix configuration modification
Handling of configuration change was messy. Whatever configuration item
needed to be updated, a whole lldpd_config structure was sent. The
daemon part was trying to guess what changed by assuming non-0 fields
need to be updated. However, when flags were added, the implementation
became inconsistent. Some flags used 1/2 for true/false, some others
kept 0/1. So, some flags were detected as changed while they were not.
Since we require to provide a current configuration before making any
change, we just copy the whole structure, modify what we want and send
it to the daemon. The daemon will then compare the new structure with
the old one to detect changes. Flags that were using 1/2 logic are now
just using 0/1 like others.
Vincent Bernat [Sun, 26 Oct 2014 10:31:34 +0000 (11:31 +0100)]
interfaces: bond listening was broken only for old kernels
With a recent kernel, we can listen to individual member. lldpd is still
listening on master to keep compatibility with older kernels and because
it is difficult to detect if the kernel gives us this ability or not. We
can't rely on version numbers as some kernels have backported
features (like 2.6.18 from RHEL 5).
Vincent Bernat [Sun, 26 Oct 2014 09:54:57 +0000 (10:54 +0100)]
interfaces: fix initialization of hardware h_data for bonds
On discovery, the master index was not correctly initialized and
therefore, the information was not retrieved correctly and therefore
listening on bond devices was broken since 0.7.0 (netlink rewrite).
Vincent Bernat [Fri, 24 Oct 2014 23:07:42 +0000 (01:07 +0200)]
frame: mention the licensing issue with POKE/PEEK macros
They were taken from ladvd but were originally based on the ones from
libcdp (under the Net::CDP umbrella) which is LGPLv2 licensed. To avoid
any grey area, the original author, Michael Chapman, kindly accepted to
relicense those under the ISC license.
Vincent Bernat [Sun, 5 Oct 2014 13:07:42 +0000 (15:07 +0200)]
build: use AC_CONFIG_FILES only to generate Makefiles
Other kind of files may get partially expanded variables. For example,
`@sbindir@` is expanded to `${exec_prefix}/sbin` which won't work in a
regular configuration file.
While this could be done easily with GNU Make, using automake doesn't
allow us to use pattern rules or stuff like that. Therefore, there are a
lot of repetitions to declare the files we need to transform.
Vincent Bernat [Fri, 5 Sep 2014 18:19:34 +0000 (20:19 +0200)]
build: check if pkg-config is correctly installed in ./autogen.sh
Absence of pkg-config leads to some odd messages:
configure.ac:27: error: possibly undefined macro: AC_SUBST
If this token and others are legitimate, please use m4_pattern_allow.
See the Autoconf documentation.
configure.ac:163: error: possibly undefined macro: AC_MSG_FAILURE
configure:21413: error: possibly undefined macro: AC_MSG_CHECKING
configure:21418: error: possibly undefined macro: AC_TRY_LINK
configure:21423: error: possibly undefined macro: AC_MSG_RESULT
configure:21432: error: possibly undefined macro: AC_MSG_NOTICE
configure:21894: error: possibly undefined macro: AC_PATH_TOOL
configure:21896: error: possibly undefined macro: AC_MSG_ERROR
configure:21975: error: possibly undefined macro: AC_DEFINE_UNQUOTED
We try to detect this situation by looking for `PKG_CHECK_MODULES` macro
in `aclocal.m4`. If not present, we issue some useful tips, like
installing the package or telling aclocal the location of
`pkg.m4` (mostly for OSX users).
Vincent Bernat [Sun, 31 Aug 2014 19:56:49 +0000 (21:56 +0200)]
lldpd: handle early cleanup in case interface cannot be created
When an interface is about to be created but an external condition makes
it impossible, the cleanup may crash because the interface was
incomplete. Check things exist before cleanup.
Vincent Bernat [Sat, 30 Aug 2014 06:45:53 +0000 (08:45 +0200)]
lib: stricter checks when resuming an operation in progress
When an operation is in progress, we used both state management and some
canary value to check if the user is resuming the right operation. The
canary was just a pointer and it was easy to get the same pointer as the
previous operation while not really resuming the previous operation. We
turn the check into a string comparison instead.
Moreover, add checks when setting configuration items too.
Michel Stam [Mon, 21 Jul 2014 14:40:41 +0000 (16:40 +0200)]
cdp: Add power requirement to CDPv2 frames
LLDP already supports sending power requirements, for
IEEE 802.3at. Older Cisco PoE switches do not support
LLDP and need a custom CDPv2 frame. This patch enables
support if the LLDP MED PoE frame is also sent.
Michel Stam [Fri, 18 Jul 2014 15:00:32 +0000 (17:00 +0200)]
lldpcli: Add support for JSON-C
OpenWRT is shipped with the JSON-C library, which is used for
several other packages. Having a separate JSON library (Jansson)
doing the exact same thing is wasting flash space.
Vincent Bernat [Thu, 10 Jul 2014 20:55:58 +0000 (22:55 +0200)]
lldpcli: change how privileged commands are declared
Even when not privileged, we declare privileged commands but tag them
accordingly. We need to be careful when executing the commands to check
the new bit.
This is a preliminary change to allow a completion command to complete
privileged commands even when not privileged.
Sam Tannous [Tue, 8 Jul 2014 19:15:50 +0000 (15:15 -0400)]
lldpcli: add display filter to show nbrs running specific protocols
LLDPD allows a peer to run multiple protocols (LLDP, CDPv1, CDPv2).
lldpcli can be used to show the primary protocol for a nbr or all
the protocols using the "hidden" cmdline arg
This allows lldpcli to filter the nbr display based on the
protocol that is running on it.
Signed-off-by: Kanna Rajagopal <kanna@cumulusnetworks.com> Signed-off-by: Sam Tannous <stannous@cumulusnetworks.com>
Sam Tannous [Tue, 8 Jul 2014 19:15:49 +0000 (15:15 -0400)]
Add call to process more messages from data already read.
Currently, the calls within lldpctl are assumed to be all associated with
synchronous sockets. With async sockets, the data read can be varied and so
its useful to process as much of the data as possible. However, lldpctl_recv
only processes one message and there isn't a call to be made to process
data that's sitting in a control connection's buffer. This patch adds such a
call for external users to call. It simply calls check_for_notification and
returns whatever check_for_notification returns with 0 signalling more
processing is possible and non-zero indicating buffer is fully processed
(though there may still be data).
Signed-off-by: Dinesh G Dutt <ddutt@cumulusnetworks.com> Signed-off-by: Sam Tannous <stannous@cumulusnetworks.com>
Sam Tannous [Tue, 8 Jul 2014 19:15:46 +0000 (15:15 -0400)]
Add ignore handler for SIGHUP in lldpcli
lldpcli which is execed by lldpd is expected to resume lldpd operations.
But in some cases, lldpcli can exiting because of SIGHUP. This fixes
these cases.