olsrd.git
4 years agojsoninfo: in /plugins list plugin parameters as array entries
Ferry Huberts [Wed, 9 Mar 2016 13:37:06 +0000 (14:37 +0100)]
jsoninfo: in /plugins list plugin parameters as array entries

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agojsoninfo: protect against out-of-bounds accesses of TXT array
Ferry Huberts [Wed, 9 Mar 2016 13:00:09 +0000 (14:00 +0100)]
jsoninfo: protect against out-of-bounds accesses of TXT array

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agojsoninfo: protect against nulll-deref in print_interface_config
Ferry Huberts [Wed, 9 Mar 2016 12:43:29 +0000 (13:43 +0100)]
jsoninfo: protect against nulll-deref in print_interface_config

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agojsoninfo: add some asserts
Ferry Huberts [Wed, 9 Mar 2016 12:43:05 +0000 (13:43 +0100)]
jsoninfo: add some asserts

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agoinfo: re-introduce composite commands
Ferry Huberts [Wed, 9 Mar 2016 10:19:18 +0000 (11:19 +0100)]
info: re-introduce composite commands

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agoinfo: skip multiple leading slashes on the command
Ferry Huberts [Tue, 8 Mar 2016 15:59:04 +0000 (16:59 +0100)]
info: skip multiple leading slashes on the command

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agoinfo: strip trailing slashes from the command
Ferry Huberts [Tue, 8 Mar 2016 15:39:04 +0000 (16:39 +0100)]
info: strip trailing slashes from the command

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agojsoninfo: move some static functions around
Ferry Huberts [Wed, 9 Mar 2016 12:00:43 +0000 (13:00 +0100)]
jsoninfo: move some static functions around

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agojsoninfo: do not show interface /sys/class/net/data in /interfaces
Ferry Huberts [Tue, 8 Mar 2016 14:13:42 +0000 (15:13 +0100)]
jsoninfo: do not show interface /sys/class/net/data in /interfaces

Has nothing to do with olsrd and can be obtained through other means

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agojsoninfo: improve /interfaces
Ferry Huberts [Mon, 7 Mar 2016 09:43:47 +0000 (10:43 +0100)]
jsoninfo: improve /interfaces

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agojsoninfo: add print_interface_config function and use it
Ferry Huberts [Tue, 8 Mar 2016 09:22:45 +0000 (10:22 +0100)]
jsoninfo: add print_interface_config function and use it

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agojsoninfo: use print_link_quality_multipliers_array_entry in /interfaces
Ferry Huberts [Mon, 7 Mar 2016 13:23:05 +0000 (14:23 +0100)]
jsoninfo: use print_link_quality_multipliers_array_entry in /interfaces

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agojsoninfo: use the abuf_json_ip_address helper
Ferry Huberts [Mon, 7 Mar 2016 19:30:21 +0000 (20:30 +0100)]
jsoninfo: use the abuf_json_ip_address helper

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agojsoninfo: improve and update /config
Ferry Huberts [Mon, 7 Mar 2016 09:41:19 +0000 (10:41 +0100)]
jsoninfo: improve and update /config

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agojsoninfo: put printing a hna entry into a function and use it
Ferry Huberts [Mon, 7 Mar 2016 19:21:09 +0000 (20:21 +0100)]
jsoninfo: put printing a hna entry into a function and use it

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agojsoninfo: minor improvements
Ferry Huberts [Mon, 7 Mar 2016 13:21:45 +0000 (14:21 +0100)]
jsoninfo: minor improvements

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agojsoninfo: simplify output_error by using an abuf
Ferry Huberts [Mon, 7 Mar 2016 13:20:52 +0000 (14:20 +0100)]
jsoninfo: simplify output_error by using an abuf

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agojsoninfo: add some comments
Ferry Huberts [Mon, 7 Mar 2016 09:41:39 +0000 (10:41 +0100)]
jsoninfo: add some comments

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agojsoninfo: helpers: account for NaN and INF in float printing
Ferry Huberts [Tue, 8 Mar 2016 13:50:04 +0000 (14:50 +0100)]
jsoninfo: helpers: account for NaN and INF in float printing

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agojsoninfo: helpers: output an empty string when the string is null
Ferry Huberts [Mon, 7 Mar 2016 09:17:17 +0000 (10:17 +0100)]
jsoninfo: helpers: output an empty string when the string is null

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agojsoninfo: helpers: add asserts
Ferry Huberts [Mon, 7 Mar 2016 09:15:18 +0000 (10:15 +0100)]
jsoninfo: helpers: add asserts

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agojsoninfo: helpers: move a static string declaration
Ferry Huberts [Mon, 7 Mar 2016 09:16:33 +0000 (10:16 +0100)]
jsoninfo: helpers: move a static string declaration

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agojsoninfo: minor improvement to /2hop
Ferry Huberts [Mon, 7 Mar 2016 09:29:28 +0000 (10:29 +0100)]
jsoninfo: minor improvement to /2hop

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agomain: do not allow nested shutdown
Ferry Huberts [Mon, 7 Mar 2016 14:45:35 +0000 (15:45 +0100)]
main: do not allow nested shutdown

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agoscheduler: make olsr_flush_timers more robust
Ferry Huberts [Mon, 7 Mar 2016 14:20:06 +0000 (15:20 +0100)]
scheduler: make olsr_flush_timers more robust

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agoscheduler: do not stop timers that are not running
Ferry Huberts [Mon, 7 Mar 2016 14:19:42 +0000 (15:19 +0100)]
scheduler: do not stop timers that are not running

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agoscheduler: fix a typo
Ferry Huberts [Mon, 7 Mar 2016 14:18:47 +0000 (15:18 +0100)]
scheduler: fix a typo

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agojsoninfo: fix a windows compile error
Ferry Huberts [Mon, 7 Mar 2016 15:12:34 +0000 (16:12 +0100)]
jsoninfo: fix a windows compile error

