]> git.ipfire.org Git - thirdparty/lldpd.git/log
thirdparty/lldpd.git
9 years agobuild: require json-c >= 0.10
Vincent Bernat [Wed, 20 May 2015 20:35:20 +0000 (22:35 +0200)] 
build: require json-c >= 0.10

`json_object_object_get_ex` is only available from this version. json-c
name has been introduced from 0.11, so we can safely assume that with
this name, we have the right version. Do the checks only on old names.

9 years agoredhat: fix a typo in conditional JSON support
Vincent Bernat [Wed, 20 May 2015 20:29:53 +0000 (22:29 +0200)] 
redhat: fix a typo in conditional JSON support

9 years agoredhat: provide a simpler buildroot
Vincent Bernat [Wed, 20 May 2015 20:28:35 +0000 (22:28 +0200)] 
redhat: provide a simpler buildroot

It seems that %() may not be expanded as expected.

9 years agorelease: prepare new version
Vincent Bernat [Wed, 20 May 2015 20:04:09 +0000 (22:04 +0200)] 
release: prepare new version

9 years agolldpcli: fix another memory leak when querying statistics
Vincent Bernat [Wed, 20 May 2015 18:34:27 +0000 (20:34 +0200)] 
lldpcli: fix another memory leak when querying statistics

9 years agolldpcli: fix a memory leak when querying custom TLVs
Vincent Bernat [Wed, 20 May 2015 18:32:40 +0000 (20:32 +0200)] 
lldpcli: fix a memory leak when querying custom TLVs

9 years agobuild: rename valgrind suppression file to match the right tool
Vincent Bernat [Wed, 20 May 2015 18:30:14 +0000 (20:30 +0200)] 
build: rename valgrind suppression file to match the right tool

9 years agoctl: don't use C99 designated initializer for structs to travel on a socket
Vincent Bernat [Wed, 20 May 2015 18:25:32 +0000 (20:25 +0200)] 
ctl: don't use C99 designated initializer for structs to travel on a socket

While this is harmless, we prefer to know that each byte is correctly
initialized to avoid Valgrind warnings.

9 years agotests: provide a complete test file for lldpcli
Vincent Bernat [Wed, 20 May 2015 18:07:06 +0000 (20:07 +0200)] 
tests: provide a complete test file for lldpcli

Unfortunately, to be fully automated, we should be able to run lldpd as
root and run the test as root as well.

9 years agolib: use ssize_t to store result from write()
Vincent Bernat [Wed, 20 May 2015 18:06:27 +0000 (20:06 +0200)] 
lib: use ssize_t to store result from write()

9 years agodoc: fix example of "configure dot3 power" command
Vincent Bernat [Wed, 20 May 2015 18:03:19 +0000 (20:03 +0200)] 
doc: fix example of "configure dot3 power" command

9 years agodoc: fix example of "configure med location address" command
Vincent Bernat [Wed, 20 May 2015 17:58:54 +0000 (19:58 +0200)] 
doc: fix example of "configure med location address" command

9 years agodoc: fix documentation of "configure lldp portidsubtype"
Vincent Bernat [Wed, 20 May 2015 17:55:18 +0000 (19:55 +0200)] 
doc: fix documentation of "configure lldp portidsubtype"

9 years agotests: remove old reference to ifdump.txt
Vincent Bernat [Wed, 20 May 2015 17:40:32 +0000 (19:40 +0200)] 
tests: remove old reference to ifdump.txt

It was used for testing getifaddrs() but we don't use it anymore.

9 years agodoc: add an entry for setting custom TLV in lldpcli manual page
Vincent Bernat [Wed, 20 May 2015 17:30:02 +0000 (19:30 +0200)] 
doc: add an entry for setting custom TLV in lldpcli manual page

9 years agodoc: add a NEWS entry for custom/unknown TLV
Vincent Bernat [Wed, 20 May 2015 17:22:49 +0000 (19:22 +0200)] 
doc: add a NEWS entry for custom/unknown TLV

9 years agoMerge pull request #109 from commodo/add-custom-tlvs
Vincent Bernat [Wed, 20 May 2015 17:19:41 +0000 (19:19 +0200)] 
Merge pull request #109 from commodo/add-custom-tlvs

