Steven Webster [Wed, 30 Aug 2017 05:43:54 +0000 (01:43 -0400)]
client: add show interfaces command (#240)
There are several lldpcli configure commands that take port name(s)
as an optional parameter.
Currently, it is not possible to verify interface specific configuration
for lldpd without access to a neighbour switch/host or packet capture.
It would be useful to have a show interfaces command, similar to the
show neighbors command that allows a user/agent to query the local
TLV information.
This commit leverages the existing port display infrastructure to
enable display of local interfaces. There are a few differences:
- Do not display the chassis RID, as the local index is always 0
- Show TTL as a seperate TLV based on tx_hold, tx_interval config,
as internally the port TTL atom info is 0, and the chassis TTL
atom info has been depreciated.
Vincent Bernat [Tue, 15 Aug 2017 17:22:00 +0000 (19:22 +0200)]
client: add "json0" to the list of available formats
This enables a more verbose JSON output whose structure is kept
the same with one or several neighbors. It's easier to parse than the
current structure.
Vincent Bernat [Sun, 13 Aug 2017 13:13:07 +0000 (15:13 +0200)]
lldpcli: add "configure system hostname ." to use node name
This is a shortcut to "configure system hostname nodename". By default,
lldpd will use the FQDN (resolving the node name using the local
resolver). We let lldpcli interpret "." as a special request to override
this value with the node name (output of "uname -n").
Vincent Bernat [Sat, 12 Aug 2017 21:15:56 +0000 (23:15 +0200)]
priv: don't run ethtool as root
Kernels older than 2.6.19 won't get any link information. Kernels 4.6,
4.7 and 4.8 won't get information from GLINKSETTINGS (higher speeds)
but they are not LTS kernels so we should be fine. This removes a
bunch of code.
Vincent Bernat [Sat, 12 Aug 2017 19:30:17 +0000 (21:30 +0200)]
interfaces: use ethtool to get permanent MAC for bonds/teams
As this doesn't work for all devices (like dummy and veth), we still
fallback to old code using /proc/net/bonding for bonds. No fallback
available for team devices.
Vincent Bernat [Sat, 12 Aug 2017 18:09:22 +0000 (20:09 +0200)]
interfaces: enable team interfaces like a bond interface
Unfortunately, we are not able to retrieve the real MAC address as the
kernel doesn't know it. Only the teamd daemon knows it. We could ask for
it through ethtool but it would be the permenant MAC address which may
be incorrect.
Steven Webster [Tue, 20 Jun 2017 20:04:38 +0000 (16:04 -0400)]
lldp: clear station bit if any other capability is enabled
The 801.1AB spec states that the station only capability should
not be set in conjunction with any other (capability) bits.
It is possible for the lldpd interface update routine to set the
station bit, while the lldpd chassis update routine may, at a later
time, set the router capability bit. In this case the station bit
is not cleared.
This commit clears the station bit if any other capability is set.
Vincent Bernat [Mon, 13 Feb 2017 08:15:13 +0000 (09:15 +0100)]
lldp: attach remote TTL to port instead of chassis
When receiving a 0 TTL, we should trigger expiry of the remote port, not
the remote chassis. Therefore, TTL is moved to port, except for the
local chassis (we need it even when we don't have a port). So, for
remote ports, TTL is on the port. For local ports, it is on the
chassis. This fixes two cases:
- a shutdown LLDPU should only expire one local port
- when a port is refreshed, another port of the same chassis shouldn't
be refreshed
Vincent Bernat [Mon, 23 Jan 2017 16:28:33 +0000 (17:28 +0100)]
client: built-in JSON support
Instead of relying on two different libs to serialize JSON, we provide
our own built-in serializer. This reduces the amount of build-related
code (detection of the correct library), as well as the amount of C code
with the exception of UTF-8 handling which was stolen from CCAN.
This will also make the life of some users easier.
The JSON format stays the same: quite verbose with --enable-json0
flag. And inconsistent without it.
Vincent Bernat [Sat, 21 Jan 2017 11:40:51 +0000 (12:40 +0100)]
netlink: clear IFF_SLAVE when no information on upper interface
This means that we have just been enslaved, but don't know the
master. On Linux, enslaved device are handled differently of regular
device. When we are half-enslaved (no upper interface yet), we are still
a regular interface. When we are fully enslaved, we may do nothing
because there is no local change (since flags are the same). Therefore,
clear the flag to avoid this issue.
Vincent Bernat [Sat, 14 Jan 2017 10:51:58 +0000 (11:51 +0100)]
netlink: by default, don't change netlink buffer size
We can't really guess what the current maximum is. On my system, the
default max is quite low (~200k). We don't want everybody to get a
warning. Also, only warn people if we got a smaller size that we
requested.
daemon: config netlink socket buf sizes at build time
I admit it would be nicer to have this configurable at run-time
or better yet, introduce a mechanism for recovering from
overrun situations via polling.
We're starting to see in certain situations that on devices
with many ports (i.e. switches with around ~50 ports) lldpd
info is not always consistent.
I'm not entirely sure that the issue is with netlink
sock buffer sizes.
But we've also recentl addressed some issues for the mstpd
daemon with netlink sock buffer sizes.
So, I'm tempted to think that it's the same issue.
We [especially I] prefer to bump sock buffer sizes where needed
and not via sysctl `net.core.rmem_default` & `net.core.wmem_default`.
Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
Vincent Bernat [Sun, 1 Jan 2017 12:26:08 +0000 (13:26 +0100)]
tests: avoid race condition when linking two namespaces
When creating a link between two namespaces, one lldpd will see the link
and send a LLDPDU before the other one. There is a slight delay for
lldpd to wait before sending the LLDPDU, but when the load is heavy, it
can be expected that the other side didn't configure the interface when
the LLDPDU is received. To solve this, just wait a bit before putting up
the second interface.
Vincent Bernat [Fri, 30 Dec 2016 22:03:34 +0000 (23:03 +0100)]
interfaces: on Linux, clear socket error queue on error
With AF_PACKET, it is possible to get an error in the error queue even
when we didn't ask to receive them (in contrast with AF_INET where we
have to set IP_RECVERR socket option). Currently, the only error we can
receive is SOL_PACKET/PACKET_TX_TIMESTAMP, but we just want to clear any
error in the socket queue to be able to read packets (otherwise, poll()
will always return POLLERR).
Vincent Bernat [Wed, 30 Nov 2016 20:37:36 +0000 (21:37 +0100)]
linux: add support for ethtool GLINKSETTINGS
With a recent enough kernel, one can use GLINKSETTINGS instead of
GSET. This is needed to overcome the limitation on the number of
supported/advertising modes supported by GSET (which is a fixed-length
bitset). We use the same kind of compatibility structure than for
ethtool.
Also, update the list of supported MAU types to support higher speed
interfaces. Unfortunately, while Linux reports the exact
advertised/supported modes, the operational mode of the interface is
only reported with its speed and its kind (copper, fiber, ...). When
this is fiber, we don't know if this is MMF or SMF or the supported
distance. Therefore, we use our best guess (this was already the case,
nothing new here).
Vincent Bernat [Fri, 25 Nov 2016 19:17:58 +0000 (20:17 +0100)]
med: fix parsing of LLDP-MED LCI when TLV size exceeds addr size
Some equipments are sending an address whose size is less than the
declared TLV size. The TLV is padded with 0. We rejected this because of
a size mismatch.
Vincent Bernat [Thu, 6 Oct 2016 06:38:10 +0000 (08:38 +0200)]
client: add an option to use pre-0.9.2 json-c format
The format has been changed in c8b8b858bbba to match the JSON format
used when compiled with Jansson. Some users may want to revert this
change. Add `--enable-json0` option for that.