sk_is_mptcp() only works with struct tcp_sock *
Closed this issue · 2 comments
sk_is_mptcp()
looks like it can be called using any struct sock *
, but it only gives valid results with struct tcp_sock *
:
static inline bool sk_is_mptcp(const struct sock *sk)
{
return tcp_sk(sk)->is_mptcp;
}
All existing callers use it correctly.
We could rename it to something like tcpsk_is_mptcp()
, or keep the existing name and add a sk_is_tcp()
check.
@mjmartineau Mat, do you mean to change it like this:
static inline bool sk_is_mptcp(const struct sock *sk)
{
return sk_is_tcp(sk) ? tcp_sk(sk)->is_mptcp : false;
}
As noted on the mailing list (https://lore.kernel.org/mptcp/CABbSpchzSj9jn1-t_nmamRf+oH61jecwDw08mr9U1YP9dnw8Pg@mail.gmail.com/) - instead of changing this function, will depend on extra checks with CONFIG_DEBUG_NET
in the mptcp code: https://lore.kernel.org/mptcp/20240201-mptcp-check-protocol-v2-2-1e253ef51990@kernel.org/
This avoids churn and extra execution overhead in the TCP code.