All of lore.kernel.org
 help / color / mirror / Atom feed
* [MPTCP] [RFC PATCH 6/6] mptcp: cleanup option parsing
@ 2020-04-28 14:20 Paolo Abeni
  0 siblings, 0 replies; only message in thread
From: Paolo Abeni @ 2020-04-28 14:20 UTC (permalink / raw)
  To: mptcp

[-- Attachment #1: Type: text/plain, Size: 1545 bytes --]

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(a)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 --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)) {
-- 
2.21.1

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2020-04-28 14:20 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-28 14:20 [MPTCP] [RFC PATCH 6/6] mptcp: cleanup option parsing Paolo Abeni

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.