linux-next/net/can
Anna Emese Nyiri a32f3e9d1e sock: support SO_PRIORITY cmsg
The Linux socket API currently allows setting SO_PRIORITY at the
socket level, applying a uniform priority to all packets sent through
that socket. The exception to this is IP_TOS, when the priority value
is calculated during the handling of
ancillary data, as implemented in commit f02db315b8 ("ipv4: IP_TOS
and IP_TTL can be specified as ancillary data").
However, this is a computed
value, and there is currently no mechanism to set a custom priority
via control messages prior to this patch.

According to this patch, if SO_PRIORITY is specified as ancillary data,
the packet is sent with the priority value set through
sockc->priority, overriding the socket-level values
set via the traditional setsockopt() method. This is analogous to
the existing support for SO_MARK, as implemented in
commit c6af0c227a ("ip: support SO_MARK cmsg").

If both cmsg SO_PRIORITY and IP_TOS are passed, then the one that
takes precedence is the last one in the cmsg list.

This patch has the side effect that raw_send_hdrinc now interprets cmsg
IP_TOS.

Reviewed-by: Willem de Bruijn <willemb@google.com>
Suggested-by: Ferenc Fejes <fejes@inf.elte.hu>
Signed-off-by: Anna Emese Nyiri <annaemesenyiri@gmail.com>
Link: https://patch.msgid.link/20241213084457.45120-3-annaemesenyiri@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2024-12-16 18:13:44 -08:00
..
j1939 can: j1939: j1939_session_new(): fix skb reference counting 2024-12-02 09:53:39 +01:00
af_can.c net: af_can: do not leave a dangling sk pointer in can_create() 2024-10-15 18:43:08 -07:00
af_can.h can: introduce CAN midlayer private and allocate it automatically 2019-09-04 13:29:14 +02:00
bcm.c can: bcm: Clear bo->bcm_proc_read after remove_proc_entry(). 2024-09-12 09:40:08 +02:00
gw.c can: gw: Use rtnl_register_many(). 2024-10-15 18:52:26 -07:00
isotp.c can: isotp: remove ISO 15675-2 specification version where possible 2024-06-20 11:52:56 +02:00
Kconfig can: isotp: remove ISO 15675-2 specification version where possible 2024-06-20 11:52:56 +02:00
Makefile can: add ISO 15765-2:2016 transport protocol 2020-10-07 23:18:33 +02:00
proc.c proc: remove PDE_DATA() completely 2022-01-22 08:33:37 +02:00
raw.c sock: support SO_PRIORITY cmsg 2024-12-16 18:13:44 -08:00