]> git.ipfire.org Git - thirdparty/lldpd.git/log
thirdparty/lldpd.git
11 years agolib: add URL in lldpctl.pc
Vincent Bernat [Wed, 12 Feb 2014 23:01:23 +0000 (00:01 +0100)] 
lib: add URL in lldpctl.pc

11 years agolib: fix includedir in lldpctl.pc
Vincent Bernat [Wed, 12 Feb 2014 23:00:39 +0000 (00:00 +0100)] 
lib: fix includedir in lldpctl.pc

11 years agofgetln: provide a version not relying on getline()
Vincent Bernat [Sun, 19 Jan 2014 10:24:45 +0000 (11:24 +0100)] 
fgetln: provide a version not relying on getline()

`getline()` is not POSIX and is a GNU extension.

11 years agodaemon: unset UPSTART_JOB and NOTIFY_SOCKET once used
Vincent Bernat [Wed, 1 Jan 2014 13:00:33 +0000 (14:00 +0100)] 
daemon: unset UPSTART_JOB and NOTIFY_SOCKET once used

While we shouldn't have children that use those environment variables,
better safe than sorry.

11 years agolldpd: use vfork+exec instead of fork+exec feature/noprivsep
Vincent Bernat [Sun, 15 Dec 2013 12:07:19 +0000 (13:07 +0100)] 
lldpd: use vfork+exec instead of fork+exec

This will help compatibility with systems not having a working `fork()`
implementation. For those who do, we will still use `fork()`.

11 years agopriv: add compilation without privilege separation to Travis
Vincent Bernat [Fri, 13 Dec 2013 22:26:33 +0000 (23:26 +0100)] 
priv: add compilation without privilege separation to Travis

11 years agopriv: add the ability to disable privilege separation
Vincent Bernat [Fri, 13 Dec 2013 22:25:04 +0000 (23:25 +0100)] 
priv: add the ability to disable privilege separation

This is a compile time switch in ./configure. It should only be used for
debugging purposes or when memory and number of processes matter or for
running on platforms without a real `fork()` syscall. We add it to the
NEWS but we make no further mention in the documentation.

11 years agoprivsep: IO should specify the context
Vincent Bernat [Fri, 13 Dec 2013 21:48:41 +0000 (22:48 +0100)] 
privsep: IO should specify the context

Currently, the context is not needed because IO is always done to the
"remote" process. If we remove privilege separation, the remote process
is ourselves and we need to know which file descriptor to use.

11 years agoREADME: add build instructions for Android
Vincent Bernat [Tue, 31 Dec 2013 14:03:12 +0000 (15:03 +0100)] 
README: add build instructions for Android

11 years agoinclude: don't ship `linux/socket.h`
Vincent Bernat [Tue, 31 Dec 2013 14:00:23 +0000 (15:00 +0100)] 
include: don't ship `linux/socket.h`

It needs to be paired with `sys/socket.h` (and we don't want to ship it
as it is bound to userland interface). On older libc, like Android's
bionic, `sys/socket.h` is almost empty and all the definitions,
including non-kernel related ones, are in `linux/socket.h`. If we ship
our version of `linux/socket.h`, we have an empty `linux/socket.h` and
an empty `sys/socket.h` and almost no definitions.

Since `linux/netlink.h` extract `__kernel_sa_family_t` from
`linux/socket.h` and we don't have it anymore, we just replace its
definition by `unsigned short`. Being a Linux kernel interface, it is
quite unlikely to change anytime soon.

11 years agopriv: declare `res_init()` for builds against Android's Bionic
Vincent Bernat [Tue, 31 Dec 2013 13:40:41 +0000 (14:40 +0100)] 
priv: declare `res_init()` for builds against Android's Bionic

`res_init()` is present in the C library (as detected by configure) but
no declared in any header.

11 years agolldpcli: replace safe use of `strcpy` by `strlcpy`
Vincent Bernat [Wed, 25 Dec 2013 11:12:10 +0000 (12:12 +0100)] 
lldpcli: replace safe use of `strcpy` by `strlcpy`

The idea is to ease automated testing by removing all use of
`strcpy`. See:
 http://marc.info/?l=openbsd-tech&m=138733933417096&w=2

11 years agobuild: hide generation of syscall-names.h
Vincent Bernat [Fri, 13 Dec 2013 22:27:18 +0000 (23:27 +0100)] 
build: hide generation of syscall-names.h