src/olsrd_jsoninfo_helpers.c: In function 'abuf_json_int':
src/olsrd_jsoninfo_helpers.c:145:22: error: unknown conversion type character 'l' in format [-Werror=format=]
   abuf_appendf(abuf, "\"%s\": %lld", key, value);
                      ^
src/olsrd_jsoninfo_helpers.c:145:22: error: too many arguments for format [-Werror=format-extra-args]

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agojsoninfo: simplify /plugins
Ferry Huberts [Sun, 6 Mar 2016 11:38:58 +0000 (12:38 +0100)]
jsoninfo: simplify /plugins

Treat all plugin parameters as strings, just like the
plugin loader does and just like in the configuration
file.

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agojsoninfo: make abuf_json_int take a long long value
Ferry Huberts [Sun, 6 Mar 2016 11:37:42 +0000 (12:37 +0100)]
jsoninfo: make abuf_json_int take a long long value

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agobmf: ignore case on the BmfMechanism plugin parameter value
Ferry Huberts [Sun, 6 Mar 2016 12:50:37 +0000 (13:50 +0100)]
bmf: ignore case on the BmfMechanism plugin parameter value

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agoconfig: always lower-case plugin parameter names
Ferry Huberts [Sun, 6 Mar 2016 16:03:38 +0000 (17:03 +0100)]
config: always lower-case plugin parameter names

Case is already ignored and this avoids extra code in other plugins.

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agojsoninfo: show more information in /version
Ferry Huberts [Sun, 6 Mar 2016 09:59:26 +0000 (10:59 +0100)]
jsoninfo: show more information in /version

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agobuilddata: generate more build information
Ferry Huberts [Sat, 5 Mar 2016 21:03:12 +0000 (22:03 +0100)]
builddata: generate more build information

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agojsoninfo: improve the skip condition in ipc_print_gateways_ipvx
Ferry Huberts [Sat, 5 Mar 2016 20:33:07 +0000 (21:33 +0100)]
jsoninfo: improve the skip condition in ipc_print_gateways_ipvx

Make it more readable, all the negations were confusing.

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agojsoninfo: improve the ipc_print_gateways_ipvx function
Ferry Huberts [Sat, 5 Mar 2016 20:24:22 +0000 (21:24 +0100)]
jsoninfo: improve the ipc_print_gateways_ipvx function

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agojsoninfo: improve printing a gateway entry, and add expiry/cleanup timers
Ferry Huberts [Sat, 5 Mar 2016 19:36:31 +0000 (20:36 +0100)]
jsoninfo: improve printing a gateway entry, and add expiry/cleanup timers

