MPTCP Linux Development
 help / color / mirror / Atom feed
From: David Carlier <devnexen@gmail.com>
To: mptcp@lists.linux.dev
Cc: Matthieu Baerts <matttbe@kernel.org>,
	Mat Martineau <martineau@kernel.org>,
	Geliang Tang <geliang@kernel.org>,
	Paolo Abeni <pabeni@redhat.com>,
	David Carlier <devnexen@gmail.com>
Subject: [PATCH mptcp-next v4 0/4] mptcp: MSG_ERRQUEUE support on the parent socket
Date: Mon, 27 Apr 2026 22:10:02 +0100	[thread overview]
Message-ID: <cover.1777324037.git.devnexen@gmail.com> (raw)
In-Reply-To: <20260421223338.52743-1-devnexen@gmail.com>

MPTCP already advertises IP_RECVERR/IPV6_RECVERR as supported, but the
parent socket does not currently provide usable MSG_ERRQUEUE handling.

This series wires the MPTCP socket up to the IPv4/IPv6 error queue
paths. It propagates RECVERR-related sockopts to existing and future
subflows, makes poll() report pending errqueue activity through the
parent socket, and lets recvmsg(MSG_ERRQUEUE) on the MPTCP socket
consume queued errors with the parent socket ABI.

A new prerequisite patch factors the per-flag inet_flags propagation
in sync_socket_options() into a single masked word copy, so further
inet_flags propagated by MPTCP can be added by extending the mask
rather than touching the call site.

Patch 2 then leverages the existing mptcp_setsockopt_all_sf() helper
for the setsockopt path and extends MPTCP_INET_FLAGS_MASK with the
four RECVERR bits, dropping the family-specific helpers from v3.

Based-on: <20260424-mptcp-pm-sockopt-set-all-sf-v1-1-38e7023822f8@kernel.org>

v3 -> v4:
  - New patch 1/4: factor inet_flags propagation in
    sync_socket_options() through MPTCP_INET_FLAGS_MASK, per Paolo's
    review.
  - Patch 2/4 (was 1/3): drop the mptcp_recverr_enabled() and
    mptcp_subflow_set_recverr() helpers; route the setsockopt path
    through mptcp_setsockopt_all_sf(). Inherit the four RECVERR bits
    via MPTCP_INET_FLAGS_MASK in sync_socket_options() instead of
    explicit inet[6]_assign_bit() calls.
  - Patch 3/4 (was 2/3): rework the MSG_ERRQUEUE plumbing per Paolo's
    review. Subflow err skbs are now spliced onto the parent msk's
    sk_error_queue from __mptcp_subflow_error_report() via the new
    __mptcp_subflow_splice_errqueue() helper. recvmsg(MSG_ERRQUEUE)
    on the parent reverts to plain inet_recv_error(), and mptcp_poll()
    only inspects the parent's sk_error_queue -- no more on-demand
    subflow walks, no extra lock_sock() / data_lock() in the poll or
    recv paths. Keep the original early-return structure of
    __mptcp_subflow_error_report() and fix the reverse christmas-tree
    variable order Paolo flagged.

v2 -> v3:
  - Only consume ssk->sk_err in the fallback / MPC-connect branch of
    __mptcp_subflow_error_report(). Steady-state MPTCP now leaves
    TCP's one-shot sk_err to TCP's own consumer instead of silently
    draining it via sock_error().
  - In mptcp_recv_error(), also route to inet_recv_error() when
    sk->sk_err is set, so a fallback-propagated error reaches userspace
    even when the parent errqueue is empty.
  - Scope the new selftest to IP_RECVERR sockopt propagation only.
    End-to-end errqueue delivery (TX timestamps, ICMP, zerocopy)
    depends on subflow-side producers that are out of scope for this
    series and will be covered by follow-up work. Fixes the
    mptcp_sockopt selftest timeout reported by the MPTCP CI on v2.

v1 -> v2:
  - Retargeted to mptcp-next per Matthieu Baerts' feedback (net-next
    closed during the merge window; iterate on the MPTCP tree).
  - Guard mptcp_setsockopt_v6_recverr() and its dispatch cases in
    mptcp_setsockopt_v6() with #if IS_ENABLED(CONFIG_IPV6) to fix
    the MPTCP CI link break on without_ipv6/with_mptcp configs
    (undefined reference to ipv6_setsockopt).

