Re: j1939: root requirements for messages with the priorities 0 & 1

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

 



On vr, 12 jun 2020 12:03:20 +0200, Oleksij Rempel wrote:
> Hello all,
> 
> We have following issues reported on can-utils:
> https://github.com/linux-can/can-utils/issues/217
> ===============================================================================
> 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.

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).

Kurt



[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