Skip to content
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

Reading from a non-bound Raw CAN socket blocks indefinitely #357

Open
derek-will opened this issue Apr 18, 2022 · 1 comment
Open

Reading from a non-bound Raw CAN socket blocks indefinitely #357

derek-will opened this issue Apr 18, 2022 · 1 comment

Comments

@derek-will
Copy link

This is quite similar to the situation found earlier for ISO-TP sockets. If there is an attempt to read from an unbound socket, then the call will be blocked indefinitely because of course there will not be any messages received when the socket is not bound to an interface.

My suggestion is that we return an error when a read, recv, etc. is attempted on an unbound socket as it is certainly an error on the application programmer's part.

Somewhere in raw_recvmsg we could add a "is socket bound" check: https://elixir.bootlin.com/linux/latest/source/net/can/raw.c#L843

@hartkopp
Copy link
Member

Yes. Makes sense for CAN_RAW and for the 'unconnected/unbound' CAN_BCM socket too.
At least better than "Learning by pain" (here: loss of lifetime)
:-D

Will add Reported-by/Suggested-by tags for you. Thx!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants