]> git.ipfire.org Git - thirdparty/lldpd.git/log
thirdparty/lldpd.git
11 years agoMac OS X support.
Vincent Bernat [Thu, 10 Jan 2013 19:23:57 +0000 (20:23 +0100)] 
Mac OS X support.

This includes bond, VLAN and bridge support. Mac OS X is pretty
similar to FreeBSD except for bonding which is different. Bonding code
is stolen from ifconfig.c. Header files from XNU are
shipped because they are missing from Mac OS X developer tools.

Still missing:
 - integration into launchd
 - homebrew formula
 - DMI part (through ioreg)

11 years agobuild: add tag date in changelog
Vincent Bernat [Mon, 7 Jan 2013 21:56:07 +0000 (22:56 +0100)] 
build: add tag date in changelog

11 years agopriv: mirror the exit status of the child
Vincent Bernat [Mon, 7 Jan 2013 20:59:32 +0000 (21:59 +0100)] 
priv: mirror the exit status of the child

When exiting because the child has exited, the privileged processus
will mirror the exit status and the signal that killed the child if
any. This allows monitoring daemon like systemd to detect an
unexpected exit.

11 years agodebian: add systemd support
Vincent Bernat [Sun, 6 Jan 2013 23:53:01 +0000 (00:53 +0100)] 
debian: add systemd support

Provides a lldpd.service file and let `lldpd` notify systemd when it
is ready using the notification socket.

11 years agolldpd: remove uncleaned control socket when noone is listening
Vincent Bernat [Mon, 7 Jan 2013 11:26:25 +0000 (12:26 +0100)] 
lldpd: remove uncleaned control socket when noone is listening

11 years agodebian: provide an upstart job
Vincent Bernat [Sun, 6 Jan 2013 23:24:31 +0000 (00:24 +0100)] 
debian: provide an upstart job

lldpd daemonization seems to confuse upstart (I think this is because
it also forks the monitor process, otherwise the daemonization is
pretty classic). Therefore, when we detect we are run by
upstart (because of UPSTART_JOB variable), we raise the SIGSTOP signal
instead of daemonizing. Upstart notices it and will resume us and
consider we are ready. No more misleading fork.

Also, ignore SIGHUP which is used for reload.

11 years agoREADME: mention multi-OS support
Vincent Bernat [Sun, 6 Jan 2013 15:47:01 +0000 (16:47 +0100)] 
README: mention multi-OS support

And mention `lldpcli` in place of `lldpctl`.

11 years agodebian: update Debian packaging.
Vincent Bernat [Sun, 6 Jan 2013 15:46:36 +0000 (16:46 +0100)] 
debian: update Debian packaging.

The diff from the official package is now a lot smaller.

11 years agoredhat: fix Redhat packaging
Vincent Bernat [Sun, 6 Jan 2013 15:42:12 +0000 (16:42 +0100)] 
redhat: fix Redhat packaging

Call /sbin/ldconfig on postinstall.

11 years agoredhat: update lldpd.spec
Vincent Bernat [Sun, 6 Jan 2013 13:56:25 +0000 (14:56 +0100)] 
redhat: update lldpd.spec

11 years agobuild: fix generation of ChangeLog
Vincent Bernat [Sun, 6 Jan 2013 13:45:53 +0000 (14:45 +0100)] 
build: fix generation of ChangeLog

