]> git.ipfire.org Git - thirdparty/lldpd.git/log
thirdparty/lldpd.git
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

11 years agopriv: correctly declare `priv_cmd` type
Vincent Bernat [Thu, 11 Jul 2013 21:13:10 +0000 (23:13 +0200)] 
priv: correctly declare `priv_cmd` type

`enum {} priv_cmd` was the declaration of a variable `priv_cmd` as an
anonymous enum. This is not what was expected. Instead, we want `enum
priv_cmd` to be a declaration of a named enum: `enum priv_cmd {}` (we
could also use `typedef enum {} priv_cmd`, but in lldpd, `typedef` is
seldomly used).

When `priv_cmd` was moved out of `priv.c`, its symbol was defined in
several objects. It seems that recent versions of gcc are able to cope
with that (because `priv_cmd` variable was not used, so it was
optimized out I think, not sure). However, some older versions like
4.2.1 complained about duplicate objects during the link phase.

11 years agodoc: add a CONTRIBUTE document
Vincent Bernat [Wed, 3 Jul 2013 21:24:19 +0000 (23:24 +0200)] 
doc: add a CONTRIBUTE document

11 years agolinux: define IFALIASZ for old systems
Vincent Bernat [Wed, 3 Jul 2013 21:03:24 +0000 (23:03 +0200)] 
linux: define IFALIASZ for old systems

11 years agolldpd: fix a fd leak when we cannot write the new alias
Vincent Bernat [Wed, 3 Jul 2013 21:02:06 +0000 (23:02 +0200)] 
lldpd: fix a fd leak when we cannot write the new alias

11 years agolldpd: append "was" to an interface description when a neighbor disappear
Vincent Bernat [Wed, 3 Jul 2013 20:57:00 +0000 (22:57 +0200)] 
lldpd: append "was" to an interface description when a neighbor disappear

This allows a user to know what neighbor was connected to a
server. This should closes #16.

11 years agoclient: add "configure/unconfigure system interface description" command
Vincent Bernat [Wed, 3 Jul 2013 08:05:23 +0000 (10:05 +0200)] 
client: add "configure/unconfigure system interface description" command

This allows to enable/disable updating interface description based on
visible neighbors.

11 years agolib: `lldpctl_k_config_receiveonly` is a read-only property
Vincent Bernat [Wed, 3 Jul 2013 07:44:59 +0000 (09:44 +0200)] 
lib: `lldpctl_k_config_receiveonly` is a read-only property

Update `lldpctl.h` to reflect this fact.

11 years agointerfaces: overwrite interface description with neighbor found
Vincent Bernat [Tue, 2 Jul 2013 22:18:41 +0000 (00:18 +0200)] 
interfaces: overwrite interface description with neighbor found

If no neighbor is found, interface name is `lldpd: no neighbor
found`. If one neighbor is found, this is `lldpd: connected to XXXXX`
and if several neighbors are found, this is `lldpd: XXX
neighbors`. Smart filter is used to count neighbors.

Currently, this is not possible to disable this. Works with FreeBSD,
OpenBSD and Linux.

11 years agopriv: avoid to leak generic socket
Vincent Bernat [Tue, 2 Jul 2013 22:16:45 +0000 (00:16 +0200)] 
priv: avoid to leak generic socket

Due to previous commit, a socket was requested for each operation
needing it but it was not released.

11 years agoprivsep: separate OS specific code to dedicated files
Vincent Bernat [Tue, 2 Jul 2013 20:38:16 +0000 (22:38 +0200)] 
privsep: separate OS specific code to dedicated files

Linux only stuff goes in `priv-linux.c`. This includes interface
handling, ethtool and ability to open files (which is not Linux
specific but only Linux requires this).

BSD stuff goes in `priv-bpf.c` since it only includes interface
handling.

Moreover, `privsep_fdpass.c` is merged into `privsep_io.c`, a new file
for almost everything about IO (read/write and passing FD). The global
`remote` object is put into this file.

This commit is mostly moving stuff around. This will enable the
ability to write interface aliases without putting too much #ifdef.

11 years agoredhat: require groupadd/useradd
Vincent Bernat [Fri, 28 Jun 2013 23:45:49 +0000 (01:45 +0200)] 
redhat: require groupadd/useradd