Affects /gateways and /sgw

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agojsoninfo: improve /mid and add validityTime of mid entry itself
Ferry Huberts [Sat, 5 Mar 2016 17:11:11 +0000 (18:11 +0100)]
jsoninfo: improve /mid and add validityTime of mid entry itself

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agogui: fix a few clang warnings
Ferry Huberts [Sat, 5 Mar 2016 14:59:09 +0000 (15:59 +0100)]
gui: fix a few clang warnings

src/ipc.c:165:17: warning: cast from 'char *' to 'union olsr_message *' increases required alignment from 1 to 4 [-Wcast-align]
          msg = (union olsr_message *)&tmp[tmp_len];
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/ipc.c:184:19: warning: cast from 'char *' to 'union olsr_message *' increases required alignment from 1 to 4 [-Wcast-align]
            msg = (union olsr_message *)tmp;
                  ^~~~~~~~~~~~~~~~~~~~~~~~~
src/main.c:54:16: warning: cast from 'char *' to 'struct in_addr *' increases required alignment from 1 to 4 [-Wcast-align]
  in.s_addr = ((struct in_addr *)(hp->h_addr_list[0]))->s_addr;
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/main.c:60:26: warning: cast from 'char *' to 'struct in_addr *' increases required alignment from 1 to 4 [-Wcast-align]
  pin.sin_addr.s_addr = ((struct in_addr *)(hp->h_addr_list[0]))->s_addr;
                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agomake: fix compiler flags probing
Ferry Huberts [Sat, 5 Mar 2016 11:22:16 +0000 (12:22 +0100)]
make: fix compiler flags probing

Basically reverts
  "make: need to load the OS specific makefile before evaluating WARNINGS"
  d9b773d94c5f84a769a20a563f9cf25a81a030fa.
and then adds OS specific compiler support

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agomake: move -Werror flag into the normal list of warnings
Ferry Huberts [Sat, 5 Mar 2016 11:28:19 +0000 (12:28 +0100)]
make: move -Werror flag into the normal list of warnings

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agomake: do not add -Wcast-qual on Windows
Ferry Huberts [Sat, 5 Mar 2016 11:22:57 +0000 (12:22 +0100)]
make: do not add -Wcast-qual on Windows

It triggers a _lot_ of warnings in src/win32/compat.h

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agomake: improve clang support
Ferry Huberts [Sat, 5 Mar 2016 14:30:32 +0000 (15:30 +0100)]
make: improve clang support

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agomain: add noreturn attribute on olsr_segv_handler
Ferry Huberts [Sat, 5 Mar 2016 10:37:31 +0000 (11:37 +0100)]
main: add noreturn attribute on olsr_segv_handler

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agotxtinfo: check INFO_HTTP_OK upon entry of the function
Ferry Huberts [Fri, 4 Mar 2016 19:09:29 +0000 (20:09 +0100)]
txtinfo: check INFO_HTTP_OK upon entry of the function

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agojsoninfo: remove some dead code
Ferry Huberts [Fri, 4 Mar 2016 19:09:07 +0000 (20:09 +0100)]
jsoninfo: remove some dead code

INFO_HTTP_OK was already checked upon entry of the function

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agoinfo: check for retry after trying to send
Ferry Huberts [Fri, 4 Mar 2016 18:56:57 +0000 (19:56 +0100)]
info: check for retry after trying to send

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agoinfo: speed up sending pending responses
Ferry Huberts [Fri, 4 Mar 2016 18:27:25 +0000 (19:27 +0100)]
info: speed up sending pending responses

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agoinfo: try to send the response immediately
Ferry Huberts [Fri, 4 Mar 2016 18:20:11 +0000 (19:20 +0100)]
info: try to send the response immediately

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agoinfo: add a comment about why info_plugin_outbuffer_t is there
Ferry Huberts [Fri, 4 Mar 2016 18:18:06 +0000 (19:18 +0100)]
info: add a comment about why info_plugin_outbuffer_t is there

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agojsoninfo: improve /hna
Ferry Huberts [Fri, 4 Mar 2016 16:37:56 +0000 (17:37 +0100)]
jsoninfo: improve /hna

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agojsoninfo: improve /topology, show more information
Ferry Huberts [Fri, 4 Mar 2016 16:22:59 +0000 (17:22 +0100)]
jsoninfo: improve /topology, show more information

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agojsoninfo: add etx to /routes
Ferry Huberts [Fri, 4 Mar 2016 15:15:42 +0000 (16:15 +0100)]
jsoninfo: add etx to /routes

