diff mbox series

[RFC,6/6] mptcp: cleanup option parsing

Message ID c47fb0968f49f3493d9ea08b8b7689f149436d53.1588082498.git.pabeni@redhat.com
State Superseded, archived
Delegated to: Mat Martineau
Headers show
Series mptcp: refactor incoming options parsing | expand

Commit Message

Paolo Abeni April 28, 2020, 2:20 p.m. UTC
The mptcp option status is always initialized by
mptcp_get_options(), we can clean-up a couple of
call sites open codying such task.

Signed-off-by: Paolo Abeni <pabeni@redhat.com>
---
this could be squashed into
"mptcp: move option parsing into mptcp_incoming_options()",
kept here to since the latter is already pretty big, but
no strong opinion against squashing
---
 net/mptcp/subflow.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/net/mptcp/subflow.c b/net/mptcp/subflow.c
index c43fe9958287..f412e886aa9b 100644
--- a/net/mptcp/subflow.c
+++ b/net/mptcp/subflow.c
@@ -128,7 +128,6 @@  static void subflow_init_req(struct request_sock *req,
 
 	pr_debug("subflow_req=%p, listener=%p", subflow_req, listener);
 
-	memset(&mp_opt, 0, sizeof(mp_opt));
 	mptcp_get_options(skb, &mp_opt);
 
 	subflow_req->mp_capable = 0;
@@ -425,6 +424,9 @@  static struct sock *subflow_syn_recv_sock(const struct sock *sk,
 
 	pr_debug("listener=%p, req=%p, conn=%p", listener, req, listener->conn);
 
+	/* we need later a valid 'mp_capable' value even when options are not
+	 * parsed
+	 */
 	mp_opt.mp_capable = 0;
 	if (tcp_rsk(req)->is_mptcp == 0)
 		goto create_child;
@@ -452,7 +454,6 @@  static struct sock *subflow_syn_recv_sock(const struct sock *sk,
 			fallback = true;
 	} else if (subflow_req->mp_join) {
 		fallback_is_fatal = true;
-		mp_opt.mp_join = 0;
 		mptcp_get_options(skb, &mp_opt);
 		if (!mp_opt.mp_join ||
 		    !subflow_hmac_valid(req, &mp_opt)) {