We must be able to have one when git is not present because we include
it in dist, but we also must generate it on each release. The previous
fix would keep the ChangeLog empty or not updated. We use a PHONY
target instead (and not a real PHONY target since we cannot add it
because automake doesn't like it).

11 years agolldpcli: add a "help" command. 0.7.0
Vincent Bernat [Sun, 6 Jan 2013 13:06:19 +0000 (14:06 +0100)] 
lldpcli: add a "help" command.

This should come handy for people not having readline or completion.

11 years agolldpcli: fix "source unknown" for Dot3/LLDP-MED power.
Vincent Bernat [Sun, 6 Jan 2013 12:34:36 +0000 (13:34 +0100)] 
lldpcli: fix "source unknown" for Dot3/LLDP-MED power.

11 years agolldpcli: don't rely on `rl_delete_text()`
Vincent Bernat [Sun, 6 Jan 2013 12:21:51 +0000 (13:21 +0100)] 
lldpcli: don't rely on `rl_delete_text()`

Even recent versions of libedit do not include `rl_delete_text()`
compatibility function. We don't use it.

11 years agolldpcli: make readline library optional.
Vincent Bernat [Sun, 6 Jan 2013 10:43:33 +0000 (11:43 +0100)] 
lldpcli: make readline library optional.

And improve compatibility. We should be compatible with BSD
libedit. However, we are not compatible with older versions that lack
`rl_insert_text()` and `rl_delete_text()`.

11 years agolldpcli: switch to GNU Readline.
Vincent Bernat [Sun, 6 Jan 2013 09:47:21 +0000 (10:47 +0100)] 
lldpcli: switch to GNU Readline.

libedit is not available on old versions of Linux distro. We try to
use Readline API instead which may be compatible with the libedit
version available in BSD.

This means that we have to write our own tokenizer. This also means
that we can make Readline optional.

11 years agoevent: trigger the main iteration when starting the main loop.
Vincent Bernat [Sat, 5 Jan 2013 19:57:24 +0000 (20:57 +0100)] 
event: trigger the main iteration when starting the main loop.

Otherwise, nothing will happen until there is an interface change...

11 years agolldpcli: ensure `conn` is initialized to NULL to avoid a compiler warning
Vincent Bernat [Sat, 5 Jan 2013 19:44:53 +0000 (20:44 +0100)] 
lldpcli: ensure `conn` is initialized to NULL to avoid a compiler warning

11 years agolldpcli: don't propose configure for options not compiled
Vincent Bernat [Sat, 5 Jan 2013 16:37:37 +0000 (17:37 +0100)] 
lldpcli: don't propose configure for options not compiled

We don't rely on ENABLE_* variables to keep lldpcli independant of the
source code of the library.

11 years agolib: fix a compilation problem when LLDP-MED or Dot3 were disabled
Vincent Bernat [Sat, 5 Jan 2013 16:31:02 +0000 (17:31 +0100)] 
lib: fix a compilation problem when LLDP-MED or Dot3 were disabled

11 years agoredhat: also ship lldpcli
Vincent Bernat [Sat, 5 Jan 2013 16:24:33 +0000 (17:24 +0100)] 
redhat: also ship lldpcli

11 years agoredhat: add libedit-devel for RPM distros as well
Vincent Bernat [Sat, 5 Jan 2013 16:22:46 +0000 (17:22 +0100)] 
redhat: add libedit-devel for RPM distros as well

11 years agodebian: also add libedit-dev as a dependency
Vincent Bernat [Sat, 5 Jan 2013 16:21:21 +0000 (17:21 +0100)] 
debian: also add libedit-dev as a dependency

11 years agotravis: add libedit-dev in the dependencies
Vincent Bernat [Sat, 5 Jan 2013 16:20:56 +0000 (17:20 +0100)] 
travis: add libedit-dev in the dependencies

11 years agolldpcli: let libedit install its own signal handlers (SIGWINCH)
Vincent Bernat [Sat, 5 Jan 2013 16:13:02 +0000 (17:13 +0100)] 
lldpcli: let libedit install its own signal handlers (SIGWINCH)

11 years agoMerge branch 'feature/1/cli'
Vincent Bernat [Sat, 5 Jan 2013 16:00:05 +0000 (17:00 +0100)] 
Merge branch 'feature/1/cli'

11 years agodoc: fix doxygen warnings and don't parse include/linux
Vincent Bernat [Sat, 5 Jan 2013 15:59:53 +0000 (16:59 +0100)] 
doc: fix doxygen warnings and don't parse include/linux

11 years agoconfigure: detect libedit without pkg-config
Vincent Bernat [Sat, 5 Jan 2013 15:59:41 +0000 (16:59 +0100)] 
configure: detect libedit without pkg-config

BSD comes with libedit shipped and without pkg-config being able to
detect it. Fallback to manual detection of the headers and check if we
can compile a program with it.

11 years agobuild: no need to save CFLAGS LDFLAGS when testing libevent
Vincent Bernat [Sat, 5 Jan 2013 15:39:04 +0000 (16:39 +0100)] 
build: no need to save CFLAGS LDFLAGS when testing libevent

11 years agolldpcli: accept a command from the command line arguments
Vincent Bernat [Sat, 5 Jan 2013 15:09:29 +0000 (16:09 +0100)] 
lldpcli: accept a command from the command line arguments

As stated in the manual page, lldpcli should accept a command from
command line arguments.

11 years agolldpcli: fix manual page about specifying ports.
Vincent Bernat [Sat, 5 Jan 2013 15:03:20 +0000 (16:03 +0100)] 
lldpcli: fix manual page about specifying ports.

Ports are comma-separated list.

11 years agolldpcli: rename lldpctl to lldpcli.
Vincent Bernat [Sat, 5 Jan 2013 15:00:33 +0000 (16:00 +0100)] 
lldpcli: rename lldpctl to lldpcli.

We also provide a backward-compatible lldpctl.

11 years agolldpctl: remove "unconfigure" commands (not implemented)
Vincent Bernat [Sat, 5 Jan 2013 13:49:51 +0000 (14:49 +0100)] 
lldpctl: remove "unconfigure" commands (not implemented)

This seems better to remove them instead of documenting them but not
implementing them. The API makes it difficult to implement them for
now.

11 years agolldpctl: add a CLI
Vincent Bernat [Sat, 5 Jan 2013 13:44:46 +0000 (14:44 +0100)] 
lldpctl: add a CLI

CLI provides contextual help and completion. It uses libedit.

11 years agolib: add a function to retrieve a map
Vincent Bernat [Sat, 5 Jan 2013 12:24:10 +0000 (13:24 +0100)] 
lib: add a function to retrieve a map

Some values can only take a discrete number of int values. We have a
map to display them as string. We provide this map through a function
and we also accept values from this map as string input. This is a
slight change in the API but it should be backward compatible.

11 years agolib: fix a memory leak when setting LLDP-MED ELIN number
Vincent Bernat [Fri, 4 Jan 2013 22:07:00 +0000 (23:07 +0100)] 
lib: fix a memory leak when setting LLDP-MED ELIN number

11 years agoevent: make levent_send_now() work again
Vincent Bernat [Tue, 1 Jan 2013 13:08:39 +0000 (14:08 +0100)] 
event: make levent_send_now() work again

11 years agoNEWS: add a word about detecting interface changes
Vincent Bernat [Mon, 31 Dec 2012 17:58:58 +0000 (18:58 +0100)] 
NEWS: add a word about detecting interface changes

And also dump next version to 0.7.0. We have a lot of changes here.

11 years ago*bsd: listen on PF_ROUTE socket to get interface changes
Vincent Bernat [Mon, 31 Dec 2012 17:57:07 +0000 (18:57 +0100)] 
*bsd: listen on PF_ROUTE socket to get interface changes

Only OpenBSD is able to filter messages. We could filter messages for
FreeBSD and NetBSD after receiving them but we don't bother doing
it. Any change will trigger a rescan of the interfaces. Since this
cannot happen more than once per second, this should be OK for most
people.

11 years agoevent: avoid socket leak if we cannot register netlink socket
Vincent Bernat [Mon, 31 Dec 2012 17:56:02 +0000 (18:56 +0100)] 
event: avoid socket leak if we cannot register netlink socket

11 years agoevent: use a separate event timer for each port
Vincent Bernat [Mon, 31 Dec 2012 17:25:42 +0000 (18:25 +0100)] 
event: use a separate event timer for each port

Each port will have its own live with its own timer. If a port just
appeared, it will have its own 30 seconds timer. We also notice
changes independently on each port, so the timer is reset on each
change on a given port.

Also, as a safeguard, update port-related information every 10
minutes. We can catch changes in addresses this way (otherwise,
detecting them via netlink is noisy).

11 years agolldpd: remove unused `g_lastsent`
Vincent Bernat [Mon, 31 Dec 2012 16:52:02 +0000 (17:52 +0100)] 
lldpd: remove unused `g_lastsent`

Since migration to libevent, `g_lastsent` variable in `struct lldpd`
was not used anymore.

11 years agomarshal: ensure that two identic structures are serialized in the same way
Vincent Bernat [Sun, 30 Dec 2012 18:12:52 +0000 (19:12 +0100)] 
marshal: ensure that two identic structures are serialized in the same way

Because we serialized pointers unchanged and use them to track
substructures, two identic structures located at different places in
the memory were serialized as two different buffers. It is easy to use
"dummy" pointers instead of real ones and then be able to compare two
structures by serializing them and compare the resulting buffers.

However, those two structures should be calloced to make this
works. When allocating from the stack, use of designated initializers
don't mean anything about padded memory (no guarantee that it will be
set to 0).