11 years agocdp: fix regression in CDP packet building
Vincent Bernat [Wed, 11 Dec 2013 10:55:12 +0000 (11:55 +0100)] 
cdp: fix regression in CDP packet building

The associativity of the ternary operator was not as expected. Put a
bunch of parentheses to fix that.

11 years agolldp: don't hard-code sysname, sysdescr and portdescr
Vincent Bernat [Mon, 9 Dec 2013 21:42:52 +0000 (22:42 +0100)] 
lldp: don't hard-code sysname, sysdescr and portdescr

Instead of using "Not received" when we don't have them, just keep a
pointer to NULL. However, we need to handle that gracefully everywhere:
don't send them over SNMP, don't display them in lldpcli, be ready for
the fact that it should not be sent (even if this is not possible for
the local chassis), don't use it on places were we display the neighbor
and update tests.

11 years agointerfaces: remove useless return
Vincent Bernat [Thu, 5 Dec 2013 21:28:55 +0000 (22:28 +0100)] 
interfaces: remove useless return

11 years agolldp: do not send system description TLV if empty
Vincent Bernat [Thu, 5 Dec 2013 20:37:04 +0000 (21:37 +0100)] 
lldp: do not send system description TLV if empty

This makes this TLV optional to send (as authorized in 802.1AB). The
user just has to provide an empty TLV, with, for example `-S ""`.

11 years agoconfigure: provide GitHub address for issues
Vincent Bernat [Sat, 23 Nov 2013 12:18:56 +0000 (13:18 +0100)] 
configure: provide GitHub address for issues

Also provide the appropriate homepage.

11 years agoclang: use ETHER_ADDR_LEN instead of sizeof()
Vincent Bernat [Sat, 23 Nov 2013 09:16:38 +0000 (10:16 +0100)] 
clang: use ETHER_ADDR_LEN instead of sizeof()

This allows clang to not choke on inappropriate types.

11 years agomarshal: use __alignof__ operator if available
Vincent Bernat [Sat, 23 Nov 2013 09:03:42 +0000 (10:03 +0100)] 
marshal: use __alignof__ operator if available

11 years agoclang: fix an obvious use after free
Vincent Bernat [Sat, 23 Nov 2013 08:39:08 +0000 (09:39 +0100)] 
clang: fix an obvious use after free

11 years agoalignof: handle sizeof(t) == 1 case
Vincent Bernat [Sat, 23 Nov 2013 08:30:35 +0000 (09:30 +0100)] 
alignof: handle sizeof(t) == 1 case

11 years agocoverity: really fix popt issue
Vincent Bernat [Fri, 22 Nov 2013 23:38:47 +0000 (00:38 +0100)] 
coverity: really fix popt issue

11 years agocoverity: add code annotation to remove false positives
Vincent Bernat [Fri, 22 Nov 2013 23:48:54 +0000 (00:48 +0100)] 
coverity: add code annotation to remove false positives

11 years agocoverity: if we cannot read /etc/localtime, don't go further
Vincent Bernat [Fri, 22 Nov 2013 23:44:08 +0000 (00:44 +0100)] 
coverity: if we cannot read /etc/localtime, don't go further

11 years agocoverity: don't fallback to next case for clarity
Vincent Bernat [Fri, 22 Nov 2013 22:40:57 +0000 (23:40 +0100)] 
coverity: don't fallback to next case for clarity

Even if the code was correct, add an `_exit(0)` to the first branch and
do not rely on the next case for that.

11 years agocoverity: replace unsafe uses of strncpy by strlcpy
Vincent Bernat [Fri, 22 Nov 2013 22:37:56 +0000 (23:37 +0100)] 
coverity: replace unsafe uses of strncpy by strlcpy

11 years agocoverity: remove always false comparison
Vincent Bernat [Fri, 22 Nov 2013 22:34:06 +0000 (23:34 +0100)] 
coverity: remove always false comparison

Also ensure that we use unsigned integers since we are reading unsigned
chars.

11 years agocoverity: remove dead code
Vincent Bernat [Fri, 22 Nov 2013 22:31:10 +0000 (23:31 +0100)] 
coverity: remove dead code

Possible values for `tlv_subtype` were already checked. The default case
is not possible.

11 years agocoverity: don't make `-L` flag switch off version advertisement
Vincent Bernat [Fri, 22 Nov 2013 22:27:53 +0000 (23:27 +0100)] 
coverity: don't make `-L` flag switch off version advertisement

A missing `break` was disabling version advertisement when using the
`-L` flag. Since the use of this flag is quite unlikely, don't tell
anyone...

