[IPV6]: Do not send RH0 anymore.
authorYOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Wed, 11 Jul 2007 05:55:49 +0000 (22:55 -0700)
committerDavid S. Miller <davem@davemloft.net>
Wed, 11 Jul 2007 05:55:49 +0000 (22:55 -0700)
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>
Documentation/networking/ip-sysctl.txt
include/linux/ipv6.h
include/net/ipv6.h
net/dccp/ipv6.c
net/ipv6/datagram.c
net/ipv6/exthdrs.c
net/ipv6/ipv6_sockglue.c
net/ipv6/tcp_ipv6.c

index af6a63ab9026a3f834a92af6746212e6b7e971f6..09c184e41cf8746b577540a349bdaeb43143575e 100644 (file)
@@ -874,8 +874,7 @@ accept_redirects - BOOLEAN
 accept_source_route - INTEGER
        Accept source routing (routing extension header).
 
-       > 0: Accept routing header.
-       = 0: Accept only routing header type 2.
+       >= 0: Accept only routing header type 2.
        < 0: Do not accept routing header.
 
        Default: 0
index 213b63be3c8f0ec8c1b4ec355eb13bee9a00399b..cb3118cf277c67ea49b23a32209e45e2ea1d3032 100644 (file)
@@ -27,8 +27,8 @@ struct in6_ifreq {
        int             ifr6_ifindex; 
 };
 
-#define IPV6_SRCRT_STRICT      0x01    /* this hop must be a neighbor  */
-#define IPV6_SRCRT_TYPE_0      0       /* IPv6 type 0 Routing Header   */
+#define IPV6_SRCRT_STRICT      0x01    /* Deprecated; will be removed */
+#define IPV6_SRCRT_TYPE_0      0       /* Deprecated; will be removed */
 #define IPV6_SRCRT_TYPE_2      2       /* IPv6 type 2 Routing Header   */
 
 /*
index 78a0d06d98d5420b2094b4c5a78b9d62c1cfdc10..46b9dce82f6e3e60255d6bd1efdb413627e00363 100644 (file)
@@ -512,10 +512,6 @@ extern int                         ipv6_ext_hdr(u8 nexthdr);
 
 extern int ipv6_find_tlv(struct sk_buff *skb, int offset, int type);
 
-extern struct ipv6_txoptions * ipv6_invert_rthdr(struct sock *sk,
-                                                 struct ipv6_rt_hdr *hdr);
-
-
 /*
  *     socket options (ipv6_sockglue.c)
  */