11 years agoNEWS: add a word about NetBSD support
Vincent Bernat [Sun, 30 Dec 2012 11:26:21 +0000 (12:26 +0100)] 
NEWS: add a word about NetBSD support

11 years agointerfaces: correctly detect link down interfaces
Vincent Bernat [Sun, 30 Dec 2012 11:22:21 +0000 (12:22 +0100)] 
interfaces: correctly detect link down interfaces

An interface can be administratively up and operationally down. Handle
this as a down interface.

11 years agonetlink: listen to netlink changes to trigger interface updates
Vincent Bernat [Sun, 23 Dec 2012 10:11:38 +0000 (11:11 +0100)] 
netlink: listen to netlink changes to trigger interface updates

This allows to detect "link down" or new interfaces in a timely
manner. There is still a global event loop for sending LLDPDU to each
port (no per-port sending loop).

11 years agolldpd: cleanup phase is done in `update_local_ports()`
Vincent Bernat [Sun, 30 Dec 2012 10:05:55 +0000 (11:05 +0100)] 
lldpd: cleanup phase is done in `update_local_ports()`

Cleaning up unused ports and chassis is really part of updating local
ports process.

11 years agoglobal: fix some issues detected by cppcheck
Vincent Bernat [Sat, 29 Dec 2012 23:25:31 +0000 (00:25 +0100)] 
global: fix some issues detected by cppcheck

