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/dccp | |
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/dccp')
-rw-r--r-- | net/dccp/dccp.h | 3 | ||||
-rw-r--r-- | net/dccp/ipv4.c | 14 | ||||
-rw-r--r-- | net/dccp/ipv6.c | 19 | ||||
-rw-r--r-- | net/dccp/minisocks.c | 7 |
4 files changed, 18 insertions, 25 deletions
diff --git a/net/dccp/dccp.h b/net/dccp/dccp.h index 3b1d64d6e093..2396f50c5b04 100644 --- a/net/dccp/dccp.h +++ b/net/dccp/dccp.h | |||
@@ -280,8 +280,7 @@ struct sock *dccp_v4_request_recv_sock(struct sock *sk, struct sk_buff *skb, | |||
280 | struct request_sock *req, | 280 | struct request_sock *req, |
281 | struct dst_entry *dst); | 281 | struct dst_entry *dst); |
282 | struct sock *dccp_check_req(struct sock *sk, struct sk_buff *skb, | 282 | struct sock *dccp_check_req(struct sock *sk, struct sk_buff *skb, |
283 | struct request_sock *req, | 283 | struct request_sock *req); |
284 | struct request_sock **prev); | ||
285 | 284 | ||
286 | int dccp_child_process(struct sock *parent, struct sock *child, | 285 | int dccp_child_process(struct sock *parent, struct sock *child, |
287 | struct sk_buff *skb); | 286 | struct sk_buff *skb); |
diff --git a/net/dccp/ipv4.c b/net/dccp/ipv4.c index e7ad291cd96b..5bffbbaf1fac 100644 --- a/net/dccp/ipv4.c +++ b/net/dccp/ipv4.c | |||
@@ -288,11 +288,11 @@ static void dccp_v4_err(struct sk_buff *skb, u32 info) | |||
288 | } | 288 | } |
289 | 289 | ||
290 | switch (sk->sk_state) { | 290 | switch (sk->sk_state) { |
291 | struct request_sock *req , **prev; | 291 | struct request_sock *req; |
292 | case DCCP_LISTEN: | 292 | case DCCP_LISTEN: |
293 | if (sock_owned_by_user(sk)) | 293 | if (sock_owned_by_user(sk)) |
294 | goto out; | 294 | goto out; |
295 | req = inet_csk_search_req(sk, &prev, dh->dccph_dport, | 295 | req = inet_csk_search_req(sk, dh->dccph_dport, |
296 | iph->daddr, iph->saddr); | 296 | iph->daddr, iph->saddr); |
297 | if (!req) | 297 | if (!req) |
298 | goto out; | 298 | goto out; |
@@ -314,7 +314,7 @@ static void dccp_v4_err(struct sk_buff *skb, u32 info) | |||
314 | * created socket, and POSIX does not want network | 314 | * created socket, and POSIX does not want network |
315 | * errors returned from accept(). | 315 | * errors returned from accept(). |
316 | */ | 316 | */ |
317 | inet_csk_reqsk_queue_drop(sk, req, prev); | 317 | inet_csk_reqsk_queue_drop(sk, req); |
318 | goto out; | 318 | goto out; |
319 | 319 | ||
320 | case DCCP_REQUESTING: | 320 | case DCCP_REQUESTING: |
@@ -448,13 +448,11 @@ static struct sock *dccp_v4_hnd_req(struct sock *sk, struct sk_buff *skb) | |||
448 | const struct dccp_hdr *dh = dccp_hdr(skb); | 448 | const struct dccp_hdr *dh = dccp_hdr(skb); |
449 | const struct iphdr *iph = ip_hdr(skb); | 449 | const struct iphdr *iph = ip_hdr(skb); |
450 | struct sock *nsk; | 450 | struct sock *nsk; |
451 | struct request_sock **prev; | ||
452 | /* Find possible connection requests. */ | 451 | /* Find possible connection requests. */ |
453 | struct request_sock *req = inet_csk_search_req(sk, &prev, | 452 | struct request_sock *req = inet_csk_search_req(sk, dh->dccph_sport, |
454 | dh->dccph_sport, | ||
455 | iph->saddr, iph->daddr); | 453 | iph->saddr, iph->daddr); |
456 | if (req != NULL) | 454 | if (req) |
457 | return dccp_check_req(sk, skb, req, prev); | 455 | return dccp_check_req(sk, skb, req); |
458 | 456 | ||
459 | nsk = inet_lookup_established(sock_net(sk), &dccp_hashinfo, | 457 | nsk = inet_lookup_established(sock_net(sk), &dccp_hashinfo, |
460 | iph->saddr, dh->dccph_sport, | 458 | iph->saddr, dh->dccph_sport, |
diff --git a/net/dccp/ipv6.c b/net/dccp/ipv6.c index c655de5f67c9..ae2184039fe3 100644 --- a/net/dccp/ipv6.c +++ b/net/dccp/ipv6.c | |||
@@ -149,12 +149,12 @@ static void dccp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, | |||
149 | 149 | ||
150 | /* Might be for an request_sock */ | 150 | /* Might be for an request_sock */ |
151 | switch (sk->sk_state) { | 151 | switch (sk->sk_state) { |
152 | struct request_sock *req, **prev; | 152 | struct request_sock *req; |
153 | case DCCP_LISTEN: | 153 | case DCCP_LISTEN: |
154 | if (sock_owned_by_user(sk)) | 154 | if (sock_owned_by_user(sk)) |
155 | goto out; | 155 | goto out; |
156 | 156 | ||
157 | req = inet6_csk_search_req(sk, &prev, dh->dccph_dport, | 157 | req = inet6_csk_search_req(sk, dh->dccph_dport, |
158 | &hdr->daddr, &hdr->saddr, | 158 | &hdr->daddr, &hdr->saddr, |
159 | inet6_iif(skb)); | 159 | inet6_iif(skb)); |
160 | if (req == NULL) | 160 | if (req == NULL) |
@@ -172,7 +172,7 @@ static void dccp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, | |||
172 | goto out; | 172 | goto out; |
173 | } | 173 | } |
174 | 174 | ||
175 | inet_csk_reqsk_queue_drop(sk, req, prev); | 175 | inet_csk_reqsk_queue_drop(sk, req); |
176 | goto out; | 176 | goto out; |
177 | 177 | ||
178 | case DCCP_REQUESTING: | 178 | case DCCP_REQUESTING: |
@@ -317,16 +317,13 @@ static struct sock *dccp_v6_hnd_req(struct sock *sk,struct sk_buff *skb) | |||
317 | { | 317 | { |
318 | const struct dccp_hdr *dh = dccp_hdr(skb); | 318 | const struct dccp_hdr *dh = dccp_hdr(skb); |
319 | const struct ipv6hdr *iph = ipv6_hdr(skb); | 319 | const struct ipv6hdr *iph = ipv6_hdr(skb); |
320 | struct request_sock *req; | ||
320 | struct sock *nsk; | 321 | struct sock *nsk; |
321 | struct request_sock **prev; | 322 | |
322 | /* Find possible connection requests. */ | 323 | req = inet6_csk_search_req(sk, dh->dccph_sport, &iph->saddr, |
323 | struct request_sock *req = inet6_csk_search_req(sk, &prev, | 324 | &iph->daddr, inet6_iif(skb)); |
324 | dh->dccph_sport, | ||
325 | &iph->saddr, | ||
326 | &iph->daddr, | ||
327 | inet6_iif(skb)); | ||
328 | if (req != NULL) | 325 | if (req != NULL) |
329 | return dccp_check_req(sk, skb, req, prev); | 326 | return dccp_check_req(sk, skb, req); |
330 | 327 | ||
331 | nsk = __inet6_lookup_established(sock_net(sk), &dccp_hashinfo, | 328 | nsk = __inet6_lookup_established(sock_net(sk), &dccp_hashinfo, |
332 | &iph->saddr, dh->dccph_sport, | 329 | &iph->saddr, dh->dccph_sport, |
diff --git a/net/dccp/minisocks.c b/net/dccp/minisocks.c index b50dc436db1f..332f7d6d9942 100644 --- a/net/dccp/minisocks.c +++ b/net/dccp/minisocks.c | |||
@@ -152,8 +152,7 @@ EXPORT_SYMBOL_GPL(dccp_create_openreq_child); | |||
152 | * as an request_sock. | 152 | * as an request_sock. |
153 | */ | 153 | */ |
154 | struct sock *dccp_check_req(struct sock *sk, struct sk_buff *skb, | 154 | struct sock *dccp_check_req(struct sock *sk, struct sk_buff *skb, |
155 | struct request_sock *req, | 155 | struct request_sock *req) |
156 | struct request_sock **prev) | ||
157 | { | 156 | { |
158 | struct sock *child = NULL; | 157 | struct sock *child = NULL; |
159 | struct dccp_request_sock *dreq = dccp_rsk(req); | 158 | struct dccp_request_sock *dreq = dccp_rsk(req); |
@@ -200,7 +199,7 @@ struct sock *dccp_check_req(struct sock *sk, struct sk_buff *skb, | |||
200 | if (child == NULL) | 199 | if (child == NULL) |
201 | goto listen_overflow; | 200 | goto listen_overflow; |
202 | 201 | ||
203 | inet_csk_reqsk_queue_unlink(sk, req, prev); | 202 | inet_csk_reqsk_queue_unlink(sk, req); |
204 | inet_csk_reqsk_queue_removed(sk, req); | 203 | inet_csk_reqsk_queue_removed(sk, req); |
205 | inet_csk_reqsk_queue_add(sk, req, child); | 204 | inet_csk_reqsk_queue_add(sk, req, child); |
206 | out: | 205 | out: |
@@ -212,7 +211,7 @@ drop: | |||
212 | if (dccp_hdr(skb)->dccph_type != DCCP_PKT_RESET) | 211 | if (dccp_hdr(skb)->dccph_type != DCCP_PKT_RESET) |
213 | req->rsk_ops->send_reset(sk, skb); | 212 | req->rsk_ops->send_reset(sk, skb); |
214 | 213 | ||
215 | inet_csk_reqsk_queue_drop(sk, req, prev); | 214 | inet_csk_reqsk_queue_drop(sk, req); |
216 | goto out; | 215 | goto out; |
217 | } | 216 | } |
218 | 217 | ||