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`.
Vincent Bernat [Wed, 7 May 2014 09:54:16 +0000 (11:54 +0200)]
lldpcli: return success when reading commands from files
When reading commands from files, we chose to not stop on errors (the
main reason is to allow to specify nonexistent configuration files and
allow lldpd to still work after incompatible updates). However, we also
always return a failure status. Fix that.
Thanks to Brian Bidulock for spotting that. Closes #62.
Vincent Bernat [Sun, 6 Apr 2014 21:41:40 +0000 (23:41 +0200)]
snmp: link with Net-SNMP later
Some systems contain static libraries in the output of `net-snmp-config
--agent-libs`. It is not possible to build a convenience library with a
static library. Therefore, we just link with the appropriate libs in the
last step. This should fix #57.
Vincent Bernat [Wed, 2 Apr 2014 15:10:08 +0000 (17:10 +0200)]
build: use __EXTENSIONS__ and _XOPEN_SOURCE_EXTENDED everywhere
It is needed for Solaris and HP-UX. It doesn't seem to harm other
platforms. Let's hope that the autoconf test will catch
problems. Otherwise, we can still conditionally use them.
Vincent Bernat [Tue, 1 Apr 2014 16:29:07 +0000 (18:29 +0200)]
asprintf: globally define _GNU_SOURCE
And also provide a replacement for asprintf if it is not available. I
would prefer to not use _GNU_SOURCE everywhere but it seems cleaner than
putting it at the top of random files. Ideally, I should wrap every
function in a separate file to just use _GNU_SOURCE for those
functions. There are `asprintf()` and `setres[ug]id()`.
Vincent Bernat [Sun, 2 Mar 2014 23:48:55 +0000 (00:48 +0100)]
lib: don't use strlcpy() when strcpy() just works
clang complains when we use strlcpy() with strlen() on the source. The
change was made because some other tools complained that we used
strcpy() instead of a more secure version. Since they don't agree, let's
switch to the saner thing to do: use strcpy() when it is safe to do.
Vincent Bernat [Thu, 20 Feb 2014 20:52:46 +0000 (21:52 +0100)]
lldpcli: check for privileges by checking access to control socket
Instead of relying on having used the suid bit to run the program, we
check if the real UID/GID could have opened the control socket. This
really fix #56.
Vincent Bernat [Thu, 20 Feb 2014 20:37:22 +0000 (21:37 +0100)]
lldpcli: root is privileged
For some reason, this bug was not catched before. It was expected that
`lldpcli` can be installed as suid `_lldpd` to give user read access to
the neighbor information. However, to avoid write access, we checked if
the user was privileged by checking equality of effective and real user
uid. However, even for root, they don't have to match. Maybe they
matched in the past?
Vincent Bernat [Wed, 19 Feb 2014 14:50:41 +0000 (15:50 +0100)]
interfaces: reset router and wlan capability bits
When adding capability for new interfaces, reset them if the interfaces
providing the capability are not present anymore. Also, add stationOnly
capability if no capability is currently present.