This includes some memory leaks when decoding erroneous LLDP TLV.

11 years agolib: use strlcpy and snprintf instead of strcpy and sprintf
Vincent Bernat [Sat, 29 Dec 2012 18:54:43 +0000 (19:54 +0100)] 
lib: use strlcpy and snprintf instead of strcpy and sprintf

Even if we used strcpy and sprintf safely, use strlcpy and snprintf to
show that we know what we do (and make OpenBSD linker happy).

11 years agoopenbsd: add DMI information
Vincent Bernat [Sat, 29 Dec 2012 18:51:27 +0000 (19:51 +0100)] 
openbsd: add DMI information

11 years agoopenbsd: don't use BIOCSSEESENT with OpenBSD
Vincent Bernat [Sat, 29 Dec 2012 17:59:07 +0000 (18:59 +0100)] 
openbsd: don't use BIOCSSEESENT with OpenBSD

This does not exist. Switch back to BIOCSDIRFILT.

11 years agofreebsd: add DMI support
Vincent Bernat [Sat, 29 Dec 2012 17:48:46 +0000 (18:48 +0100)] 
freebsd: add DMI support

11 years agopriv: open special call is only needed for Linux
Vincent Bernat [Fri, 28 Dec 2012 16:57:07 +0000 (17:57 +0100)] 
priv: open special call is only needed for Linux

11 years agoAdd NetBSD support.
Vincent Bernat [Fri, 28 Dec 2012 16:48:22 +0000 (17:48 +0100)] 
Add NetBSD support.

Only aggregation support was really different.

11 years agointerfaces: put the appropriate aggregation ID when an interface is enslaved
Vincent Bernat [Fri, 28 Dec 2012 16:46:39 +0000 (17:46 +0100)] 
interfaces: put the appropriate aggregation ID when an interface is enslaved

On *BSD, this was not done elsewhere.

11 years agoctl: fix previous partial commit about unix path max length
Vincent Bernat [Thu, 27 Dec 2012 22:53:58 +0000 (23:53 +0100)] 
ctl: fix previous partial commit about unix path max length