v1: https://lore.kernel.org/mptcp/20260421152216.38127-1-devnexen@gmail.com/
v2: https://lore.kernel.org/mptcp/20260421191337.58341-1-devnexen@gmail.com/
v3: https://lore.kernel.org/mptcp/20260421223338.52743-1-devnexen@gmail.com/

David Carlier (4):
  mptcp: sockopt: factor inet_flags propagation into a mask
  mptcp: propagate RECVERR sockopts to subflows
  mptcp: support MSG_ERRQUEUE on the parent socket
  selftests: mptcp: cover IP_RECVERR sockopt propagation

 net/mptcp/protocol.c                          |  33 +++++-
 net/mptcp/sockopt.c                           | 107 ++++++++++++++----
 .../selftests/net/mptcp/mptcp_sockopt.c       |  55 +++++++++
 3 files changed, 170 insertions(+), 25 deletions(-)

--
2.53.0


  parent reply	other threads:[~2026-04-27 21:10 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-21 22:33 [PATCH mptcp-next v3 0/3] mptcp: MSG_ERRQUEUE support on the parent socket David Carlier
2026-04-21 22:33 ` [PATCH mptcp-next v3 1/3] mptcp: propagate RECVERR sockopts to subflows David Carlier
2026-04-22  8:05   ` Paolo Abeni
2026-04-22  8:32     ` Matthieu Baerts
2026-04-22  8:35       ` Matthieu Baerts
2026-04-22  8:36         ` Matthieu Baerts
2026-04-22  8:48         ` Paolo Abeni
2026-04-22  8:50           ` Matthieu Baerts
2026-04-22 13:53             ` Paolo Abeni
2026-04-22 21:51     ` David CARLIER
2026-04-27 17:07       ` Matthieu Baerts
2026-04-21 22:33 ` [PATCH mptcp-next v3 2/3] mptcp: support MSG_ERRQUEUE on the parent socket David Carlier
2026-04-22  8:28   ` Paolo Abeni
2026-04-22 21:54     ` David CARLIER
2026-04-21 22:33 ` [PATCH mptcp-next v3 3/3] selftests: mptcp: cover IP_RECVERR sockopt propagation David Carlier
2026-04-21 23:38 ` [PATCH mptcp-next v3 0/3] mptcp: MSG_ERRQUEUE support on the parent socket MPTCP CI
2026-04-22  8:22 ` Matthieu Baerts
2026-04-22  8:56   ` David CARLIER
2026-04-27 21:10 ` David Carlier [this message]
2026-04-27 21:10   ` [PATCH mptcp-next v4 1/4] mptcp: sockopt: factor inet_flags propagation into a mask David Carlier
2026-04-27 21:10   ` [PATCH mptcp-next v4 2/4] mptcp: propagate RECVERR sockopts to subflows David Carlier
2026-05-01 15:56     ` Matthieu Baerts
2026-04-27 21:10   ` [PATCH mptcp-next v4 3/4] mptcp: support MSG_ERRQUEUE on the parent socket David Carlier
2026-04-27 21:10   ` [PATCH mptcp-next v4 4/4] selftests: mptcp: cover IP_RECVERR sockopt propagation David Carlier
2026-04-28 18:48   ` [PATCH mptcp-next v4 0/4] mptcp: MSG_ERRQUEUE support on the parent socket Matthieu Baerts
2026-04-28 18:56     ` Matthieu Baerts
2026-04-28 19:15       ` David CARLIER
2026-05-01 14:49       ` Matthieu Baerts
2026-05-01 15:28         ` David CARLIER
2026-05-01 15:56           ` Matthieu Baerts
2026-04-28 19:48   ` MPTCP CI

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cover.1777324037.git.devnexen@gmail.com \
    --to=devnexen@gmail.com \
    --cc=geliang@kernel.org \
    --cc=martineau@kernel.org \
    --cc=matttbe@kernel.org \
    --cc=mptcp@lists.linux.dev \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox