-
Notifications
You must be signed in to change notification settings - Fork 52
Update LINKTYPE_CAN_SOCKETCAN #37
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
Closed
hartkopp
wants to merge
1
commit into
the-tcpdump-group:master
from
hartkopp:socketcan-DLT-update-v2
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So is
CANFD_FDFa flag to care about, or was its introduction not useful?I.e., is the only test that should be used to distinguish between CAN CC and CAN FD frames the frame size, in which case
CANFD_FDFdoes not appear to serve any useful purpose, or is there some reason why software should care about theCANFD_FDFflag?Note also that there is no requirement that a frame using this link-layer type was delivered to a program writing the frame by a Linux kernel; at least two of the non-pcap/non-pcapng file formats that Wireshark can read are treated by Wireshark's capture-file-reading library as providing
LINKTYPE_CAN_SOCKETCAN-format frames.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Three of those formats, to be precise. See this comment for more details.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It has another functionality than you obviously expected.
CAN CC and CAN FD are different in many points:
And the only test that should be used to distinguish between CAN CC and CAN FD frames is the frame size (16/72).
The CANFD_FDF flags is some kind of bonus for the CAN FD frame structure users - nothing more.
Looking into the former and current Wireshark code makes it pretty clear that the frame size was always used to distinguish between CAN CC and CAN FD frames. Which is fine. So nothing changes, right?
The handling around CANFD_FDF is wrong as CANFD_FDF is just a bonus as described above - and not reliable indicator for CAN CC/FD.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that, currently, Wireshark handles non-pcap/pcapng CAN capture files, such as Vector Informatik BLF files, BUSMASTER files, dumps from Linux candump, and log files from CLx000 CAN loggers from CSS Electronics, by constructing a fake SocketCAN header from whatever metadata is available in the native file format and prepending that header to the CAN frame data.
This means that, if those files were to be read by a program in the Wireshark suite and written out as a pcap or pcapng file, there would be LINKTYPE_CAN_SOCKETCAN packets without the padding Linux SocketCAN adds. The frame size check can't be used for those packets; the flags have to be checked
Either the spec should allow for that, or the Wireshark code that writes LINKTYPE_CAN_SOCKETCAN packets should pad CAN CC frames to 16 octets (including the SocketCAN header) and pad CAN FD frames to 72 octets (again, including the SocketCAN header).