Add support for custom TLVs

9 years agobuild: compile libevent with -fPIC
Vincent Bernat [Wed, 20 May 2015 06:54:05 +0000 (08:54 +0200)] 
build: compile libevent with -fPIC

When embedded, libevent is configured with `--disable-shared
--enable-static`. This makes libevent compiled without `-fPIC` and we
cannot build a PIE. Use `--with-pic` to force compilation with `-fPIC`.

9 years agobuild: try -Wl,-pie before trying -pie for clang
Vincent Bernat [Tue, 19 May 2015 13:58:58 +0000 (15:58 +0200)] 
build: try -Wl,-pie before trying -pie for clang

9 years agobuild: don't enable PIE when using embedded libevent
Vincent Bernat [Tue, 19 May 2015 13:46:41 +0000 (15:46 +0200)] 
build: don't enable PIE when using embedded libevent

9 years agobuild: also try to build a PIE when hardening is not disabled.
Vincent Bernat [Tue, 19 May 2015 13:06:33 +0000 (15:06 +0200)] 
build: also try to build a PIE when hardening is not disabled.

9 years agobuild: add a switch to disable hardening functions
Vincent Bernat [Tue, 19 May 2015 13:05:13 +0000 (15:05 +0200)] 
build: add a switch to disable hardening functions

Even when the tests succeed, on some platforms, hardening CFLAGS
fail. For example, this is the case on OpenWRT. It seems that the
executable needs to be linked to libssp. Difficult to test if the
problem only happens at runtime since we can execute anything.

9 years agolldpd: convert 'oui_info' member to dynamic array 109/head
Alexandru Ardelean [Mon, 18 May 2015 07:01:56 +0000 (10:01 +0300)] 
lldpd: convert 'oui_info' member to dynamic array

Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
9 years agolldpd: make custom TLV code optional
Alexandru Ardelean [Mon, 18 May 2015 06:10:32 +0000 (09:10 +0300)] 
lldpd: make custom TLV code optional

Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
9 years agoclient: display custom TLVs when lldpctl is called
Alexandru Ardelean [Thu, 9 Apr 2015 14:56:53 +0000 (17:56 +0300)] 
client: display custom TLVs when lldpctl is called

Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
9 years agoclient: implement client interface for custom TLVs
Alexandru Ardelean [Wed, 15 Apr 2015 12:44:22 +0000 (15:44 +0300)] 
client: implement client interface for custom TLVs

Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
9 years agodaemon: implement client interface for custom TLVs
Alexandru Ardelean [Wed, 15 Apr 2015 12:44:09 +0000 (15:44 +0300)] 
daemon: implement client interface for custom TLVs

Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
9 years agolib: add custom TLV + list atom(s)
Alexandru Ardelean [Thu, 9 Apr 2015 15:00:40 +0000 (18:00 +0300)] 
lib: add custom TLV + list atom(s)

Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
9 years agodaemon: add basic custom TLV send & receive
Alexandru Ardelean [Wed, 15 Apr 2015 07:19:44 +0000 (10:19 +0300)] 
daemon: add basic custom TLV send & receive

Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
9 years agodaemon: reduce log_info() to log_debug() for unknown TLV types
Alexandru Ardelean [Thu, 16 Apr 2015 12:05:58 +0000 (15:05 +0300)] 
daemon: reduce log_info() to log_debug() for unknown TLV types

To reduce some log spam.

Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
9 years agolib: move lldpd-structs.h include into atom.h
Alexandru Ardelean [Fri, 10 Apr 2015 07:47:50 +0000 (10:47 +0300)] 
lib: move lldpd-structs.h include into atom.h

Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
9 years agolib: add null check to lldpctl_atom_inc_ref()
Alexandru Ardelean [Fri, 10 Apr 2015 10:45:14 +0000 (13:45 +0300)] 
lib: add null check to lldpctl_atom_inc_ref()

Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
9 years agolldpd: move LLDP_TLV_ORG to lldp-const.h
Alexandru Ardelean [Wed, 8 Apr 2015 11:42:51 +0000 (14:42 +0300)] 
lldpd: move LLDP_TLV_ORG to lldp-const.h

Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
9 years agolib: enable ability to change log level on-the-fly
Vincent Bernat [Sat, 16 May 2015 06:05:24 +0000 (08:05 +0200)] 
lib: enable ability to change log level on-the-fly