Those are needed on RHEL/CentOS if lldpd is installed early (for
example, in Kickstart). Thanks to Larry Brigman for correcting this.

11 years agoosx: don't repeat `pkg-ref` several times in `distribution.xml`
Vincent Bernat [Fri, 28 Jun 2013 22:05:36 +0000 (00:05 +0200)] 
osx: don't repeat `pkg-ref` several times in `distribution.xml`

11 years agoosx: don't use `domains` tag in `distribution.xml`
Vincent Bernat [Fri, 28 Jun 2013 22:04:42 +0000 (00:04 +0200)] 
osx: don't use `domains` tag in `distribution.xml`

This triggers the use of a new buggy "Destination Select" pane.

11 years agoosx: add a way to compile for older versions of OS X
Vincent Bernat [Tue, 25 Jun 2013 21:56:38 +0000 (23:56 +0200)] 
osx: add a way to compile for older versions of OS X

11 years agoosx: `make pkg` can now build universal binaries
Vincent Bernat [Tue, 25 Jun 2013 14:21:45 +0000 (16:21 +0200)] 
osx: `make pkg` can now build universal binaries

Next step: compile for another SDK.

11 years agoosx: don't try to build universal binaries
Vincent Bernat [Mon, 24 Jun 2013 23:25:04 +0000 (01:25 +0200)] 
osx: don't try to build universal binaries

The use of multiple arch is not safe with autotools. I believe that
libevent compute some arch-dependent stuff at configure-time. Just say
in README.md that the package will only work for the same version of
OSX and the same architecture.

For the future:

  - real universal binaries can be built by configuring and building
    each arch into a separate directory, then merge the result with
    `lipo`.

  - building a package for an older versions of Max OS X can be done
    by using `-mmacosx-version-min=10.6` and `-isysroot
    /Developer/SDKs/MacOSX10.5.sdk` on both `CFLAGS` and `LDFLAGS`.

11 years agoconfigure: remove out-dated instructions to regen autoconf out-of-git
Vincent Bernat [Mon, 24 Jun 2013 17:47:46 +0000 (19:47 +0200)] 
configure: remove out-dated instructions to regen autoconf out-of-git

There is no need to hack anything, thanks to the use of
`./get-version` script.

11 years agosnmp: fix a typo in `agent_priv.c`
Vincent Bernat [Mon, 24 Jun 2013 17:41:46 +0000 (19:41 +0200)] 
snmp: fix a typo in `agent_priv.c`

11 years agoconfigure: ensure that osx/scripts are executable
Vincent Bernat [Mon, 24 Jun 2013 17:41:20 +0000 (19:41 +0200)] 
configure: ensure that osx/scripts are executable

11 years agoosx: use HTML files instead of RTF for welcome message
Vincent Bernat [Mon, 24 Jun 2013 17:18:05 +0000 (19:18 +0200)] 
osx: use HTML files instead of RTF for welcome message

Also add a conclusion file.

11 years agoosx: simpler instructions in README.md
Vincent Bernat [Mon, 24 Jun 2013 17:04:33 +0000 (19:04 +0200)] 
osx: simpler instructions in README.md

11 years agoosx: add a target to build an OSX package
Vincent Bernat [Sun, 23 Jun 2013 21:26:05 +0000 (23:26 +0200)] 
osx: add a target to build an OSX package

We use pkgbuild and productbuild (which seem to have superseded
PackageMaker). Those tools are shipped from OSX 10.6.6. There are only
a few examples of how to use those tools with daemons. You may also
look at Jenkins or ngircd.

See `README.md` for more information on how to invoke the build of a
package.

11 years agoconfigure: fix a typo in the description of `--with-embedded-libevent` option
Vincent Bernat [Mon, 24 Jun 2013 10:03:55 +0000 (12:03 +0200)] 
configure: fix a typo in the description of `--with-embedded-libevent` option

11 years agotravis: check that we can build lldpd with embedded libevent
Vincent Bernat [Mon, 24 Jun 2013 09:58:37 +0000 (11:58 +0200)] 
travis: check that we can build lldpd with embedded libevent

Since we got an option to force the use of embedded libevent, let's
test that.

11 years agoconfigure: add a flag to force use of embedded libevent
Vincent Bernat [Mon, 24 Jun 2013 09:57:21 +0000 (11:57 +0200)] 
configure: add a flag to force use of embedded libevent