Never commit without compiling. Thanks Travis-CI for spotting this.

11 years agoctl: don't use a #define to define size, use sizeof()
Vincent Bernat [Thu, 27 Dec 2012 22:40:45 +0000 (23:40 +0100)] 
ctl: don't use a #define to define size, use sizeof()

11 years agoOpenBSD support.
Vincent Bernat [Thu, 27 Dec 2012 22:25:26 +0000 (23:25 +0100)] 
OpenBSD support.

With VLAN, bonding and bridge support as well. Tested with OpenBSD
5.2.

To ease porting, we also shop `netinet/if_ether.h` which is a stripped
down version of the one contained in OpenBSD (without kernel and ARP
stuff). Including correctly this header has always been a pain, even
when supporting only Linux.

11 years agofreebsd: make it compile and work on real FreeBSD systems
Vincent Bernat [Thu, 27 Dec 2012 21:04:28 +0000 (22:04 +0100)] 
freebsd: make it compile and work on real FreeBSD systems

lldpd now also runs on FreeBSD. Tested on FreeBSD 8.3.

11 years agofreebsd: link aggregation only works from FreeBSD 9.1.
Vincent Bernat [Wed, 26 Dec 2012 00:28:44 +0000 (01:28 +0100)] 
freebsd: link aggregation only works from FreeBSD 9.1.

This is due to a limitation in the kernel forbidding any packet to be
sent on physical interfaces.

11 years agofreebsd: correctly check if routing is enabled
Vincent Bernat [Tue, 25 Dec 2012 22:57:37 +0000 (23:57 +0100)] 
freebsd: correctly check if routing is enabled

11 years agobuild: allow more modern coding style with empty initializers
Vincent Bernat [Tue, 25 Dec 2012 21:38:38 +0000 (22:38 +0100)] 
build: allow more modern coding style with empty initializers

In C99, we can do:

     struct ifreq ifr = {};

Instead of

     struct ifreq ifr;
     memset(&ifr, 0. sizeof(ifr));

We disable the empty initializer warning to allow this. Moreover, we
also allow to mix code and declarations.

11 years agoAdd support for FreeBSD.
Vincent Bernat [Tue, 25 Dec 2012 18:43:48 +0000 (19:43 +0100)] 
Add support for FreeBSD.

lldpd is now able to run on FreeBSD (at least Debian
GNU/kFreeBSD). Adaptation to other BSD should be easy. The support is
complete and include VLAN, bridges and link aggregation.

11 years agointerfaces: sending/receiving on raw interfaces is OS specific
Vincent Bernat [Tue, 25 Dec 2012 11:15:36 +0000 (12:15 +0100)] 
interfaces: sending/receiving on raw interfaces is OS specific

On Linux, we can send/receive with `recvfrom()`. With BSD and the use
of BPF, we send receive from BPF buffers. Therefore, ethernet
operations are moved into `interfaces-linux.c`.

11 years agointerfaces: setting up raw interface with BPF filter is OS specific
Vincent Bernat [Tue, 25 Dec 2012 10:40:06 +0000 (11:40 +0100)] 
interfaces: setting up raw interface with BPF filter is OS specific

On Linux, setting up a BPF filter on an interface means using
`setsockopt()` on a raw socket. On BSD, we need to open `/dev/bpf` as
a raw socket and attach the interface to it. Therefore, physical
interface initialization cannot be abstracted.

11 years agointerfaces: abstraction of interfaces/devices
Vincent Bernat [Mon, 24 Dec 2012 16:56:01 +0000 (17:56 +0100)] 
interfaces: abstraction of interfaces/devices

To prepare support of additional OS, interfaces have been abstracted
into a proper structure. It is still expected that each OS should have
its own `update_interfaces()` that will discover interfaces and set
the appropriate `lldpd_hardware` structures. However, helper functions
have been setup with the assumption that interfaces are put in an
abstract `interfaces_device_list`. It is expected that
`update_interfaces()` build such a list with all sensible
information (VLAN, bond, bridge, drivers, ...). Once this is done,
`interfaces_helper_*` function can be called to do most of the work.