And remove the previous commit, use internal logging instead.

9 years agolldpcli: ensure we also display logs from liblldpctl
Vincent Bernat [Sat, 16 May 2015 05:57:41 +0000 (07:57 +0200)] 
lldpcli: ensure we also display logs from liblldpctl

9 years agotests: fix typo in SNMP checks with protocol identity
Vincent Bernat [Thu, 14 May 2015 22:51:57 +0000 (00:51 +0200)] 
tests: fix typo in SNMP checks with protocol identity

9 years agoframe: change checksum function
Vincent Bernat [Thu, 14 May 2015 22:45:51 +0000 (00:45 +0200)] 
frame: change checksum function

At the end of function, we used to call ntohs() but we also call the
same function before providing the checksum to POKE_UINT16 (which will
in turn call ntohs). We remove those two first extra calls as they
aren't necessary.

Moreover, the SNMP agent uses this function and this makes it
endian-dependant. We don't want that.

The function is quite convulated and isn't a classic checksum
function. I don't remember how I came with this function but since there
is the special case for Cisco devices and I know this special case work
now, I don't want to change to another function which may breaks this
special case.

Add a NEWS entry to let people know, just in case.

9 years agotests: fix SNMP tests
Vincent Bernat [Thu, 14 May 2015 20:05:30 +0000 (22:05 +0200)] 
tests: fix SNMP tests

Management address need to be provided in network byte order.

9 years agotests: fix signed/unsigned discrepancy
Vincent Bernat [Thu, 14 May 2015 19:06:15 +0000 (21:06 +0200)] 
tests: fix signed/unsigned discrepancy

9 years agobuild: cleaner way to not alter CFLAGS/CPPFLAGS/LDFLAGS
Vincent Bernat [Wed, 13 May 2015 06:21:09 +0000 (08:21 +0200)] 
build: cleaner way to not alter CFLAGS/CPPFLAGS/LDFLAGS

9 years agobuild: enable JSON/XML support automatically by default
Vincent Bernat [Tue, 12 May 2015 08:12:16 +0000 (10:12 +0200)] 
build: enable JSON/XML support automatically by default

9 years agoredhat: enable JSON support if recent enough
Vincent Bernat [Sun, 10 May 2015 11:06:28 +0000 (13:06 +0200)] 
redhat: enable JSON support if recent enough

9 years agodebian: enable JSON support
Vincent Bernat [Sun, 10 May 2015 11:00:47 +0000 (13:00 +0200)] 
debian: enable JSON support

9 years agobuild: automatic detection of optional features
Vincent Bernat [Sun, 10 May 2015 10:58:16 +0000 (12:58 +0200)] 
build: automatic detection of optional features

`./configure` can now detect optional features. This works with XML and
JSON output as well as for SNMP support. The defaults are still the
same, so a user has to pass `auto` keyword to the requested option (for
example `--with-json=auto`).

9 years agoclient: only output supported formats
Vincent Bernat [Sat, 9 May 2015 10:51:53 +0000 (12:51 +0200)] 
client: only output supported formats

9 years agoclient: complain if the provided format is not supported
Vincent Bernat [Sat, 9 May 2015 10:50:10 +0000 (12:50 +0200)] 
client: complain if the provided format is not supported

9 years agoclient: fix a trivial typo
Vincent Bernat [Sun, 26 Apr 2015 15:32:58 +0000 (17:32 +0200)] 
client: fix a trivial typo

9 years agoMerge pull request #106 from commodo/make-some-tlvs-optional
Vincent Bernat [Fri, 24 Apr 2015 07:53:08 +0000 (09:53 +0200)] 
Merge pull request #106 from commodo/make-some-tlvs-optional

Make some TLVs optional

