diff options
author | Eric Dumazet <edumazet@google.com> | 2015-03-19 22:04:19 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-03-20 12:40:25 -0400 |
commit | 52452c542559ac980b48dbf22a30ee7fa0af507c (patch) | |
tree | a212dbe95694ea11e86b9d9aca8a2eba0b06a2d1 /net/ipv6 | |
parent | a998f712f77ea4892d3fcf24e0a67603e63da128 (diff) |
inet: drop prev pointer handling in request sock
When request sock are put in ehash table, the whole notion
of having a previous request to update dl_next is pointless.
Also, following patch will get rid of big purge timer,
so we want to delete a request sock without holding listener lock.
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6')
-rw-r--r-- | net/ipv6/inet6_connection_sock.c | 10 | ||||
-rw-r--r-- | net/ipv6/tcp_ipv6.c | 12 |
2 files changed, 10 insertions, 12 deletions
diff --git a/net/ipv6/inet6_connection_sock.c b/net/ipv6/inet6_connection_sock.c index 29b32206e494..b7acb9ebc4f5 100644 --- a/net/ipv6/inet6_connection_sock.c +++ b/net/ipv6/inet6_connection_sock.c | |||
@@ -113,7 +113,6 @@ static u32 inet6_synq_hash(const struct in6_addr *raddr, const __be16 rport, | |||
113 | } | 113 | } |
114 | 114 | ||
115 | struct request_sock *inet6_csk_search_req(const struct sock *sk, | 115 | struct request_sock *inet6_csk_search_req(const struct sock *sk, |
116 | struct request_sock ***prevp, | ||
117 | const __be16 rport, | 116 | const __be16 rport, |
118 | const struct in6_addr *raddr, | 117 | const struct in6_addr *raddr, |
119 | const struct in6_addr *laddr, | 118 | const struct in6_addr *laddr, |
@@ -121,13 +120,13 @@ struct request_sock *inet6_csk_search_req(const struct sock *sk, | |||
121 | { | 120 | { |
122 | const struct inet_connection_sock *icsk = inet_csk(sk); | 121 | const struct inet_connection_sock *icsk = inet_csk(sk); |
123 | struct listen_sock *lopt = icsk->icsk_accept_queue.listen_opt; | 122 | struct listen_sock *lopt = icsk->icsk_accept_queue.listen_opt; |
124 | struct request_sock *req, **prev; | 123 | struct request_sock *req; |
125 | 124 | ||
126 | for (prev = &lopt->syn_table[inet6_synq_hash(raddr, rport, | 125 | for (req = lopt->syn_table[inet6_synq_hash(raddr, rport, |
127 | lopt->hash_rnd, | 126 | lopt->hash_rnd, |
128 | lopt->nr_table_entries)]; | 127 | lopt->nr_table_entries)]; |
129 | (req = *prev) != NULL; | 128 | req != NULL; |
130 | prev = &req->dl_next) { | 129 | req = req->dl_next) { |
131 | const struct inet_request_sock *ireq = inet_rsk(req); | 130 | const struct inet_request_sock *ireq = inet_rsk(req); |
132 | 131 | ||
133 | if (ireq->ir_rmt_port == rport && | 132 | if (ireq->ir_rmt_port == rport && |
@@ -136,7 +135,6 @@ struct request_sock *inet6_csk_search_req(const struct sock *sk, | |||
136 | ipv6_addr_equal(&ireq->ir_v6_loc_addr, laddr) && | 135 | ipv6_addr_equal(&ireq->ir_v6_loc_addr, laddr) && |
137 | (!ireq->ir_iif || ireq->ir_iif == iif)) { | 136 | (!ireq->ir_iif || ireq->ir_iif == iif)) { |
138 | WARN_ON(req->sk != NULL); | 137 | WARN_ON(req->sk != NULL); |
139 | *prevp = prev; | ||
140 | return req; | 138 | return req; |
141 | } | 139 | } |
142 | } | 140 | } |
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c index 720676d073d9..146f123b52c9 100644 --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c | |||
@@ -403,13 +403,13 @@ static void tcp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, | |||
403 | 403 | ||
404 | /* Might be for an request_sock */ | 404 | /* Might be for an request_sock */ |
405 | switch (sk->sk_state) { | 405 | switch (sk->sk_state) { |
406 | struct request_sock *req, **prev; | 406 | struct request_sock *req; |
407 | case TCP_LISTEN: | 407 | case TCP_LISTEN: |
408 | if (sock_owned_by_user(sk)) | 408 | if (sock_owned_by_user(sk)) |
409 | goto out; | 409 | goto out; |
410 | 410 | ||
411 | /* Note : We use inet6_iif() here, not tcp_v6_iif() */ | 411 | /* Note : We use inet6_iif() here, not tcp_v6_iif() */ |
412 | req = inet6_csk_search_req(sk, &prev, th->dest, &hdr->daddr, | 412 | req = inet6_csk_search_req(sk, th->dest, &hdr->daddr, |
413 | &hdr->saddr, inet6_iif(skb)); | 413 | &hdr->saddr, inet6_iif(skb)); |
414 | if (!req) | 414 | if (!req) |
415 | goto out; | 415 | goto out; |
@@ -424,7 +424,7 @@ static void tcp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, | |||
424 | goto out; | 424 | goto out; |
425 | } | 425 | } |
426 | 426 | ||
427 | inet_csk_reqsk_queue_drop(sk, req, prev); | 427 | inet_csk_reqsk_queue_drop(sk, req); |
428 | NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_LISTENDROPS); | 428 | NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_LISTENDROPS); |
429 | goto out; | 429 | goto out; |
430 | 430 | ||
@@ -980,16 +980,16 @@ static void tcp_v6_reqsk_send_ack(struct sock *sk, struct sk_buff *skb, | |||
980 | 980 | ||
981 | static struct sock *tcp_v6_hnd_req(struct sock *sk, struct sk_buff *skb) | 981 | static struct sock *tcp_v6_hnd_req(struct sock *sk, struct sk_buff *skb) |
982 | { | 982 | { |
983 | struct request_sock *req, **prev; | ||
984 | const struct tcphdr *th = tcp_hdr(skb); | 983 | const struct tcphdr *th = tcp_hdr(skb); |
984 | struct request_sock *req; | ||
985 | struct sock *nsk; | 985 | struct sock *nsk; |
986 | 986 | ||
987 | /* Find possible connection requests. */ | 987 | /* Find possible connection requests. */ |
988 | req = inet6_csk_search_req(sk, &prev, th->source, | 988 | req = inet6_csk_search_req(sk, th->source, |
989 | &ipv6_hdr(skb)->saddr, | 989 | &ipv6_hdr(skb)->saddr, |
990 | &ipv6_hdr(skb)->daddr, tcp_v6_iif(skb)); | 990 | &ipv6_hdr(skb)->daddr, tcp_v6_iif(skb)); |
991 | if (req) | 991 | if (req) |
992 | return tcp_check_req(sk, skb, req, prev, false); | 992 | return tcp_check_req(sk, skb, req, false); |
993 | 993 | ||
994 | nsk = __inet6_lookup_established(sock_net(sk), &tcp_hashinfo, | 994 | nsk = __inet6_lookup_established(sock_net(sk), &tcp_hashinfo, |
995 | &ipv6_hdr(skb)->saddr, th->source, | 995 | &ipv6_hdr(skb)->saddr, th->source, |