This will prove useful for OSX when building as a package.

11 years agodebian: update packaging to match downstream
Vincent Bernat [Sun, 23 Jun 2013 17:41:44 +0000 (19:41 +0200)] 
debian: update packaging to match downstream

11 years agocompat: include config.h in compat.h
Vincent Bernat [Sun, 23 Jun 2013 12:26:53 +0000 (14:26 +0200)] 
compat: include config.h in compat.h

Without this inclusion, no `HAVE_*` macro was defined. This was
triggered because with some libc, `strndup()` is defined by a macro
and therefore cannot be redefined as a function.

11 years agocompat: fix strndup
Vincent Bernat [Sun, 23 Jun 2013 08:03:27 +0000 (10:03 +0200)] 
compat: fix strndup

11 years agoNEWS: add an entry about the use of `strndup()`
Vincent Bernat [Sun, 23 Jun 2013 07:43:20 +0000 (09:43 +0200)] 
NEWS: add an entry about the use of `strndup()`

11 years agocompat: add `strndup()` compatibility function
Vincent Bernat [Sun, 23 Jun 2013 07:25:02 +0000 (09:25 +0200)] 
compat: add `strndup()` compatibility function

This function does not exist on OS X 10.6 for example. This was a long
time GNU extension.

11 years agocompat: remove copyright notice for setproctitle()
Vincent Bernat [Sun, 23 Jun 2013 07:24:13 +0000 (09:24 +0200)] 
compat: remove copyright notice for setproctitle()

It's an empty function!

11 years agotests: define ck_assert_ptr_eq if check is too old
Vincent Bernat [Sun, 23 Jun 2013 07:09:13 +0000 (09:09 +0200)] 
tests: define ck_assert_ptr_eq if check is too old

11 years agoosx: use SHA1 instead of MD5 in homebrew formula
Vincent Bernat [Sun, 23 Jun 2013 06:58:42 +0000 (08:58 +0200)] 
osx: use SHA1 instead of MD5 in homebrew formula

11 years agocheck: use `ck_assert_ptr_eq` instead of `ck_assert_int_eq`.
Vincent Bernat [Sat, 22 Jun 2013 15:04:36 +0000 (17:04 +0200)] 
check: use `ck_assert_ptr_eq` instead of `ck_assert_int_eq`.

11 years agostyle: use C99 designated initializers instead of memset() when possible
Vincent Bernat [Sat, 22 Jun 2013 15:00:34 +0000 (17:00 +0200)] 
style: use C99 designated initializers instead of memset() when possible

11 years agopackaging: update to 0.7.5
Vincent Bernat [Sat, 22 Jun 2013 12:07:08 +0000 (14:07 +0200)] 
packaging: update to 0.7.5

11 years agotokenizer: input buffer was too small 0.7.5
Vincent Bernat [Sat, 22 Jun 2013 11:57:31 +0000 (13:57 +0200)] 
tokenizer: input buffer was too small

11 years agopackaging: update packaging
Vincent Bernat [Sat, 22 Jun 2013 10:55:27 +0000 (12:55 +0200)] 
packaging: update packaging

11 years agobpf: on OpenBSD, invert the filter direction 0.7.4
Vincent Bernat [Sat, 22 Jun 2013 10:15:47 +0000 (12:15 +0200)] 
bpf: on OpenBSD, invert the filter direction

From the manual page:

> Sets or gets the status of the `direction filter` flag.  If
> non-zero, packets matching the specified direction (either
> `BPF_DIRECTION_IN` or `BPF_DIRECTION_OUT`) will be ignored.

11 years agoNEWS: add an entry for the use of `setproctitle()`
Vincent Bernat [Fri, 21 Jun 2013 07:33:40 +0000 (09:33 +0200)] 
NEWS: add an entry for the use of `setproctitle()`

11 years agocompat: declare `setproctitle()` as a printf function
Vincent Bernat [Fri, 21 Jun 2013 07:29:41 +0000 (09:29 +0200)] 
compat: declare `setproctitle()` as a printf function

11 years agodebian: build-depends on libbssd-dev
Vincent Bernat [Fri, 21 Jun 2013 07:13:57 +0000 (09:13 +0200)] 
debian: build-depends on libbssd-dev