9 years agoclient: add some log_debug() messages 106/head
Alexandru Ardelean [Thu, 16 Apr 2015 05:58:12 +0000 (08:58 +0300)] 
client: add some log_debug() messages

Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
9 years agotests/check_lldp: add global config object for testing
Alexandru Ardelean [Thu, 9 Apr 2015 12:15:55 +0000 (15:15 +0300)] 
tests/check_lldp: add global config object for testing

Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
9 years agolldpd: make management addresses advertisement optional
Alexandru Ardelean [Thu, 2 Apr 2015 10:03:02 +0000 (13:03 +0300)] 
lldpd: make management addresses advertisement optional

Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
9 years agolldpd: make chassis capabilities advertisement optional
Alexandru Ardelean [Thu, 2 Apr 2015 09:26:46 +0000 (12:26 +0300)] 
lldpd: make chassis capabilities advertisement optional

Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
9 years agodaemon/lldpd.c: free() cfg at end of main function
Alexandru Ardelean [Thu, 2 Apr 2015 07:48:55 +0000 (10:48 +0300)] 
daemon/lldpd.c: free() cfg at end of main function

Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
9 years agodaemon/protocols/lldp.c: do not send system capabilities if none available
Alexandru Ardelean [Thu, 2 Apr 2015 07:40:13 +0000 (10:40 +0300)] 
daemon/protocols/lldp.c: do not send system capabilities if none available

Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
9 years agolib: don't define __constructor__ twice
Vincent Bernat [Thu, 9 Apr 2015 08:31:45 +0000 (10:31 +0200)] 
lib: don't define __constructor__ twice

9 years agoMerge pull request #105 from commodo/cleanup
Vincent Bernat [Thu, 9 Apr 2015 08:30:59 +0000 (10:30 +0200)] 
Merge pull request #105 from commodo/cleanup

Some Cleanup & prep-work for further updates

9 years agorelease: prepare 0.7.14 0.7.14
Vincent Bernat [Sat, 4 Apr 2015 14:29:39 +0000 (16:29 +0200)] 
release: prepare 0.7.14

9 years agodaemon: move protocol files into subfolder 105/head
Alexandru Ardelean [Thu, 2 Apr 2015 13:20:26 +0000 (16:20 +0300)] 
daemon: move protocol files into subfolder

9 years agolib/atom.c: move here remaining code from atom-private.c
Alexandru Ardelean [Wed, 1 Apr 2015 09:14:04 +0000 (12:14 +0300)] 
lib/atom.c: move here remaining code from atom-private.c

Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
9 years agolib/private.h: rename to atom.h
Alexandru Ardelean [Wed, 1 Apr 2015 09:08:05 +0000 (12:08 +0300)] 
lib/private.h: rename to atom.h

Makes sense to have it named like this now.
Would have been a bit nicer to do it earlier, but now should be fine too.

Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
9 years agolib/atom-private.c: break it into smaller modules
Alexandru Ardelean [Tue, 31 Mar 2015 10:40:52 +0000 (13:40 +0300)] 
lib/atom-private.c: break it into smaller modules

This is a huge commit, but 90%+ of it is just splitting
'lib/atom-private.c' into smaller atoms and putting them
into the 'lib/atoms' folder.

Some glue code has been added, for constructing maps and builders.

For the 'struct atom_builder' type a 'nextb' field has been
appended at the end, to help make it a single-linked list of
'struct atom_builders's.
The 'next' field in 'struct atom_builder' is taken (hence 'nextb').

For the maps, a wrapper struct (called 'struct atom_map')
has been added on top of 'lldpctl_map_t' in order to create
single-linked list construct of maps.
The struct looks like:
    struct atom_map {
        int key;             /* lldpctl_key_t equivalent */
        struct atom_map *next; /* next 'struct atom_map' */
        lldpctl_map_t map[]; /* has to be at the end to
                                to be statically init-ed */
    }
The point of this is to register them at load-time so
that 'lldpctl_key_get_map()' can return them.

Each file in 'lib/atoms' registers it's own 'struct atom_builder's
and 'struct atom_map's.

