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

j1939 - Remove root requirements for messages with the priorities 0 & 1 #217

Open
josemic opened this issue May 30, 2020 · 1 comment
Open

Comments

@josemic
Copy link
Contributor

josemic commented May 30, 2020

This is a follow-up of the issue #159 .

When testing the priorities, I noticed, that for the priorities 0 and 1, the message occurs, that setting the priority is not permitted:

./testj1939 -B -s -p3 vcan0:0x80 :,0x0200

Works ok.

./testj1939 -B -s -p1 vcan0:0x80 :,0x0200
testj1939: set priority 1: Operation not permitted
./testj1939 -B -s -p0 vcan0:0x80 :,0x0200
testj1939: set priority 0: Operation not permitted

I am not aware that the priorities 0 & 1 are not permitted.

Originally posted by @marckleinebudde in #159 (comment):
Priorities 0 and 1 are only permitted for root or users with capable(CAP_NET_ADMIN), see:

https://elixir.bootlin.com/linux/latest/source/net/can/j1939/socket.c#L705

I think this limit is arbitrary and we can discuss if this makes sense at all or add this to the documentation.

@marckleinebudde
Copy link
Member

In https://www.spinics.net/lists/linux-can/msg03690.html Kurt says:

If I remember well, there is a similar restriction for ethernet or IP priorities. It's true that this limit is arbritrary. It's based on me never having seen intended prio 0 or 1 messages on a bus, but only as a result of 'we forgot to set the priority'.

The goal is to avoid people using 0 as a default without further attention. I think that this could be replaced by some kind of setsockopt call, that sets the highest allowed priority, without ever requiring root. The initial default would then be 2 (or any other value, but 2 seems feasible to me).

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