aboutsummaryrefslogtreecommitdiffstats
path: root/net/dccp/ipv4.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2011-05-08 18:28:03 -0400
committerDavid S. Miller <davem@davemloft.net>2011-05-08 18:28:03 -0400
commit0e734419923bd8e599858f8fc196c7804bb85564 (patch)
tree5e8dfaeb84c610a1c4086ed88c26b73e4ba87197 /net/dccp/ipv4.c
parent77357a95522ba645bbfd65253b34317c824103f9 (diff)
ipv4: Use inet_csk_route_child_sock() in DCCP and TCP.
Operation order is now transposed, we first create the child socket then we try to hook up the route. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/dccp/ipv4.c')
-rw-r--r--net/dccp/ipv4.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/net/dccp/ipv4.c b/net/dccp/ipv4.c
index 4ac1a728083a..46b15e9e9b57 100644
--- a/net/dccp/ipv4.c
+++ b/net/dccp/ipv4.c
@@ -396,15 +396,10 @@ struct sock *dccp_v4_request_recv_sock(struct sock *sk, struct sk_buff *skb,
396 if (sk_acceptq_is_full(sk)) 396 if (sk_acceptq_is_full(sk))
397 goto exit_overflow; 397 goto exit_overflow;
398 398
399 if (dst == NULL && (dst = inet_csk_route_req(sk, req)) == NULL)
400 goto exit;
401
402 newsk = dccp_create_openreq_child(sk, req, skb); 399 newsk = dccp_create_openreq_child(sk, req, skb);
403 if (newsk == NULL) 400 if (newsk == NULL)
404 goto exit_nonewsk; 401 goto exit_nonewsk;
405 402
406 sk_setup_caps(newsk, dst);
407
408 newinet = inet_sk(newsk); 403 newinet = inet_sk(newsk);
409 ireq = inet_rsk(req); 404 ireq = inet_rsk(req);
410 newinet->inet_daddr = ireq->rmt_addr; 405 newinet->inet_daddr = ireq->rmt_addr;
@@ -416,12 +411,15 @@ struct sock *dccp_v4_request_recv_sock(struct sock *sk, struct sk_buff *skb,
416 newinet->mc_ttl = ip_hdr(skb)->ttl; 411 newinet->mc_ttl = ip_hdr(skb)->ttl;
417 newinet->inet_id = jiffies; 412 newinet->inet_id = jiffies;
418 413
414 if (dst == NULL && (dst = inet_csk_route_child_sock(sk, newsk, req)) == NULL)
415 goto put_and_exit;
416
417 sk_setup_caps(newsk, dst);
418
419 dccp_sync_mss(newsk, dst_mtu(dst)); 419 dccp_sync_mss(newsk, dst_mtu(dst));
420 420
421 if (__inet_inherit_port(sk, newsk) < 0) { 421 if (__inet_inherit_port(sk, newsk) < 0)
422 sock_put(newsk); 422 goto put_and_exit;
423 goto exit;
424 }
425 __inet_hash_nolisten(newsk, NULL); 423 __inet_hash_nolisten(newsk, NULL);
426 424
427 return newsk; 425 return newsk;
@@ -433,6 +431,9 @@ exit_nonewsk:
433exit: 431exit:
434 NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_LISTENDROPS); 432 NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_LISTENDROPS);
435 return NULL; 433 return NULL;
434put_and_exit:
435 sock_put(newsk);
436 goto exit;
436} 437}
437 438
438EXPORT_SYMBOL_GPL(dccp_v4_request_recv_sock); 439EXPORT_SYMBOL_GPL(dccp_v4_request_recv_sock);