mptcp: enable JOIN requests even if cookies are in use
JOIN requests do not work in syncookie mode -- for HMAC validation, the peers nonce and the mptcp token (to obtain the desired connection socket the join is for) are required, but this information is only present in the initial syn. So either we need to drop all JOIN requests once a listening socket enters syncookie mode, or we need to store enough state to reconstruct the request socket later. This adds a state table (1024 entries) to store the data present in the MP_JOIN syn request and the random nonce used for the cookie syn/ack. When a MP_JOIN ACK passed cookie validation, the table is consulted to rebuild the request socket from it. An alternate approach would be to "cancel" syn-cookie mode and force MP_JOIN to always use a syn queue entry. However, doing so brings the backlog over the configured queue limit. v2: use req->syncookie, not (removed) want_cookie arg Suggested-by: Paolo Abeni <pabeni@redhat.com> Signed-off-by: Florian Westphal <fw@strlen.de> Reviewed-by: Mat Martineau <mathew.j.martineau@linux.intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
6fc8c827dd
commit
9466a1cceb
@@ -506,4 +506,24 @@ static inline bool subflow_simultaneous_connect(struct sock *sk)
|
||||
!subflow->conn_finished;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_SYN_COOKIES
|
||||
void subflow_init_req_cookie_join_save(const struct mptcp_subflow_request_sock *subflow_req,
|
||||
struct sk_buff *skb);
|
||||
bool mptcp_token_join_cookie_init_state(struct mptcp_subflow_request_sock *subflow_req,
|
||||
struct sk_buff *skb);
|
||||
void __init mptcp_join_cookie_init(void);
|
||||
#else
|
||||
static inline void
|
||||
subflow_init_req_cookie_join_save(const struct mptcp_subflow_request_sock *subflow_req,
|
||||
struct sk_buff *skb) {}
|
||||
static inline bool
|
||||
mptcp_token_join_cookie_init_state(struct mptcp_subflow_request_sock *subflow_req,
|
||||
struct sk_buff *skb)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
static inline void mptcp_join_cookie_init(void) {}
|
||||
#endif
|
||||
|
||||
#endif /* __MPTCP_PROTOCOL_H */
|
||||
|
Reference in New Issue
Block a user