11 years agocoverity: handle case where we didn't get enough place in getopt string
Vincent Bernat [Fri, 22 Nov 2013 22:24:42 +0000 (23:24 +0100)] 
coverity: handle case where we didn't get enough place in getopt string

While not currently possible, it may become possible in the future to
forget to allocate enough place in getopt specification string to add
protocols.

11 years agocoverity: remove a theoritical memory leak
Vincent Bernat [Fri, 22 Nov 2013 22:20:30 +0000 (23:20 +0100)] 
coverity: remove a theoritical memory leak

If cargc is 0, cargv should not have been allocated. However, to be more
robust, let's say this is possible and handle this case correctly.

11 years agocoverity: fix a memory leak
Vincent Bernat [Fri, 22 Nov 2013 22:12:02 +0000 (23:12 +0100)] 
coverity: fix a memory leak

A memory leak was happening when setting the description of an interface.

11 years agocoverity: fix a resource leak
Vincent Bernat [Fri, 22 Nov 2013 22:09:33 +0000 (23:09 +0100)] 
coverity: fix a resource leak

In `netlink.c`, ensure we free the socket if we have a memory allocation
problem.

11 years agocoverity: fix TOCTOU problem when creating chroot
Vincent Bernat [Fri, 22 Nov 2013 22:03:51 +0000 (23:03 +0100)] 
coverity: fix TOCTOU problem when creating chroot

It is believed that checking for existence of a directory or a file
before an action is useless since it could be created after the check
and before the action. Therefore, it is better to just try to do the
action and handle any failure gracefully.

When setting up the chroot, instead of checking if it already exists, we
create it and don't display an error if it is already set up.

11 years agocoverity: remove dead code
Vincent Bernat [Fri, 22 Nov 2013 21:45:49 +0000 (22:45 +0100)] 
coverity: remove dead code

A spurious return was added at the end of a function.

11 years agocoverity: remove unused pointer value
Vincent Bernat [Fri, 22 Nov 2013 21:43:54 +0000 (22:43 +0100)] 
coverity: remove unused pointer value

Also clarify how we use a similar pointer nearby.

11 years agogitignore: add GNU global files
Vincent Bernat [Sun, 17 Nov 2013 18:15:31 +0000 (19:15 +0100)] 
gitignore: add GNU global files

11 years agodebian: fix debian/lldpd.install to use provided lldpd.service
Vincent Bernat [Sun, 17 Nov 2013 08:55:39 +0000 (09:55 +0100)] 
debian: fix debian/lldpd.install to use provided lldpd.service

11 years agoredhat: don't try to install systemd stuff
Vincent Bernat [Sun, 10 Nov 2013 15:40:58 +0000 (16:40 +0100)] 
redhat: don't try to install systemd stuff

I don't know how I should handle this. Let somebody with better
knowledge tell me how to install systemd in the .spec file.

11 years agoredhat: fix version in lldpd.spec
Vincent Bernat [Sun, 10 Nov 2013 15:29:03 +0000 (16:29 +0100)] 
redhat: fix version in lldpd.spec

11 years agoosx: update homebrew recipe
Vincent Bernat [Sun, 10 Nov 2013 15:10:34 +0000 (16:10 +0100)] 
osx: update homebrew recipe

The patch is not needed anymore. We replace it with the appropriate
`./configure` option. We could use the shipped launchd file but it
does not contain provision to specify options to enable SNMP support.

11 years agorelease: prepare for release of 0.7.7 0.7.7
Vincent Bernat [Sun, 10 Nov 2013 14:42:52 +0000 (15:42 +0100)] 
release: prepare for release of 0.7.7

11 years agolldpd: tell `lldpcli` to use the appropriate control socket
Vincent Bernat [Fri, 8 Nov 2013 13:26:34 +0000 (14:26 +0100)] 
lldpd: tell `lldpcli` to use the appropriate control socket

When using a non-default control socket, lldpd was not providing the
appropriate name to lldpcli which was then not able to configure lldpd
during startup.

This fixes #48.

11 years agolldpcli: accepts `-u` option to specify control socket
Vincent Bernat [Fri, 8 Nov 2013 13:23:39 +0000 (14:23 +0100)] 
lldpcli: accepts `-u` option to specify control socket

Fix: #48.

11 years agoprivsep: put /etc/localtime in chroot
Vincent Bernat [Wed, 23 Oct 2013 08:01:12 +0000 (10:01 +0200)] 
privsep: put /etc/localtime in chroot

