Vincent Bernat [Sat, 11 Jul 2015 18:41:44 +0000 (20:41 +0200)]
lib: bump ABI
Due to the absence of compatibility layer, all atom-related functions
are considered incompatible since they don't work on ports like they
used too. This is not strictly an ABI incompatibility, but we consider
the change important enough to do like it was.
This commit will be reverted once the compatibility layer is here.
Vincent Bernat [Sat, 11 Jul 2015 18:04:12 +0000 (20:04 +0200)]
lib: ability to get and query local chassis
Up until now, to get information about the local chassis, we had to get
one interface and query the associated local port, then get chassis
information out of it.
With this change, a dedicated `lldpctl_get_local_chassis()` function is
provided and returns a chassis atom. All the chassis-related properties
are moved to this kind of atom. We also add a `lldpctl_k_port_chassis`
key to get the chassis associated to a port.
Left for next commits:
- lldpcli hasn't been updated
- compatibility layer to query chassis-related properties from port
Vincent Bernat [Mon, 25 May 2015 17:36:34 +0000 (19:36 +0200)]
osx: ensure pre/postinstall scripts are created correctly
Because we declare the scripts/*install target in `edit.am` and in
`Makefile.am`, only one of them is used. With automake, it doesn't seem
possible to easily extend a target. Instead, do the chmod just before we
need it.
Vincent Bernat [Thu, 21 May 2015 06:45:55 +0000 (08:45 +0200)]
lib: don't use priority with constructor
It is not supported on older versions of gcc. Like the one in RHEL 5. It
should not matter for our case as atoms and builders can be added in any
order. Cc @commodo for confirmation.
Vincent Bernat [Wed, 20 May 2015 21:44:21 +0000 (23:44 +0200)]
build: don't use -Wl,-pie
This flag seems to work when running on i386 on Linux but isn't handled
correctly by libtool and liblldpctl.so ends being without any
symbol. Use -pie only and try an up-to-date libtoolize on OSX to see if
it performs better.
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.
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`.
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.
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.
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`).
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>