]> git.ipfire.org Git - thirdparty/lldpd.git/log
thirdparty/lldpd.git
11 years agointerfaces: fallback to fixed MAC if already a local MAC
Vincent Bernat [Sat, 10 May 2014 07:03:03 +0000 (09:03 +0200)] 
interfaces: fallback to fixed MAC if already a local MAC

This is what is documented in the manual page.

11 years agointerfaces: fix use of locally administered use on bond devices
Vincent Bernat [Sat, 10 May 2014 07:00:37 +0000 (09:00 +0200)] 
interfaces: fix use of locally administered use on bond devices

This was broken in a previous commit (2746d430fbcc7).

11 years agoosx: use /var as a base for socket location
Vincent Bernat [Wed, 7 May 2014 11:43:21 +0000 (13:43 +0200)] 
osx: use /var as a base for socket location

11 years agoman: use configured path for /var/run/lldpd.socket
Vincent Bernat [Wed, 7 May 2014 11:31:32 +0000 (13:31 +0200)] 
man: use configured path for /var/run/lldpd.socket

11 years agoconfigure: make default PID location configurable
Vincent Bernat [Wed, 7 May 2014 11:21:50 +0000 (13:21 +0200)] 
configure: make default PID location configurable

Also, document those changes in NEWS as using `localstatedir` may move
stuff from `/var` to `/usr/local/var`.

Closes #64.

11 years agoconfigure: make default socket location configurable in configure
Vincent Bernat [Wed, 7 May 2014 11:12:53 +0000 (13:12 +0200)] 
configure: make default socket location configurable in configure

This closes #63.

11 years agoconfigure: use `runstatedir` instead of /var/run in configure
Vincent Bernat [Wed, 7 May 2014 11:06:05 +0000 (13:06 +0200)] 
configure: use `runstatedir` instead of /var/run in configure

11 years agoconfigure: don't use fallback values in summary
Vincent Bernat [Wed, 7 May 2014 10:42:46 +0000 (12:42 +0200)] 
configure: don't use fallback values in summary

They are not needed anymore, if default values are used, they are expanded.

11 years agolldpcli: return success when reading commands from files
Vincent Bernat [Wed, 7 May 2014 09:54:16 +0000 (11:54 +0200)] 
lldpcli: return success when reading commands from files

When reading commands from files, we chose to not stop on errors (the
main reason is to allow to specify nonexistent configuration files and
allow lldpd to still work after incompatible updates). However, we also
always return a failure status. Fix that.

Thanks to Brian Bidulock for spotting that. Closes #62.

11 years agoosx: update Homebrew formula to match what has been done in Homebrew
Vincent Bernat [Sun, 27 Apr 2014 10:54:44 +0000 (12:54 +0200)] 
osx: update Homebrew formula to match what has been done in Homebrew

11 years agoconfigure: enable use of colored output for gcc
Vincent Bernat [Thu, 24 Apr 2014 15:53:34 +0000 (17:53 +0200)] 
configure: enable use of colored output for gcc

11 years agoconfigure: use -fstack-protector-strong if available
Vincent Bernat [Thu, 24 Apr 2014 15:50:55 +0000 (17:50 +0200)] 
configure: use -fstack-protector-strong if available

11 years agoosx: new release
Vincent Bernat [Sun, 13 Apr 2014 09:49:52 +0000 (11:49 +0200)] 
osx: new release

11 years agolldpcli: document new "configure system hostname" directive
Vincent Bernat [Sun, 13 Apr 2014 08:55:10 +0000 (10:55 +0200)] 
lldpcli: document new "configure system hostname" directive

11 years agoversion: prepare new release 0.7.8
Vincent Bernat [Sun, 13 Apr 2014 08:34:13 +0000 (10:34 +0200)] 
version: prepare new release

11 years agoNEWS: add several items to the changelog
Vincent Bernat [Sun, 13 Apr 2014 06:04:12 +0000 (08:04 +0200)] 
NEWS: add several items to the changelog

11 years agoconfigure: make some flags conditional
Vincent Bernat [Sat, 12 Apr 2014 10:34:28 +0000 (12:34 +0200)] 
configure: make some flags conditional

Use of _XOPEN_SOURCE is quite dangerous.

11 years agoosx: blacklist p2pX interfaces
Vincent Bernat [Sat, 12 Apr 2014 10:11:21 +0000 (12:11 +0200)] 
osx: blacklist p2pX interfaces

They are related to AirDrop and transmitting anything on it will broke
the wireless network. This should fix #61.