And protect against a possible null-deref.
Minor optimisation.

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agojsoninfo: add hysteresis to /links
Ferry Huberts [Fri, 4 Mar 2016 14:38:47 +0000 (15:38 +0100)]
jsoninfo: add hysteresis to /links

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agojsoninfo: all neighbour entries now have twoHopNeighborCount
Ferry Huberts [Fri, 4 Mar 2016 14:04:31 +0000 (15:04 +0100)]
jsoninfo: all neighbour entries now have twoHopNeighborCount

Affects a 2-hop neighbour entry, it gains this field.
Also improve ipc_print_neighbors_internal

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agojsoninfo: re-arrange some imports
Ferry Huberts [Fri, 4 Mar 2016 12:49:34 +0000 (13:49 +0100)]
jsoninfo: re-arrange some imports

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agojsoninfo: output an error on unknown status codes too
Ferry Huberts [Fri, 4 Mar 2016 12:55:12 +0000 (13:55 +0100)]
jsoninfo: output an error on unknown status codes too

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agotxtinfo: move a function
Ferry Huberts [Fri, 4 Mar 2016 12:56:52 +0000 (13:56 +0100)]
txtinfo: move a function

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agotxtinfo: output an error on unknown status codes too
Ferry Huberts [Fri, 4 Mar 2016 12:56:02 +0000 (13:56 +0100)]
txtinfo: output an error on unknown status codes too

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agomain: cleanup the gateways earlier on shutdown
Ferry Huberts [Tue, 1 Mar 2016 10:29:37 +0000 (11:29 +0100)]
main: cleanup the gateways earlier on shutdown

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agomain: print the received signal name instead of the signal number
Ferry Huberts [Tue, 1 Mar 2016 10:28:50 +0000 (11:28 +0100)]
main: print the received signal name instead of the signal number

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agoscheduler: fix olsr_flush_timers to not hang
Ferry Huberts [Tue, 1 Mar 2016 10:39:32 +0000 (11:39 +0100)]
scheduler: fix olsr_flush_timers to not hang

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agocfgparser: remove some unreachable code
Ferry Huberts [Sat, 27 Feb 2016 12:12:43 +0000 (13:12 +0100)]
cfgparser: remove some unreachable code

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agomain: ensure all timers are stopped in shutdown
Ferry Huberts [Fri, 26 Feb 2016 23:48:28 +0000 (00:48 +0100)]
main: ensure all timers are stopped in shutdown

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agoscheduler: mark timers for removal and only remove them in a cleanup walk
Ferry Huberts [Fri, 26 Feb 2016 23:20:24 +0000 (00:20 +0100)]
scheduler: mark timers for removal and only remove them in a cleanup walk

Fixes crashes in networks with many nodes.

*** olsr.org - pre-0.9.1-git_dd7c5a0-hash_b9729ef932ee0c718b5da79dcf6a5fce ***
 Build date: 2016-02-24 21:02:23 on jenkins
 http://www.olsr.org

/usr/sbin/olsrd               (olsr_segv_handler)          src/main.c:323
/lib/i386-linux-gnu/libc.so.6 (+0x2de78)                   [0xb760ce78]
/usr/sbin/olsrd               (list_remove)                src/common/list.c:105
/usr/sbin/olsrd               (olsr_stop_timer)            src/scheduler.c:874
/usr/sbin/olsrd               (olsr_del_nbr2_list)         src/neighbor_table.c:85
/usr/sbin/olsrd               (olsr_delete_neighbor_table) src/neighbor_table.c:211
/usr/sbin/olsrd               (olsr_delete_link_entry)     src/link_set.c:375
/usr/sbin/olsrd               (olsr_expire_link_entry)     src/link_set.c:495
/usr/sbin/olsrd               (walk_timers)                src/scheduler.c:650
/usr/sbin/olsrd               (olsr_scheduler)             src/scheduler.c:506
/usr/sbin/olsrd               (main)                       src/main.c:705

