Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

mptcp: sockopt: fix getting freebind & transparent

When adding a socket option support in MPTCP, both the get and set parts
are supposed to be implemented.

IP(V6)_FREEBIND and IP(V6)_TRANSPARENT support for the setsockopt part
has been added a while ago, but it looks like the get part got
forgotten. It should have been present as a way to verify a setting has
been set as expected, and not to act differently from TCP or any other
socket types.

Everything was in place to expose it, just the last step was missing.
Only new code is added to cover these specific getsockopt(), that seems
safe.

Fixes: c9406a23c116 ("mptcp: sockopt: add SOL_IP freebind & transparent options")
Cc: stable@vger.kernel.org
Reviewed-by: Mat Martineau <martineau@kernel.org>
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20250314-net-mptcp-fix-data-stream-corr-sockopt-v1-3-122dbb249db3@kernel.org
Signed-off-by: Paolo Abeni <pabeni@redhat.com>

authored by

Matthieu Baerts (NGI0) and committed by
Paolo Abeni
e2f4ac7b 8c396337

+12
+12
net/mptcp/sockopt.c
··· 1419 1419 switch (optname) { 1420 1420 case IP_TOS: 1421 1421 return mptcp_put_int_option(msk, optval, optlen, READ_ONCE(inet_sk(sk)->tos)); 1422 + case IP_FREEBIND: 1423 + return mptcp_put_int_option(msk, optval, optlen, 1424 + inet_test_bit(FREEBIND, sk)); 1425 + case IP_TRANSPARENT: 1426 + return mptcp_put_int_option(msk, optval, optlen, 1427 + inet_test_bit(TRANSPARENT, sk)); 1422 1428 case IP_BIND_ADDRESS_NO_PORT: 1423 1429 return mptcp_put_int_option(msk, optval, optlen, 1424 1430 inet_test_bit(BIND_ADDRESS_NO_PORT, sk)); ··· 1445 1439 case IPV6_V6ONLY: 1446 1440 return mptcp_put_int_option(msk, optval, optlen, 1447 1441 sk->sk_ipv6only); 1442 + case IPV6_TRANSPARENT: 1443 + return mptcp_put_int_option(msk, optval, optlen, 1444 + inet_test_bit(TRANSPARENT, sk)); 1445 + case IPV6_FREEBIND: 1446 + return mptcp_put_int_option(msk, optval, optlen, 1447 + inet_test_bit(FREEBIND, sk)); 1448 1448 } 1449 1449 1450 1450 return -EOPNOTSUPP;