11 years agoconfigure: hide errors when systemd is not present
Vincent Bernat [Wed, 9 Apr 2014 19:06:57 +0000 (21:06 +0200)] 
configure: hide errors when systemd is not present

11 years agocompat: fix vsyslog to rely on the result of vasprintf
Vincent Bernat [Wed, 9 Apr 2014 19:03:17 +0000 (21:03 +0200)] 
compat: fix vsyslog to rely on the result of vasprintf

11 years agocompat: include stdarg to get va_list
Vincent Bernat [Wed, 9 Apr 2014 19:03:10 +0000 (21:03 +0200)] 
compat: include stdarg to get va_list

11 years agocompat: fix use of vasprintf (previously _vasprintf)
Vincent Bernat [Wed, 9 Apr 2014 18:56:32 +0000 (20:56 +0200)] 
compat: fix use of vasprintf (previously _vasprintf)

11 years agolldpcli: use a previously unused variable
Vincent Bernat [Wed, 9 Apr 2014 18:56:04 +0000 (20:56 +0200)] 
lldpcli: use a previously unused variable

11 years agolldpd: add a note about command-line options
Vincent Bernat [Wed, 9 Apr 2014 07:56:38 +0000 (09:56 +0200)] 
lldpd: add a note about command-line options

lldpcli should be preferred for new options.

11 years agoMerge pull request #60 from jonasj76/override-hostname
Vincent Bernat [Wed, 9 Apr 2014 07:54:54 +0000 (09:54 +0200)] 
Merge pull request #60 from jonasj76/override-hostname

lldp: add option/command to override hostname

11 years agolldpd: Remove the '-N' command-line flag 60/head
Jonas Johansson [Wed, 9 Apr 2014 06:02:48 +0000 (08:02 +0200)] 
lldpd: Remove the '-N' command-line flag

Too many flags being added, use of configuration file is prefered.

Signed-off-by: Jonas Johansson <jonasj76@gmail.com>
11 years agolldp: add option/command to override hostname
Jonas Johansson [Tue, 8 Apr 2014 11:30:24 +0000 (13:30 +0200)] 
lldp: add option/command to override hostname

Allow to override the system name (hostname) by using '-N' as parameter to
lldpd, or by using "configure system hostname <NAME>" to lldpcli.

Signed-off-by: Jonas Johansson <jonasj76@gmail.com>
11 years agocoverity: change a bit the annotations
Vincent Bernat [Tue, 8 Apr 2014 07:32:02 +0000 (09:32 +0200)] 
coverity: change a bit the annotations

We want coverity to ignore those errors. It doesn't seem to be the case.

11 years agocoverity: fix a false positive in SNMP transport
Vincent Bernat [Tue, 8 Apr 2014 07:17:29 +0000 (09:17 +0200)] 
coverity: fix a false positive in SNMP transport

`remote` is not expected to be a NULL-terminated string. However, just
in case it is used as one somewhere, we alloc the appropriate space for
it.

11 years agocoverity: fix memory leak in lldpd when the same option is repeated
Vincent Bernat [Tue, 8 Apr 2014 07:14:48 +0000 (09:14 +0200)] 
coverity: fix memory leak in lldpd when the same option is repeated

11 years agocoverity: fix memory leak in lldpcli
Vincent Bernat [Tue, 8 Apr 2014 07:11:21 +0000 (09:11 +0200)] 
coverity: fix memory leak in lldpcli

