* [MPTCP] [PATCH v3 09/10] Use pm_get_local_id() to get the real local address id.
@ 2019-08-07 22:44 Peter Krystad
0 siblings, 0 replies; 2+ messages in thread
From: Peter Krystad @ 2019-08-07 22:44 UTC (permalink / raw)
To: mptcp
[-- Attachment #1: Type: text/plain, Size: 1869 bytes --]
Also, take reference to mptcp sock while using it
squashto: Add handling of incoming MP_JOIN requests
Signed-off-by: Peter Krystad <peter.krystad(a)linux.intel.com>
---
net/mptcp/token.c | 31 ++++++++++++++++++++++---------
1 file changed, 22 insertions(+), 9 deletions(-)
diff --git a/net/mptcp/token.c b/net/mptcp/token.c
index d7cf40b40beb..80acb6c6657f 100644
--- a/net/mptcp/token.c
+++ b/net/mptcp/token.c
@@ -222,14 +222,22 @@ int token_join_request(struct request_sock *req, const struct sk_buff *skb)
pr_debug("subflow_req=%p, token=%u", subflow_req, subflow_req->token);
spin_lock_bh(&token_tree_lock);
conn = lookup_token(subflow_req->token);
+ if (conn)
+ sock_hold(conn);
spin_unlock_bh(&token_tree_lock);
- if (conn) {
- // @@ get real local address id for this skb->saddr
- subflow_req->local_id = 0;
- new_req_join(req, conn, skb);
- return 0;
+
+ if (!conn)
+ return -1;
+
+ if (pm_get_local_id(req, conn, skb)) {
+ sock_put(conn);
+ return -1;
}
- return -1;
+
+ new_req_join(req, conn, skb);
+
+ sock_put(conn);
+ return 0;
}
/* validate received truncated hmac and create hmac for third ACK */
@@ -247,15 +255,20 @@ int token_join_valid(struct request_sock *req,
{
struct subflow_request_sock *subflow_req = subflow_rsk(req);
struct sock *conn;
+ int err;
pr_debug("subflow_req=%p, token=%u", subflow_req, subflow_req->token);
spin_lock_bh(&token_tree_lock);
conn = lookup_token(subflow_req->token);
- spin_unlock_bh(&token_tree_lock);
if (conn)
- return new_join_valid(req, conn, rx_opt);
+ sock_hold(conn);
+ spin_unlock_bh(&token_tree_lock);
+ if (!conn)
+ return -1;
- return -1;
+ err = new_join_valid(req, conn, rx_opt);
+ sock_put(conn);
+ return err;
}
/* create new local key, idsn, and token for subflow */
--
2.17.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [MPTCP] [PATCH v3 09/10] Use pm_get_local_id() to get the real local address id.
@ 2019-08-12 19:36 Matthieu Baerts
0 siblings, 0 replies; 2+ messages in thread
From: Matthieu Baerts @ 2019-08-12 19:36 UTC (permalink / raw)
To: mptcp
[-- Attachment #1: Type: text/plain, Size: 544 bytes --]
Hi Peter, Paolo, Mat,
On 08/08/2019 00:44, Peter Krystad wrote:
> Also, take reference to mptcp sock while using it
>
> squashto: Add handling of incoming MP_JOIN requests
Thank you for the patch and the reviews!
- 05f13c173cb5: "squashed" in "mptcp: Add handling of incoming MP_JOIN
requests"
- 6c6c0f074bf5..417bdddfeedd: result
Cheers,
Matt
--
Matthieu Baerts | R&D Engineer
matthieu.baerts(a)tessares.net
Tessares SA | Hybrid Access Solutions
www.tessares.net
1 Avenue Jean Monnet, 1348 Louvain-la-Neuve, Belgium
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-08-12 19:36 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-08-07 22:44 [MPTCP] [PATCH v3 09/10] Use pm_get_local_id() to get the real local address id Peter Krystad
-- strict thread matches above, loose matches on Subject: below --
2019-08-12 19:36 Matthieu Baerts
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.