[PATCH mptcp-next v12 0/4] mptcp: MSG_ERRQUEUE support on the parent socket

David Carlier posted 4 patches 3 weeks, 3 days ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/multipath-tcp/mptcp_net-next tags/patchew/20260730071244.69473-1-devnexen@gmail.com
net/mptcp/protocol.c                          |  54 +++++--
net/mptcp/sockopt.c                           | 153 +++++++++++++++---
.../selftests/net/mptcp/mptcp_sockopt.c       |  55 +++++++
3 files changed, 228 insertions(+), 34 deletions(-)
[PATCH mptcp-next v12 0/4] mptcp: MSG_ERRQUEUE support on the parent socket
Posted by David Carlier 3 weeks, 3 days ago
This series lets MPTCP applications use poll(EPOLLERR) and
recvmsg(MSG_ERRQUEUE) on the parent socket to drain TX timestamps
through the standard inet ABI, the same way they would on a plain TCP
socket. ICMP-derived errors stay on the subflow queue: the legacy
RECVERR ABI cannot convey their per-subflow peer identity, and they
are intended for a future MPTCP_RECERR channel.

Patch 1 splices subflow err-skbs onto the parent's sk_error_queue at
error-report time. All forwarded events go through sock_queue_err_skb(),
which re-homes skb->sk onto the parent and charges sk_rmem_alloc, so the
parent's error queue stays bounded by sk_rcvbuf and is dropped under rmem
pressure, matching tcp's tx-timestamp path and ip_icmp_error() /
ipv6_icmp_error(). mptcp_recvmsg(MSG_ERRQUEUE) forwards directly to
inet_recv_error(), and mptcp_poll() advertises EPOLLERR purely on the
parent's sk_err / sk_error_queue, matching tcp_poll().

Patch 2 factors the existing inet_flags subflow-propagation hard-coded
list into a mask, so the next patch can extend it without churn.

Patch 3 makes IP_RECVERR / IPV6_RECVERR (and the RFC4884 variants)
propagate to the subflows. The parent stores the bit so MPTCP-aware
helpers can branch on it.

Patch 4 is a selftest covering the propagation path.

