]> err.no Git - linux-2.6/commitdiff
[IPV6] NDISC: Don't rely on node-type hint from L2 unless required.
authorYOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Sun, 16 Mar 2008 03:59:18 +0000 (23:59 -0400)
committerYOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Thu, 3 Apr 2008 01:06:01 +0000 (10:06 +0900)
Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
include/linux/skbuff.h
net/ipv6/Kconfig
net/ipv6/ndisc.c

index e10e55c9b081003e22d01743a961611c66ad761a..e517701c25baef56f2953d1e6c568c81400b955f 100644 (file)
@@ -313,7 +313,9 @@ struct sk_buff {
        __u16                   tc_verd;        /* traffic control verdict */
 #endif
 #endif
+#ifdef CONFIG_IPV6_NDISC_NODETYPE
        __u8                    ndisc_nodetype:2;
+#endif
        /* 14 bit hole */
 
 #ifdef CONFIG_NET_DMA
index 47263e45bacb930227a077b65daf10e217a50cfe..7d2e7f0941ac1c975be32bdbc7f5739cee28ea57 100644 (file)
@@ -168,6 +168,7 @@ config IPV6_SIT
        tristate "IPv6: IPv6-in-IPv4 tunnel (SIT driver)"
        depends on IPV6
        select INET_TUNNEL
+       select IPV6_NDISC_NODETYPE
        default y
        ---help---
          Tunneling means encapsulating data of one protocol type within
@@ -178,6 +179,9 @@ config IPV6_SIT
 
          Saying M here will produce a module called sit.ko. If unsure, say Y.
 
+config IPV6_NDISC_NODETYPE
+       bool
+
 config IPV6_TUNNEL
        tristate "IPv6: IP-in-IPv6 tunnel (RFC2473)"
        select INET6_TUNNEL
index 16273e11e53d76e0bc2d40eb3080a0cefb00bfa5..c400b874097a87aa34c4cf3db0c51190378a8b43 100644 (file)
@@ -1092,11 +1092,13 @@ static void ndisc_router_discovery(struct sk_buff *skb)
                return;
        }
 
+#ifdef CONFIG_IPV6_NDISC_NODETYPE
        if (skb->ndisc_nodetype == NDISC_NODETYPE_HOST) {
                ND_PRINTK2(KERN_WARNING
                           "ICMPv6 RA: from host or unauthorized router\n");
                return;
        }
+#endif
 
        /*
         *      set the RA_RECV flag in the interface
@@ -1121,9 +1123,11 @@ static void ndisc_router_discovery(struct sk_buff *skb)
                return;
        }
 
+#ifdef CONFIG_IPV6_NDISC_NODETYPE
        /* skip link-specific parameters from interior routers */
        if (skb->ndisc_nodetype == NDISC_NODETYPE_NODEFAULT)
                goto skip_linkparms;
+#endif
 
        if (in6_dev->if_flags & IF_RS_SENT) {
                /*
@@ -1239,7 +1243,9 @@ skip_defrtr:
                }
        }
 
+#ifdef CONFIG_IPV6_NDISC_NODETYPE
 skip_linkparms:
+#endif
 
        /*
         *      Process options.
@@ -1286,9 +1292,11 @@ skip_linkparms:
        }
 #endif
 
+#ifdef CONFIG_IPV6_NDISC_NODETYPE
        /* skip link-specific ndopts from interior routers */
        if (skb->ndisc_nodetype == NDISC_NODETYPE_NODEFAULT)
                goto out;
+#endif
 
        if (in6_dev->cnf.accept_ra_pinfo && ndopts.nd_opts_pi) {
                struct nd_opt_hdr *p;
@@ -1353,6 +1361,7 @@ static void ndisc_redirect_rcv(struct sk_buff *skb)
        int optlen;
        u8 *lladdr = NULL;
 
+#ifdef CONFIG_IPV6_NDISC_NODETYPE
        switch (skb->ndisc_nodetype) {
        case NDISC_NODETYPE_HOST:
        case NDISC_NODETYPE_NODEFAULT:
@@ -1360,6 +1369,7 @@ static void ndisc_redirect_rcv(struct sk_buff *skb)
                           "ICMPv6 Redirect: from host or unauthorized router\n");
                return;
        }
+#endif
 
        if (!(ipv6_addr_type(&ipv6_hdr(skb)->saddr) & IPV6_ADDR_LINKLOCAL)) {
                ND_PRINTK2(KERN_WARNING