diff options
Diffstat (limited to 'net/dccp')
-rw-r--r-- | net/dccp/dccp.h | 6 | ||||
-rw-r--r-- | net/dccp/ipv4.c | 20 | ||||
-rw-r--r-- | net/dccp/ipv6.c | 40 | ||||
-rw-r--r-- | net/dccp/minisocks.c | 2 |
4 files changed, 32 insertions, 36 deletions
diff --git a/net/dccp/dccp.h b/net/dccp/dccp.h index 287a62bc2e0f..e1b7c9c6a623 100644 --- a/net/dccp/dccp.h +++ b/net/dccp/dccp.h | |||
@@ -23,9 +23,9 @@ | |||
23 | * DCCP - specific warning and debugging macros. | 23 | * DCCP - specific warning and debugging macros. |
24 | */ | 24 | */ |
25 | #define DCCP_WARN(fmt, a...) LIMIT_NETDEBUG(KERN_WARNING "%s: " fmt, \ | 25 | #define DCCP_WARN(fmt, a...) LIMIT_NETDEBUG(KERN_WARNING "%s: " fmt, \ |
26 | __FUNCTION__, ##a) | 26 | __func__, ##a) |
27 | #define DCCP_CRIT(fmt, a...) printk(KERN_CRIT fmt " at %s:%d/%s()\n", ##a, \ | 27 | #define DCCP_CRIT(fmt, a...) printk(KERN_CRIT fmt " at %s:%d/%s()\n", ##a, \ |
28 | __FILE__, __LINE__, __FUNCTION__) | 28 | __FILE__, __LINE__, __func__) |
29 | #define DCCP_BUG(a...) do { DCCP_CRIT("BUG: " a); dump_stack(); } while(0) | 29 | #define DCCP_BUG(a...) do { DCCP_CRIT("BUG: " a); dump_stack(); } while(0) |
30 | #define DCCP_BUG_ON(cond) do { if (unlikely((cond) != 0)) \ | 30 | #define DCCP_BUG_ON(cond) do { if (unlikely((cond) != 0)) \ |
31 | DCCP_BUG("\"%s\" holds (exception!)", \ | 31 | DCCP_BUG("\"%s\" holds (exception!)", \ |
@@ -36,7 +36,7 @@ | |||
36 | printk(fmt, ##args); \ | 36 | printk(fmt, ##args); \ |
37 | } while(0) | 37 | } while(0) |
38 | #define DCCP_PR_DEBUG(enable, fmt, a...) DCCP_PRINTK(enable, KERN_DEBUG \ | 38 | #define DCCP_PR_DEBUG(enable, fmt, a...) DCCP_PRINTK(enable, KERN_DEBUG \ |
39 | "%s: " fmt, __FUNCTION__, ##a) | 39 | "%s: " fmt, __func__, ##a) |
40 | 40 | ||
41 | #ifdef CONFIG_IP_DCCP_DEBUG | 41 | #ifdef CONFIG_IP_DCCP_DEBUG |
42 | extern int dccp_debug; | 42 | extern int dccp_debug; |
diff --git a/net/dccp/ipv4.c b/net/dccp/ipv4.c index 474075adbde4..4ca8b0c93c80 100644 --- a/net/dccp/ipv4.c +++ b/net/dccp/ipv4.c | |||
@@ -450,7 +450,7 @@ static struct dst_entry* dccp_v4_route_skb(struct sock *sk, | |||
450 | struct sk_buff *skb) | 450 | struct sk_buff *skb) |
451 | { | 451 | { |
452 | struct rtable *rt; | 452 | struct rtable *rt; |
453 | struct flowi fl = { .oif = ((struct rtable *)skb->dst)->rt_iif, | 453 | struct flowi fl = { .oif = skb->rtable->rt_iif, |
454 | .nl_u = { .ip4_u = | 454 | .nl_u = { .ip4_u = |
455 | { .daddr = ip_hdr(skb)->saddr, | 455 | { .daddr = ip_hdr(skb)->saddr, |
456 | .saddr = ip_hdr(skb)->daddr, | 456 | .saddr = ip_hdr(skb)->daddr, |
@@ -471,15 +471,14 @@ static struct dst_entry* dccp_v4_route_skb(struct sock *sk, | |||
471 | return &rt->u.dst; | 471 | return &rt->u.dst; |
472 | } | 472 | } |
473 | 473 | ||
474 | static int dccp_v4_send_response(struct sock *sk, struct request_sock *req, | 474 | static int dccp_v4_send_response(struct sock *sk, struct request_sock *req) |
475 | struct dst_entry *dst) | ||
476 | { | 475 | { |
477 | int err = -1; | 476 | int err = -1; |
478 | struct sk_buff *skb; | 477 | struct sk_buff *skb; |
478 | struct dst_entry *dst; | ||
479 | 479 | ||
480 | /* First, grab a route. */ | 480 | dst = inet_csk_route_req(sk, req); |
481 | 481 | if (dst == NULL) | |
482 | if (dst == NULL && (dst = inet_csk_route_req(sk, req)) == NULL) | ||
483 | goto out; | 482 | goto out; |
484 | 483 | ||
485 | skb = dccp_make_response(sk, dst, req); | 484 | skb = dccp_make_response(sk, dst, req); |
@@ -512,7 +511,7 @@ static void dccp_v4_ctl_send_reset(struct sock *sk, struct sk_buff *rxskb) | |||
512 | if (dccp_hdr(rxskb)->dccph_type == DCCP_PKT_RESET) | 511 | if (dccp_hdr(rxskb)->dccph_type == DCCP_PKT_RESET) |
513 | return; | 512 | return; |
514 | 513 | ||
515 | if (((struct rtable *)rxskb->dst)->rt_type != RTN_LOCAL) | 514 | if (rxskb->rtable->rt_type != RTN_LOCAL) |
516 | return; | 515 | return; |
517 | 516 | ||
518 | dst = dccp_v4_route_skb(dccp_v4_ctl_socket->sk, rxskb); | 517 | dst = dccp_v4_route_skb(dccp_v4_ctl_socket->sk, rxskb); |
@@ -564,8 +563,7 @@ int dccp_v4_conn_request(struct sock *sk, struct sk_buff *skb) | |||
564 | struct dccp_skb_cb *dcb = DCCP_SKB_CB(skb); | 563 | struct dccp_skb_cb *dcb = DCCP_SKB_CB(skb); |
565 | 564 | ||
566 | /* Never answer to DCCP_PKT_REQUESTs send to broadcast or multicast */ | 565 | /* Never answer to DCCP_PKT_REQUESTs send to broadcast or multicast */ |
567 | if (((struct rtable *)skb->dst)->rt_flags & | 566 | if (skb->rtable->rt_flags & (RTCF_BROADCAST | RTCF_MULTICAST)) |
568 | (RTCF_BROADCAST | RTCF_MULTICAST)) | ||
569 | return 0; /* discard, don't send a reset here */ | 567 | return 0; /* discard, don't send a reset here */ |
570 | 568 | ||
571 | if (dccp_bad_service_code(sk, service)) { | 569 | if (dccp_bad_service_code(sk, service)) { |
@@ -620,7 +618,7 @@ int dccp_v4_conn_request(struct sock *sk, struct sk_buff *skb) | |||
620 | dreq->dreq_iss = dccp_v4_init_sequence(skb); | 618 | dreq->dreq_iss = dccp_v4_init_sequence(skb); |
621 | dreq->dreq_service = service; | 619 | dreq->dreq_service = service; |
622 | 620 | ||
623 | if (dccp_v4_send_response(sk, req, NULL)) | 621 | if (dccp_v4_send_response(sk, req)) |
624 | goto drop_and_free; | 622 | goto drop_and_free; |
625 | 623 | ||
626 | inet_csk_reqsk_queue_hash_add(sk, req, DCCP_TIMEOUT_INIT); | 624 | inet_csk_reqsk_queue_hash_add(sk, req, DCCP_TIMEOUT_INIT); |
@@ -943,7 +941,7 @@ static struct proto dccp_v4_prot = { | |||
943 | .obj_size = sizeof(struct dccp_sock), | 941 | .obj_size = sizeof(struct dccp_sock), |
944 | .rsk_prot = &dccp_request_sock_ops, | 942 | .rsk_prot = &dccp_request_sock_ops, |
945 | .twsk_prot = &dccp_timewait_sock_ops, | 943 | .twsk_prot = &dccp_timewait_sock_ops, |
946 | .hashinfo = &dccp_hashinfo, | 944 | .h.hashinfo = &dccp_hashinfo, |
947 | #ifdef CONFIG_COMPAT | 945 | #ifdef CONFIG_COMPAT |
948 | .compat_setsockopt = compat_dccp_setsockopt, | 946 | .compat_setsockopt = compat_dccp_setsockopt, |
949 | .compat_getsockopt = compat_dccp_getsockopt, | 947 | .compat_getsockopt = compat_dccp_getsockopt, |
diff --git a/net/dccp/ipv6.c b/net/dccp/ipv6.c index 490333d47c7b..2fec1af1a8c3 100644 --- a/net/dccp/ipv6.c +++ b/net/dccp/ipv6.c | |||
@@ -224,8 +224,7 @@ out: | |||
224 | } | 224 | } |
225 | 225 | ||
226 | 226 | ||
227 | static int dccp_v6_send_response(struct sock *sk, struct request_sock *req, | 227 | static int dccp_v6_send_response(struct sock *sk, struct request_sock *req) |
228 | struct dst_entry *dst) | ||
229 | { | 228 | { |
230 | struct inet6_request_sock *ireq6 = inet6_rsk(req); | 229 | struct inet6_request_sock *ireq6 = inet6_rsk(req); |
231 | struct ipv6_pinfo *np = inet6_sk(sk); | 230 | struct ipv6_pinfo *np = inet6_sk(sk); |
@@ -234,6 +233,7 @@ static int dccp_v6_send_response(struct sock *sk, struct request_sock *req, | |||
234 | struct in6_addr *final_p = NULL, final; | 233 | struct in6_addr *final_p = NULL, final; |
235 | struct flowi fl; | 234 | struct flowi fl; |
236 | int err = -1; | 235 | int err = -1; |
236 | struct dst_entry *dst; | ||
237 | 237 | ||
238 | memset(&fl, 0, sizeof(fl)); | 238 | memset(&fl, 0, sizeof(fl)); |
239 | fl.proto = IPPROTO_DCCP; | 239 | fl.proto = IPPROTO_DCCP; |
@@ -245,28 +245,26 @@ static int dccp_v6_send_response(struct sock *sk, struct request_sock *req, | |||
245 | fl.fl_ip_sport = inet_sk(sk)->sport; | 245 | fl.fl_ip_sport = inet_sk(sk)->sport; |
246 | security_req_classify_flow(req, &fl); | 246 | security_req_classify_flow(req, &fl); |
247 | 247 | ||
248 | if (dst == NULL) { | 248 | opt = np->opt; |
249 | opt = np->opt; | ||
250 | 249 | ||
251 | if (opt != NULL && opt->srcrt != NULL) { | 250 | if (opt != NULL && opt->srcrt != NULL) { |
252 | const struct rt0_hdr *rt0 = (struct rt0_hdr *)opt->srcrt; | 251 | const struct rt0_hdr *rt0 = (struct rt0_hdr *)opt->srcrt; |
253 | 252 | ||
254 | ipv6_addr_copy(&final, &fl.fl6_dst); | 253 | ipv6_addr_copy(&final, &fl.fl6_dst); |
255 | ipv6_addr_copy(&fl.fl6_dst, rt0->addr); | 254 | ipv6_addr_copy(&fl.fl6_dst, rt0->addr); |
256 | final_p = &final; | 255 | final_p = &final; |
257 | } | 256 | } |
258 | 257 | ||
259 | err = ip6_dst_lookup(sk, &dst, &fl); | 258 | err = ip6_dst_lookup(sk, &dst, &fl); |
260 | if (err) | 259 | if (err) |
261 | goto done; | 260 | goto done; |
262 | 261 | ||
263 | if (final_p) | 262 | if (final_p) |
264 | ipv6_addr_copy(&fl.fl6_dst, final_p); | 263 | ipv6_addr_copy(&fl.fl6_dst, final_p); |
265 | 264 | ||
266 | err = xfrm_lookup(&dst, &fl, sk, 0); | 265 | err = xfrm_lookup(&dst, &fl, sk, 0); |
267 | if (err < 0) | 266 | if (err < 0) |
268 | goto done; | 267 | goto done; |
269 | } | ||
270 | 268 | ||
271 | skb = dccp_make_response(sk, dst, req); | 269 | skb = dccp_make_response(sk, dst, req); |
272 | if (skb != NULL) { | 270 | if (skb != NULL) { |
@@ -448,7 +446,7 @@ static int dccp_v6_conn_request(struct sock *sk, struct sk_buff *skb) | |||
448 | dreq->dreq_iss = dccp_v6_init_sequence(skb); | 446 | dreq->dreq_iss = dccp_v6_init_sequence(skb); |
449 | dreq->dreq_service = service; | 447 | dreq->dreq_service = service; |
450 | 448 | ||
451 | if (dccp_v6_send_response(sk, req, NULL)) | 449 | if (dccp_v6_send_response(sk, req)) |
452 | goto drop_and_free; | 450 | goto drop_and_free; |
453 | 451 | ||
454 | inet6_csk_reqsk_queue_hash_add(sk, req, DCCP_TIMEOUT_INIT); | 452 | inet6_csk_reqsk_queue_hash_add(sk, req, DCCP_TIMEOUT_INIT); |
@@ -1128,7 +1126,7 @@ static struct proto dccp_v6_prot = { | |||
1128 | .obj_size = sizeof(struct dccp6_sock), | 1126 | .obj_size = sizeof(struct dccp6_sock), |
1129 | .rsk_prot = &dccp6_request_sock_ops, | 1127 | .rsk_prot = &dccp6_request_sock_ops, |
1130 | .twsk_prot = &dccp6_timewait_sock_ops, | 1128 | .twsk_prot = &dccp6_timewait_sock_ops, |
1131 | .hashinfo = &dccp_hashinfo, | 1129 | .h.hashinfo = &dccp_hashinfo, |
1132 | #ifdef CONFIG_COMPAT | 1130 | #ifdef CONFIG_COMPAT |
1133 | .compat_setsockopt = compat_dccp_setsockopt, | 1131 | .compat_setsockopt = compat_dccp_setsockopt, |
1134 | .compat_getsockopt = compat_dccp_getsockopt, | 1132 | .compat_getsockopt = compat_dccp_getsockopt, |
diff --git a/net/dccp/minisocks.c b/net/dccp/minisocks.c index 027d1814e1ab..33ad48321b08 100644 --- a/net/dccp/minisocks.c +++ b/net/dccp/minisocks.c | |||
@@ -216,7 +216,7 @@ struct sock *dccp_check_req(struct sock *sk, struct sk_buff *skb, | |||
216 | * counter (backoff, monitored by dccp_response_timer). | 216 | * counter (backoff, monitored by dccp_response_timer). |
217 | */ | 217 | */ |
218 | req->retrans++; | 218 | req->retrans++; |
219 | req->rsk_ops->rtx_syn_ack(sk, req, NULL); | 219 | req->rsk_ops->rtx_syn_ack(sk, req); |
220 | } | 220 | } |
221 | /* Network Duplicate, discard packet */ | 221 | /* Network Duplicate, discard packet */ |
222 | return NULL; | 222 | return NULL; |