olsrd.git
7 years agojsoninfo: remove pointless compare
Ferry Huberts [Tue, 23 Oct 2012 09:35:11 +0000 (11:35 +0200)]
jsoninfo: remove pointless compare

Coverity:
CID 739666 (#1 of 1): Array compared against 0 (NO_EFFECT)
  Comparing an array to null is not useful: "linkpath != NULL".

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
7 years agojsoninfo: remove some dead code
Ferry Huberts [Tue, 23 Oct 2012 09:33:14 +0000 (11:33 +0200)]
jsoninfo: remove some dead code

Coverity:
CID 739629 (#1 of 1): Logically dead code (DEADCODE)
  Execution cannot reach this expression ""auto"" inside statement
  "v4 = (autoV4 ? "auto" : "s");".
CID 739630 (#1 of 1): Logically dead code (DEADCODE)
  Execution cannot reach this expression ""auto"" inside statement
  "v6 = (autoV6 ? "auto" : "s");".

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
7 years agojsoninfo: make sure that uuid is null-terminated
Ferry Huberts [Tue, 23 Oct 2012 08:16:47 +0000 (10:16 +0200)]
jsoninfo: make sure that uuid is null-terminated

Since it's used as a string.

Coverity:
CID 739693 (#1 of 1): String not null terminated (STRING_NULL)
At (2): Function "fread(void * restrict, size_t, size_t, FILE * restrict)"
        does not terminate string "*uuid".
At (4): Passing unterminated string "uuid" to "strchr(char const *, int)",
        which expects a null-terminated string.

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
7 years agojsoninfo: fix a resource leak
Ferry Huberts [Tue, 23 Oct 2012 08:46:08 +0000 (10:46 +0200)]
jsoninfo: fix a resource leak

Coverity:
CID 739677 (#1 of 1): Resource leak (RESOURCE_LEAK)
At (6): Variable "f" going out of scope leaks the storage it points to.

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
7 years agonameservice: remove some dead code
Ferry Huberts [Tue, 23 Oct 2012 11:21:05 +0000 (13:21 +0200)]
nameservice: remove some dead code

Coverity:
CID 739633 (#1 of 1): Logically dead code (DEADCODE)
  Execution cannot reach this expression "127" inside statement
  "tmp->len = ((len_of_name > ...".
  (The condition "len_of_name > 127U" cannot be true.)

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
7 years agonameservice: do not close an fd that is not open
Ferry Huberts [Tue, 23 Oct 2012 11:18:05 +0000 (13:18 +0200)]
nameservice: do not close an fd that is not open

Coverity:
CID 739644 (#1 of 1): Dereference after null check (FORWARD_NULL)At (11): Passing null pointer "add_hosts" to function "fclose(FILE *)", which dereferences it.

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
7 years agonameservice: check return value of fcntl
Ferry Huberts [Tue, 23 Oct 2012 10:40:45 +0000 (12:40 +0200)]
nameservice: check return value of fcntl

Coverity:
CID 739618 (#1 of 1): Unchecked return value (CHECKED_RETURN)
At (4): Calling function "fcntl(fd, 4, 1)" without checking return value.
        This library function may fail and return an error code.
At (5): No check of the return value of "fcntl(fd, 4, 1)".

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
7 years agonameservice: fix wrong size argument
Ferry Huberts [Tue, 23 Oct 2012 10:07:15 +0000 (12:07 +0200)]
nameservice: fix wrong size argument

Coverity:
CID 739689 (#1 of 1): Wrong sizeof argument (SIZEOF_MISMATCH)
  Passing argument "ip" of type "union olsr_ip_addr *" and argument
  "8UL /* sizeof (ip) */" to function "memset(void *, int, size_t)" is
  suspicious. Did you intend to use "sizeof(*ip)" instead of "sizeof (ip)"?

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
7 years agonameservice: fix a resource leak
Ferry Huberts [Tue, 23 Oct 2012 08:39:48 +0000 (10:39 +0200)]
nameservice: fix a resource leak

Coverity:
CID 739678 (#1 of 1): Resource leak (RESOURCE_LEAK)
At (24): Handle variable "fd" going out of scope leaks the handle.

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
7 years agosecure: initialise cmsg correctly
Ferry Huberts [Tue, 23 Oct 2012 08:06:28 +0000 (10:06 +0200)]
secure: initialise cmsg correctly

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
7 years agosecure: decrease a (stack allocated) buffer size
Ferry Huberts [Tue, 23 Oct 2012 08:06:01 +0000 (10:06 +0200)]
secure: decrease a (stack allocated) buffer size

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
7 years agosecure: do not hard-code a sizeof()
Ferry Huberts [Tue, 23 Oct 2012 08:05:46 +0000 (10:05 +0200)]
secure: do not hard-code a sizeof()

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
7 years agosecure: can only work for IPv4, so assert on it
Ferry Huberts [Tue, 23 Oct 2012 08:05:27 +0000 (10:05 +0200)]
secure: can only work for IPv4, so assert on it

Because of:
  memcpy(&cmsg.destination, new_host, olsr_cnf->ipsize);
with
  cmsg.destination being an uint32_t

7 years agosecure: initialise crmsg correctly
Ferry Huberts [Tue, 23 Oct 2012 07:58:49 +0000 (09:58 +0200)]
secure: initialise crmsg correctly

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
7 years agosecure: decrease a (stack allocated) buffer size
Ferry Huberts [Tue, 23 Oct 2012 07:58:38 +0000 (09:58 +0200)]
secure: decrease a (stack allocated) buffer size

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
7 years agosecure: use sizeof() of the fields being copied
Ferry Huberts [Tue, 23 Oct 2012 07:58:27 +0000 (09:58 +0200)]
secure: use sizeof() of the fields being copied

7 years agosecure: decrease a (stack allocated) buffer size
Ferry Huberts [Tue, 23 Oct 2012 07:57:53 +0000 (09:57 +0200)]
secure: decrease a (stack allocated) buffer size

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
7 years agosecure: do not hard-code a sizeof()
Ferry Huberts [Tue, 23 Oct 2012 07:57:40 +0000 (09:57 +0200)]
secure: do not hard-code a sizeof()

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
7 years agosecure: can only work for IPv4, so assert on it
Ferry Huberts [Tue, 23 Oct 2012 07:57:06 +0000 (09:57 +0200)]
secure: can only work for IPv4, so assert on it

Because of:
  memcpy(&crmsg.destination, to, olsr_cnf->ipsize);
with
  crmsg.destination being an uint32_t

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
7 years agosecure: initialise rrmsg correctly
Ferry Huberts [Tue, 23 Oct 2012 07:52:00 +0000 (09:52 +0200)]
secure: initialise rrmsg correctly

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
7 years agosecure: decrease a (stack allocated) buffer size
Ferry Huberts [Tue, 23 Oct 2012 07:51:41 +0000 (09:51 +0200)]
secure: decrease a (stack allocated) buffer size

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
7 years agosecure: use sizeof() of the fields being copied
Ferry Huberts [Tue, 23 Oct 2012 07:51:21 +0000 (09:51 +0200)]
secure: use sizeof() of the fields being copied

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
7 years agosecure: decrease a (stack allocated) buffer size
Ferry Huberts [Tue, 23 Oct 2012 07:45:42 +0000 (09:45 +0200)]
secure: decrease a (stack allocated) buffer size

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
7 years agosecure: do not hard-code a sizeof()
Ferry Huberts [Tue, 23 Oct 2012 07:44:57 +0000 (09:44 +0200)]
secure: do not hard-code a sizeof()

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
7 years agosecure: can only work for IPv4, so assert on it
Ferry Huberts [Tue, 23 Oct 2012 07:43:25 +0000 (09:43 +0200)]
secure: can only work for IPv4, so assert on it

Because of:
  memcpy(&rrmsg.destination, to, olsr_cnf->ipsize);
with
  rrmsg.destination being an uint32_t

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
7 years agohttpdinfo: fix resource leak
Ferry Huberts [Mon, 22 Oct 2012 13:45:07 +0000 (15:45 +0200)]
httpdinfo: fix resource leak

Coverity:
CID 739676 (#1 of 1): Resource leak (RESOURCE_LEAK)
At (18): Handle variable "client_socket" going out of scope leaks the
handle.

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
7 years agohttpinfo: do not close an 'error' socket return value
Ferry Huberts [Mon, 22 Oct 2012 13:31:51 +0000 (15:31 +0200)]
httpinfo: do not close an 'error' socket return value

Coverity:
CID 739658 (#1 of 1): Argument cannot be negative (NEGATIVE_RETURNS)
At (5): "client_socket" is passed to a parameter that cannot be negative.

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
7 years agobmf: do not dereference NULL pointer
Ferry Huberts [Mon, 22 Oct 2012 13:29:15 +0000 (15:29 +0200)]
bmf: do not dereference NULL pointer

Coverity:
CID 739667 (#1 of 1): Dereference null return value (NULL_RETURNS)
At (31): Dereferencing a null pointer "bestIntf".

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
7 years agobmf: do not close an 'error' socket return value
Ferry Huberts [Mon, 22 Oct 2012 13:27:00 +0000 (15:27 +0200)]
bmf: do not close an 'error' socket return value

Coverity:
CID 739657 (#1 of 1): Argument cannot be negative (NEGATIVE_RETURNS)
At (12): "listeningSkfd" is passed to a parameter that cannot be negative.

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
7 years agobmf: explicitly cast fgetc result into a char
Ferry Huberts [Mon, 22 Oct 2012 13:24:25 +0000 (15:24 +0200)]
bmf: explicitly cast fgetc result into a char

Coverity:
CID 739615 (#1 of 1): Truncated stdio return value (CHAR_IO)
Assigning the return value of "fgetc(FILE *)" to char "EthTapSpoofState"
truncates its value.

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
7 years agoFix scanf() format vulnerabilities
Henning Rogge [Mon, 22 Oct 2012 13:25:18 +0000 (15:25 +0200)]
Fix scanf() format vulnerabilities

7 years ago Close file descriptor if error happens
Henning Rogge [Mon, 22 Oct 2012 13:13:46 +0000 (15:13 +0200)]
Close file descriptor if error happens

    Coverity:

    CID 739686 (#1 of 3): Resource leak (RESOURCE_LEAK)
    At (8): Handle variable "fd" going out of scope leaks the handle.

    CID 739686: Resource leak (RESOURCE_LEAK)
    At (12): Handle variable "fd" going out of scope leaks the handle.

    CID 739686: Resource leak (RESOURCE_LEAK)
    At (14): Handle variable "fd" going out of scope leaks the handle.

Signed-off-by: Henning Rogge <henning.rogge@fkie.fraunhofer.de>
7 years ago Check inet_pton return value
Henning Rogge [Mon, 22 Oct 2012 13:08:56 +0000 (15:08 +0200)]
Check inet_pton return value

    Coverity:

    CID 739622 (#1 of 1): Unchecked return value (CHECKED_RETURN)
    At (8): Calling function "inet_pton(int, char const * restrict, void * restrict)" without checking return value (as is done elsewhere 22 out of 25 times).

Signed-off-by: Henning Rogge <henning.rogge@fkie.fraunhofer.de>
7 years ago Use strscpy instead of strncpy.
Henning Rogge [Mon, 22 Oct 2012 13:06:57 +0000 (15:06 +0200)]
Use strscpy instead of strncpy.

    Coverity:

    CID 739613 (#1 of 1): Buffer not null terminated (BUFFER_SIZE_WARNING)
    At (6): Calling strncpy with a maximum size argument of 16 bytes on destination array "t->if_name" of size 16 bytes might leave the destination string unterminated.

    CID 739614 (#1 of 3): Buffer not null terminated (BUFFER_SIZE_WARNING)
    At (4): Calling strncpy with a maximum size argument of 16 bytes on destination array "p4.name" of size 16 bytes might leave the destination string unterminated.

    CID 739614 (#2 of 3): Buffer not null terminated (BUFFER_SIZE_WARNING)
    At (4): Calling strncpy with a maximum size argument of 16 bytes on destination array "p6.name" of size 16 bytes might leave the destination string unterminated.

    CID 739614 (#3 of 3): Buffer not null terminated (BUFFER_SIZE_WARNING)
    At (5): Calling strncpy with a maximum size argument of 16 bytes on destination array "ifr.ifr_ifrn.ifrn_name" of size 16 bytes might leave the destination string unterminated.

Signed-off-by: Henning Rogge <henning.rogge@fkie.fraunhofer.de>
7 years agoMerge branch 'master' of http://olsr.org/git/olsrd
Henning Rogge [Mon, 22 Oct 2012 13:03:20 +0000 (15:03 +0200)]
Merge branch 'master' of http://olsr.org/git/olsrd

7 years agosgwdynspeed: fix resource leak and file stat/use race
Ferry Huberts [Mon, 22 Oct 2012 12:46:14 +0000 (14:46 +0200)]
sgwdynspeed: fix resource leak and file stat/use race

Coverity:
CID 739680 (#1 of 1): Resource leak (RESOURCE_LEAK)
At (32): Variable "fd" going out of scope leaks the storage it points to.

CID 739697 (#1 of 1): Time of check time of use (TOCTOU)
At (1): Calling function "stat(char const * restrict,
                               struct stat * restrict)"
        to perform check on "fileName".
At (4): Calling function "fopen(char const * restrict,
                                char const * restrict)"
        that uses "fileName" after a check function. This can cause a
        time-of-check, time-of-use race condition.

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
7 years agopud: fix checking of downlink message IP version
Ferry Huberts [Mon, 22 Oct 2012 12:37:23 +0000 (14:37 +0200)]
pud: fix checking of downlink message IP version

Coverity:
CID 739637 (#1 of 1): Logically dead code (DEADCODE)
Execution cannot reach this expression ""false"" inside statement
"pudError(false, "Received w...".

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
7 years agopud: fix closing fd
Ferry Huberts [Mon, 22 Oct 2012 12:20:16 +0000 (14:20 +0200)]
pud: fix closing fd

Coverity:
CID 739704 (#1 of 1): Argument cannot be negative (NEGATIVE_RETURNS)
At (7): "fd" is passed to a parameter that cannot be negative.

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
7 years agopud: nmealib: fix invalid format string conversion
Ferry Huberts [Mon, 22 Oct 2012 12:28:45 +0000 (14:28 +0200)]
pud: nmealib: fix invalid format string conversion

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
7 years agopud: nmealib: fix invalid format string conversion
Ferry Huberts [Mon, 22 Oct 2012 12:28:36 +0000 (14:28 +0200)]
pud: nmealib: fix invalid format string conversion

Coverity:
CID 739671 (#1 of 1): Printf format string issue (PW.BAD_PRINTF_FORMAT_STRING)
At (1): invalid format string conversion

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
7 years agoadd a COVERITY instructions text file
Ferry Huberts [Mon, 22 Oct 2012 12:55:33 +0000 (14:55 +0200)]
add a COVERITY instructions text file

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
7 years ago Close socket if bind() fails.
Henning Rogge [Mon, 22 Oct 2012 13:02:33 +0000 (15:02 +0200)]
Close socket if bind() fails.

    Coverity:

    CID 739685 (#1 of 1): Resource leak (RESOURCE_LEAK)
    At (8): Handle variable "sock" going out of scope leaks the handle.

Signed-off-by: Henning Rogge <henning.rogge@fkie.fraunhofer.de>
7 years ago Protect against stupid data from ACPI
Henning Rogge [Mon, 22 Oct 2012 12:57:56 +0000 (14:57 +0200)]
Protect against stupid data from ACPI

    Coverity:

    CID 739643 (#1 of 1): Division or modulo by zero (DIVIDE_BY_ZERO)
    At (29): In expression "bat_val * 100 / bat_max", division by expression "bat_max" which may be zero has undefined behavior.

Signed-off-by: Henning Rogge <henning.rogge@fkie.fraunhofer.de>
7 years ago Convert allocated memory into temporary variable
Henning Rogge [Mon, 22 Oct 2012 12:48:30 +0000 (14:48 +0200)]
Convert allocated memory into temporary variable

    Coverity:

    CID 739683 (#1 of 1): Resource leak (RESOURCE_LEAK)
    At (14): Variable "net_msg" going out of scope leaks the storage it points to.

Signed-off-by: Henning Rogge <henning.rogge@fkie.fraunhofer.de>
7 years ago fix wrong sizeof() parameter
Henning Rogge [Mon, 22 Oct 2012 12:34:31 +0000 (14:34 +0200)]
fix wrong sizeof() parameter

    Coverity:

    CID 739610 (#1 of 1): Incorrect sizeof expression (BAD_SIZEOF)
    Taking the size of pointer parameter "lower_border_ip" is suspicious.

    CID 739611 (#1 of 1): Incorrect sizeof expression (BAD_SIZEOF)
    Taking the size of pointer parameter "upper_border_ip" is suspicious.

    CID 739692 (#1 of 2): Wrong sizeof argument (SIZEOF_MISMATCH)
    Passing argument "lower_border_ip" of type "union olsr_ip_addr *" and argument "8UL /* sizeof (lower_border_ip) */" to function "memset(void *, int, size_t)" is suspicious. Did you intend to use "sizeof(*lower_border_ip)" instead of "sizeof (lower_border_ip)" ?

    CID 739692 (#2 of 2): Wrong sizeof argument (SIZEOF_MISMATCH)
    Passing argument "upper_border_ip" of type "union olsr_ip_addr *" and argument "8UL /* sizeof (upper_border_ip) */" to function "memset(void *, int, size_t)" is suspicious. Did you intend to use "sizeof(*upper_border_ip)" instead of "sizeof (upper_border_ip)" ?

Signed-off-by: Henning Rogge <henning.rogge@fkie.fraunhofer.de>
7 years ago fix control flow if kill() command fails to end program
Henning Rogge [Mon, 22 Oct 2012 12:29:30 +0000 (14:29 +0200)]
fix control flow if kill() command fails to end program

    Coverity:
    CID 739665 (#1 of 1): Argument cannot be negative (NEGATIVE_RETURNS)
    At (17): "ifp->olsr_socket" is passed to a parameter that cannot be negative.

Signed-off-by: Henning Rogge <henning.rogge@fkie.fraunhofer.de>
7 years agopud: nmealib: fix invalid format string conversion
Ferry Huberts [Mon, 22 Oct 2012 10:14:05 +0000 (12:14 +0200)]
pud: nmealib: fix invalid format string conversion

Coverity:
CID 739674 (#1 of 1): Printf format string issue (PW.BAD_PRINTF_FORMAT_STRING)
At (1): invalid format string conversion

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
7 years agopud: nmealib: fix buffer overrun
Ferry Huberts [Mon, 22 Oct 2012 10:08:32 +0000 (12:08 +0200)]
pud: nmealib: fix buffer overrun

Coverity:
CID 739669 (#1 of 1): Out-of-bounds write (OVERRUN)
At (11): Overrunning array of 64 bytes at byte offset 64 by dereferencing
         pointer "psSatInfo".

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
7 years agopud: nmealib: fix buffer overrun
Ferry Huberts [Mon, 22 Oct 2012 10:07:54 +0000 (12:07 +0200)]
pud: nmealib: fix buffer overrun

Coverity:
CID 739668 (#1 of 1): Out-of-bounds write (OVERRUN)
At (10): Overrunning array of 64 bytes at byte offset 64 by dereferencing
         pointer "psSatPrn".

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
7 years agopud: nmealib: fix copy/paste error
Ferry Huberts [Mon, 22 Oct 2012 09:50:59 +0000 (11:50 +0200)]
pud: nmealib: fix copy/paste error

Coverity:
CID 739627 (#1 of 1): Copy-paste error (COPY_PASTE_ERROR)
"lat" in "pos->lat" looks like a copy-paste error.
Should it say "lon" instead?

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
7 years agopud: fix getBestUplinkGateway
Ferry Huberts [Mon, 22 Oct 2012 11:01:18 +0000 (13:01 +0200)]
pud: fix getBestUplinkGateway

Coverity:
CID 739645 (#1 of 1): Explicit null dereferenced (FORWARD_NULL)
At (18): Passing null pointer "&gw_best->originator.v4" to function
         "ip4cmp(struct in_addr const *, struct in_addr const *)", which
         dereferences it.

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
7 years agopud: fix position file stat/use race
Ferry Huberts [Mon, 22 Oct 2012 10:48:29 +0000 (12:48 +0200)]
pud: fix position file stat/use race

Coverity:
CID 739696 (#1 of 1): Time of check time of use (TOCTOU)
At (1): Calling function "stat(char const * restrict,
                               struct stat * restrict)"
        to perform check on "fileName".
At (4): Calling function "fopen(char const * restrict,
                                char const * restrict)"
        that uses "fileName" after a check function. This can cause a
        time-of-check, time-of-use race condition.

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
7 years agopud: fix socket error
Ferry Huberts [Mon, 22 Oct 2012 11:45:40 +0000 (13:45 +0200)]
pud: fix socket error

Coverity:
CID 739663 (#2 of 2): Argument cannot be negative (NEGATIVE_RETURNS)
At (8): "fd" is passed to a parameter that cannot be negative.

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
7 years agopud: fix socket error
Ferry Huberts [Mon, 22 Oct 2012 10:19:25 +0000 (12:19 +0200)]
pud: fix socket error

Coverity:
CID 739662 (#2 of 2): Argument cannot be negative (NEGATIVE_RETURNS)
At (9): "fd" is passed to a parameter that cannot be negative.

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
7 years agopud: fix resource leak
Ferry Huberts [Mon, 22 Oct 2012 09:48:21 +0000 (11:48 +0200)]
pud: fix resource leak

Coverity:
CID 739679 (#1 of 1): Resource leak (RESOURCE_LEAK)
At (24): Variable "fd" going out of scope leaks the storage it points to.

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
7 years agocommon: fix varargs cleanup
Ferry Huberts [Mon, 22 Oct 2012 11:26:30 +0000 (13:26 +0200)]
common: fix varargs cleanup

Coverity:
CID 739703 (#1 of 1): Missing varargs init or cleanup (VARARGS)
At (4): va_end was not called for "ap2".

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
7 years agoimprove VERBOSE handling
Ferry Huberts [Fri, 19 Oct 2012 22:59:50 +0000 (00:59 +0200)]
improve VERBOSE handling

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
7 years agoandroid: gcc 4.6 comes with NDK r8b and is not in NDK r8
Hans-Christoph Steiner [Fri, 19 Oct 2012 15:08:58 +0000 (11:08 -0400)]
android: gcc 4.6 comes with NDK r8b and is not in NDK r8

7 years agoandroid: update to use gcc 4.6, available starting with NDK r8
Hans-Christoph Steiner [Fri, 19 Oct 2012 14:38:08 +0000 (10:38 -0400)]
android: update to use gcc 4.6, available starting with NDK r8

7 years agoMoved regex library to a makefile of its own to solve the issues with compiler warnings.
Henning Rogge [Fri, 19 Oct 2012 14:16:18 +0000 (16:16 +0200)]
Moved regex library to a makefile of its own to solve the issues with compiler warnings.

7 years agobsd: fixup comment
Ferry Huberts [Thu, 18 Oct 2012 09:26:03 +0000 (11:26 +0200)]
bsd: fixup comment

to make it the same as in the release-0.6.4 branch

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
7 years agoFix slightly insulting error message.
Henning Rogge [Thu, 18 Oct 2012 09:17:04 +0000 (11:17 +0200)]
Fix slightly insulting error message.

7 years agochose the proper #define in order to take the right #include
Aaron Kaplan [Thu, 18 Oct 2012 08:44:57 +0000 (10:44 +0200)]
chose the proper #define in order to take the right #include
dependencies

7 years agoAdd VERBOSE flag to makefile to display full gcc commands
Henning Rogge [Tue, 16 Oct 2012 06:47:14 +0000 (08:47 +0200)]
Add VERBOSE flag to makefile to display full gcc commands

7 years agoAdd -Werror=format-security
Henning Rogge [Tue, 16 Oct 2012 06:43:54 +0000 (08:43 +0200)]
Add -Werror=format-security
Add -O2 -D_FORTIFY_SOURCE=2 for non-debug builds (unless overwritten)

7 years agoFix buffer overflow in mdns plugin
Henning Rogge [Mon, 15 Oct 2012 06:00:17 +0000 (08:00 +0200)]
Fix buffer overflow in mdns plugin

7 years agoadd gcc hardening flags to linux-gtk GUI
Hans-Christoph Steiner [Fri, 12 Oct 2012 20:10:07 +0000 (16:10 -0400)]
add gcc hardening flags to linux-gtk GUI

7 years agomdns: fix a compilation warning / copy-paste error
Ferry Huberts [Thu, 11 Oct 2012 08:49:09 +0000 (10:49 +0200)]
mdns: fix a compilation warning / copy-paste error

src/RouterElection.c: In function ‘electTimer’:
src/RouterElection.c:177:17: warning: ‘tmp’ may be used uninitialized in this function [-Wuninitialized]

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
7 years agomdns: fix compilation warnings
Ferry Huberts [Thu, 11 Oct 2012 08:15:45 +0000 (10:15 +0200)]
mdns: fix compilation warnings

src/mdns.c: In function ‘isInFilteredList’:
src/mdns.c:406:7: warning: passing argument 2 of ‘olsr_ip_to_string’ from incompatible pointer type [enabled by default]
In file included from src/mdns.c:65:0:
../../src/ipcalc.h:146:1: note: expected ‘const union olsr_ip_addr *’ but argument is of type ‘struct in_addr *’
src/mdns.c:406:7: warning: passing argument 2 of ‘olsr_ip_to_string’ from incompatible pointer type [enabled by default]
In file included from src/mdns.c:65:0:
../../src/ipcalc.h:146:1: note: expected ‘const union olsr_ip_addr *’ but argument is of type ‘struct in_addr *’
src/mdns.c:411:7: warning: passing argument 2 of ‘olsr_ip_to_string’ from incompatible pointer type [enabled by default]
In file included from src/mdns.c:65:0:
../../src/ipcalc.h:146:1: note: expected ‘const union olsr_ip_addr *’ but argument is of type ‘struct in6_addr *’
src/mdns.c:411:7: warning: passing argument 2 of ‘olsr_ip_to_string’ from incompatible pointer type [enabled by default]
In file included from src/mdns.c:65:0:
../../src/ipcalc.h:146:1: note: expected ‘const union olsr_ip_addr *’ but argument is of type ‘struct in6_addr *’

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
7 years agogateway: merge the olsr_get_ipv{4,6}_inet_gateway functions
Ferry Huberts [Wed, 29 Aug 2012 09:52:52 +0000 (11:52 +0200)]
gateway: merge the olsr_get_ipv{4,6}_inet_gateway functions

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
7 years agoremove most '#if 0' blocks
Ferry Huberts [Tue, 28 Aug 2012 11:57:30 +0000 (13:57 +0200)]
remove most '#if 0' blocks

Leave mpr related blocks alone.

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
7 years agoMerge remote-tracking branch 'origin/mDNS-plugin-GSoC-2012'
Saverio Proto [Wed, 3 Oct 2012 15:40:39 +0000 (17:40 +0200)]
Merge remote-tracking branch 'origin/mDNS-plugin-GSoC-2012'

7 years agofixed misspelling: usefull -> useful
Hans-Christoph Steiner [Tue, 2 Oct 2012 23:05:53 +0000 (19:05 -0400)]
fixed misspelling: usefull -> useful

7 years agofix misspelling: 'adress' --> 'address'
Hans-Christoph Steiner [Tue, 2 Oct 2012 23:05:21 +0000 (19:05 -0400)]
fix misspelling: 'adress' --> 'address'

    - an 'address' represents a location, i.e. MAC address

    - 'adress' is a verb meaning "to speak to"

7 years agoolsrd-adhoc-setup: configure NetworkManager to be nice when adhoc is manually setup
Hans-Christoph Steiner [Wed, 12 Sep 2012 00:42:24 +0000 (20:42 -0400)]
olsrd-adhoc-setup: configure NetworkManager to be nice when adhoc is manually setup

7 years agoolsrd-adhoc-setup: use static BSSID by default to assoc. with the right mesh
Hans-Christoph Steiner [Tue, 11 Sep 2012 22:35:06 +0000 (18:35 -0400)]
olsrd-adhoc-setup: use static BSSID by default to assoc. with the right mesh

7 years agoFix optional compilation of the nl80211 lq plugin
Frank de Brabander [Mon, 3 Sep 2012 11:38:38 +0000 (13:38 +0200)]
Fix optional compilation of the nl80211 lq plugin

Signed-off-by: Frank de Brabander <brabander@fox-it.com>
7 years agoIncorporate fix by Ferry Hubert for float to double promotion
Frank de Brabander [Fri, 31 Aug 2012 11:34:29 +0000 (13:34 +0200)]
Incorporate fix by Ferry Hubert for float to double promotion

Signed-off-by: Frank de Brabander <brabander@fox-it.com>
7 years agoMerge branch with new lq plugin for NL80211 support
Frank de Brabander [Fri, 31 Aug 2012 11:24:20 +0000 (13:24 +0200)]
Merge branch with new lq plugin for NL80211 support

Signed-off-by: Frank de Brabander <brabander@fox-it.com>
7 years agogateway: rename 2 variables
Ferry Huberts [Mon, 27 Aug 2012 12:27:54 +0000 (14:27 +0200)]
gateway: rename 2 variables

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
7 years agoolsrd_plugin: remove #if 1
Ferry Huberts [Tue, 28 Aug 2012 11:47:33 +0000 (13:47 +0200)]
olsrd_plugin: remove #if 1

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
7 years agoupdate comments on all ifdefs
Ferry Huberts [Tue, 28 Aug 2012 11:43:44 +0000 (13:43 +0200)]
update comments on all ifdefs

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
7 years agoifdef: fix some include ifdefs
Ferry Huberts [Tue, 28 Aug 2012 11:43:41 +0000 (13:43 +0200)]
ifdef: fix some include ifdefs

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
7 years agouse the Microsoft standard '_WIN32' macro instead of the self-defined 'WIN32'
Hans-Christoph Steiner [Mon, 27 Aug 2012 19:25:05 +0000 (15:25 -0400)]
use the Microsoft standard '_WIN32' macro instead of the self-defined 'WIN32'

http://msdn.microsoft.com/en-us/library/ff540443.aspx

7 years agouse the POSIX standard '__linux__' macro instead of 'linux'
Hans-Christoph Steiner [Mon, 27 Aug 2012 18:58:24 +0000 (14:58 -0400)]
use the POSIX standard '__linux__' macro instead of 'linux'

"Use __linux__ for this purpose, not linux. Although the latter is defined, it is not POSIX compliant."
http://www.faqs.org/docs/Linux-HOWTO/GCC-HOWTO.html#INDEX.25

7 years agohttp_info: pud satellites in use are now green, not in use are red
Ferry Huberts [Mon, 27 Aug 2012 11:04:11 +0000 (13:04 +0200)]
http_info: pud satellites in use are now green, not in use are red

To improve readability

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
7 years agopud: include nmealib v1.0.3
Ferry Huberts [Mon, 27 Aug 2012 08:24:57 +0000 (10:24 +0200)]
pud: include nmealib v1.0.3

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
7 years agopud: force pending buffer out if not enough space for our message
Ferry Huberts [Fri, 24 Aug 2012 13:10:51 +0000 (15:10 +0200)]
pud: force pending buffer out if not enough space for our message

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
7 years agoPud: Do not use the variable name strlen.
Henning Rogge [Sat, 25 Aug 2012 11:03:08 +0000 (13:03 +0200)]
Pud: Do not use the variable name strlen.

7 years agogateway: merge 2 code blocks
Ferry Huberts [Fri, 24 Aug 2012 08:50:46 +0000 (10:50 +0200)]
gateway: merge 2 code blocks

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
Reviewed-by: Henning Rogge <henning.rogge@fkie.fraunhofer.de>
7 years agogateway: prevent 2 NULL dereferences
Ferry Huberts [Thu, 23 Aug 2012 12:53:48 +0000 (14:53 +0200)]
gateway: prevent 2 NULL dereferences

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
Reviewed-by: Henning Rogge <henning.rogge@fkie.fraunhofer.de>
7 years agogateway: the gateway to set must either be an IPv4 or IPv6 gateway or both
Ferry Huberts [Thu, 23 Aug 2012 12:42:24 +0000 (14:42 +0200)]
gateway: the gateway to set must either be an IPv4 or IPv6 gateway or both

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
Reviewed-by: Henning Rogge <henning.rogge@fkie.fraunhofer.de>
7 years agogateway: the gateway to set must be in the gateway tree
Ferry Huberts [Thu, 23 Aug 2012 12:40:28 +0000 (14:40 +0200)]
gateway: the gateway to set must be in the gateway tree

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
Reviewed-by: Henning Rogge <henning.rogge@fkie.fraunhofer.de>
7 years agogateway: merge 2 code blocks
Ferry Huberts [Thu, 23 Aug 2012 12:33:28 +0000 (14:33 +0200)]
gateway: merge 2 code blocks

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
Reviewed-by: Henning Rogge <henning.rogge@fkie.fraunhofer.de>
7 years agogateway: push an if condition into its nested if's
Ferry Huberts [Thu, 23 Aug 2012 12:31:54 +0000 (14:31 +0200)]
gateway: push an if condition into its nested if's

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
Reviewed-by: Henning Rogge <henning.rogge@fkie.fraunhofer.de>
7 years agogateway: simplify a condition
Ferry Huberts [Thu, 23 Aug 2012 12:15:54 +0000 (14:15 +0200)]
gateway: simplify a condition

Because of the preceding
  if (ipv4) {
    current_ipv4_gw = NULL;
  }
  if (ipv6) {
    current_ipv6_gw = NULL;
  }

The condition(s)
   if (ipvX && entry != current_ipvX_gw
Are effectively
   if (ipvX && entry != NULL
Also, the test
   entry != NULL
was already performed by the enclosing if statement

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
Reviewed-by: Henning Rogge <henning.rogge@fkie.fraunhofer.de>
7 years agogateway: rename a function
Ferry Huberts [Tue, 21 Aug 2012 12:52:12 +0000 (14:52 +0200)]
gateway: rename a function

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
Reviewed-by: Henning Rogge <henning.rogge@fkie.fraunhofer.de>
7 years agogateway: inline olsr_trigger_inetgw_selection function
Ferry Huberts [Wed, 22 Aug 2012 10:48:16 +0000 (12:48 +0200)]
gateway: inline olsr_trigger_inetgw_selection function

To simplify and reduce the number of functions

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
Reviewed-by: Henning Rogge <henning.rogge@fkie.fraunhofer.de>
7 years agogateway: inline olsr_find_gateway_entry function
Ferry Huberts [Wed, 22 Aug 2012 10:47:50 +0000 (12:47 +0200)]
gateway: inline olsr_find_gateway_entry function

To simplify and reduce the number of functions

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
Reviewed-by: Henning Rogge <henning.rogge@fkie.fraunhofer.de>
7 years agogateway: add comments to struct olsr_gw_handler function prototypes
Ferry Huberts [Wed, 22 Aug 2012 11:28:11 +0000 (13:28 +0200)]
gateway: add comments to struct olsr_gw_handler function prototypes

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
Reviewed-by: Henning Rogge <henning.rogge@fkie.fraunhofer.de>