* [PATCH net-next v3 0/2] Simplify the tcp_conn_request.
@ 2017-08-22 6:33 Tonghao Zhang
2017-08-22 6:33 ` [PATCH net-next v3 1/2] tcp: Get a proper dst before checking it Tonghao Zhang
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Tonghao Zhang @ 2017-08-22 6:33 UTC (permalink / raw)
To: netdev; +Cc: eric.dumazet, Tonghao Zhang
Just simplify the tcp_conn_request function.
Tonghao Zhang (2):
tcp: Get a proper dst before checking it.
tcp: Remove the unused parameter for tcp_try_fastopen.
include/net/tcp.h | 3 +--
net/ipv4/tcp_fastopen.c | 6 ++----
net/ipv4/tcp_input.c | 11 +++++------
3 files changed, 8 insertions(+), 12 deletions(-)
--
2.13.4
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH net-next v3 1/2] tcp: Get a proper dst before checking it.
2017-08-22 6:33 [PATCH net-next v3 0/2] Simplify the tcp_conn_request Tonghao Zhang
@ 2017-08-22 6:33 ` Tonghao Zhang
2017-08-22 18:14 ` Eric Dumazet
2017-08-22 6:33 ` [PATCH net-next v3 2/2] tcp: Remove the unused parameter for tcp_try_fastopen Tonghao Zhang
2017-08-22 21:16 ` [PATCH net-next v3 0/2] Simplify the tcp_conn_request David Miller
2 siblings, 1 reply; 6+ messages in thread
From: Tonghao Zhang @ 2017-08-22 6:33 UTC (permalink / raw)
To: netdev; +Cc: eric.dumazet, Tonghao Zhang
tcp_peer_is_proven needs a proper route to make the
determination, but dst always is NULL. This bug may
be there at the beginning of git tree. This does not
look serious enough to deserve backports to stable
versions.
Signed-off-by: Tonghao Zhang <xiangxia.m.yue@gmail.com>
---
net/ipv4/tcp_input.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index d73903fe8c83..9397e989e1d1 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -6112,6 +6112,10 @@ int tcp_conn_request(struct request_sock_ops *rsk_ops,
if (tmp_opt.tstamp_ok)
tcp_rsk(req)->ts_off = af_ops->init_ts_off(net, skb);
+ dst = af_ops->route_req(sk, &fl, req);
+ if (!dst)
+ goto drop_and_free;
+
if (!want_cookie && !isn) {
/* Kill the following clause, if you dislike this way. */
if (!net->ipv4.sysctl_tcp_syncookies &&
@@ -6132,11 +6136,6 @@ int tcp_conn_request(struct request_sock_ops *rsk_ops,
isn = af_ops->init_seq(skb);
}
- if (!dst) {
- dst = af_ops->route_req(sk, &fl, req);
- if (!dst)
- goto drop_and_free;
- }
tcp_ecn_create_request(req, skb, sk, dst);
--
2.13.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH net-next v3 2/2] tcp: Remove the unused parameter for tcp_try_fastopen.
2017-08-22 6:33 [PATCH net-next v3 0/2] Simplify the tcp_conn_request Tonghao Zhang
2017-08-22 6:33 ` [PATCH net-next v3 1/2] tcp: Get a proper dst before checking it Tonghao Zhang
@ 2017-08-22 6:33 ` Tonghao Zhang
2017-08-22 18:19 ` Eric Dumazet
2017-08-22 21:16 ` [PATCH net-next v3 0/2] Simplify the tcp_conn_request David Miller
2 siblings, 1 reply; 6+ messages in thread
From: Tonghao Zhang @ 2017-08-22 6:33 UTC (permalink / raw)
To: netdev; +Cc: eric.dumazet, Tonghao Zhang
Signed-off-by: Tonghao Zhang <xiangxia.m.yue@gmail.com>
---
include/net/tcp.h | 3 +--
net/ipv4/tcp_fastopen.c | 6 ++----
net/ipv4/tcp_input.c | 2 +-
3 files changed, 4 insertions(+), 7 deletions(-)
diff --git a/include/net/tcp.h b/include/net/tcp.h
index afdab3781425..a995004ae946 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -1533,8 +1533,7 @@ int tcp_fastopen_reset_cipher(void *key, unsigned int len);
void tcp_fastopen_add_skb(struct sock *sk, struct sk_buff *skb);
struct sock *tcp_try_fastopen(struct sock *sk, struct sk_buff *skb,
struct request_sock *req,
- struct tcp_fastopen_cookie *foc,
- struct dst_entry *dst);
+ struct tcp_fastopen_cookie *foc);
void tcp_fastopen_init_key_once(bool publish);
bool tcp_fastopen_cookie_check(struct sock *sk, u16 *mss,
struct tcp_fastopen_cookie *cookie);
diff --git a/net/ipv4/tcp_fastopen.c b/net/ipv4/tcp_fastopen.c
index ce9c7fef200f..e3c33220c418 100644
--- a/net/ipv4/tcp_fastopen.c
+++ b/net/ipv4/tcp_fastopen.c
@@ -171,7 +171,6 @@ void tcp_fastopen_add_skb(struct sock *sk, struct sk_buff *skb)
static struct sock *tcp_fastopen_create_child(struct sock *sk,
struct sk_buff *skb,
- struct dst_entry *dst,
struct request_sock *req)
{
struct tcp_sock *tp;
@@ -278,8 +277,7 @@ static bool tcp_fastopen_queue_check(struct sock *sk)
*/
struct sock *tcp_try_fastopen(struct sock *sk, struct sk_buff *skb,
struct request_sock *req,
- struct tcp_fastopen_cookie *foc,
- struct dst_entry *dst)
+ struct tcp_fastopen_cookie *foc)
{
struct tcp_fastopen_cookie valid_foc = { .len = -1 };
bool syn_data = TCP_SKB_CB(skb)->end_seq != TCP_SKB_CB(skb)->seq + 1;
@@ -312,7 +310,7 @@ struct sock *tcp_try_fastopen(struct sock *sk, struct sk_buff *skb,
* data in SYN_RECV state.
*/
fastopen:
- child = tcp_fastopen_create_child(sk, skb, dst, req);
+ child = tcp_fastopen_create_child(sk, skb, req);
if (child) {
foc->len = -1;
NET_INC_STATS(sock_net(sk),
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 9397e989e1d1..6bd1f0f56e8b 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -6151,7 +6151,7 @@ int tcp_conn_request(struct request_sock_ops *rsk_ops,
tcp_openreq_init_rwin(req, sk, dst);
if (!want_cookie) {
tcp_reqsk_record_syn(sk, req, skb);
- fastopen_sk = tcp_try_fastopen(sk, skb, req, &foc, dst);
+ fastopen_sk = tcp_try_fastopen(sk, skb, req, &foc);
}
if (fastopen_sk) {
af_ops->send_synack(fastopen_sk, dst, &fl, req,
--
2.13.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH net-next v3 1/2] tcp: Get a proper dst before checking it.
2017-08-22 6:33 ` [PATCH net-next v3 1/2] tcp: Get a proper dst before checking it Tonghao Zhang
@ 2017-08-22 18:14 ` Eric Dumazet
0 siblings, 0 replies; 6+ messages in thread
From: Eric Dumazet @ 2017-08-22 18:14 UTC (permalink / raw)
To: Tonghao Zhang; +Cc: netdev
On Mon, 2017-08-21 at 23:33 -0700, Tonghao Zhang wrote:
> tcp_peer_is_proven needs a proper route to make the
> determination, but dst always is NULL. This bug may
> be there at the beginning of git tree. This does not
> look serious enough to deserve backports to stable
> versions.
>
> Signed-off-by: Tonghao Zhang <xiangxia.m.yue@gmail.com>
> ---
Acked-by: Eric Dumazet <edumazet@google.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH net-next v3 2/2] tcp: Remove the unused parameter for tcp_try_fastopen.
2017-08-22 6:33 ` [PATCH net-next v3 2/2] tcp: Remove the unused parameter for tcp_try_fastopen Tonghao Zhang
@ 2017-08-22 18:19 ` Eric Dumazet
0 siblings, 0 replies; 6+ messages in thread
From: Eric Dumazet @ 2017-08-22 18:19 UTC (permalink / raw)
To: Tonghao Zhang; +Cc: netdev
On Mon, 2017-08-21 at 23:33 -0700, Tonghao Zhang wrote:
> Signed-off-by: Tonghao Zhang <xiangxia.m.yue@gmail.com>
> ---
> include/net/tcp.h | 3 +--
> net/ipv4/tcp_fastopen.c | 6 ++----
> net/ipv4/tcp_input.c | 2 +-
> 3 files changed, 4 insertions(+), 7 deletions(-)
Acked-by: Eric Dumazet <edumazet@google.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH net-next v3 0/2] Simplify the tcp_conn_request.
2017-08-22 6:33 [PATCH net-next v3 0/2] Simplify the tcp_conn_request Tonghao Zhang
2017-08-22 6:33 ` [PATCH net-next v3 1/2] tcp: Get a proper dst before checking it Tonghao Zhang
2017-08-22 6:33 ` [PATCH net-next v3 2/2] tcp: Remove the unused parameter for tcp_try_fastopen Tonghao Zhang
@ 2017-08-22 21:16 ` David Miller
2 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2017-08-22 21:16 UTC (permalink / raw)
To: xiangxia.m.yue; +Cc: netdev, eric.dumazet
From: Tonghao Zhang <xiangxia.m.yue@gmail.com>
Date: Mon, 21 Aug 2017 23:33:47 -0700
> Just simplify the tcp_conn_request function.
Series applied, thanks.
The explicit 'dst = NULL' in the variable declaration is probably
superfluous now.
And in fact it was hiding the bug that we didn't have a proper
'dst' early enough.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2017-08-22 21:17 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-22 6:33 [PATCH net-next v3 0/2] Simplify the tcp_conn_request Tonghao Zhang
2017-08-22 6:33 ` [PATCH net-next v3 1/2] tcp: Get a proper dst before checking it Tonghao Zhang
2017-08-22 18:14 ` Eric Dumazet
2017-08-22 6:33 ` [PATCH net-next v3 2/2] tcp: Remove the unused parameter for tcp_try_fastopen Tonghao Zhang
2017-08-22 18:19 ` Eric Dumazet
2017-08-22 21:16 ` [PATCH net-next v3 0/2] Simplify the tcp_conn_request David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).