[PATCH net-next 0/5] mptcp: refactor first subflow init

From: Matthieu Baerts
Date: Fri Apr 14 2023 - 10:09:11 EST


This series refactors the initialisation of the first subflow of a
listen socket. The first subflow allocation is no longer done at the
initialisation of the socket but later, when the connection request is
received or when requested by the userspace.

This is needed not just because Paolo likes to refactor things but
because this simplifies the code and makes the behaviour more consistent
with the rest. Also, this is a prerequisite for future patches adding
proper support of SELinux/LSM labels with MPTCP and accept(2).

In [1], Ondrej Mosnacek explained they discovered the (userspace-facing)
sockets returned by accept(2) when using MPTCP always end up with the
label representing the kernel (typically system_u:system_r:kernel_t:s0),
while it would make more sense to inherit the context from the parent
socket (the one that is passed to accept(2)).

Before being able to properly support that on SELinux/LSM side, patches
2-3/5 prepare the code to simplify the patch 4/5 moving the allocation.

Patch 1/5 is a small clean-up seen while working on the series and patch
5/5 is a small improvement when closing unaccepted sockets.

[1] https://lore.kernel.org/netdev/CAFqZXNs2LF-OoQBUiiSEyranJUXkPLcCfBkMkwFeM6qEwMKCTw@xxxxxxxxxxxxxx/

Signed-off-by: Matthieu Baerts <matthieu.baerts@xxxxxxxxxxxx>
---
Paolo Abeni (5):
mptcp: drop unneeded argument
mptcp: avoid unneeded __mptcp_nmpc_socket() usage
mptcp: move fastopen subflow check inside mptcp_sendmsg_fastopen()
mptcp: move first subflow allocation at mpc access time
mptcp: fastclose msk when cleaning unaccepted sockets

net/mptcp/options.c | 2 +-
net/mptcp/pm.c | 4 +--
net/mptcp/pm_netlink.c | 4 +--
net/mptcp/protocol.c | 97 +++++++++++++++++++++++++++++++++-----------------
net/mptcp/protocol.h | 4 +--
net/mptcp/sockopt.c | 24 +++++++------
net/mptcp/subflow.c | 2 +-
7 files changed, 86 insertions(+), 51 deletions(-)
---
base-commit: e473ea818bfe42cbdf872c41593cbaf24dbf1297
change-id: 20230414-upstream-net-next-20230414-mptcp-refactor-first-subflow-init-ae4659df6ab9

Best regards,
--
Matthieu Baerts <matthieu.baerts@xxxxxxxxxxxx>