index 31737cdf156a5e657760278c557cbb861d2961f7..b158c661867bb128d7f182e0c215e6836f710f36 100644 (file)
@@ -253,17 +253,6 @@ static int dccp_v6_send_response(struct sock *sk, struct request_sock *req,
 
        if (dst == NULL) {
                opt = np->opt;
-               if (opt == NULL &&
-                   np->rxopt.bits.osrcrt == 2 &&
-                   ireq6->pktopts) {
-                       struct sk_buff *pktopts = ireq6->pktopts;
-                       struct inet6_skb_parm *rxopt = IP6CB(pktopts);
-
-                       if (rxopt->srcrt)
-                               opt = ipv6_invert_rthdr(sk,
-                         (struct ipv6_rt_hdr *)(skb_network_header(pktopts) +
-                                                rxopt->srcrt));
-               }
 
                if (opt != NULL && opt->srcrt != NULL) {
                        const struct rt0_hdr *rt0 = (struct rt0_hdr *)opt->srcrt;
@@ -570,15 +559,6 @@ static struct sock *dccp_v6_request_recv_sock(struct sock *sk,
        if (sk_acceptq_is_full(sk))
                goto out_overflow;
 
-       if (np->rxopt.bits.osrcrt == 2 && opt == NULL && ireq6->pktopts) {
-               const struct inet6_skb_parm *rxopt = IP6CB(ireq6->pktopts);
-
-               if (rxopt->srcrt)
-                       opt = ipv6_invert_rthdr(sk,
-                  (struct ipv6_rt_hdr *)(skb_network_header(ireq6->pktopts) +
-                                         rxopt->srcrt));
-       }
-
        if (dst == NULL) {
                struct in6_addr *final_p = NULL, final;
                struct flowi fl;
index ba1386dd41684a2257fb0a63ddc856d94760f4db..fe0f49024a0a213a843cb854404ea428ebcca350 100644 (file)
@@ -657,11 +657,10 @@ int datagram_send_ctl(struct msghdr *msg, struct flowi *fl,
                        rthdr = (struct ipv6_rt_hdr *)CMSG_DATA(cmsg);
 
                        switch (rthdr->type) {
-                       case IPV6_SRCRT_TYPE_0:
 #if defined(CONFIG_IPV6_MIP6) || defined(CONFIG_IPV6_MIP6_MODULE)
                        case IPV6_SRCRT_TYPE_2:
-#endif
                                break;
+#endif
                        default:
                                err = -EINVAL;
                                goto exit_f;
index fc3a961fc5ba7209d5a03f511dd287c4951ad3e2..c82d4d49f71f1aff4eada6daaa69f8718bbbe019 100644 (file)
@@ -427,18 +427,6 @@ looped_back:
        }
 
        switch (hdr->type) {
-       case IPV6_SRCRT_TYPE_0:
-               if (accept_source_route <= 0)
-                       goto unknown_rh;
-               if (hdr->hdrlen & 0x01) {
-                       IP6_INC_STATS_BH(ip6_dst_idev(skb->dst),
-                                        IPSTATS_MIB_INHDRERRORS);
-                       icmpv6_param_prob(skb, ICMPV6_HDR_FIELD,
-                                         ((&hdr->hdrlen) -
-                                          skb_network_header(skb)));
-                       return -1;
-               }
-               break;
 #if defined(CONFIG_IPV6_MIP6) || defined(CONFIG_IPV6_MIP6_MODULE)
        case IPV6_SRCRT_TYPE_2:
                if (accept_source_route < 0)
@@ -576,72 +564,6 @@ void __init ipv6_rthdr_init(void)
                printk(KERN_ERR "ipv6_rthdr_init: Could not register protocol\n");
 };
 
-/*
-   This function inverts received rthdr.
-   NOTE: specs allow to make it automatically only if
-   packet authenticated.
-
-   I will not discuss it here (though, I am really pissed off at
-   this stupid requirement making rthdr idea useless)
-
-   Actually, it creates severe problems  for us.
-   Embryonic requests has no associated sockets,
-   so that user have no control over it and
-   cannot not only to set reply options, but
-   even to know, that someone wants to connect
-   without success. :-(
-
-   For now we need to test the engine, so that I created
-   temporary (or permanent) backdoor.
-   If listening socket set IPV6_RTHDR to 2, then we invert header.
-                                                  --ANK (980729)
- */
-
-struct ipv6_txoptions *
-ipv6_invert_rthdr(struct sock *sk, struct ipv6_rt_hdr *hdr)
-{
-       /* Received rthdr:
-
-          [ H1 -> H2 -> ... H_prev ]  daddr=ME
-
-          Inverted result:
-          [ H_prev -> ... -> H1 ] daddr =sender
-
-          Note, that IP output engine will rewrite this rthdr
-          by rotating it left by one addr.
-        */
-
-       int n, i;
-       struct rt0_hdr *rthdr = (struct rt0_hdr*)hdr;
-       struct rt0_hdr *irthdr;
-       struct ipv6_txoptions *opt;
-       int hdrlen = ipv6_optlen(hdr);
-
-       if (hdr->segments_left ||
-           hdr->type != IPV6_SRCRT_TYPE_0 ||
-           hdr->hdrlen & 0x01)
-               return NULL;
-
-       n = hdr->hdrlen >> 1;
-       opt = sock_kmalloc(sk, sizeof(*opt) + hdrlen, GFP_ATOMIC);
-       if (opt == NULL)
-               return NULL;
-       memset(opt, 0, sizeof(*opt));
-       opt->tot_len = sizeof(*opt) + hdrlen;
-       opt->srcrt = (void*)(opt+1);
-       opt->opt_nflen = hdrlen;
-
-       memcpy(opt->srcrt, hdr, sizeof(*hdr));
-       irthdr = (struct rt0_hdr*)opt->srcrt;
-       irthdr->reserved = 0;
-       opt->srcrt->segments_left = n;
-       for (i=0; i<n; i++)
-               memcpy(irthdr->addr+i, rthdr->addr+(n-1-i), 16);
-       return opt;
-}
-
-EXPORT_SYMBOL_GPL(ipv6_invert_rthdr);
-
 /**********************************
   Hop-by-hop options.
  **********************************/
index 1c3506696cb5587b1f3b987deca8c2d0d416d241..1841714ac4199377cb9cc99ab26aeb234cd9a3d3 100644 (file)
@@ -416,11 +416,10 @@ static int do_ipv6_setsockopt(struct sock *sk, int level, int optname,
                if (optname == IPV6_RTHDR && opt && opt->srcrt) {
                        struct ipv6_rt_hdr *rthdr = opt->srcrt;
                        switch (rthdr->type) {
-                       case IPV6_SRCRT_TYPE_0:
 #if defined(CONFIG_IPV6_MIP6) || defined(CONFIG_IPV6_MIP6_MODULE)
                        case IPV6_SRCRT_TYPE_2:
-#endif
                                break;
+#endif
                        default:
                                goto sticky_done;
                        }
index 193d9d60bb7a8fabb0ab3eec481e1a7ce0ff1b86..d67fb1ef751edc270eaa832d4048c8bff4faa5a0 100644 (file)
@@ -484,17 +484,6 @@ static int tcp_v6_send_synack(struct sock *sk, struct request_sock *req,
 
        if (dst == NULL) {
                opt = np->opt;
-               if (opt == NULL &&
-                   np->rxopt.bits.osrcrt == 2 &&
-                   treq->pktopts) {
-                       struct sk_buff *pktopts = treq->pktopts;
-                       struct inet6_skb_parm *rxopt = IP6CB(pktopts);
-                       if (rxopt->srcrt)
-                               opt = ipv6_invert_rthdr(sk,
-                         (struct ipv6_rt_hdr *)(skb_network_header(pktopts) +
-                                                rxopt->srcrt));
-               }
-
                if (opt && opt->srcrt) {
                        struct rt0_hdr *rt0 = (struct rt0_hdr *) opt->srcrt;
                        ipv6_addr_copy(&final, &fl.fl6_dst);
@@ -1391,15 +1380,6 @@ static struct sock * tcp_v6_syn_recv_sock(struct sock *sk, struct sk_buff *skb,
        if (sk_acceptq_is_full(sk))
                goto out_overflow;
 
-       if (np->rxopt.bits.osrcrt == 2 &&
-           opt == NULL && treq->pktopts) {
-               struct inet6_skb_parm *rxopt = IP6CB(treq->pktopts);
-               if (rxopt->srcrt)
-                       opt = ipv6_invert_rthdr(sk,
-                  (struct ipv6_rt_hdr *)(skb_network_header(treq->pktopts) +
-                                         rxopt->srcrt));
-       }
-
        if (dst == NULL) {
                struct in6_addr *final_p = NULL, final;
                struct flowi fl;