Another change is that VLAN stuff, bridge stuff and bonding stuff is
discovered only once instead of using functions each time we need to
know something. This should lower the number of ioctl call (which can
be costly on some special hardware, for example with Marvell
DSA). This also enable to discover some of those stuff through
Netlink.

Supporting FreeBSD is the next step.

11 years agonetlink: fix bogus alignment warnings
Vincent Bernat [Sun, 23 Dec 2012 15:26:38 +0000 (16:26 +0100)] 
netlink: fix bogus alignment warnings

The fix is stolen from XORP: we insert an intermediate cast to
`(void*)` to avoid the warning. Netlink stuff is already taking care
of the alignment issue, the compiler just doesn't know. This means
that the headers we copied from the kernel should be modified with:

     sed -i -e 's/\*)(((char\*/*)(void*)(((char*/g' \
            -e 's/(void\*)(void\*)/(void*)/g' include/**/*.h

11 years agoframe: mark with `(void)` when we don't check for result of PEEK/POKE
Vincent Bernat [Sun, 23 Dec 2012 14:51:48 +0000 (15:51 +0100)] 
frame: mark with `(void)` when we don't check for result of PEEK/POKE

11 years agoctl: fix alignment issue
Vincent Bernat [Sun, 23 Dec 2012 14:48:11 +0000 (15:48 +0100)] 
ctl: fix alignment issue

If the provided input buffer is not aligned properly, the use of
message header won't work on structure not allowing unaligned access.

11 years agomarshal: respect GCC strict-aliasing rule
Vincent Bernat [Sun, 23 Dec 2012 12:08:26 +0000 (13:08 +0100)] 
marshal: respect GCC strict-aliasing rule

Strict-aliasing states that when a derefencing pointers to objects of
different types will never refer to the same memory location. A
complete explanation is available here:
 http://cellperformance.beyond3d.com/articles/2006/06/understanding-strict-aliasing.html

While `void*` is a special kind, `void**` is not. Therefore, we
respect strict-aliasing by using an intermediate variable.

11 years agointerfaces: disable the use of ioctl for bridges
Vincent Bernat [Sat, 22 Dec 2012 22:45:48 +0000 (23:45 +0100)] 
interfaces: disable the use of ioctl for bridges

ioctl for bridges are not needed since 2.6.14. Moreover, they don't
play well with some drivers and they have an undefined behaviour in
32/64 bits mixed environment. Instead, we use sysfs.

Moreover, we define a new configure option `--enable-oldies` which
allows the use of those ioctl. Currently, anything not needed with a
2.6.18 kernel will be declared as oldies and disabled by default.

11 years agobuild: ensure _GNU_SOURCE is defined early
Vincent Bernat [Sat, 22 Dec 2012 22:30:22 +0000 (23:30 +0100)] 
build: ensure _GNU_SOURCE is defined early

It is needed to use some extensions like `strnlen()`.

11 years agobuild: ship a include/ directory
Vincent Bernat [Sat, 22 Dec 2012 20:14:18 +0000 (21:14 +0100)] 
build: ship a include/ directory

Some (old) distributions are shipping outdated kernel headers. Some
oddities were detected in `configure` and corrected in `compat.h` but
this is cumbersome. Like `iproute`, we now ship a "complete" include/
directory containing the missing bits. It comes from a 3.6.9
kernel. Using too recent headers with too old kernel should not be a
problem. Those headers are just definition and there was not guarantee
that the kernel used to compile was the one which will be used to run.

11 years agointerfaces: harmonize arguments of detection functions
Vincent Bernat [Sat, 22 Dec 2012 19:25:23 +0000 (20:25 +0100)] 
interfaces: harmonize arguments of detection functions

Some detection functions were requiring a name, other an index. We
always use a `struct netlink_interface`. The only drawback is that
those functions can only be called in the context where this structure
exists, i.e when discovering interfaces. In the case of bonding, we
used one function to detect if the interface was active. We replace
this by an unconditional replacement of the source MAC address by 0.

11 years agolldpd: fix debug message when discarding a received frame
Vincent Bernat [Sat, 22 Dec 2012 19:23:07 +0000 (20:23 +0100)] 
lldpd: fix debug message when discarding a received frame

