Skip to content

Commit e2f4ac7

Browse files
matttbePaolo Abeni
authored and
Paolo Abeni
committed
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: c9406a2 ("mptcp: sockopt: add SOL_IP freebind & transparent options") Cc: [email protected] Reviewed-by: Mat Martineau <[email protected]> Signed-off-by: Matthieu Baerts (NGI0) <[email protected]> Reviewed-by: Simon Horman <[email protected]> Link: https://patch.msgid.link/20250314-net-mptcp-fix-data-stream-corr-sockopt-v1-3-122dbb249db3@kernel.org Signed-off-by: Paolo Abeni <[email protected]>
1 parent 8c39633 commit e2f4ac7

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

net/mptcp/sockopt.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1419,6 +1419,12 @@ static int mptcp_getsockopt_v4(struct mptcp_sock *msk, int optname,
14191419
switch (optname) {
14201420
case IP_TOS:
14211421
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));
14221428
case IP_BIND_ADDRESS_NO_PORT:
14231429
return mptcp_put_int_option(msk, optval, optlen,
14241430
inet_test_bit(BIND_ADDRESS_NO_PORT, sk));
@@ -1439,6 +1445,12 @@ static int mptcp_getsockopt_v6(struct mptcp_sock *msk, int optname,
14391445
case IPV6_V6ONLY:
14401446
return mptcp_put_int_option(msk, optval, optlen,
14411447
sk->sk_ipv6only);
1448+
case IPV6_TRANSPARENT:
1449+
return mptcp_put_int_option(msk, optval, optlen,
1450+
inet_test_bit(TRANSPARENT, sk));
1451+
case IPV6_FREEBIND:
1452+
return mptcp_put_int_option(msk, optval, optlen,
1453+
inet_test_bit(FREEBIND, sk));
14421454
}
14431455

14441456
return -EOPNOTSUPP;

0 commit comments

Comments
 (0)