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, and lets recvmsg(MSG_ERRQUEUE) on the parent socket consume
queued TX-timestamp and MSG_ZEROCOPY completion notifications.
A prerequisite patch factors the per-flag inet_flags propagation in
sync_socket_options() into a mask-driven loop, so further inet_flags
propagated by MPTCP can be added by extending the mask rather than
touching the call site.
Patch 2 leverages mptcp_setsockopt_all_sf() for the setsockopt path
and extends MPTCP_INET_FLAGS_MASK with the four RECVERR bits, with a
single mptcp_setsockopt_recverr() helper covering both families.
Patch 3 splices subflow err skbs onto the parent at error-report
time, filtering by SO_EE_ORIGIN so user-data cmsgs (TIMESTAMPING,
ZEROCOPY, LOCAL) reach the parent socket while subflow-level ICMP
errors are dropped to avoid leaking subflow identity through the
single-path RECVERR ABI. A future MPTCP_RECERR channel is the right
home for those events along with the per-fd subflow lifecycle events
tracked by [1].
Changes in v5:
- 1/4: replace the WRITE_ONCE() RMW with a per-bit assign_bit() loop
so the per-bit atomicity of the original inet_assign_bit() calls
is preserved (Sashiko).
- 2/4: collapse the family-specific helpers into one
mptcp_setsockopt_recverr() that snapshots optval into a local int,
bumps msk->setsockopt_seq, and forwards via
mptcp_setsockopt_all_sf() (Matthieu, Sashiko); skip
family-mismatched subflows in mptcp_setsockopt_all_sf() (Sashiko).
- 3/4: filter the splice by SO_EE_ORIGIN to forward
TIMESTAMPING / ZEROCOPY / LOCAL only and drop ICMP / ICMPv6
(Matthieu, Paolo); add mptcp_recv_error() to retry the splice on
the pull side so a parent-side rmem-ENOMEM does not strand subflow
skbs (Sashiko).
- 4/4: unchanged.
[1] https://github.com/multipath-tcp/mptcp_net-next/issues/78
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 | 66 ++++++++++-
net/mptcp/sockopt.c | 108 ++++++++++++++----
.../selftests/net/mptcp/mptcp_sockopt.c | 55 +++++++++
3 files changed, 203 insertions(+), 26 deletions(-)
--
2.53.0