Re: [PATCH v1] can: can327: Clean up payload encoding in can327_handle_prompt()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 11/20/24 02:15, Max Staudt wrote:
A bit off-topic, but since CAN_RAW came up: Why does CAN_RAW even sanitise anything at all, instead of relying on checks on later layers? It seems like quite a few checks are duplicated. And all the while it's possible for userspace to do weird stuff like seemingly enabling CAN FD on the socket via setsockopt() CAN_RAW_FD_FRAMES, but that's only flipping a bit on the CAN_RAW socket, yet changes nothing underneath. It was quite confusing to read. I suppose the explanation is "legacy"?

Answering my own question here:

CAN_RAW_FD_FRAMES modifies what frames are allowed to pass through the CAN_RAW socket towards userspace. This way, simple software handling only CAN 2.0 frames may assume that reading anything other than CAN_MTU bytes from the socket is an error. This keeps the code simple, and old programs have to be written this way, because there is no way for them to guess what not yet implemented CAN versions will look like.

So, this option makes a lot more sense to me now, sorry for the extra noise :)


Max





[Index of Archives]     [Automotive Discussions]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]     [CAN Bus]

  Powered by Linux