olsrd crashed, stack trace follows
/usr/sbin/olsrd               (olsr_segv_handler)          src/main.c:323
/lib/i386-linux-gnu/libc.so.6 (+0x2de78)                   [0xb764ce78]
/usr/sbin/olsrd               (list_remove)                src/common/list.c:105
/usr/sbin/olsrd               (olsr_stop_timer)            src/scheduler.c:874
/usr/sbin/olsrd               (olsr_update_gateway_entry)  src/gateway.c:1208
/usr/sbin/olsrd               (olsr_input_hna)             src/hna_set.c:446
/usr/sbin/olsrd               (parse_packet)               src/parser.c:393
/usr/sbin/olsrd               (olsr_input)                 src/parser.c:496
/usr/sbin/olsrd               (poll_sockets)               src/scheduler.c:341
/usr/sbin/olsrd               (olsr_scheduler)             src/scheduler.c:499
/usr/sbin/olsrd               (main)                       src/main.c:705

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agoscheduler: fix a typo
Ferry Huberts [Fri, 26 Feb 2016 21:11:01 +0000 (22:11 +0100)]
scheduler: fix a typo

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agomake: add new GCC 6 warning flags
Ferry Huberts [Tue, 23 Feb 2016 23:00:12 +0000 (00:00 +0100)]
make: add new GCC 6 warning flags

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agoquagga: fix GCC 6 warnings
Ferry Huberts [Tue, 23 Feb 2016 18:24:19 +0000 (19:24 +0100)]
quagga: fix GCC 6 warnings

