Linux Kernel Module#
Overview#
Sources at hartkopp/can-isotp
Part of Linux Mainline since Linux version 5.10
can-isotp
is a Linux Kernel module which extends SocketCAN with ISO-TP functionalityAll transport layer operations are done in the Kernel space
Users can open an ISOTP Socket and directly send and receive data. No CAN frames need to be generated by the user.
Figure from [Har15].
Utilities#
Loading the kernel module:
sudo modprobe can-isotp
Linux
can-utils
comes with handy utilities for ISOTPisotpsend
: Send PDUs from stdin to CANisotprecv
: print received PDU to stdoutisotpdump
: dump CAN frames with PCI decodingisotpsniffer
: dump reassembled ISO-TP PDUsisotptun
: create an IP tunnel over unreliable ISO-TP PDUs
Utility examples#
All examples use vcan0
as interface name!
Send an ISOTP PDU
echo "12 34 56" | isotpsend vcan0 -s 123 -d 321
echo "12 34 56 aa bb cc dd ee ff gg" | isotpsend vcan0 -s 123 -d 321
Receive an ISOTP PDU
isotprecv vcan0 -s 321 -d 123
12 34 56
isotprecv vcan0 -s 321 -d 123
12 34 56 AA BB CC DD EE FF
Sniff ISOTP PDUs
isotpsniffer vcan0 -s 123 -d 321
vcan0 123 [3] 12 34 56 - '.4V'
vcan0 123 [9] 12 34 56 AA BB CC DD EE FF - '.4V......'
Sniff CAN frames with ISOTP decoding
isotpdump vcan0 -s 123 -d 321
vcan0 123 [4] [SF] ln: 3 data: 12 34 56
vcan0 123 [8] [FF] ln: 9 data: 12 34 56 AA BB CC
vcan0 321 [3] [FC] FC: 0=CTS BS: 0=off STmin: 0x00=0ms
vcan0 123 [4] [CF] sn: 1 data: DD EE FF