The chroot directory was created by lldpd if missing. We also copy
`/etc/localtime` in it if not already present. This allows us to
remove duplicate code in many init scripts. Since this file is not
essential, we don't make a fuzz for some edge cases.

11 years agosystemd: also read /etc/sysconfig/lldpd
Vincent Bernat [Tue, 22 Oct 2013 19:24:19 +0000 (21:24 +0200)] 
systemd: also read /etc/sysconfig/lldpd

While systemd's author says that we should get rid of those
pseudo-configuration files, keeping compatibility with previous ways
to configure daemons seem a valid reason to keep them. `/etc/default`
is Debian specific. We also read the equivalent one for RedHat to
ensure that everything will also continue to work here.

 http://0pointer.de/blog/projects/on-etc-sysinit.html

11 years agosystemd: require mount points to have chroot possible
Vincent Bernat [Tue, 22 Oct 2013 19:10:15 +0000 (21:10 +0200)] 
systemd: require mount points to have chroot possible

11 years agosystemd: starts lldpd after network
Vincent Bernat [Tue, 22 Oct 2013 19:08:57 +0000 (21:08 +0200)] 
systemd: starts lldpd after network

While lldpd can detect new interface, it does not make sense to make
it starts before network is ready. Let other more important programs
run.

11 years agotests: only test if we have `check` installed
Vincent Bernat [Sun, 13 Oct 2013 10:19:01 +0000 (12:19 +0200)] 
tests: only test if we have `check` installed

There should have been a good reason to put `TESTS` outside the
conditional but I don't remember it. It works by putting `TESTS`
inside the conditional and avoid an odd error message when trying to
execute tests without check installed.

11 years agoseccomp: do not ship `syscall-names.h`
Vincent Bernat [Sat, 12 Oct 2013 16:05:06 +0000 (18:05 +0200)] 
seccomp: do not ship `syscall-names.h`

`syscall-names.h` is generated at build-time. Since automake will put
anything in `*_SOURCES` in the dist tarball, we tell it to not do
that.

11 years agotravis: don't limit tests to master branch.
Vincent Bernat [Sat, 12 Oct 2013 15:52:21 +0000 (17:52 +0200)] 
travis: don't limit tests to master branch.

11 years agolib: fix a segfault introduced in ef3707 when freeing an atom
Vincent Bernat [Sat, 12 Oct 2013 15:29:26 +0000 (17:29 +0200)] 
lib: fix a segfault introduced in ef3707 when freeing an atom

In the change "lldpd: make notifications work when a port goes down",
a regression was introduced. It is important to never call
`TAILQ_REMOVE` on a marshalled struct, like when we are in
liblldpctl. This is because the marshalling process does not keep a
real list (prev pointer is incorrect).

The change ef3707 did introduce a regression by calling TAILQ_REMOVE
in a case where it is useless. We only need to call TAILQ_REMOVE if we
won't empty the whole list. So when we call `lldpd_remote_cleanup()`
with `all` set to `1`, we don't need to call TAILQ_REMOVE.

11 years agoseccomp: add support for seccomp through libseccomp
Vincent Bernat [Sat, 12 Oct 2013 14:00:40 +0000 (16:00 +0200)] 
seccomp: add support for seccomp through libseccomp

The support is only for the monitor process (running as root). It is
enabled when the monitor has been initiliazed, before the event loop.

The monitor has to open a lot of files and read them (files in /proc,
/sys). Moreover, for some files, it has to write to them (for example,
stdout, /dev/log and for writing interface aliases). Therefore, there
are many registered syscalls. It should be possible to filter more but
this would require some efforts.

Becuase it is difficult to reliably report errors to the user and we
may have to execute arbitrary code because we need to resolve
hostnames (and therefore, connect to nscd, LDAP or anything else
handled by NSS), this does not seem to be reliable enough, yet.

Moreover, displaying failed syscall is a bit hackhish.

Maybe we could enable it by default if we change the default behaviour
from killing the offending process to just return a failed errno. Or
just logging the problem.

11 years agosystemd: use full path for mkdir/cp
Vincent Bernat [Tue, 1 Oct 2013 14:00:49 +0000 (16:00 +0200)] 
systemd: use full path for mkdir/cp

Otherwise, systemd will just ignore the commands.

11 years agosystemtap: provide an appropriate tapset
Vincent Bernat [Sat, 28 Sep 2013 11:50:19 +0000 (13:50 +0200)] 
systemtap: provide an appropriate tapset

