Commit Graph

24 Commits (30b6b040537c7c783792d8a924a4e05488f98055)

Author SHA1 Message Date
Oliver Hartkopp 6e7f845a68 isotpsend: add support for transmission without flow control
Usually the ISO 15765-2 protocol is a point-to-point protocol to transfer
segmented PDUs to a dedicated receiver. This receiver sends a flow control
message to specify protocol options and timings (e.g. block size / STmin).

The so called functional addressing communication allows a 1:N
communication but is limited to a single frame length.

The new CAN_ISOTP_CF_BROADCAST flag introduced in Linux 5.19 allows an
unconfirmed 1:N communication with PDU lengths that would not fit into a
single frame. This feature is not covered by the ISO 15765-2 standard.

The isotpsend tool gets a new option '-C' to enable this unconfirmed 1:N
communication by setting the CAN_ISOTP_CF_BROADCAST flag.

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2022-05-13 20:00:45 +02:00
Oliver Hartkopp dfb607c807 remove obsolete char pointer casts
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2022-03-14 18:21:45 +01:00
Oliver Hartkopp 84d3294132 isotp: support Linux 5.18 features
- update isotp.h include file
- update maximum PDU (buffer) size to 64kByte buffer
- support setting of N_As (frame_txtime) to zero

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2022-03-12 18:09:48 +01:00
Oliver Hartkopp acec220189 isotpsend: add new options to generate PDU traffic load
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2022-02-09 18:34:09 +01:00
Oliver Hartkopp f7307b8290 can-utils: check for return values of if_nametoindex()
if_nametoindex() returns zero and a specific errno in the case the network
interface does not exist. The missing check leads to the use of the 'any'
CAN device but leaves the user alone as the user gets no error message.

Reported-by: Lothar Rubusch <lotophagon@protonmail.com>
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2021-10-18 09:37:46 +02:00
Oliver Hartkopp 682e01a40a isotpsend: add SF_BROADCAST support for functional addressing
When CAN_ISOTP_SF_BROADCAST is set in the CAN_ISOTP_OPTS flags the
CAN_ISOTP socket is switched into functional addressing mode, where
only single frame (SF) protocol data units can be send on the specified
CAN interface and the given tp.tx_id after bind().

In opposite to normal and extended addressing this socket does not
register a CAN-ID for reception which would be needed for a 1-to-1
ISOTP connection with a segmented bi-directional data transfer.

The new option '-S' sets the CAN_ISOTP_SF_BROADCAST to test the option
with different length settings, e.g. link layer data lengths.

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2020-12-06 14:41:48 +01:00
Rosen Penev b153fe3f35
clang-tidy: sort includes alphabetically
Found with llvm-include-order

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-10-12 23:28:58 -07:00
Oliver Hartkopp f6d963b5d9 isotpsend: add support for blocking write flag
With the new flag 'CAN_ISOTP_WAIT_TX_DONE' the send()/write() syscall returns
when the PDU is completely passed to the CAN netdevice queue. Depending on
STmin and other settings for the tx-queue-len this does not necessarily mean
that the PDU has been completely sent on the CAN interface at that time.

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2020-10-01 20:42:50 +02:00
Alexander Gerasiov 3d6a53550e isotpsend.c: Reformat help/usage output to be compatible with help2man.
Signed-off-by: Alexander Gerasiov <gq@debian.org>

Gbp-Pq: Name 0015-isotpsend.c-Reformat-help-usage-output-to-be-compati.patch
2020-04-27 08:20:09 +03:00
Yegor Yefremov 7b7331976a Add SPDX identifiers
Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
2019-06-19 12:24:24 +02:00
Sven Schmitt f5fb7317aa treewide: use if_nametoindex to avoid overflows
replaced strcpy(if_name, argv[x]) + ioctl by if_idx = if_nametoindex(argv[x])
to avoid overflows caused by long user input.

Signed-off-by: Sven Schmitt <sven.schmitt@gmx.net>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2015-06-30 21:00:04 +02:00
Oliver Hartkopp a51be177d8 isotp[send|recv]: change command line option for padding bytes
Allow to specify the TX and RX padding content separately.
Due to the optional values it is possible to provide either TX or RX values
which enables and set the given values.

-p 55:AA => TX padding 0x55, RX padding 0xAA
-p 55    => TX padding 0x55
-p 55:   => TX padding 0x55
-p :AA   => RX padding 0xAA

Additionally the comment for the -P <mode> option was updated to point out the
checking mode of the padding in the received PDUs (rx padding).

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2014-11-20 23:13:37 +01:00
Oliver Hartkopp 523f3d8fc0 isotp[send|recv]: change command line option for extended addressing
Enable to pass the optional second extended address with the '-x' option and
do not pollute the command line options with just another '-X' option.

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2014-11-19 20:44:41 +01:00
Oliver Hartkopp 8150e21a11 isotp: add tool support for ISO 15765-2:2015 with CAN FD
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2014-11-16 22:24:04 +01:00
Oliver Hartkopp 4ffb7fe5c7 isotp: added support for separate extended address in rx path
As requested by Laurent Vaudoit the extended address can be different in the
tx and he rx path:

(..) how can i have a segmented transfer like this:
0x6a7  0x55 0x10 0x08 ........
0x687  0xAA 0x30 0x00 0x00
0x6a7  0x55 0x21 .....

The connection i need is between two ECU, using IDs 0x6a7/687 and one has
adress extension 0x55, the other 0xAA (this adressing method is used on some
FIAT ECUs for example).

http://marc.info/?l=linux-can&m=140354647413513&w=2

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2014-11-16 20:38:31 +01:00
Oliver Hartkopp c517af5a0b isotpsend: add option to automatically create test data with specifc length
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2014-10-24 21:05:52 +02:00
Oliver Hartkopp 2fa9b0005b isotp[send|recv]: support PDU sizes greater than 4095
Allow PDU sizes greater than 4095 to be able to check the correct
implementation of the kernel socket API error handlings.

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2014-10-24 20:41:11 +02:00
Oliver Hartkopp 9c5bfab229 isotp: fix copy paste error for isotp padding config
Thanks for the anonymous hint, Mr X ;-)

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2014-10-23 19:07:54 +02:00
Oliver Hartkopp 836d3cc012 remove obsolete SVN ID tags
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2012-11-14 20:57:16 +01:00
Marc Kleine-Budde 722a09116d treewide: replace berlios contact email by linux-can@vger.kernel.org
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2012-01-11 12:14:15 +01:00
Oliver Hartkopp 6aeb7d1faa Added new socketoptions to force the isotp protocol to intentionally
misbehave for regression tests.

CAN_ISOTP_TX_STMIN:
Set a value in nano secs that's used as minimum CF gap by the sender.
This value is used instead of the value provided by the receiver inside the FC.

CAN_ISOTP_RX_STMIN:
Ignores received CF frames which timestamps differ less than this value in nano
secs. This is used to test the receivers misbehaviour when the receiver
provides a lower stmin value that he's able to cope with. Received CF frames
are silently dropped when they come faster than specified by this value.
2010-11-14 08:55:06 +00:00
Oliver Hartkopp 4369ac1c55 Consistencely allow '-?' to get a help text. 2009-01-13 09:32:45 +00:00
Oliver Hartkopp 4e41082935 Added Id keyword propertiy on new files. 2008-11-05 14:20:52 +00:00
Oliver Hartkopp f1d4ebbbba Added ISO 15765-2 CAN transport protocol for protocol family CAN.
Including some tools and coarse documentation README.isotp
2008-11-05 11:34:23 +00:00