Re: [PATCH bpf-next v2] selftests/bpf: Mask socket type flags in mptcpify prog
From: Matthieu Baerts
Date: Tue Jun 30 2026 - 07:46:19 EST
Hi Guillaume,
Thank you for sharing this fix!
> The mptcpify BPF prog upgrades eligible TCP sockets to MPTCP, but only
> when the socket type is exactly SOCK_STREAM. Its update_socket_protocol()
> hook runs on the raw type from userspace, before the socket core masks
> it with SOCK_TYPE_MASK, so the type may still carry SOCK_CLOEXEC or
> SOCK_NONBLOCK in its upper bits and the equality check fails.
>
> As a result, a socket(AF_INET, SOCK_STREAM | SOCK_CLOEXEC, 0) -- what
> common libraries do by default -- is silently left as plain TCP. This
> was hit in practice with curl. Since mptcpify.c is referenced as example
> code for enabling MPTCP transparently, the same mistake is likely to be
> copied into real deployments where it fails the same way and is hard to
> diagnose.
Good idea to fix this code in mptcpify.c, which is indeed used as a
reference, and ends up in real deployments.
The modifications look good to me:
Reviewed-by: Matthieu Baerts (NGI0) <matttbe@xxxxxxxxxx>
--
Matthieu Baerts (NGI0) <matttbe@xxxxxxxxxx>