It should be possible to get something sensible with:

    stap -e 'probe lldpd.* { print($$vars) }'

11 years agodtrace: add systemtap/DTrace support
Vincent Bernat [Sat, 28 Sep 2013 10:26:03 +0000 (12:26 +0200)] 
dtrace: add systemtap/DTrace support

Let's dive into what is hot today. The support was mostly just tested
with systemtap but should works just fine with dtrace as well. We
should provide a tapset to help use all this.

11 years agoREADME: explain how to handle VLAN-encapsulated LLDP frames
Vincent Bernat [Mon, 16 Sep 2013 09:02:17 +0000 (11:02 +0200)] 
README: explain how to handle VLAN-encapsulated LLDP frames

Some Cisco are sending LLDP packets into a VLAN. Sometimes, this is
VLAN 1 and the VLAN needs to be tagged when VLAN acceleration is
available.

11 years agoconfigure: use a convenience library for fixed point arithmetic
Vincent Bernat [Sun, 15 Sep 2013 10:24:43 +0000 (12:24 +0200)] 
configure: use a convenience library for fixed point arithmetic

automake >= 1.14 does not like building binaries from source in other
directories. To avoid a warning, `subdir-objects` option has to be
passed to `AM_INIT_AUTOMAKE`. Unfortunately, this breaks what worked
before. Fixed point tests are using `fixedpoint.c` from
`src/lib`. This seems to confuse dependency tracking. See:

 http://debbugs.gnu.org/cgi/bugreport.cgi?bug=13928
 http://mytestbed.net/issues/1327

As a workaround, we use a convenience library instead.

11 years agoRevert "README: remove inexact paragraph about stacking bonding/vlans/bridges"
Vincent Bernat [Sun, 15 Sep 2013 09:30:33 +0000 (11:30 +0200)] 
Revert "README: remove inexact paragraph about stacking bonding/vlans/bridges"

This reverts commit ba09084d47643b630f3705242c1e6761d0412c46.

In fact, we still have limitations on how stacking is done. Bonds are
expected to be done on physical devices. Bonds on bonds are not
supported. In fact, there are some setups that cannot work
correctly. For example, let's assume the following:

 - eth0
 - eth1
 - vlan40@eth0
 - vlan41@eth1
 - vlan42@eth0
 - vlan43@eth1
 - bond0@(vlan40 + vlan41)
 - bond1@(vlan43 + vlan42)

On paper, we can still retrieve the real MAC addresses of various
stuff. However, Linux will alter the MAC addresses of the
VLAN. Moreover, depending on how bond1 is built, it can have the same
MAC address than bond0 or a different one. If MAC addresses are
propagated to the root, there may or may not have conflicts.

Putting bonds on physical interfaces should be the only sane thing to
do. While we could accomodate more complex setup, let's not try to do
something quite complex that nobody will use.

Hence the revert.

11 years agolinux: fix a regression in how enslaved devices' MAC addresses are retrieved
Vincent Bernat [Sun, 15 Sep 2013 09:29:46 +0000 (11:29 +0200)] 
linux: fix a regression in how enslaved devices' MAC addresses are retrieved

The MAC address of an enslaved device was not retrieved
correctly. `iflinux_get_permanent_mac()` was called with the master
device instead of the enslaved device. Most of the time, no warning
was issued except when the master device was a slave of another
device (for example, a bridge). This closes #45.

11 years agoevent: don't call `netsnmp_check_outstanding_agent_requests()`
Vincent Bernat [Mon, 9 Sep 2013 19:30:39 +0000 (21:30 +0200)] 
event: don't call `netsnmp_check_outstanding_agent_requests()`

We don't use delegated requests and therefore, this call is not
necessary. It was put here out of safety but it seems that it can
trigger spurious alarms and microseconds timeout. This makes lldpd
consume a lot of CPU. We just remove this call from the event loop.

11 years agopriv: use unistd.h to get `close()`
Vincent Bernat [Sun, 8 Sep 2013 13:52:53 +0000 (15:52 +0200)] 
priv: use unistd.h to get `close()`

11 years agoconfigure: remove an extra parenthesis in args.m4
Vincent Bernat [Thu, 15 Aug 2013 15:01:12 +0000 (17:01 +0200)] 
configure: remove an extra parenthesis in args.m4

11 years agosystemd: install service file using `systemdsystemunit_DATA`
Vincent Bernat [Thu, 15 Aug 2013 09:08:39 +0000 (11:08 +0200)] 
systemd: install service file using `systemdsystemunit_DATA`

