Re: CAN_RAW_RECV_OWN_MSGS and filters

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

 



On 14.04.2021 21:22:50, Erik Flodin wrote:
> I've been using a raw CAN socket with RECV_OWN_MSGS enabled to get a
> transmission confirmation when a frame has been sent. Today when I
> tried to enable filters to limit what I receive to only those frames
> that I'm interested in I noticed that the filters also affected
> reception of my own frames. So in order to receive all frames that I
> send I must also add a filter that matches all frames that I send.
> 
> Is this the expected behavior?

At least it's implemented this way.

On TX complete of a CAN frame it's pushed into the RX path of the
networking stack, along with the information of the originating socket.

Then the CAN frame is delivered into AF_CAN, where it is passed on to
all registered receivers depending on filters. One receiver is the
sending socket in CAN_RAW. Then in CAN_RAW the it is checked if the
sending socket has RECV_OWN_MSGS enabled.

> I can see why it works the way it does, but I had expected that
> setting the RECV_OWN_MSGS flag would give me all frames sent on the
> socket. Is there a way to get my expected behavior without having to
> set a filter that matches all frames that I plan to send?

I don't think there's a way to do that without modifying the kernel
code. One option is to add a new sockopt RECV_OWN_MSGS_ALL or
RECV_OWN_MSGS_UNFILTERED. The CAN_RAW can then register another receiver
at AF_CAN for own messages only.

regards,
Marc

-- 
Pengutronix e.K.                 | Marc Kleine-Budde           |
Embedded Linux                   | https://www.pengutronix.de  |
Vertretung West/Dortmund         | Phone: +49-231-2826-924     |
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917-5555 |

Attachment: signature.asc
Description: PGP signature


[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