mptcp: sockopt: fix getting freebind & transparent
commite2f4ac7babupstream. 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:c9406a23c1("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> [ Conflict in sockopt.c due to commite08d0b3d17("inet: implement lockless IP_TOS") not being in this version. The conflict is in the context and the modification can still be applied in mptcp_getsockopt_v4() after the IP_TOS case. ] Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
d69a23d8e9
commit
392dfed4af
@@ -1388,6 +1388,12 @@ static int mptcp_getsockopt_v4(struct mptcp_sock *msk, int optname,
|
||||
switch (optname) {
|
||||
case IP_TOS:
|
||||
return mptcp_put_int_option(msk, optval, optlen, inet_sk(sk)->tos);
|
||||
case IP_FREEBIND:
|
||||
return mptcp_put_int_option(msk, optval, optlen,
|
||||
inet_test_bit(FREEBIND, sk));
|
||||
case IP_TRANSPARENT:
|
||||
return mptcp_put_int_option(msk, optval, optlen,
|
||||
inet_test_bit(TRANSPARENT, sk));
|
||||
}
|
||||
|
||||
return -EOPNOTSUPP;
|
||||
@@ -1402,6 +1408,12 @@ static int mptcp_getsockopt_v6(struct mptcp_sock *msk, int optname,
|
||||
case IPV6_V6ONLY:
|
||||
return mptcp_put_int_option(msk, optval, optlen,
|
||||
sk->sk_ipv6only);
|
||||
case IPV6_TRANSPARENT:
|
||||
return mptcp_put_int_option(msk, optval, optlen,
|
||||
inet_test_bit(TRANSPARENT, sk));
|
||||
case IPV6_FREEBIND:
|
||||
return mptcp_put_int_option(msk, optval, optlen,
|
||||
inet_test_bit(FREEBIND, sk));
|
||||
}
|
||||
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
Reference in New Issue
Block a user