aboutsummaryrefslogtreecommitdiffstats
path: root/net/dccp/ipv4.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/dccp/ipv4.c')
-rw-r--r--net/dccp/ipv4.c46
1 files changed, 25 insertions, 21 deletions
diff --git a/net/dccp/ipv4.c b/net/dccp/ipv4.c
index 7302e1498d46..efbcfdc12796 100644
--- a/net/dccp/ipv4.c
+++ b/net/dccp/ipv4.c
@@ -62,10 +62,10 @@ int dccp_v4_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len)
62 nexthop = inet->opt->faddr; 62 nexthop = inet->opt->faddr;
63 } 63 }
64 64
65 tmp = ip_route_connect(&rt, nexthop, inet->saddr, 65 tmp = ip_route_connect(&rt, nexthop, inet->inet_saddr,
66 RT_CONN_FLAGS(sk), sk->sk_bound_dev_if, 66 RT_CONN_FLAGS(sk), sk->sk_bound_dev_if,
67 IPPROTO_DCCP, 67 IPPROTO_DCCP,
68 inet->sport, usin->sin_port, sk, 1); 68 inet->inet_sport, usin->sin_port, sk, 1);
69 if (tmp < 0) 69 if (tmp < 0)
70 return tmp; 70 return tmp;
71 71
@@ -77,12 +77,12 @@ int dccp_v4_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len)
77 if (inet->opt == NULL || !inet->opt->srr) 77 if (inet->opt == NULL || !inet->opt->srr)
78 daddr = rt->rt_dst; 78 daddr = rt->rt_dst;
79 79
80 if (inet->saddr == 0) 80 if (inet->inet_saddr == 0)
81 inet->saddr = rt->rt_src; 81 inet->inet_saddr = rt->rt_src;
82 inet->rcv_saddr = inet->saddr; 82 inet->inet_rcv_saddr = inet->inet_saddr;
83 83
84 inet->dport = usin->sin_port; 84 inet->inet_dport = usin->sin_port;
85 inet->daddr = daddr; 85 inet->inet_daddr = daddr;
86 86
87 inet_csk(sk)->icsk_ext_hdr_len = 0; 87 inet_csk(sk)->icsk_ext_hdr_len = 0;
88 if (inet->opt != NULL) 88 if (inet->opt != NULL)
@@ -98,17 +98,19 @@ int dccp_v4_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len)
98 if (err != 0) 98 if (err != 0)
99 goto failure; 99 goto failure;
100 100
101 err = ip_route_newports(&rt, IPPROTO_DCCP, inet->sport, inet->dport, 101 err = ip_route_newports(&rt, IPPROTO_DCCP, inet->inet_sport,
102 sk); 102 inet->inet_dport, sk);
103 if (err != 0) 103 if (err != 0)
104 goto failure; 104 goto failure;
105 105
106 /* OK, now commit destination to socket. */ 106 /* OK, now commit destination to socket. */
107 sk_setup_caps(sk, &rt->u.dst); 107 sk_setup_caps(sk, &rt->u.dst);
108 108
109 dp->dccps_iss = secure_dccp_sequence_number(inet->saddr, inet->daddr, 109 dp->dccps_iss = secure_dccp_sequence_number(inet->inet_saddr,
110 inet->sport, inet->dport); 110 inet->inet_daddr,
111 inet->id = dp->dccps_iss ^ jiffies; 111 inet->inet_sport,
112 inet->inet_dport);
113 inet->inet_id = dp->dccps_iss ^ jiffies;
112 114
113 err = dccp_connect(sk); 115 err = dccp_connect(sk);
114 rt = NULL; 116 rt = NULL;
@@ -123,7 +125,7 @@ failure:
123 dccp_set_state(sk, DCCP_CLOSED); 125 dccp_set_state(sk, DCCP_CLOSED);
124 ip_rt_put(rt); 126 ip_rt_put(rt);
125 sk->sk_route_caps = 0; 127 sk->sk_route_caps = 0;
126 inet->dport = 0; 128 inet->inet_dport = 0;
127 goto out; 129 goto out;
128} 130}
129 131
@@ -352,7 +354,9 @@ void dccp_v4_send_check(struct sock *sk, int unused, struct sk_buff *skb)
352 struct dccp_hdr *dh = dccp_hdr(skb); 354 struct dccp_hdr *dh = dccp_hdr(skb);
353 355
354 dccp_csum_outgoing(skb); 356 dccp_csum_outgoing(skb);
355 dh->dccph_checksum = dccp_v4_csum_finish(skb, inet->saddr, inet->daddr); 357 dh->dccph_checksum = dccp_v4_csum_finish(skb,
358 inet->inet_saddr,
359 inet->inet_daddr);
356} 360}
357 361
358EXPORT_SYMBOL_GPL(dccp_v4_send_check); 362EXPORT_SYMBOL_GPL(dccp_v4_send_check);
@@ -393,14 +397,14 @@ struct sock *dccp_v4_request_recv_sock(struct sock *sk, struct sk_buff *skb,
393 397
394 newinet = inet_sk(newsk); 398 newinet = inet_sk(newsk);
395 ireq = inet_rsk(req); 399 ireq = inet_rsk(req);
396 newinet->daddr = ireq->rmt_addr; 400 newinet->inet_daddr = ireq->rmt_addr;
397 newinet->rcv_saddr = ireq->loc_addr; 401 newinet->inet_rcv_saddr = ireq->loc_addr;
398 newinet->saddr = ireq->loc_addr; 402 newinet->inet_saddr = ireq->loc_addr;
399 newinet->opt = ireq->opt; 403 newinet->opt = ireq->opt;
400 ireq->opt = NULL; 404 ireq->opt = NULL;
401 newinet->mc_index = inet_iif(skb); 405 newinet->mc_index = inet_iif(skb);
402 newinet->mc_ttl = ip_hdr(skb)->ttl; 406 newinet->mc_ttl = ip_hdr(skb)->ttl;
403 newinet->id = jiffies; 407 newinet->inet_id = jiffies;
404 408
405 dccp_sync_mss(newsk, dst_mtu(dst)); 409 dccp_sync_mss(newsk, dst_mtu(dst));
406 410
@@ -473,7 +477,8 @@ static struct dst_entry* dccp_v4_route_skb(struct net *net, struct sock *sk,
473 return &rt->u.dst; 477 return &rt->u.dst;
474} 478}
475 479
476static int dccp_v4_send_response(struct sock *sk, struct request_sock *req) 480static int dccp_v4_send_response(struct sock *sk, struct request_sock *req,
481 struct request_values *rv_unused)
477{ 482{
478 int err = -1; 483 int err = -1;
479 struct sk_buff *skb; 484 struct sk_buff *skb;
@@ -622,7 +627,7 @@ int dccp_v4_conn_request(struct sock *sk, struct sk_buff *skb)
622 dreq->dreq_iss = dccp_v4_init_sequence(skb); 627 dreq->dreq_iss = dccp_v4_init_sequence(skb);
623 dreq->dreq_service = service; 628 dreq->dreq_service = service;
624 629
625 if (dccp_v4_send_response(sk, req)) 630 if (dccp_v4_send_response(sk, req, NULL))
626 goto drop_and_free; 631 goto drop_and_free;
627 632
628 inet_csk_reqsk_queue_hash_add(sk, req, DCCP_TIMEOUT_INIT); 633 inet_csk_reqsk_queue_hash_add(sk, req, DCCP_TIMEOUT_INIT);
@@ -987,7 +992,6 @@ static struct inet_protosw dccp_v4_protosw = {
987 .protocol = IPPROTO_DCCP, 992 .protocol = IPPROTO_DCCP,
988 .prot = &dccp_v4_prot, 993 .prot = &dccp_v4_prot,
989 .ops = &inet_dccp_ops, 994 .ops = &inet_dccp_ops,
990 .capability = -1,
991 .no_check = 0, 995 .no_check = 0,
992 .flags = INET_PROTOSW_ICSK, 996 .flags = INET_PROTOSW_ICSK,
993}; 997};