Changes in v12 (addresses Paolo's v11 review):
 - reordered the series so the core MSG_ERRQUEUE infrastructure lands
   first, before the sockopt plumbing that exposes it to user space.
   The former patch 3/4 is now 1/4.
 - 1/4: narrow mptcp_errqueue_skb_forwardable() to
   SO_EE_ORIGIN_TIMESTAMPING. SO_EE_ORIGIN_ZEROCOPY and
   SO_EE_ORIGIN_LOCAL events cannot be generated on an MPTCP parent
   today, so the helper only needs extending if and when they can be.
 - 1/4: trim the block comment above sock_queue_err_skb() and the
   matching changelog paragraphs, now redundant with the narrower
   filter.
 - 2/4: reverse christmas tree declaration ordering in
   sync_socket_options().
 - dropped the Suggested-by: Paolo Abeni tags from patches 1-3.
 - rebased on current export.

v11: https://lore.kernel.org/mptcp/20260531145955.322337-1-devnexen@gmail.com/
v10: https://lore.kernel.org/mptcp/20260529174524.260199-1-devnexen@gmail.com/

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

 net/mptcp/protocol.c                          |  54 +++++--
 net/mptcp/sockopt.c                           | 153 +++++++++++++++---
 .../selftests/net/mptcp/mptcp_sockopt.c       |  55 +++++++
 3 files changed, 228 insertions(+), 34 deletions(-)


base-commit: 6201be839b36e8dd22a23b9b367388ed900a257f
-- 
2.53.0
Re: [PATCH mptcp-next v12 0/4] mptcp: MSG_ERRQUEUE support on the parent socket
Posted by Matthieu Baerts 3 weeks, 2 days ago
Hi David, Paolo,

On 30/07/2026 09:12, David Carlier wrote:
> This series lets MPTCP applications use poll(EPOLLERR) and
> recvmsg(MSG_ERRQUEUE) on the parent socket to drain TX timestamps
> through the standard inet ABI, the same way they would on a plain TCP
> socket. ICMP-derived errors stay on the subflow queue: the legacy
> RECVERR ABI cannot convey their per-subflow peer identity, and they
> are intended for a future MPTCP_RECERR channel.
> 
> Patch 1 splices subflow err-skbs onto the parent's sk_error_queue at
> error-report time. All forwarded events go through sock_queue_err_skb(),
> which re-homes skb->sk onto the parent and charges sk_rmem_alloc, so the
> parent's error queue stays bounded by sk_rcvbuf and is dropped under rmem
> pressure, matching tcp's tx-timestamp path and ip_icmp_error() /
> ipv6_icmp_error(). mptcp_recvmsg(MSG_ERRQUEUE) forwards directly to
> inet_recv_error(), and mptcp_poll() advertises EPOLLERR purely on the
> parent's sk_err / sk_error_queue, matching tcp_poll().
> 
> Patch 2 factors the existing inet_flags subflow-propagation hard-coded
> list into a mask, so the next patch can extend it without churn.
> 
> Patch 3 makes IP_RECVERR / IPV6_RECVERR (and the RFC4884 variants)
> propagate to the subflows. The parent stores the bit so MPTCP-aware
> helpers can branch on it.
> 
> Patch 4 is a selftest covering the propagation path.
> 
> Changes in v12 (addresses Paolo's v11 review):
>  - reordered the series so the core MSG_ERRQUEUE infrastructure lands
>    first, before the sockopt plumbing that exposes it to user space.
>    The former patch 3/4 is now 1/4.
>  - 1/4: narrow mptcp_errqueue_skb_forwardable() to
>    SO_EE_ORIGIN_TIMESTAMPING. SO_EE_ORIGIN_ZEROCOPY and
>    SO_EE_ORIGIN_LOCAL events cannot be generated on an MPTCP parent
>    today, so the helper only needs extending if and when they can be.
>  - 1/4: trim the block comment above sock_queue_err_skb() and the
>    matching changelog paragraphs, now redundant with the narrower
>    filter.
>  - 2/4: reverse christmas tree declaration ordering in
>    sync_socket_options().
>  - dropped the Suggested-by: Paolo Abeni tags from patches 1-3.
>  - rebased on current export.
Thank you for the v12 and for the previous reviews!

I just applied this series with Paolo's ACK, as I understood the v11 was
good for him, and you applied the last requests he had. I hope that's
OK, I can always fix that later.

Note that I also fixed a few checkpatch issues, not to get in troubles
when upstreaming these patches later.

New patches for t/upstream:
- d1c8339c6464: mptcp: support MSG_ERRQUEUE on the parent socket
- b10c2f76fdcf: mptcp: sockopt: factor inet_flags propagation into a mask
- 36a365e46b58: mptcp: propagate RECVERR sockopts to subflows
- a2f437ee45ab: selftests: mptcp: cover IP_RECVERR sockopt propagation
- Results: e5730411f842..e486d89a0699 (export)

Tests are now in progress:

- export:
https://github.com/multipath-tcp/mptcp_net-next/commit/0565f7c5598354965c1a391e4f96fe5d2f1c09a1/checks

Cheers,
Matt
-- 
Sponsored by the NGI0 Core fund.
Re: [PATCH mptcp-next v12 0/4] mptcp: MSG_ERRQUEUE support on the parent socket
Posted by MPTCP CI 3 weeks, 3 days ago
Hi David,

Thank you for your modifications, that's great!

Our CI did some validations and here is its report:

- KVM Validation: normal (except selftest_mptcp_join): Success! ✅
- KVM Validation: normal (only selftest_mptcp_join): Success! ✅
- KVM Validation: debug (except selftest_mptcp_join): Success! ✅
- KVM Validation: debug (only selftest_mptcp_join): Success! ✅
- KVM Validation: btf-normal (only bpftest_all): Success! ✅
- KVM Validation: btf-debug (only bpftest_all): Success! ✅
- Task: https://github.com/multipath-tcp/mptcp_net-next/actions/runs/30523444243

Initiator: Patchew Applier
Commits: https://github.com/multipath-tcp/mptcp_net-next/commits/9fff460b62d5
Patchwork: https://patchwork.kernel.org/project/mptcp/list/?series=1137167


If there are some issues, you can reproduce them using the same environment as
the one used by the CI thanks to a docker image, e.g.:

    $ cd [kernel source code]
    $ docker run -v "${PWD}:${PWD}:rw" -w "${PWD}" --privileged --rm -it \
        --pull always mptcp/mptcp-upstream-virtme-docker:latest \
        auto-normal

For more details:

    https://github.com/multipath-tcp/mptcp-upstream-virtme-docker


Please note that despite all the efforts that have been already done to have a
stable tests suite when executed on a public CI like here, it is possible some
reported issues are not due to your modifications. Still, do not hesitate to
help us improve that ;-)

Cheers,
MPTCP GH Action bot
Bot operated by Matthieu Baerts (NGI0 Core)