-
Notifications
You must be signed in to change notification settings - Fork 894
Open
Description
In the current master branch of libpcap inbound
matches both Rx and Tx SocketCAN packets (which seems to be by design) and outbound
matches no packets.
Steps to reproduce (hardware)
- Wire two SocketCAN USB adapters together.
- Plug one adapter into host A (Debian 12, kernel version 6.1.128-1).
- Plug another adapter into host B (RaspiOS mod of the above, kernel version 6.6.74-1+rpt1).
- On each host run:
This sends synthetic test traffic at 1 packet per second in each direction.
# ip li se dev can0 type can bitrate 500000 # ip li se dev can0 up # cangen -g 1000 can0
- At each host look at the packets using
candump
and observe the packets going in both directions at the expected rate (the timestamps are delta since the previous packet):# candump -x -t d can0 (000.000000) can0 RX - - 53C [8] A4 A7 FC 19 7B D3 B0 71 (000.280610) can0 TX - - 4A1 [4] 31 89 E2 69 (000.719490) can0 RX - - 1E5 [6] 3F 6D D2 0A 01 AB (000.280745) can0 TX - - 6A0 [8] EB 76 EF 45 D2 9F 45 21 (000.719374) can0 RX - - 74B [8] 89 34 6D 6A D0 C1 EF 67 (000.280634) can0 TX - - 021 [5] 01 AA F5 45 2D (000.719354) can0 RX - - 380 [0] (000.280744) can0 TX - - 01C [5] 3F 7A 5C 22 E3
- At each host look at the packets using
tcpdump
and observe similar inter-packet timings:# tcpdump -n -i can0 -ttt tcpdump: verbose output suppressed, use -v[v]... for full protocol decode listening on can0, link-type CAN_SOCKETCAN (CAN-bus with SocketCAN headers), snapshot length 262144 bytes 00:00:00.000000 UNSUPPORTED 0x0000: 0000 0041 0600 0000 ebb0 4c1f af90 0000 ...A......L..... 00:00:00.734333 UNSUPPORTED 0x0000: 0000 0459 0200 0000 66c2 0000 0000 0000 ...Y....f....... 00:00:00.265780 UNSUPPORTED 0x0000: 0000 05d4 0800 0000 5748 1200 bd22 c81c ........WH...".. 00:00:00.734383 UNSUPPORTED 0x0000: 0000 037b 0800 0000 3c55 6606 fabc 547f ...{....<Uf...T. 00:00:00.265719 UNSUPPORTED 0x0000: 0000 0368 0800 0000 49a4 8307 d61e 7c32 ...h....I.....|2 00:00:00.734359 UNSUPPORTED 0x0000: 0000 044a 0800 0000 963e be25 a072 e17c ...J.....>.%.r.| 00:00:00.265743 UNSUPPORTED 0x0000: 0000 0737 0800 0000 c060 6b5c 6a86 d609 ...7.....`k\j... 00:00:00.734320 UNSUPPORTED 0x0000: 0000 06d9 0800 0000 8466 3943 36e2 3514 .........f9C6.5.
- On any host try
inbound
and observe the same:# timeout 4 tcpdump -n -i can0 -ttt inbound tcpdump: verbose output suppressed, use -v[v]... for full protocol decode listening on can0, link-type CAN_SOCKETCAN (CAN-bus with SocketCAN headers), snapshot length 262144 bytes 00:00:00.000000 UNSUPPORTED 0x0000: 0000 0149 0100 0000 2700 0000 0000 0000 ...I....'....... 00:00:00.716940 UNSUPPORTED 0x0000: 0000 048f 0800 0000 023e b533 81e7 a374 .........>.3...t 00:00:00.283203 UNSUPPORTED 0x0000: 0000 02bc 0300 0000 4f72 5400 0000 0000 ........OrT..... 00:00:00.716936 UNSUPPORTED 0x0000: 0000 03e0 0800 0000 4bde d23c 7f03 0c30 ........K..<...0 00:00:00.283239 UNSUPPORTED 0x0000: 0000 04ec 0800 0000 d110 b303 4b2e 174a ............K..J 00:00:00.716803 UNSUPPORTED 0x0000: 0000 046e 0800 0000 aff4 d519 56d5 937d ...n........V..} 00:00:00.283255 UNSUPPORTED 0x0000: 0000 0165 0500 0000 77a9 6635 2e00 0000 ...e....w.f5.... 7 packets captured 8 packets received by filter 0 packets dropped by kernel
- On any host try
outbound
and observe no packets:# timeout 10 tcpdump -n -i can0 -ttt outbound tcpdump: verbose output suppressed, use -v[v]... for full protocol decode listening on can0, link-type CAN_SOCKETCAN (CAN-bus with SocketCAN headers), snapshot length 262144 bytes 0 packets captured 10 packets received by filter 0 packets dropped by kernel
Steps to reproduce (virtual device)
# ip li add type vcan
# ip li se dev vcan0 up
# cangen -g 1000 vcan0
(in a different terminal)
# timeout 3 candump -x -t d vcan0
(000.000000) vcan0 TX - - 610 [8] 52 41 3A 22 51 56 3D 4D
(001.000068) vcan0 TX - - 69A [8] BF 44 CA 00 F8 A0 4E 56
(001.000064) vcan0 TX - - 29D [0]
# timeout 3 tcpdump -n -i vcan0
tcpdump: verbose output suppressed, use -v[v]... for full protocol decode
listening on vcan0, link-type CAN_SOCKETCAN (CAN-bus with SocketCAN headers), snapshot length 262144 bytes
00:00:00.000000 UNSUPPORTED
0x0000: 0000 03b2 0800 0000 dc9f 2b64 fa6d e43f ..........+d.m.?
00:00:01.000071 UNSUPPORTED
0x0000: 0000 02de 0800 0000 cce7 8c4b 0bd9 1f75 ...........K...u
00:00:01.000064 UNSUPPORTED
0x0000: 0000 003c 0800 0000 2986 7b37 454b f768 ...<....).{7EK.h
3 packets captured
6 packets received by filter
0 packets dropped by kernel
# timeout 3 tcpdump -n -i vcan0 -ttt inbound
tcpdump: verbose output suppressed, use -v[v]... for full protocol decode
listening on vcan0, link-type CAN_SOCKETCAN (CAN-bus with SocketCAN headers), snapshot length 262144 bytes
00:00:00.000000 UNSUPPORTED
0x0000: 0000 0555 0100 0000 ca00 0000 0000 0000 ...U............
00:00:01.000066 UNSUPPORTED
0x0000: 0000 01ee 0800 0000 12b2 9926 6d0d 0213 ...........&m...
2 packets captured
3 packets received by filter
0 packets dropped by kernel
# timeout 3 tcpdump -n -i vcan0 -ttt outbound
tcpdump: verbose output suppressed, use -v[v]... for full protocol decode
listening on vcan0, link-type CAN_SOCKETCAN (CAN-bus with SocketCAN headers), snapshot length 262144 bytes
0 packets captured
3 packets received by filter
0 packets dropped by kernel