When there is an autoconf variable `somethingdir`, we can use
`something_DATA` in automake to install things to this directory. This
is more convenient than using local targets We still have to protect
the use of those variables with conditional macros since they can be
empty or set to no. There is also a drawback about distcheck trying to
set prefix and not expecting things to be installed outside of prefix.

Do the same thing for OS X launchd daemon configuration file.

11 years agolib: fix notification by reading one byte at a time from Unix socket
Vincent Bernat [Wed, 14 Aug 2013 17:17:23 +0000 (19:17 +0200)] 
lib: fix notification by reading one byte at a time from Unix socket

Internally, several bytes will be read at once and the notification
should be detected earlier. This fixes a regression introduced in
5aeda65433fd41b7bb67f908d8c4741f045ce508 because we relied on datagram
boundary semantics. This was not important when pulling information
but we still used this semantic when pushing information. Closes: #43.

11 years agosystemd: ship lldpd.service file if possible
Vincent Bernat [Wed, 14 Aug 2013 16:46:56 +0000 (18:46 +0200)] 
systemd: ship lldpd.service file if possible

11 years agolldpd: fix a segfault when a port disappear
Vincent Bernat [Tue, 13 Aug 2013 20:01:05 +0000 (22:01 +0200)] 
lldpd: fix a segfault when a port disappear

Due to previous recent change, a NULL function could be called when a
port disappear. Fix that.

11 years agolldpd: small optimization in the expiration process
Vincent Bernat [Tue, 13 Aug 2013 19:34:19 +0000 (21:34 +0200)] 
lldpd: small optimization in the expiration process

Don't check if we have to expire a port if we will remove it anyway.

11 years agolldpd: make notifications work when a port goes down
Vincent Bernat [Tue, 13 Aug 2013 19:33:29 +0000 (21:33 +0200)] 
lldpd: make notifications work when a port goes down

We need to refactor a bit `lldpd_remote_cleanup()` to separate the
expiration process (checking each remote port to check if it is still
current) and the removal of remote port (which triggers the expire
function because we want to be notified when a neighbor disappear this
way).

11 years agolinux: add support for team devices
Vincent Bernat [Sun, 11 Aug 2013 21:00:05 +0000 (23:00 +0200)] 
linux: add support for team devices

11 years agorpc: don't check source MAC settings when it is 0
Vincent Bernat [Sun, 11 Aug 2013 20:14:33 +0000 (22:14 +0200)] 
rpc: don't check source MAC settings when it is 0

11 years agointerfaces: mangle source MAC address on bonds for other OS too
Vincent Bernat [Sun, 11 Aug 2013 20:11:51 +0000 (22:11 +0200)] 
interfaces: mangle source MAC address on bonds for other OS too

11 years agointerfaces: abstract a bit MAC address mangling for bonding devices
Vincent Bernat [Sun, 11 Aug 2013 20:07:57 +0000 (22:07 +0200)] 
interfaces: abstract a bit MAC address mangling for bonding devices

A variable in `struct lldpd_hardware` control the mangling. On the
other end, `hardware->h_ops->send()` should not be called directly
anymore. Instead, `interfaces_helper_send()` should be used instead.

11 years agointerfaces: move "mangle" function for bond slaves
Vincent Bernat [Sun, 11 Aug 2013 19:42:12 +0000 (21:42 +0200)] 
interfaces: move "mangle" function for bond slaves

This will allow it to be used by other OS.

11 years agolldpcli: remove unused variable
Vincent Bernat [Sun, 11 Aug 2013 19:34:21 +0000 (21:34 +0200)] 
lldpcli: remove unused variable

Also fix a cast.

11 years agolib: update version-info to match previous changes
Vincent Bernat [Sun, 11 Aug 2013 19:21:02 +0000 (21:21 +0200)] 
lib: update version-info to match previous changes

11 years agobond: reenable the possibility to use a fixed MAC address
Vincent Bernat [Sun, 11 Aug 2013 19:19:11 +0000 (21:19 +0200)] 
bond: reenable the possibility to use a fixed MAC address

Moreover, this will be the default. The fixed MAC is not configurable.

11 years agoclient: move register of bond-slave-src-mac-type to a separate function
Vincent Bernat [Sun, 11 Aug 2013 19:11:50 +0000 (21:11 +0200)] 
client: move register of bond-slave-src-mac-type to a separate function

