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.
Vincent Bernat [Tue, 8 Jul 2014 20:15:12 +0000 (22:15 +0200)]
snmp: use poll() to wait for AgentX socket to be ready
Instead of sleeping for an arbitrary amount of time, query if the socket
is ready using poll() which should be portable enough (POSIX.1-2001) to
work everywhere.
Vincent Bernat [Tue, 8 Jul 2014 19:41:48 +0000 (21:41 +0200)]
log: info messages should be logged on syslog but not on first debug level
Without `-d`, syslog should log info messages. With `-d`, they should
not be displayed. With `-dd`, they should be displayed. This is an
amendment of the previous patch.
Sam Tannous [Tue, 8 Jul 2014 19:15:39 +0000 (15:15 -0400)]
lldpd: fix log_info
Currently none of the log_info msgs are getting
printed into syslog. vlog already does the right checks.
Remove the checks in log_info which is making all default log_info
prints no-ops
Also change severity of "interface reset timer" msg
Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com> Signed-off-by: Sam Tannous <stannous@cumulusnetworks.com>
Patrick McLean [Tue, 8 Jul 2014 18:40:15 +0000 (11:40 -0700)]
lldpd: whitelist sendto, poll, recvmsg and readv in seccomp sandbox
With privilege separation and seccomp enabled, the monitor thread was
dying due to seccomp errors, while leaving the child alive. This whitelists
some extra syscalls to allow the monitor process to stay alive.
udbxtd2008 [Sun, 15 Jun 2014 07:05:06 +0000 (15:05 +0800)]
frame: fix CDP checksum
The checksum of CDP frame is calculated off-by-one error when the length
of frame is odd, and the highest bit of the last octet is 1, which is as
a known question mentioned in wireshark.
Sam Tannous [Wed, 21 May 2014 14:11:24 +0000 (10:11 -0400)]
Support for modifying PortID TLV
This patch adds the ability to change the behavior of what
lldpd sends in the PortID TLV.
By default, lldpd sets the MAC address in the PortID and the ifname
in the PortDescr field. This patch allows the user to
configure lldpd via the CLI (lldpcli or /etc/lldpd.conf)
to send either the interface name
(ifname) or the MAC address in the PortID TLV.
Signed-off-by: Sam Tannous <stannous@cumulusnetworks.com>
Vincent Bernat [Thu, 15 May 2014 23:08:27 +0000 (01:08 +0200)]
bsd: fix clang warning about alignment problem with sockaddr
While this does not seem to be extensively documented, when casting a
`sockaddr *` to something else, like `sockaddr_dl *`, it is believed
that initially, it was a `sockaddr_dl *`, so there is no alignment
problem in this case. We use a macro to cast to `void *` to avoid the
warning.
Vincent Bernat [Sat, 10 May 2014 15:32:10 +0000 (17:32 +0200)]
interfaces: default to use of a local administered MAC address for bonds
Since in the default configuration, some swicthes (Cisco on IOS 15.x)
will complain about MAC addresses flapping when using `configure system
bond-slave-src-mac-type fixed`, and some other switches (still Cisco)
will complain when using `configure system bond-slave-src-mac-type
fixed`, we change the default to `local`. This is not the safest option
but the probability of having a collision is quite low.
Usually, locally administered addresses are used for VM but they are
taken from a known prefix and we are unlikely to have a collision with
this prefix. On VM, we will fallback to a fixed address but hopefully,
the switch will be a virtual one which won't have a problem with the
fixed address.
Vincent Bernat [Sat, 10 May 2014 07:13:02 +0000 (09:13 +0200)]
man: more documentation for bond-slave-src-mac-type
We document the MAC address used (to be able to find it through Google
or `git grep`). We also explain why the default is `fixed` and when it
should be changed to `local`.