11 years agolldpd: when no `setproctitle()` available, don't count neighbors
Vincent Bernat [Fri, 21 Jun 2013 07:13:01 +0000 (09:13 +0200)] 
lldpd: when no `setproctitle()` available, don't count neighbors

11 years agolldpd: count number of chassis to get number of neighbors
Vincent Bernat [Fri, 21 Jun 2013 07:10:02 +0000 (09:10 +0200)] 
lldpd: count number of chassis to get number of neighbors

Also, if only one neighbor, just display its name.

11 years agolldpd: don't call `lldpd_count_neighbors()` too many times
Vincent Bernat [Fri, 21 Jun 2013 07:01:30 +0000 (09:01 +0200)] 
lldpd: don't call `lldpd_count_neighbors()` too many times

11 years agobuild: use libbsd if available, also use `setproctitle()`
Vincent Bernat [Fri, 21 Jun 2013 00:55:50 +0000 (02:55 +0200)] 
build: use libbsd if available, also use `setproctitle()`

The monitor process will be titled "monitor", while the unprivileged
one will have the number of neighbors displayed. We provide an empty
fallback since this function is not essential.

On Linux, we expect `setproctitle()` to be available in `libbsd`. This
makes functions like `strlcpy()` and `fgetln()` also
available. However, the headers are `bsd/string.h`, so we either need
to declare the prototype or include those new headers (or use the
overlay system). A simple thing to do is to detect the usage of libbsd
and include the appropriate headers in this case.

11 years agolldpcli: `configure system platform` to override platform description
Vincent Bernat [Thu, 20 Jun 2013 23:24:04 +0000 (01:24 +0200)] 
lldpcli: `configure system platform` to override platform description

11 years agolldpcli: `configure system description` to override chassis description
Vincent Bernat [Thu, 20 Jun 2013 23:15:15 +0000 (01:15 +0200)] 
lldpcli: `configure system description` to override chassis description

11 years agolldpcli: split `conf.c` into `conf-system.c` and `conf-lldp.c`.
Vincent Bernat [Thu, 20 Jun 2013 23:01:46 +0000 (01:01 +0200)] 
lldpcli: split `conf.c` into `conf-system.c` and `conf-lldp.c`.

11 years agolldpcli: `configure system interface pattern` instead of `configure lldp iface-pattern`
Vincent Bernat [Thu, 20 Jun 2013 22:58:51 +0000 (00:58 +0200)] 
lldpcli: `configure system interface pattern` instead of `configure lldp iface-pattern`

`configure system` will contain non-LLDP related stuff. Moreover, we
may add `configure system interface alias rewrite` to enable the
rewrite of ifalias (a long awaited feature).

12 years agolibevent: use GitHub git tree
Vincent Bernat [Sun, 9 Jun 2013 12:23:23 +0000 (14:23 +0200)] 
libevent: use GitHub git tree

Sourceforge one is out-of-date

12 years agodebian: sync packaging with official Debian package
Vincent Bernat [Sun, 9 Jun 2013 09:32:04 +0000 (11:32 +0200)] 
debian: sync packaging with official Debian package

12 years agolibevent: switch to patches-2.0 branch to get the appropriate automake fix
Vincent Bernat [Sun, 9 Jun 2013 09:17:52 +0000 (11:17 +0200)] 
libevent: switch to patches-2.0 branch to get the appropriate automake fix

libevent 2.0.21 is not compatible with automake 2.13. libevent 2.0.22
will be but is not released.

12 years agogit: ignore test-driver, generated by recent automake versions
Vincent Bernat [Sun, 9 Jun 2013 09:13:26 +0000 (11:13 +0200)] 
git: ignore test-driver, generated by recent automake versions

12 years agoFixed some boundary conditions in code that cleans
Roopa Prabhu [Sat, 8 Jun 2013 08:30:43 +0000 (10:30 +0200)] 
Fixed some boundary conditions in code that cleans
remote ports on ttl expiry.

Problem:
- ttl expires, cleanup check fails to detect that ttl has elapsed
and skips cleanup
- After that, The ttl timer set routine again ends up setting the timer to ttl
resulting in 2 * ttl time for the expired rport to get released

(The test I did was with 1 port)

12 years agoliblldpctl: fix infinite loop when user is reading fixed chunks
Pradosh Mohapatra [Fri, 7 Jun 2013 06:28:23 +0000 (08:28 +0200)] 
liblldpctl: fix infinite loop when user is reading fixed chunks

