[PATCH net-next 0/3] tcp: convert the SOL_TCP getsockopt path to sockopt_t

From: Breno Leitao

Date: Thu Nov 12 2026 - 12:14:40 EST


This series continues the migration to sockopt_t, as described in [1].
do_ip_getsockopt() and do_ipv6_getsockopt() moved to sockopt_t in [2];
this does the same for do_tcp_getsockopt(), which still takes a
sockptr_t pair.

Once this lands, the MPTCP and SCTP getsockopt paths come next. MPTCP
builds on this series: with do_tcp_getsockopt() on sockopt_t,
mptcp_getsockopt_first_sf_only() can pass its own sockopt_t to it on the
first subflow, instead of calling tcp_getsockopt() with the user
pointers.

Patch 1 converts the TCP-AO getters.
Patch 2 converts do_tcp_getsockopt() itself. tcp_getsockopt() keeps its
__user prototype and builds the sockopt_t once the level is SOL_TCP, as
ip_getsockopt() does.
Patch 3 adds a tcp fixture to the getsockopt_iter selftest.

Link: https://lore.kernel.org/20260401-getsockopt-v2-0-611df6771aff@xxxxxxxxxx [1]
Link: https://lore.kernel.org/20261103-sockopt_expand_out_v2-v4-0-2d36da923578@xxxxxxxxxx [2]
Link: https://lore.kernel.org/20260914-getsockopt_phase6-v2-0-e48befc9602e@xxxxxxxxxx [3]

Signed-off-by: Breno Leitao <leitao@xxxxxxxxxx>
---
Breno Leitao (3):
net/tcp-ao: convert the getsockopt helpers to sockopt_t
tcp: convert do_tcp_getsockopt() to sockopt_t
selftests: net: getsockopt_iter: cover tcp

include/net/tcp.h | 3 +-
include/net/tcp_ao.h | 13 +-
net/core/filter.c | 30 +++-
net/ipv4/tcp.c | 116 ++++++------
net/ipv4/tcp_ao.c | 77 ++++----
tools/testing/selftests/net/getsockopt_iter.c | 245 ++++++++++++++++++++++++++
6 files changed, 372 insertions(+), 112 deletions(-)
---
base-commit: c88fd6989aea9237a60a4859139a265bfb7ddc0b
base-tree: git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git main
change-id: 20261109-getsockopt_phase7-9f14457eba34

Best regards,
--
Breno Leitao <leitao@xxxxxxxxxx>