The whole point of this is to be able to add a 'custom' and/or
'custom_list' atom(s) to be able to configure/broadcast other TLVs
in the future.
This mechanism is extensible to add other TLVs defined by
future standards.

Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
9 years agolib/atom-private.c: move 'struct atom-builder' to private.h
Alexandru Ardelean [Tue, 31 Mar 2015 09:25:06 +0000 (12:25 +0300)] 
lib/atom-private.c: move 'struct atom-builder' to private.h

Move this here, before splitting lib/atom-private.c.

Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
9 years agoconfigure.ac: add 'subdir-objects' option
Alexandru Ardelean [Wed, 1 Apr 2015 18:08:34 +0000 (21:08 +0300)] 
configure.ac: add 'subdir-objects' option

Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
9 years agoNEWS: add an entry to NEWS file for previous changes
Vincent Bernat [Sun, 29 Mar 2015 16:45:09 +0000 (18:45 +0200)] 
NEWS: add an entry to NEWS file for previous changes

9 years agolib: update revision info to reflect ABI update of latest changes
Vincent Bernat [Sun, 29 Mar 2015 16:44:06 +0000 (18:44 +0200)] 
lib: update revision info to reflect ABI update of latest changes

9 years agolib: a change to port description is transmitted now
Vincent Bernat [Sun, 29 Mar 2015 16:42:14 +0000 (18:42 +0200)] 
lib: a change to port description is transmitted now

9 years agoclient: when receiving a port update, transmit it now
Vincent Bernat [Sun, 29 Mar 2015 16:41:25 +0000 (18:41 +0200)] 
client: when receiving a port update, transmit it now

9 years agolldpcli: use "description" keyword when setting port description
Vincent Bernat [Sun, 29 Mar 2015 16:38:58 +0000 (18:38 +0200)] 
lldpcli: use "description" keyword when setting port description

9 years agolldpcli: document ability to change port id and description
Vincent Bernat [Sun, 29 Mar 2015 16:37:08 +0000 (18:37 +0200)] 
lldpcli: document ability to change port id and description

9 years agolldpcli: ensure optional local port description cannot be repeated
Vincent Bernat [Sun, 29 Mar 2015 16:31:55 +0000 (18:31 +0200)] 
lldpcli: ensure optional local port description cannot be repeated

Also fix some descriptions (no capitalization).

9 years agoMerge pull request #101 from commodo/port_label2
Vincent Bernat [Sun, 29 Mar 2015 16:23:09 +0000 (18:23 +0200)] 
Merge pull request #101 from commodo/port_label2

lldpd: implement basic support to override port IDs via lldpcli

9 years agointerfaces: management address is set to pattern on exact match
Vincent Bernat [Sat, 28 Mar 2015 08:57:43 +0000 (09:57 +0100)] 
interfaces: management address is set to pattern on exact match

When the management pattern is an exact IP address, use it as is instead
of trying to match an interface. When a user doesn't want this
behavior (keeping the check), they should use something like
`192.168.1.15,0` or `!*,!!192.168.1.15` instead of the exact IP address.

This feature allows a user to advertise an out-of-band management IP
address.

Closes #103

9 years agolldpd: add port description override via lldpcli 101/head
Alexandru Ardelean [Tue, 24 Mar 2015 09:10:49 +0000 (11:10 +0200)] 
lldpd: add port description override via lldpcli

Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
9 years agolldpd: implement basic support to override port IDs via lldpcli
Alexandru Ardelean [Tue, 24 Mar 2015 07:08:33 +0000 (09:08 +0200)] 
lldpd: implement basic support to override port IDs via lldpcli

Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
9 years ago.gitignore: ignore vim swap files
Alexandru Ardelean [Tue, 17 Mar 2015 11:57:05 +0000 (13:57 +0200)] 
.gitignore: ignore vim swap files

Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
9 years agostyle: remove `if (...) free(...)` pattern
Vincent Bernat [Mon, 23 Mar 2015 20:35:03 +0000 (21:35 +0100)] 
style: remove `if (...) free(...)` pattern

