aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6/exthdrs.c
diff options
context:
space:
mode:
authorYOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>2007-07-11 01:55:49 -0400
committerDavid S. Miller <davem@davemloft.net>2007-07-11 01:55:49 -0400
commitbb4dbf9e61d0801927e7df2569bb3dd8287ea301 (patch)
tree62d0878b6128fbed608bdee342e705fd371c78cd /net/ipv6/exthdrs.c
parentc382bb9d32a55029fb13b118858e25908fab4617 (diff)
[IPV6]: Do not send RH0 anymore.
Based on <draft-ietf-ipv6-deprecate-rh0-00.txt>. Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/exthdrs.c')
-rw-r--r--net/ipv6/exthdrs.c78
1 files changed, 0 insertions, 78 deletions
diff --git a/net/ipv6/exthdrs.c b/net/ipv6/exthdrs.c
index fc3a961fc5ba..c82d4d49f71f 100644
--- a/net/ipv6/exthdrs.c
+++ b/net/ipv6/exthdrs.c
@@ -427,18 +427,6 @@ looped_back:
427 } 427 }
428 428
429 switch (hdr->type) { 429 switch (hdr->type) {
430 case IPV6_SRCRT_TYPE_0:
431 if (accept_source_route <= 0)
432 goto unknown_rh;
433 if (hdr->hdrlen & 0x01) {
434 IP6_INC_STATS_BH(ip6_dst_idev(skb->dst),
435 IPSTATS_MIB_INHDRERRORS);
436 icmpv6_param_prob(skb, ICMPV6_HDR_FIELD,
437 ((&hdr->hdrlen) -
438 skb_network_header(skb)));
439 return -1;
440 }
441 break;
442#if defined(CONFIG_IPV6_MIP6) || defined(CONFIG_IPV6_MIP6_MODULE) 430#if defined(CONFIG_IPV6_MIP6) || defined(CONFIG_IPV6_MIP6_MODULE)
443 case IPV6_SRCRT_TYPE_2: 431 case IPV6_SRCRT_TYPE_2:
444 if (accept_source_route < 0) 432 if (accept_source_route < 0)
@@ -576,72 +564,6 @@ void __init ipv6_rthdr_init(void)
576 printk(KERN_ERR "ipv6_rthdr_init: Could not register protocol\n"); 564 printk(KERN_ERR "ipv6_rthdr_init: Could not register protocol\n");
577}; 565};
578 566
579/*
580 This function inverts received rthdr.
581 NOTE: specs allow to make it automatically only if
582 packet authenticated.
583
584 I will not discuss it here (though, I am really pissed off at
585 this stupid requirement making rthdr idea useless)
586
587 Actually, it creates severe problems for us.
588 Embryonic requests has no associated sockets,
589 so that user have no control over it and
590 cannot not only to set reply options, but
591 even to know, that someone wants to connect
592 without success. :-(
593
594 For now we need to test the engine, so that I created
595 temporary (or permanent) backdoor.
596 If listening socket set IPV6_RTHDR to 2, then we invert header.
597 --ANK (980729)
598 */
599
600struct ipv6_txoptions *
601ipv6_invert_rthdr(struct sock *sk, struct ipv6_rt_hdr *hdr)
602{
603 /* Received rthdr:
604
605 [ H1 -> H2 -> ... H_prev ] daddr=ME
606
607 Inverted result:
608 [ H_prev -> ... -> H1 ] daddr =sender
609
610 Note, that IP output engine will rewrite this rthdr
611 by rotating it left by one addr.
612 */
613
614 int n, i;
615 struct rt0_hdr *rthdr = (struct rt0_hdr*)hdr;
616 struct rt0_hdr *irthdr;
617 struct ipv6_txoptions *opt;
618 int hdrlen = ipv6_optlen(hdr);
619
620 if (hdr->segments_left ||
621 hdr->type != IPV6_SRCRT_TYPE_0 ||
622 hdr->hdrlen & 0x01)
623 return NULL;
624
625 n = hdr->hdrlen >> 1;
626 opt = sock_kmalloc(sk, sizeof(*opt) + hdrlen, GFP_ATOMIC);
627 if (opt == NULL)
628 return NULL;
629 memset(opt, 0, sizeof(*opt));
630 opt->tot_len = sizeof(*opt) + hdrlen;
631 opt->srcrt = (void*)(opt+1);
632 opt->opt_nflen = hdrlen;
633
634 memcpy(opt->srcrt, hdr, sizeof(*hdr));
635 irthdr = (struct rt0_hdr*)opt->srcrt;
636 irthdr->reserved = 0;
637 opt->srcrt->segments_left = n;
638 for (i=0; i<n; i++)
639 memcpy(irthdr->addr+i, rthdr->addr+(n-1-i), 16);
640 return opt;
641}
642
643EXPORT_SYMBOL_GPL(ipv6_invert_rthdr);
644
645/********************************** 567/**********************************
646 Hop-by-hop options. 568 Hop-by-hop options.
647 **********************************/ 569 **********************************/