ISSUE:

_lldpctl_do_something() has the following loop for receiving a complete
message:

while ((bytes_needed = ctl_msg_recv_unserialized(...)) > 0) {
    _lldpctl_needs(bytes_needed)
}

ctl_msg_recv_unserialized() processes the received message and determines
how many more bytes are needed. First time, it requests "header" worth of
bytes. Once it receives that, it looks at header->len to determine next
set of bytes.

_lldpctl_needs() calls the connection's receive() routine to receive a
chunk of data and copies that over the a buffer in the connection structure,
either by malloc/copy or realloc/memmove. This buffer is called
conn->input_buffer. conn->input_buffer_len stores how many bytes are
currently in conn->input_buffer.

The issue is with the following statement in _lldpctl_needs():

        if (conn->input_buffer_len >= length) return 0;

where length is bytes_needed in the above illustration.

Suppose the message requires 16578 bytes. The connection's receive()
routine provided by the application reads in chunks of 1024 bytes.
With the above logic, the loop will execute successfully for 16 times
with the following resultant state:

conn->input_buffer_len = 16384
bytes_needed = 194

The above conditional statement in the beginning of _lldpctl_needs()
will cause it to return 0. ctl_msg_recv_unserialized() will keep asking
for 194 more bytes. The while() loop goes ad infinitum.

PATCH:

Remove the above statement. It is not needed.

12 years agomarshal: fix alignment issue when unserializing
Vincent Bernat [Thu, 6 Jun 2013 21:54:23 +0000 (23:54 +0200)] 
marshal: fix alignment issue when unserializing

On some archs (Sparc and sometimes ARM), unaligned access are
forbidden. Instead of copying unaligned structures with `memcpy()`, we
ensure that `struct marshal_serialized` structures are always
correctly aligned, including when they are serialized. This is done by
adding some padding before appending such a structure to a buffer.

12 years agolog: fix memory leak when using a log handler
Vincent Bernat [Thu, 6 Jun 2013 21:23:13 +0000 (23:23 +0200)] 
log: fix memory leak when using a log handler

This is quite important for liblldpctl.

12 years agomarshal: don't declare serialize/unserialize helper for string
Vincent Bernat [Thu, 6 Jun 2013 20:48:42 +0000 (22:48 +0200)] 
marshal: don't declare serialize/unserialize helper for string

When using convenience library, this may lead to multiple definition
of this function. We are better off not defining it and using
`marshal_unserialize()` in `client.c` instead.

12 years agolldpd: fix an alignment (non-)issue
Vincent Bernat [Thu, 6 Jun 2013 20:38:43 +0000 (22:38 +0200)] 
lldpd: fix an alignment (non-)issue

12 years agolldpcli: don't use an hack to pass the writer to watch callback
Vincent Bernat [Thu, 6 Jun 2013 20:38:28 +0000 (22:38 +0200)] 
lldpcli: don't use an hack to pass the writer to watch callback

Use a proper structure for this purpose.

12 years agomarshal: provide type-specific serialization/unserialization functions
Vincent Bernat [Sun, 2 Jun 2013 13:49:09 +0000 (15:49 +0200)] 
marshal: provide type-specific serialization/unserialization functions

Those functions should be used in place of `marshal_serialize()` and
`marshal_unserialize()` if possible.

12 years agoclient: fix a memory leak when changing lldpd configuration
Vincent Bernat [Sat, 1 Jun 2013 10:07:43 +0000 (12:07 +0200)] 
client: fix a memory leak when changing lldpd configuration

lldpd_config_cleanup() does not free the configuration structure.

12 years agoctl: fix a memory leak when cleaning control socket
Vincent Bernat [Sat, 1 Jun 2013 10:05:11 +0000 (12:05 +0200)] 
ctl: fix a memory leak when cleaning control socket

12 years agoclient: trigger interface refresh when updating interface pattern
Vincent Bernat [Sat, 1 Jun 2013 09:57:09 +0000 (11:57 +0200)] 
client: trigger interface refresh when updating interface pattern

12 years agolib: fix a memory leak when modifying interface pattern
Vincent Bernat [Sat, 1 Jun 2013 09:48:24 +0000 (11:48 +0200)] 
lib: fix a memory leak when modifying interface pattern