11 years ago[PATCH| lldpd: use bond slave real mac with locally administered bit set as sour
Roopa Prabhu [Sun, 11 Aug 2013 19:06:50 +0000 (21:06 +0200)] 
[PATCH| lldpd: use bond slave real mac with locally administered bit set as sour
ce man in lldp frames sent on bond slaves

By default lldpd sent src mac of zero for all lldp frames sent on bond
slaves. See https://tickets.cumulusnetworks.com/browse/CM-1283

This patch provides a few options to select the source address in lldp
trames sent on bonded slaves.

The problem with using the bond slave real mac in lldp frames
is described in https://github.com/vincentbernat/lldpd/issues/26

This patch provides 3 choices to src mac address selection on bond slaves:

# lldpcli help configure system bond-slave-src-mac-type

-- Set LLDP bond slave src mac type
      real  Real mac
      zero  All zero mac
     local  Real Mac with locally administered bit set

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
Signed-off-by: Vincent Bernat <bernat@luffy.cx>
11 years agolinux: mangle MAC address for enslaved devices
Vincent Bernat [Thu, 25 Jul 2013 08:24:30 +0000 (10:24 +0200)] 
linux: mangle MAC address for enslaved devices

With enslaved devices, we may end up with in a situation where we send
a packet with a source MAC address that may confuse switches. For
example:

 1. eth0, MAC X connected to switch A.
 2. eth1, MAC Y connected to switch B.
 3. Active/backup bond is created, MAC X.
 4. eth1 is active, eth0 is backup.

If we use the real MAC, eth0 will send LLDP packets with MAC X to
switch A that will learn this MAC and send packets on backup port eth0
and they will be discarded.

The solution until then was to use a zero MAC address in those
cases. However, it seems that some switches may be confused by such a
move. See #26.

Instead, we set the "local" bit to 1 if not already set. Otherwise, we
just use some arbitrary MAC address that I have on an unused 3Com
"Tornado" card. It is unlikely to be reused (100 MBps and it is in a
basement). If you happen to have an even older MAC address and are
willing to give it for lldpd, feel free to tell me. The later case
does not handle all problems but allievate the problem with switches
discarding or complaining about zero MAC address as a source.

11 years agolib: fix parsing of "11542."
Vincent Bernat [Wed, 24 Jul 2013 22:39:39 +0000 (00:39 +0200)] 
lib: fix parsing of "11542."

The case was correctly handled but clz() does not handle 0 as its
argument.

11 years agolib: introduce proper fixed point parsing and representation module
Vincent Bernat [Wed, 24 Jul 2013 20:20:50 +0000 (22:20 +0200)] 
lib: introduce proper fixed point parsing and representation module

This additional modules isolates the complexity of parsing and
representing fixed point numbers. This is uses for coordinates in
LLDP-MED.

The previous version was using an incorrect precision. When parsing
user input, the precision is now derivated from the number of digits
provided. When displaying a value, the precision is used to add
additional 0 if needed.

Moreover, the previous version was a bit buggy with some values and
with negative numbers. This change contains unittest to tackle most
issues.

It relies on presence of __builtin_clzll() function, available in GCC
and others. Maybe this will become a portability issue.

This closes #41.

11 years agolib: correctly set altitude unit without erasing neighbouring data
Vincent Bernat [Wed, 24 Jul 2013 16:33:51 +0000 (18:33 +0200)] 
lib: correctly set altitude unit without erasing neighbouring data

The way the altitude unit was set in buffer was erasing 4 unrelated
bits with 0. This made the altitude precision wrong.

11 years agoevent: replace `evutil_make_socket_nonblocking()` by an idempotent version
Vincent Bernat [Mon, 15 Jul 2013 18:56:00 +0000 (20:56 +0200)] 
event: replace `evutil_make_socket_nonblocking()` by an idempotent version

Once a file descriptor is locked with `BIOCLOCK`, it is not possible
to make it non-blocking. Therefore, we need to make it non-blocking
before locking it. Unfortunately, `evutil_make_socket_nonblocking()`
does not check the current value of the flag to see if there is
anything to do and we get a spurious warning. Just provide our version
of this function for this purpose.

11 years agolldpd: invoke `setproctitle_init()` when needed
Vincent Bernat [Mon, 15 Jul 2013 13:46:36 +0000 (15:46 +0200)] 
lldpd: invoke `setproctitle_init()` when needed

On some systems, we need to invoke `setproctitle_init()` before using
`setproctitle()`.

11 years agopriv: use `sigaction()` instead of `signal()` to install non-default signals
Vincent Bernat [Mon, 15 Jul 2013 13:28:46 +0000 (15:28 +0200)] 
priv: use `sigaction()` instead of `signal()` to install non-default signals

`signal()` is not portable to install non-default signals.

11 years agoREADME: on OSX, /etc is a symlink to /private/etc.
Vincent Bernat [Sat, 13 Jul 2013 16:04:58 +0000 (18:04 +0200)] 
README: on OSX, /etc is a symlink to /private/etc.

11 years agoosx: make the path to /Library/LaunchDaemons configurable
Vincent Bernat [Sat, 13 Jul 2013 15:59:47 +0000 (17:59 +0200)] 
osx: make the path to /Library/LaunchDaemons configurable

This path can also be set to `no` to avoid the installation of such a daemon.

11 years agoosx: minimize differences with downstream Homebrew formula
Vincent Bernat [Sat, 13 Jul 2013 15:44:56 +0000 (17:44 +0200)] 
osx: minimize differences with downstream Homebrew formula

11 years agoosx: fix a syntax error in Homebrew formula
Vincent Bernat [Sat, 13 Jul 2013 15:40:53 +0000 (17:40 +0200)] 
osx: fix a syntax error in Homebrew formula

11 years agoosx: patch the installation of launchd plist file for Homebrew
Vincent Bernat [Sat, 13 Jul 2013 15:40:01 +0000 (17:40 +0200)] 
osx: patch the installation of launchd plist file for Homebrew

11 years agoosx: don't remove the whole /Library/LaunchDaemons directory on uninstall!
Vincent Bernat [Sat, 13 Jul 2013 15:21:05 +0000 (17:21 +0200)] 
osx: don't remove the whole /Library/LaunchDaemons directory on uninstall!

11 years agoconfigure: check for `res_init()` before trying other forms.
Vincent Bernat [Fri, 12 Jul 2013 22:07:16 +0000 (00:07 +0200)] 
configure: check for `res_init()` before trying other forms.

On OSX, `res_init()` is a symbol of `libsystem_info` (a dependency of
`libSystem`). So, AC_SEARCH_LIBS directly finds this symbol without an
additional library. However, once you include `resolv.h`, this becomes
a macro to `res_9_init` which is a symbol of `libresolv`. So you need
to link to `libresolv`. This is why we test first for `res_9_init` and
only after for `res_init`.

See more info about this here:
 http://blog.achernya.com/2013/03/os-x-has-silly-libsystem.html

However, on other systems, this will link to libbind while this is not
needed because `res_9_init` is a symbol of libbind while `res_init` is
correctly defined in `libc` and no odd redefinition.

So, the solution is to force `AC_SEARCH_LIBS` to include `resolv.h`
and only test for `res_init` (as a symbol or a macro, we don't
care). This is done by redefining `AC_LANG_CALL(C)` to include
`resolv.h`.

11 years agoREADME: remove inexact paragraph about stacking bonding/vlans/bridges
Vincent Bernat [Fri, 12 Jul 2013 20:29:37 +0000 (22:29 +0200)] 
README: remove inexact paragraph about stacking bonding/vlans/bridges

lldpd now supports any kind of stacking

11 years agoosx: update SHA1 sum for Homebrew recipe
Vincent Bernat [Fri, 12 Jul 2013 08:11:41 +0000 (10:11 +0200)] 
osx: update SHA1 sum for Homebrew recipe

11 years agoosx: fix postinstall script 0.7.6
Vincent Bernat [Fri, 12 Jul 2013 08:00:01 +0000 (10:00 +0200)] 
osx: fix postinstall script

`@PRIVSEP_USER@` and `@PRIVSEP_GROUP@` were not substituted with the
appropriate values because they were not declared as an output
variable.

11 years agopackaging: change `PreReq` to `Requires(pre)` in lldpd.spec
Vincent Bernat [Fri, 12 Jul 2013 07:36:40 +0000 (09:36 +0200)] 
packaging: change `PreReq` to `Requires(pre)` in lldpd.spec

PreReq is deprecated and makes the build fail on OSC.

11 years agopackaging: update to 0.7.6
Vincent Bernat [Fri, 12 Jul 2013 07:24:32 +0000 (09:24 +0200)] 
packaging: update to 0.7.6

11 years agoREADME: show how to use tcpdump for troubleshooting
Vincent Bernat [Thu, 11 Jul 2013 22:44:56 +0000 (00:44 +0200)] 
README: show how to use tcpdump for troubleshooting