Commit Graph

19 Commits

Author SHA1 Message Date
Matthias Schiffer
51a1708453
gluon-neighbour-info: avoid recv() with NULL buffer (#2323)
Calling functions like recv() with a NULL buffer is not explicitly
allowed by the POSIX standard, so it must be avoided to be portable
across different libc implementations. Allocate an initial buffer before
handling requests, and also pass this buffer to the peek recv() call.

Fixes: 531937cf6f ("gluon-neighbour-info: fix broken output with large results")
2021-10-16 14:01:34 +02:00
T-X
531937cf6f
gluon-neighbour-info: fix broken output with large results (#2322)
Currently a buffer with a fixed size of 8192 bytes is used. However the
result can potentially be larger, which leads to a truncated JSON
output on stdout. UDP packets, without compression and with IP
fragmentation, can be up to 64KiB large.

Instead of using a fixed size buffer on the stack ask the kernel first
about the size of the UDP data and allocate a buffer of appropriate size
on the heap before receiving the UDP data.

The issue was observed with a custom respondd provider.

Signed-off-by: Linus Lüssing <linus.luessing@c0d3.blue>
2021-10-04 21:23:29 +02:00
J. Burfeind
2c0f8292c6
gluon-neighbour-info: end before timeout (#2185)
End the process after one result in case -l is not given
and destination address is unicast.
Reduces singleshot execution time from timeout seconds to around 150ms.

resolves #2184
2021-03-15 17:52:34 +01:00
lemoer
74bdf79be0 gluon-neighbour-info: use default port 1001 and default dest ::1 2020-01-10 00:13:37 +01:00
Matthias Schiffer
a5614a5019
gluon-neighbour-info: fix outgoing interface for non-link-local multicast addresses 2019-04-21 19:19:02 +02:00
Matthias Schiffer
e9e1e2d18a
gluon-neighbour-info: exit on unknown parameters 2019-04-21 19:19:02 +02:00
Matthias Schiffer
7dec8ebf87
gluon-neighbour-info: fix mixed tab/space indentation 2019-04-21 19:19:02 +02:00
Matthias Schiffer
fc5f93604e
gluon-neighbour-info: fix inet_pton() error message
inet_pton() doesn't set errno on regular parse errors, so using perror()
doesn't make sense (and we avoid a confusing "Success" message).
2019-04-21 19:19:02 +02:00
lemoer
8e8f794c24 gluon-neighbour-info: improve verbosity on wrong cli parameters (#829)
gluon-neighbour-info: improve verbosity on wrong cli parameters
2016-07-25 15:52:27 +02:00
Matthias Schiffer
fa504dae8d gluon-neighbour-info: simplify and fix timeout calculation
The timeout was calculated incorrectly (in each iteration the span between
the start time and the current time was substracted from the timeout
again), and would often become negative, causing warnings in the kernel
log.
2015-12-18 17:46:24 +01:00
Matthias Schiffer
a3155c427a gluon-neighbour-info: fix a few compiler warnings 2015-12-18 17:46:24 +01:00
Matthias Schiffer
d3bc707caa gluon-neighbour-info: flush after writing the HTTP header
sse-multiplex likes to get the header as fast as possible.
2015-12-18 17:46:24 +01:00
Jan-Philipp Litza
d2ff7d5c22 gluon-neighbour-info: Add -l and -c parameter, make event type for -s configurable 2015-10-15 01:49:20 +02:00
Jan-Philipp Litza
9f91a5f841 gluon-neighbour-info: Support sub-second timeout 2015-07-09 20:18:11 +02:00
Hans-Werner Hilse
66060cf08a gluon-neighbour-info: Do not use error()
error() is a glibc specific function and should not be used in
code meant to be portable.
2015-07-06 09:37:22 +02:00
Nils Schneider
abcc86bf8f gluon-neighbour-info: global timeout 2014-09-06 15:40:03 +02:00
Nils Schneider
0222f342af gluon-neighbour-info: newlines between responses 2014-09-06 14:10:43 +02:00
Nils Schneider
b969f3e644 gluon-neighbour-info: cleanup, use recv instead of recvfrom 2014-09-06 14:02:19 +02:00
Nils Schneider
fe57f93bc7 gluon-neighbour-info: query direct neighbours
This is a simple client for gluon-announced.
2014-08-28 18:48:57 +02:00