CID 1198257 (#1 of 1): Resource leak (RESOURCE_LEAK)

11 years agoredhat: enable SNMP support on RHEL 5 and CentOS 5 by default
Vincent Bernat [Sun, 6 Apr 2014 21:44:17 +0000 (23:44 +0200)] 
redhat: enable SNMP support on RHEL 5 and CentOS 5 by default

This is related with the fix in the previous commit (ae7f4c2).

11 years agosnmp: link with Net-SNMP later
Vincent Bernat [Sun, 6 Apr 2014 21:41:40 +0000 (23:41 +0200)] 
snmp: link with Net-SNMP later

Some systems contain static libraries in the output of `net-snmp-config
--agent-libs`. It is not possible to build a convenience library with a
static library. Therefore, we just link with the appropriate libs in the
last step. This should fix #57.

11 years agopriv: use AF_UNIX for socketpair()
Vincent Bernat [Fri, 4 Apr 2014 08:17:43 +0000 (10:17 +0200)] 
priv: use AF_UNIX for socketpair()

This is a synonym of AF_LOCAL but it seems more widely known (for
example, on HP-UX).

11 years agoconfigure: _XOPEN_SOURCE=500 to be like _GNU_SOURCE=1
Vincent Bernat [Thu, 3 Apr 2014 07:45:24 +0000 (09:45 +0200)] 
configure: _XOPEN_SOURCE=500 to be like _GNU_SOURCE=1

11 years agohpux: provide a replacement for daemon() for HP-UX
Vincent Bernat [Wed, 2 Apr 2014 16:01:24 +0000 (18:01 +0200)] 
hpux: provide a replacement for daemon() for HP-UX

11 years agohpux: provide a replacement for vsyslog() for HP-UX
Vincent Bernat [Wed, 2 Apr 2014 15:54:20 +0000 (17:54 +0200)] 
hpux: provide a replacement for vsyslog() for HP-UX

11 years agoasprintf: we are also using vasprintf, let's define it correctly
Vincent Bernat [Wed, 2 Apr 2014 15:38:56 +0000 (17:38 +0200)] 
asprintf: we are also using vasprintf, let's define it correctly

11 years agobuild: use __EXTENSIONS__ and _XOPEN_SOURCE_EXTENDED everywhere
Vincent Bernat [Wed, 2 Apr 2014 15:10:08 +0000 (17:10 +0200)] 
build: use __EXTENSIONS__ and _XOPEN_SOURCE_EXTENDED everywhere

It is needed for Solaris and HP-UX. It doesn't seem to harm other
platforms. Let's hope that the autoconf test will catch
problems. Otherwise, we can still conditionally use them.

11 years agobsd: check of SIOCGIFDESCR instead of IFDESCRSIZE
Vincent Bernat [Wed, 2 Apr 2014 13:55:55 +0000 (15:55 +0200)] 
bsd: check of SIOCGIFDESCR instead of IFDESCRSIZE

IFDESCRSIZE is defined at the beginning of the file and is therefore
always defined. Just check if SIOCGIFDESCR exists instead.

11 years agoprivsep: don't use err.h: not needed
Vincent Bernat [Wed, 2 Apr 2014 13:33:02 +0000 (15:33 +0200)] 
privsep: don't use err.h: not needed

11 years agoasprintf: fix warnings in SNMP tests related to asprintf
Vincent Bernat [Tue, 1 Apr 2014 17:20:28 +0000 (19:20 +0200)] 
asprintf: fix warnings in SNMP tests related to asprintf

11 years agoasprintf: do not redeclare on SNMP tests
Vincent Bernat [Tue, 1 Apr 2014 17:16:56 +0000 (19:16 +0200)] 
asprintf: do not redeclare on SNMP tests

11 years agoasprintf: globally define _GNU_SOURCE
Vincent Bernat [Tue, 1 Apr 2014 16:29:07 +0000 (18:29 +0200)] 
asprintf: globally define _GNU_SOURCE

And also provide a replacement for asprintf if it is not available. I
would prefer to not use _GNU_SOURCE everywhere but it seems cleaner than
putting it at the top of random files. Ideally, I should wrap every
function in a separate file to just use _GNU_SOURCE for those
functions. There are `asprintf()` and `setres[ug]id()`.

11 years agodebian: fix postinst to create _lldpd user
Vincent Bernat [Fri, 21 Mar 2014 14:14:06 +0000 (15:14 +0100)] 
debian: fix postinst to create _lldpd user

Previous commit was incorrect and did not create _lldpd user on install.

11 years agodebian: same style for postinst and postrm
Vincent Bernat [Thu, 20 Mar 2014 15:55:55 +0000 (16:55 +0100)] 
debian: same style for postinst and postrm

Use a case switch in both files. Moreover, `#DEBHELPER#` may want to do
something if we configure or reconfigure. Let it do that.

11 years agolib: use strlcpy() instead of strcpy()
Vincent Bernat [Tue, 11 Mar 2014 20:43:59 +0000 (21:43 +0100)] 
lib: use strlcpy() instead of strcpy()

This reverts back 27faad4fd79399eda8811d4315c96317ed47a151 but we
introduce a variable for the value of strlen()+1 to make it clear we know
what we are doing.

11 years agointerfaces: convert a whitelisted interface to a physical one
Vincent Bernat [Fri, 7 Mar 2014 09:21:15 +0000 (10:21 +0100)] 
interfaces: convert a whitelisted interface to a physical one

The previous change didn't allow to have bonds and VLAN handled in a
sensible way in case of a whitelisted interface.

11 years agointerfaces: circumvent any physical check on exact match
Vincent Bernat [Thu, 6 Mar 2014 17:28:21 +0000 (18:28 +0100)] 
interfaces: circumvent any physical check on exact match

When enabling an interface with `-I eth0`, any physical check will be
circumvented. This allows lldpd to send and receive on VLAN interfaces.

11 years agointerfaces: allow whitelisting an interface
Vincent Bernat [Thu, 6 Mar 2014 17:09:27 +0000 (18:09 +0100)] 
interfaces: allow whitelisting an interface

Currently, this means that an interface can be both blacklisted and
whitelisted and in this case, it is accepted as valid.

11 years agointerfaces: document and test pattern matching
Vincent Bernat [Thu, 6 Mar 2014 16:55:22 +0000 (17:55 +0100)] 
interfaces: document and test pattern matching

11 years agobuild: use -fno-omit-frame-pointer for ease of debug
Vincent Bernat [Thu, 6 Mar 2014 16:20:09 +0000 (17:20 +0100)] 
build: use -fno-omit-frame-pointer for ease of debug

We are not a performance sensitive program and this helps debugging in
many situations.

11 years agolib: don't use strlcpy() when strcpy() just works
Vincent Bernat [Sun, 2 Mar 2014 23:48:55 +0000 (00:48 +0100)] 
lib: don't use strlcpy() when strcpy() just works

clang complains when we use strlcpy() with strlen() on the source. The
change was made because some other tools complained that we used
strcpy() instead of a more secure version. Since they don't agree, let's
switch to the saner thing to do: use strcpy() when it is safe to do.

11 years agobuild: remove duplicate const declaration
Vincent Bernat [Sun, 2 Mar 2014 23:45:17 +0000 (00:45 +0100)] 
build: remove duplicate const declaration

clang complains about this. I don't remember why I did this.

11 years agotravis: put installation and test instructions into shell scripts
Vincent Bernat [Sun, 2 Mar 2014 23:30:17 +0000 (00:30 +0100)] 
travis: put installation and test instructions into shell scripts

11 years agotravis: test with OSX and clang
Vincent Bernat [Sun, 2 Mar 2014 23:24:56 +0000 (00:24 +0100)] 
travis: test with OSX and clang

It seems that Travis-CI now supports OSX and clang. Let's try out. See:
 https://github.com/pyca/cryptography/blob/master/.travis.yml

11 years agobuild: on OSX, use glibtoolize by default
Vincent Bernat [Sun, 2 Mar 2014 23:20:20 +0000 (00:20 +0100)] 
build: on OSX, use glibtoolize by default

11 years agolldpcli: fix readline() wrapper to take prompt as argument
Vincent Bernat [Thu, 20 Feb 2014 20:57:29 +0000 (21:57 +0100)] 
lldpcli: fix readline() wrapper to take prompt as argument

`readline()` is expecting the prompt as argument. We fix the wrapper to
have the same requirement.

11 years agolldpcli: check for privileges by checking access to control socket
Vincent Bernat [Thu, 20 Feb 2014 20:52:46 +0000 (21:52 +0100)] 
lldpcli: check for privileges by checking access to control socket

Instead of relying on having used the suid bit to run the program, we
check if the real UID/GID could have opened the control socket. This
really fix #56.

11 years agolldpcli: root is privileged
Vincent Bernat [Thu, 20 Feb 2014 20:37:22 +0000 (21:37 +0100)] 
lldpcli: root is privileged

For some reason, this bug was not catched before. It was expected that
`lldpcli` can be installed as suid `_lldpd` to give user read access to
the neighbor information. However, to avoid write access, we checked if
the user was privileged by checking equality of effective and real user
uid. However, even for root, they don't have to match. Maybe they
matched in the past?

Therefore, directly check for UID == 0 too.

This should fix #56

11 years agointerfaces: reset router and wlan capability bits
Vincent Bernat [Wed, 19 Feb 2014 14:50:41 +0000 (15:50 +0100)] 
interfaces: reset router and wlan capability bits

When adding capability for new interfaces, reset them if the interfaces
providing the capability are not present anymore. Also, add stationOnly
capability if no capability is currently present.

11 years agolldpd: enable "stationOnly" capability if we don't have anything else
Vincent Bernat [Wed, 19 Feb 2014 14:48:37 +0000 (15:48 +0100)] 
lldpd: enable "stationOnly" capability if we don't have anything else

This should fix #55.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Also provide the appropriate homepage.

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

This allows clang to not choke on inappropriate types.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Also clarify how we use a similar pointer nearby.

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