If j1939spy is started with the verbose option "-v" or "--verbose", it
will print the error "j1939spy: listening: Success" and exit. Remove
this option altogether.
Fixes: c50b5a39de ("can-j1939: add jspy 'sniffer' program")
We don't need to block any signals, so a select() is sufficient. This
also fixes the problem that sigmask is uninitialized and may block the
sig ARLM, which make canbusload hang until a CAN frame is recieved.
Closes: https://github.com/linux-can/can-utils/issues/465
If CAN_ERR_CNT is set, the snprintf_can_error_frame() bails out, as it
cannot decode CAN_ERR_CNT.
Fixes: 21fb43532e ("lib: snprintf_can_error_frame: print counter errors if CAN_ERR_CNT is set")
In 913311fc15 ("can-calc-bit-timing: add support to decode user
supplied bit timing parameters") support to decide user supplied bit
timing parameters was added. However, it was forgotten to add --tq to
the help text.
Add help text for the --tq paramter.
Reported-by: https://github.com/EnricoMontecaggi
Closes: https://github.com/linux-can/can-utils/issues/459
Fixes: 913311fc15 ("can-calc-bit-timing: add support to decode user supplied bit timing parameters")
Commit 0be066bee6 ("cansequence: main(): allow to bind on "any"
interface") converted from SIOCGIFINDEX ioctl() to if_nametoindex()
and adjusted the error message, but forgot the "()" after the function
name, which is used in the rest of the error messages in this file.
Add the missing "()".
Fixes: 0be066bee6 ("cansequence: main(): allow to bind on "any" interface")
In commit 9567230494 ("cansequence: print out dropped packages by
socket counter"), the read() syscall was replaced by recvmsg(). Adjust
error message accordingly.
Fixes: 9567230494 ("cansequence: print out dropped packages by socket counter")
It is not implemented and not supported by any of the can-utils, so
remove it.
Reported-by: Jan Luebbe <jlu@pengutronix.de>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
By using C99 initializers for struct sockaddr_can addr the not
assigned members are automatically set to 0x0, resulting in not
passing uninitialized memory to the bind() syscall.
Also remove the printing of the socket family, type and proto, this
was interesting back in the days, when the numbers were not fixed, yet.
By using C99 initializers for struct sockaddr_can addr the not
assigned members are automatically set to 0x0, resulting in not
passing uninitialized memory to the bind() syscall.
| cangen.c: In function ‘parse_dataoptarg’:
| cangen.c:422:2: error: ‘for’ loop initial declarations are only allowed in C99 mode
| for (int i = 0; i < CANFD_MAX_DLEN && i < arglen / 2; i++) {
| ^
| cangen.c:422:2: note: use option -std=c99 or -std=gnu99 to compile your code
| cangen.c: In function ‘main’:
| cangen.c:796:4: error: ‘for’ loop initial declarations are only allowed in C99 mode
| for (int i = 0; i < frame.len; i++) {
| ^
Reported-by: https://github.com/yannS2016
Link: https://github.com/linux-can/can-utils/issues/428
Fixes: e409aa4c8c ("cangen: new generation mode - partially randomized payload (-D)")
| cangen.c: In function ‘parse_dataoptarg’:
| cangen.c:422:2: error: ‘for’ loop initial declarations are only allowed in C99 mode
| for (int i = 0; i < CANFD_MAX_DLEN && i < arglen / 2; i++) {
| ^
| cangen.c:422:2: note: use option -std=c99 or -std=gnu99 to compile your code
| cangen.c: In function ‘main’:
| cangen.c:796:4: error: ‘for’ loop initial declarations are only allowed in C99 mode
| for (int i = 0; i < frame.len; i++) {
| ^
Reported-by: https://github.com/yannS2016
Link: https://github.com/linux-can/can-utils/issues/428
Fixes: e409aa4c8c ("cangen: new generation mode - partially randomized payload (-D)")
This patch replaces strcpy() + ioctl() by if_nametoindex() to avoid
overflows caused by long user input.
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Fixes the following warning:
| cangen.c:524:7: warning: comparing floating-point with ‘==’ or ‘!=’ is unsafe [-Wfloat-equal]
| 524 | if (gap && burst_sent_count >= burst_count) /* gap == 0 => performance test :-] */
| | ^~~
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Silence the "comparison of integer expressions of different
signedness" warning. We want to compile the code as is from the
kernel, including bugs.
| calc-bit-timing/can-calc-bit-timing-v2_6_31.c: In function ‘can_update_spt_v2_6_31’:
| calc-bit-timing/can-calc-bit-timing-v2_6_31.c:51:13: warning: comparison of integer expressions of different signedness: ‘int’ and ‘__u32’ {aka ‘const unsigned int’} [-Wsign-compare]
Fixes: 18eb0ab784 ("can-calc-bit-timing: import bit timing calculation algorithm from v4.8")
Fixes: b777ce2e6d ("can-calc-bit-timing: import bit timing calculation algorithm from v3.18")
Fixes: c1f5dc53ec ("can-calc-bit-timing: import bit timing calculation algorithm from v2.6.31")
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Vincent Mailhol <mailhol.vincent@wanadoo.fr> says:
This series contain cleanup patches and update of header files. There
is no real relation between each patch (aside of 2/6 and 3/6 which
form a pair) so I will end the cover letter here and let you refer to
the short description.
* Changelog *
v2 -> v3:
* reorder the patches so that related changes are next to each
other (especially patch 2/6 and 3/6).
* patch 2/6: new patch to update include/linux/can/error.h with the
latest hearder from Linux 6.0.0.
* patch 3/6: do not use an #ifdef anymore and make sure that the
code still work if run on old kernel version lower than 6.0.0.
* patch 6/6: rewrite commit description to point out that there is a
local copy of the linux headers under include/linux/.
v1 -> v2:
* patch 2/5: add a note in commit message to explain that slcanpty.c
debug is deactivated by default.
* patch 2/5: make the compiler check the pr_debug() syntax even if
debug is off.
* reorder the patches so that the lib.c and the candump.c patches
are next to each other in the series.
Link: https://lore.kernel.org/all/20221114163848.3398-1-mailhol.vincent@wanadoo.fr
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
The ctrlmsg must be large enough to contains 3 elements of various
sizes, not a single element of the sum of the size.
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>