-
Notifications
You must be signed in to change notification settings - Fork 891
"outbound" matches no packets on a Linux SocketCAN live capture #1474
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Oy. To fix #1051 "Duplicated CAN packages", apparently caused by CAN adapters or drivers looping back transmitted packets in such a way that they're delivered to the CAN stack as output and to the CAN stack as input, libpcap discards outgoing CAN packet under the assumption that they'll be seen as input. This means that libpcap will discard outgoing packets, so any packets that pass the filter "outbound" will be discarded. If there were a reliable way to discover input packets that correspond to packets sent by the machine, we could, instead, discard incoming packets that might already have been seen as outgoing packets, making CAN interfaces look more like, for example, Ethernet interfaces. (Or if there's a way to cause a PF_PACKET socket that's either 1) bound to a CAN interface or 2) unbound (as in the "any" device) not to see those looped-back outgoing packets, that'd also work.) |
As far as I managed to grasp from the Linux kernel document, the Tx loopback is by design and if the driver does not loop the packets back, the stack will do it anyway. |
From a quick look at https://github.com/linux-can/can-utils/blob/master/candump.c, it only uses that flag to mark frames as "transmitted" or "received", not to discard the received copy of a frame transmitted by the host running |
The Documentation/networking/can.rst file says
The problem is that tcpdump/Wireshark/etc. is, in that scenario, like an application D that, if running on the first machine in example (1), would want to see all packets transmitted by application A and all packets received by that host from the other machines and, if running on the first machine in example (2), would want to see all packets transmitted by application A and B and all packets received by that host from the other machines - and not see two copies of packets sent by applications on the same machine. This is a bit different from what the section of the document in question says. |
It could be one of the many |
So if there's a way to specify for a particular |
In the current master branch of libpcap
inbound
matches both Rx and Tx SocketCAN packets (which seems to be by design) andoutbound
matches no packets.Steps to reproduce (hardware)
candump
and observe the packets going in both directions at the expected rate (the timestamps are delta since the previous packet):tcpdump
and observe similar inter-packet timings:inbound
and observe the same:outbound
and observe no packets:Steps to reproduce (virtual device)
The text was updated successfully, but these errors were encountered: