The Commanded Address message contains the 8 byte NAME and the new
source address. The received length was not checked, so the new source
address was taken from stale or uninitialized content of the receive
buffer for short messages. Also the idle and global addresses were
passed to claim_address() which terminates the daemon when bind() fails.
Check for the complete message length and only accept unicast addresses.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
- remove legacy '-p' option (prefix to use when logging), fixes uclibc
compile
Fixes:
j1939acd.c: In function 'main':
j1939acd.c:489:38: error: passing argument 1 of 'asprintf' from incompatible pointer type [-Wincompatible-pointer-types]
489 | if (asprintf(&program_invocation_name, "%s.%s",
| ^~~~~~~~~~~~~~~~~~~~~~~~
| |
| const char **
Signed-off-by: Peter Seiderer <ps.report@gmx.net>
Bash and many other shells use 128 + signum as the exit status when a
program get signal and exit. Follow the common behavior so that we
know how the programs are killed.
For j1939acd.c, it was using s.sig_term as a boolean key to exit from
the while loop. This commit replaces a.sig_term with a.signal_num,
which holds the signal it received.
Signed-off-by: Yasushi SHOJI <yashi@spacecubics.com>
open_socket() has a parameter to provide a network device name which
is properly assigned by its callers to s.intf in main().
Instead of using the callers value open_socket() directly accesses the
global s.intf which generates an unused variable warning with clang.
Fix this by using the provided parameter (no functional change).
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
Some debug messages were implemented using err(), which does not return,
but exit the program. This patches replaces the debug messages by
fprintf(stdout, ).
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Using j*smthng* for j1939-related tools is not very good for 2 reasons:
1. j prefix is not very informative;
2. jcat name is used by journal cat tool from popular sleuthkit toolkit;
2`. jacd sounds very similar to jackd.
2``. Possible future name conflicts for new tools.
Thus I renamed j* to j1939\1 to deal with this issue.
Signed-off-by: Alexander GQ Gerasiov <gq@cs.msu.su>