Skip to content

RFC Change sock->sk_protocol to a 16-bit value

Mat Martineau mptcp 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest3 patches 1 replyIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3net: Make sock protocol value checks more specificinclude/net/sock.h net/ax25/af_ax25.c net/decnet/af_decnet.c+2 -30 replies
2/3sock: Make sk_protocol a 16-bit valueinclude/net/sock.h include/trace/events/sock.h+3 -30 replies
3/3net: Add IPPROTO_MPTCP to inet_sock_set_state tracepoint outputinclude/trace/events/sock.h+2 -10 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [MPTCP] [RFC PATCH 0/3] Change sock->sk_protocol to a 16-bit value

While debugging socket state transitions in MPTCP sockets, I found that MPTCP sockets were listing IPPROTO_TCP as their protocol in /sys/kernel/debug/tracing/trace. sock->sk_protocol was only 8 bits wide, truncating the new value of IPPROTO_MPTCP (0x0106) to IPPROTO_TCP (0x06).

The networking code has varying integer widths for 'protocol' at different layers:

* POSIX socket API: 32 bits
* sk_buff->protocol: 16 bits
* IP header (on the wire): 8 bits

MPTCP shows a use for protocol values outside those that fit in an IP header. The change to struct sock fills an 8-bit hole, so there is no change in the size of the structure.

Given that we are currently discussing the appropriate value for IPPROTO_MPTCP, I'm sending this as an RFC to inform those discussions. I had previously thought that the 16-bit value for IPPROTO_MPTCP was compatible with the existing code base.

Mat Martineau (3):
net: Make sock protocol value checks more specific
sock: Make sk_protocol a 16-bit value
net: Add IPPROTO_MPTCP to inet_sock_set_state tracepoint output

 include/net/sock.h          | 5 ++---
 include/trace/events/sock.h | 5 +++--
 net/ax25/af_ax25.c          | 2 +-
 net/decnet/af_decnet.c      | 2 +-
 4 files changed, 7 insertions(+), 7 deletions(-)
Signature · 1 line
2.22.0