diff options
author | Gerrit Renker <gerrit@erg.abdn.ac.uk> | 2006-11-10 09:32:01 -0500 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-12-03 00:21:58 -0500 |
commit | 8a73cd09d96aa01743316657fc4e6864fe79b703 (patch) | |
tree | fa22ed8ac78c5c76cc8ee3afd8bf72607290d42d /net/dccp/ipv6.c | |
parent | f6484f7c7ad22e4bb018875c386d6a7aaa441426 (diff) |
[DCCP]: calling dccp_v{4,6}_reqsk_send_ack is a BUG
This patch removes two functions, the send_ack functions of request_sock,
which are not called/used by the DCCP code. It is correct that these
functions are not called, below is a justification why calling these
functions (on a passive socket in the LISTEN/RESPOND state) would mean
a DCCP protocol violation.
A) Background: using request_sock in TCP:
Diffstat (limited to 'net/dccp/ipv6.c')
-rw-r--r-- | net/dccp/ipv6.c | 57 |
1 files changed, 1 insertions, 56 deletions
diff --git a/net/dccp/ipv6.c b/net/dccp/ipv6.c index dee085301576..718509dcb24d 100644 --- a/net/dccp/ipv6.c +++ b/net/dccp/ipv6.c | |||
@@ -37,8 +37,6 @@ | |||
37 | static struct socket *dccp_v6_ctl_socket; | 37 | static struct socket *dccp_v6_ctl_socket; |
38 | 38 | ||
39 | static void dccp_v6_ctl_send_reset(struct sk_buff *skb); | 39 | static void dccp_v6_ctl_send_reset(struct sk_buff *skb); |
40 | static void dccp_v6_reqsk_send_ack(struct sk_buff *skb, | ||
41 | struct request_sock *req); | ||
42 | static void dccp_v6_send_check(struct sock *sk, int len, struct sk_buff *skb); | 40 | static void dccp_v6_send_check(struct sock *sk, int len, struct sk_buff *skb); |
43 | 41 | ||
44 | static int dccp_v6_do_rcv(struct sock *sk, struct sk_buff *skb); | 42 | static int dccp_v6_do_rcv(struct sock *sk, struct sk_buff *skb); |
@@ -493,7 +491,7 @@ static struct request_sock_ops dccp6_request_sock_ops = { | |||
493 | .family = AF_INET6, | 491 | .family = AF_INET6, |
494 | .obj_size = sizeof(struct dccp6_request_sock), | 492 | .obj_size = sizeof(struct dccp6_request_sock), |
495 | .rtx_syn_ack = dccp_v6_send_response, | 493 | .rtx_syn_ack = dccp_v6_send_response, |
496 | .send_ack = dccp_v6_reqsk_send_ack, | 494 | .send_ack = dccp_reqsk_send_ack, |
497 | .destructor = dccp_v6_reqsk_destructor, | 495 | .destructor = dccp_v6_reqsk_destructor, |
498 | .send_reset = dccp_v6_ctl_send_reset, | 496 | .send_reset = dccp_v6_ctl_send_reset, |
499 | }; | 497 | }; |
@@ -582,59 +580,6 @@ static void dccp_v6_ctl_send_reset(struct sk_buff *rxskb) | |||
582 | kfree_skb(skb); | 580 | kfree_skb(skb); |
583 | } | 581 | } |
584 | 582 | ||
585 | static void dccp_v6_reqsk_send_ack(struct sk_buff *rxskb, | ||
586 | struct request_sock *req) | ||
587 | { | ||
588 | struct flowi fl; | ||
589 | struct dccp_hdr *rxdh = dccp_hdr(rxskb), *dh; | ||
590 | const u32 dccp_hdr_ack_len = sizeof(struct dccp_hdr) + | ||
591 | sizeof(struct dccp_hdr_ext) + | ||
592 | sizeof(struct dccp_hdr_ack_bits); | ||
593 | struct sk_buff *skb; | ||
594 | |||
595 | skb = alloc_skb(dccp_v6_ctl_socket->sk->sk_prot->max_header, | ||
596 | GFP_ATOMIC); | ||
597 | if (skb == NULL) | ||
598 | return; | ||
599 | |||
600 | skb_reserve(skb, dccp_v6_ctl_socket->sk->sk_prot->max_header); | ||
601 | |||
602 | dh = dccp_zeroed_hdr(skb, dccp_hdr_ack_len); | ||
603 | |||
604 | /* Build DCCP header and checksum it. */ | ||
605 | dh->dccph_type = DCCP_PKT_ACK; | ||
606 | dh->dccph_sport = rxdh->dccph_dport; | ||
607 | dh->dccph_dport = rxdh->dccph_sport; | ||
608 | dh->dccph_doff = dccp_hdr_ack_len / 4; | ||
609 | dh->dccph_x = 1; | ||
610 | |||
611 | dccp_hdr_set_seq(dh, DCCP_SKB_CB(rxskb)->dccpd_ack_seq); | ||
612 | dccp_hdr_set_ack(dccp_hdr_ack_bits(skb), | ||
613 | DCCP_SKB_CB(rxskb)->dccpd_seq); | ||
614 | |||
615 | memset(&fl, 0, sizeof(fl)); | ||
616 | ipv6_addr_copy(&fl.fl6_dst, &rxskb->nh.ipv6h->saddr); | ||
617 | ipv6_addr_copy(&fl.fl6_src, &rxskb->nh.ipv6h->daddr); | ||
618 | |||
619 | /* FIXME: calculate checksum, IPv4 also should... */ | ||
620 | |||
621 | fl.proto = IPPROTO_DCCP; | ||
622 | fl.oif = inet6_iif(rxskb); | ||
623 | fl.fl_ip_dport = dh->dccph_dport; | ||
624 | fl.fl_ip_sport = dh->dccph_sport; | ||
625 | security_req_classify_flow(req, &fl); | ||
626 | |||
627 | if (!ip6_dst_lookup(NULL, &skb->dst, &fl)) { | ||
628 | if (xfrm_lookup(&skb->dst, &fl, NULL, 0) >= 0) { | ||
629 | ip6_xmit(dccp_v6_ctl_socket->sk, skb, &fl, NULL, 0); | ||
630 | DCCP_INC_STATS_BH(DCCP_MIB_OUTSEGS); | ||
631 | return; | ||
632 | } | ||
633 | } | ||
634 | |||
635 | kfree_skb(skb); | ||
636 | } | ||
637 | |||
638 | static struct sock *dccp_v6_hnd_req(struct sock *sk,struct sk_buff *skb) | 583 | static struct sock *dccp_v6_hnd_req(struct sock *sk,struct sk_buff *skb) |
639 | { | 584 | { |
640 | const struct dccp_hdr *dh = dccp_hdr(skb); | 585 | const struct dccp_hdr *dh = dccp_hdr(skb); |