Using the following Coccinelle patch:

    @@
    expression ptr;
    @@

    - if (ptr) {
    -   free(ptr);
    - }
    + free(ptr);

    @@
    expression ptr;
    @@

    - if (ptr) free(ptr);
    + free(ptr);

    @@
    expression ptr;
    @@

    - if (ptr != NULL) {
    -   free(ptr);
    - }
    + free(ptr);

    @@
    expression ptr;
    @@

    - if (ptr != NULL) free(ptr);
    + free(ptr);

9 years agointerfaces: don't test for NULL before `free`
Vincent Bernat [Mon, 23 Mar 2015 19:56:13 +0000 (20:56 +0100)] 
interfaces: don't test for NULL before `free`

This is unneeded.

9 years agopriv: document improvement in crash handling in NEWS file
Vincent Bernat [Wed, 18 Mar 2015 16:10:12 +0000 (17:10 +0100)] 
priv: document improvement in crash handling in NEWS file

9 years agoRevert "priv: on Linux, when monitor dies, kill child"
Vincent Bernat [Wed, 18 Mar 2015 14:42:24 +0000 (15:42 +0100)] 
Revert "priv: on Linux, when monitor dies, kill child"

This reverts commit 4747e964096a1b490de062460608805c46f0cfd2. This
commit is now useless due to the previous (more portable) commits. It is
harmless but also unneeded.

9 years agopriv: use SOCK_STREAM for monitor communication
Vincent Bernat [Wed, 18 Mar 2015 14:35:10 +0000 (15:35 +0100)] 
priv: use SOCK_STREAM for monitor communication

SOCK_SEQPACKET is better but not available everywhere. We can't just
fallback to SOCK_DGRAM since we lose the ability to detect when the
monitor dies. So, we use SOCK_STREAM (now possible with commit
004b5f944539). The code (stolen from OpenBSD) was already ready for
that.

9 years agopriv: don't log anything when handling SIGCHLD
Vincent Bernat [Wed, 18 Mar 2015 14:33:17 +0000 (15:33 +0100)] 
priv: don't log anything when handling SIGCHLD

Logging is not signal-safe. Notably, we use date-functions which are
using locks.

9 years agopriv: ensure we write exactly what will be read
Vincent Bernat [Wed, 18 Mar 2015 14:25:36 +0000 (15:25 +0100)] 
priv: ensure we write exactly what will be read

When using SOCK_DGRAM/SOCK_SEQPACKET, it doesn't matter to write a bit
more since it is truncated. However, if we want to switch to
SOCK_STREAM, we must exactly write the right amount of bytes.

9 years agoctl: create control socket with close-on-exec semantic
Vincent Bernat [Wed, 18 Mar 2015 14:14:41 +0000 (15:14 +0100)] 
ctl: create control socket with close-on-exec semantic

Otherwise, when we spawn lldpcli, it inherits the file descriptor and
doesn't detect if the daemon dies just after because it is listening
itself to the Unix socket.

9 years agopriv: fallback to SOCK_DGRAM if SOCK_SEQPACKET not available
Vincent Bernat [Wed, 18 Mar 2015 13:34:54 +0000 (14:34 +0100)] 
priv: fallback to SOCK_DGRAM if SOCK_SEQPACKET not available

9 years agopriv: use a SOCK_SEQPACKET for communication with monitor
Vincent Bernat [Wed, 18 Mar 2015 13:21:46 +0000 (14:21 +0100)] 
priv: use a SOCK_SEQPACKET for communication with monitor

This has the same semantics than SOCK_DGRAM but it also supports the
ability to notify the other end of end-of-file events. However, it may
not be widely implemented, hence the separate commit.

9 years agopriv: monitor the monitor process
Vincent Bernat [Wed, 18 Mar 2015 13:20:26 +0000 (14:20 +0100)] 
priv: monitor the monitor process

By monitoring the socket connection with the monitor process, we ensure
that we kill ourselves if the monitor disappears and fails to notice us.

This doesn't work yet because there is no "end of file" event for a
SOCK_DGRAM. See the next commit.

9 years agolog: add token to all `fatalx` instances
Vincent Bernat [Wed, 18 Mar 2015 13:12:58 +0000 (14:12 +0100)] 
log: add token to all `fatalx` instances

The inability to use a token is quite artificial.