There are legit reasons to discard a received frame. This happens on
bond interfaces. Fix the message to just say we have discarded a
frame, not we are not able to receive something.

11 years agointerfaces: handle correctly VLAN inside VLAN inside bridges inside bonds
Vincent Bernat [Sat, 22 Dec 2012 18:49:15 +0000 (19:49 +0100)] 
interfaces: handle correctly VLAN inside VLAN inside bridges inside bonds

Recursively look for the physical interface.

11 years agointerfaces: switch to Netlink to gather interface-related information
Vincent Bernat [Thu, 20 Dec 2012 07:28:29 +0000 (08:28 +0100)] 
interfaces: switch to Netlink to gather interface-related information

Instead of using getifaddrs() which gives incomplete information, we
use Netlink which is supported since a long time. Many information are
supported by Netlink: bonding, bridging, VLAN... Unfortunately, the
degree of support depends on the version of the kernel:

 - IFLA_VLAN_* stuff is available since 2.6.23 only.
 - IFLA_MASTER seems to be supported since ages (at least
   2.4.32). However, it does not allow to differentiate a bridge and a
   bonding. It does not apply to a VLAN.
 - IFLA_LINK is not sent for a VLAN before 2.6.23.
 - IFLA_BRPORT_* has just landed in Linux.
 - IFLA_LINKINFO and IFLA_INFO_KIND which could help detect the kind
   of device are only available since 2.6.23.

So, in summary, we can't reliably use Netlink to gather VLAN, bridging
and bonding information if we want to support 2.6.18 kernels. When
2.6.23 will be the minimal version, we could do some interesting
things. Also, it seems that ethtool stuff is not available through
Netlink.

This commit also happens to prepare the support of additional OS. Only
interfaces-linux.c (and netlink.c) are now Linux specific. Adding
support for KFreeBSD should be easy enough. More code factorisation
will happen then.

11 years agobuild: make autogen.sh a little bit more generic
Vincent Bernat [Thu, 20 Dec 2012 08:23:01 +0000 (09:23 +0100)] 
build: make autogen.sh a little bit more generic

11 years agobuild: use a simplified autogen.sh script
Vincent Bernat [Wed, 19 Dec 2012 22:35:58 +0000 (23:35 +0100)] 
build: use a simplified autogen.sh script

The previous one was fairly complete but did not manage to generate
what was needed to get the build prepared. The bug is in autoreconf
which was calling `libtoolize` in `libevent` before doing it for the
main project. Hence, `ltmain.sh` was not found. It is still surprising
that we have such hackish build systems in 2012.

11 years agolibevent: use a git submodule
Vincent Bernat [Wed, 19 Dec 2012 21:15:27 +0000 (22:15 +0100)] 
libevent: use a git submodule

Instead of shipping the whole tarball for libevent in git, just use a
submodule against the official repository. ./autogen.sh is also
updated to be able to compile it.

11 years agotravis: workaround the fact that Travis images are not always up-to-date
Vincent Bernat [Mon, 17 Dec 2012 07:19:15 +0000 (08:19 +0100)] 
travis: workaround the fact that Travis images are not always up-to-date

11 years agolldpctl: new JSON output
Vincent Bernat [Mon, 17 Dec 2012 06:48:02 +0000 (07:48 +0100)] 
lldpctl: new JSON output

JSON output is done with "Jansson", a convenient JSON library. The
output may be a bit difficult to use when a multivalued field with
only one value is present. In this case, it is not put into an
array. For example, if there is only one neighbor, you get:
`{interface:{eth0: ...}}` while you will get this for two neighbors:
`{interface:[{eth0:...},{eth1:...}]}`.

11 years agolog: remove extra linefeeds from log_*() and fatal*() calls
Vincent Bernat [Mon, 17 Dec 2012 04:35:25 +0000 (05:35 +0100)] 
log: remove extra linefeeds from log_*() and fatal*() calls

11 years agoNEWS: add a mention about the fact we can filter debug logs
Vincent Bernat [Sun, 16 Dec 2012 15:15:41 +0000 (16:15 +0100)] 
NEWS: add a mention about the fact we can filter debug logs