src/plugin.c:57:66: error: logical ‘and’ of equal expressions [-Werror=logical-op]
   for (i = 0; i < ARRAYSIZE(zroute_types) && i < ZEBRA_ROUTE_MAX; i++) {
                                                                  ^~

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agopud: fix GCC 6 warnings
Ferry Huberts [Tue, 23 Feb 2016 18:51:50 +0000 (19:51 +0100)]
pud: fix GCC 6 warnings

src/netTools.c: In function ‘getIPv4Address’:
src/netTools.c:96:55: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
  return &((struct sockaddr_in *)(void *) &ifr->ifr_addr)->sin_addr;
                                                       ^

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agop2pd: fix GCC 6 warnings
Ferry Huberts [Tue, 23 Feb 2016 18:49:01 +0000 (19:49 +0100)]
p2pd: fix GCC 6 warnings

src/NetworkInterfaces.c: In function ‘CreateInterface’:
src/NetworkInterfaces.c:247:50: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
       newIf->intAddr.v4 = ((struct sockaddr_in *) ARM_NOWARN_ALIGN(&ifr.ifr_addr))->sin_addr;
                                                  ^
src/NetworkInterfaces.c:260:52: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
       newIf->broadAddr.v4 = ((struct sockaddr_in *) ARM_NOWARN_ALIGN(&ifr.ifr_broadaddr))->sin_addr;
                                                    ^
src/NetworkInterfaces.c: In function ‘CreateNonOlsrNetworkInterfaces’:
src/NetworkInterfaces.c:368:40: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
     ipAddr.v4 = ((struct sockaddr_in *) ARM_NOWARN_ALIGN(&ifr->ifr_addr))->sin_addr;
                                        ^

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agomdns: fix GCC 6 warnings
Ferry Huberts [Tue, 23 Feb 2016 18:46:20 +0000 (19:46 +0100)]
mdns: fix GCC 6 warnings

src/NetworkInterfaces.c: In function ‘CreateRouterElectionSocket’:
src/NetworkInterfaces.c:288:59: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
   ipv4_addr = ((struct sockaddr_in *)(void *) &req.ifr_addr)->sin_addr;
                                                           ^
src/NetworkInterfaces.c: In function ‘CreateHelloSocket’:
src/NetworkInterfaces.c:383:59: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
   ipv4_addr = ((struct sockaddr_in *)(void *) &req.ifr_addr)->sin_addr;
                                                           ^
src/NetworkInterfaces.c: In function ‘CreateInterface’:
src/NetworkInterfaces.c:541:49: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
       newIf->intAddr.v4 = ((struct sockaddr_in *)ARM_NOWARN_ALIGN(&ifr.ifr_addr))->sin_addr;
                                                 ^
src/NetworkInterfaces.c:554:51: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
       newIf->broadAddr.v4 = ((struct sockaddr_in *)ARM_NOWARN_ALIGN(&ifr.ifr_broadaddr))->sin_addr;
                                                   ^
src/NetworkInterfaces.c: In function ‘CreateBmfNetworkInterfaces’:
src/NetworkInterfaces.c:662:39: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
     ipAddr.v4 = ((struct sockaddr_in *)ARM_NOWARN_ALIGN(&ifr->ifr_addr))->sin_addr;
                                       ^

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agobmf: fix GCC 6 warnings
Ferry Huberts [Tue, 23 Feb 2016 18:16:12 +0000 (19:16 +0100)]
bmf: fix GCC 6 warnings

src/NetworkInterfaces.c: In function ‘CreateLocalEtherTunTap’:
src/NetworkInterfaces.c:1275:25: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
   ((struct sockaddr_in*) ARM_NOWARN_ALIGN(&ifreq.ifr_addr))->sin_addr.s_addr = htonl(EtherTunTapIp);
                         ^
src/NetworkInterfaces.c:1280:27: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
     ((struct sockaddr_in*) ARM_NOWARN_ALIGN(&ifreq.ifr_netmask))->sin_addr.s_addr = htonl(EtherTunTapIpMask);
                           ^
src/NetworkInterfaces.c:1285:29: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
       ((struct sockaddr_in*) ARM_NOWARN_ALIGN(&ifreq.ifr_broadaddr))->sin_addr.s_addr = htonl(EtherTunTapIpBroadcast);
                             ^
src/NetworkInterfaces.c: In function ‘CreateInterface’:
src/NetworkInterfaces.c:1497:50: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
       newIf->intAddr.v4 = ((struct sockaddr_in *) ARM_NOWARN_ALIGN(&ifr.ifr_addr))->sin_addr;
                                                  ^
src/NetworkInterfaces.c:1513:52: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
       newIf->broadAddr.v4 = ((struct sockaddr_in *) ARM_NOWARN_ALIGN(&ifr.ifr_broadaddr))->sin_addr;
                                                    ^
src/NetworkInterfaces.c: In function ‘CreateBmfNetworkInterfaces’:
src/NetworkInterfaces.c:1626:40: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
     ipAddr.v4 =  ((struct sockaddr_in*) ARM_NOWARN_ALIGN(&ifr->ifr_addr))->sin_addr;
                                        ^
src/NetworkInterfaces.c: In function ‘AddMulticastRoute’:
src/NetworkInterfaces.c:1944:12: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
   ((struct sockaddr_in *) ARM_NOWARN_ALIGN(&kernel_route.rt_dst))->sin_addr.s_addr = htonl(0xE0000000);
            ^~~~~~~~~~~
src/NetworkInterfaces.c:1945:12: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
   ((struct sockaddr_in *) ARM_NOWARN_ALIGN(&kernel_route.rt_genmask))->sin_addr.s_addr = htonl(0xF0000000);
            ^~~~~~~~~~~
src/NetworkInterfaces.c: In function ‘DeleteMulticastRoute’:
src/NetworkInterfaces.c:1989:14: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
     ((struct sockaddr_in *) ARM_NOWARN_ALIGN(&kernel_route.rt_dst))->sin_addr.s_addr = htonl(0xE0000000);
              ^~~~~~~~~~~
src/NetworkInterfaces.c:1990:14: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
     ((struct sockaddr_in *) ARM_NOWARN_ALIGN(&kernel_route.rt_genmask))->sin_addr.s_addr = htonl(0xF0000000);
              ^~~~~~~~~~~

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agoparser: fix GCC 6 warnings
Ferry Huberts [Tue, 23 Feb 2016 18:25:31 +0000 (19:25 +0100)]
parser: fix GCC 6 warnings

src/parser.c:450:30: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
       void * src = &((struct sockaddr_in *)(void *)&from)->sin_addr;
                              ^~~~~~~~~~~
src/parser.c:454:30: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
       void * src = &((struct sockaddr_in6 *)(void *)&from)->sin6_addr;
                              ^~~~~~~~~~~~

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agosgw: fix GCC 6 warnings
Ferry Huberts [Tue, 23 Feb 2016 21:48:04 +0000 (22:48 +0100)]
sgw: fix GCC 6 warnings

src/gateway.c: In function ‘takeDownExpensiveGateways’:
src/gateway.c:701:17: error: potential null pointer dereference [-Werror=null-dereference]
     if (worst_gw->gw->path_cost < current_gw_cost_boundary) {
         ~~~~~~~~^~~~

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agolink_set: fix GCC 6 warnings
Ferry Huberts [Tue, 23 Feb 2016 21:55:18 +0000 (22:55 +0100)]
link_set: fix GCC 6 warnings

src/link_set.c: In function ‘update_link_entry’:
src/link_set.c:335:24: error: potential null pointer dereference [-Werror=null-dereference]
   for (mult = cfg_inter->cnf->lq_mult; mult != NULL; mult = mult->next) {
               ~~~~~~~~~^~~~~

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agounix: fix GCC 6 warnings
Ferry Huberts [Tue, 23 Feb 2016 18:36:46 +0000 (19:36 +0100)]
unix: fix GCC 6 warnings

src/unix/ifnet.c:270:109: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
         (&((struct sockaddr_in *)ARM_NOWARN_ALIGN(&ifp->int_addr))->sin_addr.s_addr, &((struct sockaddr_in *)ARM_NOWARN_ALIGN(&ifr.ifr_addr))->sin_addr.s_addr,
                                                                                                             ^
src/unix/ifnet.c:277:45: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
       ifp->int_addr = *(struct sockaddr_in *)ARM_NOWARN_ALIGN(&ifr.ifr_addr);
                                             ^
src/unix/ifnet.c:278:52: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
       memcpy(&ifp->ip_addr, &((struct sockaddr_in *)ARM_NOWARN_ALIGN(&ifr.ifr_addr))->sin_addr.s_addr, olsr_cnf->ipsize);
                                                    ^
src/unix/ifnet.c:296:112: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
         (&((struct sockaddr_in *)ARM_NOWARN_ALIGN(&ifp->int_netmask))->sin_addr.s_addr, &((struct sockaddr_in *)ARM_NOWARN_ALIGN(&ifr.ifr_netmask))->sin_addr.s_addr,
                                                                                                                ^
src/unix/ifnet.c:303:48: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
       ifp->int_netmask = *(struct sockaddr_in *)ARM_NOWARN_ALIGN(&ifr.ifr_netmask);
                                                ^
src/unix/ifnet.c:332:52: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
         ifp->int_broadaddr = *(struct sockaddr_in *)ARM_NOWARN_ALIGN(&ifr.ifr_broadaddr);
                                                    ^
src/unix/ifnet.c: In function ‘chk_if_up’:
src/unix/ifnet.c:604:44: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
       ifs.int_addr = *(struct sockaddr_in *)ARM_NOWARN_ALIGN(&ifr.ifr_addr);
                                            ^
src/unix/ifnet.c:612:45: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
     ifs.int_netmask = *(struct sockaddr_in *)ARM_NOWARN_ALIGN(&ifr.ifr_netmask);
                                             ^
src/unix/ifnet.c:625:49: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
       ifs.int_broadaddr = *(struct sockaddr_in *)ARM_NOWARN_ALIGN(&ifr.ifr_broadaddr);
                                                 ^

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agomake: sort warnings flags and make that section a bit easier to read
Ferry Huberts [Tue, 23 Feb 2016 22:54:54 +0000 (23:54 +0100)]
make: sort warnings flags and make that section a bit easier to read

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agomake: remove conditionals in WARNINGS section, no longer needed
Ferry Huberts [Tue, 23 Feb 2016 22:55:46 +0000 (23:55 +0100)]
make: remove conditionals in WARNINGS section, no longer needed

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agomake: need to load the OS specific makefile before evaluating WARNINGS
Ferry Huberts [Tue, 23 Feb 2016 22:42:36 +0000 (23:42 +0100)]
make: need to load the OS specific makefile before evaluating WARNINGS

Otherwise the compiler flag detection will not use the correct CC

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agomake: add more recognised formats to the gcc-warnings script
Ferry Huberts [Tue, 23 Feb 2016 22:42:04 +0000 (23:42 +0100)]
make: add more recognised formats to the gcc-warnings script

And fix a typo

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agochangelog: update for info/jsoninfo/txtinfo changes
Ferry Huberts [Sun, 21 Feb 2016 17:51:40 +0000 (18:51 +0100)]
changelog: update for info/jsoninfo/txtinfo changes

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agotxtinfo: /config & /plugins are not implemented: return "not found" (404)
Ferry Huberts [Sun, 21 Feb 2016 17:26:39 +0000 (18:26 +0100)]
txtinfo: /config & /plugins are not implemented: return "not found" (404)

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agoinfo: respond with "no content" (204) on empty output
Ferry Huberts [Sun, 21 Feb 2016 16:20:22 +0000 (17:20 +0100)]
info: respond with "no content" (204) on empty output

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agoinfo: respond with "not found" (404) on invalid commands
Ferry Huberts [Sun, 21 Feb 2016 15:26:07 +0000 (16:26 +0100)]
info: respond with "not found" (404) on invalid commands

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agoinfo: add function to the function table to output an error
Ferry Huberts [Sun, 21 Feb 2016 13:28:18 +0000 (14:28 +0100)]
info: add function to the function table to output an error

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agoinfo: prepare for more HTTP status codes
Ferry Huberts [Sun, 21 Feb 2016 14:05:35 +0000 (15:05 +0100)]
info: prepare for more HTTP status codes

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agoinfo: requesting / now is equivalent to /all
Ferry Huberts [Sun, 21 Feb 2016 14:11:23 +0000 (15:11 +0100)]
info: requesting / now is equivalent to /all

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agoinfo: rename an HTTP status define
Ferry Huberts [Sun, 21 Feb 2016 14:09:23 +0000 (15:09 +0100)]
info: rename an HTTP status define

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agoinfo: also handle empty requests
Ferry Huberts [Sun, 21 Feb 2016 14:37:51 +0000 (15:37 +0100)]
info: also handle empty requests

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agoinfo: requests that are too large must set s to < 0
Ferry Huberts [Sun, 21 Feb 2016 14:41:03 +0000 (15:41 +0100)]
info: requests that are too large must set s to < 0

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agomake: preserve debugging info when NOSTRIP is set
Ferry Huberts [Wed, 24 Feb 2016 18:11:31 +0000 (19:11 +0100)]
make: preserve debugging info when NOSTRIP is set

Facilitates more accurate stack traces

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agomain: musl does not support execinfo.h (the backtrace functions)
Ferry Huberts [Wed, 24 Feb 2016 00:07:03 +0000 (01:07 +0100)]
main: musl does not support execinfo.h (the backtrace functions)

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agochangelog: update the warning about txtinfo/jsoninfo
Ferry Huberts [Sun, 21 Feb 2016 12:35:46 +0000 (13:35 +0100)]
changelog: update the warning about txtinfo/jsoninfo

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agotxtinfo: simplify interfaces
Ferry Huberts [Sun, 21 Feb 2016 12:06:19 +0000 (13:06 +0100)]
txtinfo: simplify interfaces

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agotxtinfo: add an empty line after the version, like all other tables
Ferry Huberts [Sun, 21 Feb 2016 12:03:51 +0000 (13:03 +0100)]
txtinfo: add an empty line after the version, like all other tables

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agotxtinfo: simplify sgw
Ferry Huberts [Sun, 21 Feb 2016 12:02:13 +0000 (13:02 +0100)]
txtinfo: simplify sgw

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agotxtinfo: simplify gateways
Ferry Huberts [Sun, 21 Feb 2016 11:49:46 +0000 (12:49 +0100)]
txtinfo: simplify gateways

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agotxtinfo: clarify that using /gat and /sgw on non-Linux is an error
Ferry Huberts [Sat, 20 Feb 2016 19:17:13 +0000 (20:17 +0100)]
txtinfo: clarify that using /gat and /sgw on non-Linux is an error

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agotxtinfo: simplify and fix printing MIDs
Ferry Huberts [Sun, 21 Feb 2016 11:41:03 +0000 (12:41 +0100)]
txtinfo: simplify and fix printing MIDs

This changes the format when vtime is set to true.
The code for vtime did not account for multiple aliases.

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
4 years agotxtinfo: simplify printing HNAs
Ferry Huberts [Sun, 21 Feb 2016 10:54:02 +0000 (11:54 +0100)]
txtinfo: simplify printing HNAs

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>