9 years agopriv: on Linux, when monitor dies, kill child
Vincent Bernat [Wed, 18 Mar 2015 09:00:44 +0000 (10:00 +0100)] 
priv: on Linux, when monitor dies, kill child

When the monitor dies, it sends its child a TERM signal but if it
segfaults or is killed with an uncatchable signal, the child will
continue to run "unharmed". On Linux, it is possible to send a signal to
the child in this case, with `prctl()`. Do that.

9 years agoevent: don't remember (in cfg) control socket event
Vincent Bernat [Wed, 18 Mar 2015 07:35:53 +0000 (08:35 +0100)] 
event: don't remember (in cfg) control socket event

We don't need it outside of event loop initialization.

9 years agoevent: don't ignore SIGHUP twice
Vincent Bernat [Wed, 18 Mar 2015 07:31:00 +0000 (08:31 +0100)] 
event: don't ignore SIGHUP twice

9 years agobuild: don't use `sort -V`
Vincent Bernat [Thu, 19 Feb 2015 21:52:13 +0000 (22:52 +0100)] 
build: don't use `sort -V`

Not portable enough. Use `sort -k ... -k ...` instead.

9 years agocheck: add missing license headers to some files
Vincent Bernat [Thu, 19 Feb 2015 19:19:42 +0000 (20:19 +0100)] 
check: add missing license headers to some files

9 years agocheck: fix SNMP test format error
Vincent Bernat [Thu, 19 Feb 2015 19:17:44 +0000 (20:17 +0100)] 
check: fix SNMP test format error

9 years agocheck: more comparison with `ck_assert_ptr_eq()`
Vincent Bernat [Thu, 19 Feb 2015 18:59:53 +0000 (19:59 +0100)] 
check: more comparison with `ck_assert_ptr_eq()`

9 years agocheck: compare pointers with `ck_assert_ptr_eq()`
Vincent Bernat [Thu, 19 Feb 2015 18:35:57 +0000 (19:35 +0100)] 
check: compare pointers with `ck_assert_ptr_eq()`

9 years agocheck: enforce correct alignment during SNMP tests
Vincent Bernat [Thu, 19 Feb 2015 16:28:00 +0000 (17:28 +0100)] 
check: enforce correct alignment during SNMP tests

This should fix the following clang error, despite the fact that we know
that the alignment was correct:

```
check_snmp.c:900:9: fatal error: cast from 'u_char *' (aka 'unsigned char *') to
      'unsigned long *' increases required alignment from 1 to 8 [-Wcast-align]
                            *(unsigned long int *)result,
                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/check.h:220:22: note: expanded from macro 'fail_unless'
        _fail_unless(expr, __FILE__, __LINE__,\
                     ^
1 error generated.
```

9 years agotravis: don't configure with CFLAGS=-Werror
Vincent Bernat [Thu, 19 Feb 2015 16:05:18 +0000 (17:05 +0100)] 
travis: don't configure with CFLAGS=-Werror

This is unsupported. Instead, call `make CFLAGS=-Werror`.

9 years agoconfigure: move LDFLAGS to LLDP_LDFLAGS
Vincent Bernat [Thu, 19 Feb 2015 16:01:35 +0000 (17:01 +0100)] 
configure: move LDFLAGS to LLDP_LDFLAGS

9 years agoconfigure: move CFLAGS/CPPFLAGS to LLDP_CFLAGS/LLDP_CPPFLAGS
Vincent Bernat [Thu, 19 Feb 2015 15:52:55 +0000 (16:52 +0100)] 
configure: move CFLAGS/CPPFLAGS to LLDP_CFLAGS/LLDP_CPPFLAGS

The goal is to avoid the user to override those flags when using `make
CFLAGS=somethingelse`. This is to enable a user to use `make
CFLAGS=-Werror` since this flag cannot be used with `./configure`.

9 years agoconfigure: put cpp flags into CPPFLAGS instead of CFLAGS
Vincent Bernat [Thu, 19 Feb 2015 15:47:06 +0000 (16:47 +0100)] 
configure: put cpp flags into CPPFLAGS instead of CFLAGS