11 years agolog: add -D option to filter out debug logs
Vincent Bernat [Sun, 16 Dec 2012 14:58:14 +0000 (15:58 +0100)] 
log: add -D option to filter out debug logs

The list of accepted tokens is documented in the manual page.

11 years agolog: convert LLOG_* to log_* and add more debug logs
Vincent Bernat [Sun, 16 Dec 2012 14:10:54 +0000 (15:10 +0100)] 
log: convert LLOG_* to log_* and add more debug logs

Convert all call to LLOG_* to log_* with prefix. Also convert
fatal/fatalx calls. Add more debugging since we will soon be able to
filter them.

11 years agosnmp: don't send traps when SNMP is not enabled
Vincent Bernat [Sun, 16 Dec 2012 12:35:21 +0000 (13:35 +0100)] 
snmp: don't send traps when SNMP is not enabled

11 years agolog: prefix logs with a token to allow filtering
Vincent Bernat [Sun, 16 Dec 2012 12:12:51 +0000 (13:12 +0100)] 
log: prefix logs with a token to allow filtering

Currently, the token defaults to the filename. Filtering has yet to be
done.

11 years agolog: enhance logging output
Vincent Bernat [Sun, 16 Dec 2012 11:34:36 +0000 (12:34 +0100)] 
log: enhance logging output

Append the current date in front of the log line. Display the
priority. Add some colors when logging on a TTY.

11 years agocompile: remove a warning about uninitialized struct
Vincent Bernat [Sun, 16 Dec 2012 11:27:53 +0000 (12:27 +0100)] 
compile: remove a warning about uninitialized struct

11 years agoUpdate to libevent 2.0.21.
Vincent Bernat [Mon, 19 Nov 2012 22:00:06 +0000 (23:00 +0100)] 
Update to libevent 2.0.21.

11 years agolldpd: add possibility to disable LLDP
Vincent Bernat [Mon, 12 Nov 2012 15:36:55 +0000 (16:36 +0100)] 
lldpd: add possibility to disable LLDP

LLDP was mandatory. It is now possible to disable it entirely with
`-ll`. In this case, when no neighbor is detected, the first enabled
protocol will be used. For example, with `-ll -c`, lldpd will act as a
pure CDP daemon.

11 years agolldp: fix parsing of LLDP pair control
Vincent Bernat [Thu, 25 Oct 2012 05:39:21 +0000 (07:39 +0200)] 
lldp: fix parsing of LLDP pair control

Thanks to Viktor Dukhovni for noticing this bug.

12 years agobuild: don't use a comment at start of rule (unportable)
Vincent Bernat [Wed, 26 Sep 2012 22:23:54 +0000 (00:23 +0200)] 
build: don't use a comment at start of rule (unportable)

12 years agobuild: build an empty changelog if not available
Vincent Bernat [Wed, 26 Sep 2012 22:14:01 +0000 (00:14 +0200)] 
build: build an empty changelog if not available

12 years agoredhat: don't build SNMP support on CentOS
Vincent Bernat [Wed, 26 Sep 2012 21:50:18 +0000 (23:50 +0200)] 
redhat: don't build SNMP support on CentOS

12 years agolib: silent some compiler warning about unitialized value
Vincent Bernat [Wed, 26 Sep 2012 21:37:45 +0000 (23:37 +0200)] 
lib: silent some compiler warning about unitialized value

12 years agobuild: install ChangeLog in /usr/share/doc
Vincent Bernat [Wed, 26 Sep 2012 21:37:25 +0000 (23:37 +0200)] 
build: install ChangeLog in /usr/share/doc

12 years agodebian/redhat: update packaging
Vincent Bernat [Wed, 26 Sep 2012 21:04:46 +0000 (23:04 +0200)] 
debian/redhat: update packaging

12 years agointerfaces: don't listen to enslaved interface until master interface has been configured
Vincent Bernat [Wed, 26 Sep 2012 19:08:08 +0000 (21:08 +0200)] 
interfaces: don't listen to enslaved interface until master interface has been configured

In case of errors, we were leaking events.