]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - net/ipv6/ndisc.c
[IPSEC]: Move RO-specific output code into xfrm6_mode_ro.c
[linux-2.6-omap-h63xx.git] / net / ipv6 / ndisc.c
index d8b36451badac3a227e7258b62b6e7b3efd482fb..d4acd283111bab6cd32bc7a3653d28f89d64f669 100644 (file)
@@ -256,7 +256,7 @@ static struct ndisc_options *ndisc_parse_options(u8 *opt, int opt_len,
                        break;
                case ND_OPT_PREFIX_INFO:
                        ndopts->nd_opts_pi_end = nd_opt;
-                       if (ndopts->nd_opt_array[nd_opt->nd_opt_type] == 0)
+                       if (!ndopts->nd_opt_array[nd_opt->nd_opt_type])
                                ndopts->nd_opt_array[nd_opt->nd_opt_type] = nd_opt;
                        break;
 #ifdef CONFIG_IPV6_ROUTE_INFO
@@ -354,7 +354,7 @@ static int ndisc_constructor(struct neighbour *neigh)
        rcu_read_unlock();
 
        neigh->type = is_multicast ? RTN_MULTICAST : RTN_UNICAST;
-       if (dev->hard_header == NULL) {
+       if (!dev->header_ops) {
                neigh->nud_state = NUD_NOARP;
                neigh->ops = &ndisc_direct_ops;
                neigh->output = neigh->ops->queue_xmit;
@@ -371,7 +371,7 @@ static int ndisc_constructor(struct neighbour *neigh)
                        neigh->nud_state = NUD_NOARP;
                        memcpy(neigh->ha, dev->broadcast, dev->addr_len);
                }
-               if (dev->hard_header_cache)
+               if (dev->header_ops->cache)
                        neigh->ops = &ndisc_hh_ops;
                else
                        neigh->ops = &ndisc_generic_ops;
@@ -431,7 +431,7 @@ static void __ndisc_send(struct net_device *dev,
                         struct neighbour *neigh,
                         struct in6_addr *daddr, struct in6_addr *saddr,
                         struct icmp6hdr *icmp6h, struct in6_addr *target,
-                        int llinfo, int icmp6_mib_outnd)
+                        int llinfo)
 {
        struct flowi fl;
        struct dst_entry *dst;
@@ -441,9 +441,11 @@ static void __ndisc_send(struct net_device *dev,
        struct inet6_dev *idev;
        int len;
        int err;
-       u8 *opt;
+       u8 *opt, type;
+
+       type = icmp6h->icmp6_type;
 
-       ndisc_flow_init(&fl, icmp6h->icmp6_type, saddr, daddr,
+       ndisc_flow_init(&fl, type, saddr, daddr,
                        dev->ifindex);
 
        dst = ndisc_dst_alloc(dev, neigh, daddr, ip6_output);
@@ -504,7 +506,7 @@ static void __ndisc_send(struct net_device *dev,
 
        err = NF_HOOK(PF_INET6, NF_IP6_LOCAL_OUT, skb, NULL, dst->dev, dst_output);
        if (!err) {
-               ICMP6_INC_STATS(idev, icmp6_mib_outnd);
+               ICMP6MSGOUT_INC_STATS(idev, type);
                ICMP6_INC_STATS(idev, ICMP6_MIB_OUTMSGS);
        }
 
@@ -542,8 +544,7 @@ static void ndisc_send_na(struct net_device *dev, struct neighbour *neigh,
 
        __ndisc_send(dev, neigh, daddr, src_addr,
                     &icmp6h, solicited_addr,
-                    inc_opt ? ND_OPT_TARGET_LL_ADDR : 0,
-                    ICMP6_MIB_OUTNEIGHBORADVERTISEMENTS);
+                    inc_opt ? ND_OPT_TARGET_LL_ADDR : 0);
 }
 
 void ndisc_send_ns(struct net_device *dev, struct neighbour *neigh,
@@ -564,8 +565,7 @@ void ndisc_send_ns(struct net_device *dev, struct neighbour *neigh,
 
        __ndisc_send(dev, neigh, daddr, saddr,
                     &icmp6h, solicit,
-                    !ipv6_addr_any(saddr) ? ND_OPT_SOURCE_LL_ADDR : 0,
-                    ICMP6_MIB_OUTNEIGHBORSOLICITS);
+                    !ipv6_addr_any(saddr) ? ND_OPT_SOURCE_LL_ADDR : 0);
 }
 
 void ndisc_send_rs(struct net_device *dev, struct in6_addr *saddr,
@@ -599,8 +599,7 @@ void ndisc_send_rs(struct net_device *dev, struct in6_addr *saddr,
 #endif
        __ndisc_send(dev, NULL, daddr, saddr,
                     &icmp6h, NULL,
-                    send_sllao ? ND_OPT_SOURCE_LL_ADDR : 0,
-                    ICMP6_MIB_OUTROUTERSOLICITS);
+                    send_sllao ? ND_OPT_SOURCE_LL_ADDR : 0);
 }
 
 
@@ -736,7 +735,7 @@ static void ndisc_recv_ns(struct sk_buff *skb)
                                 * so fail our DAD process
                                 */
                                addrconf_dad_failure(ifp);
-                               goto out;
+                               return;
                        } else {
                                /*
                                 * This is not a dad solicitation.
@@ -808,7 +807,7 @@ static void ndisc_recv_ns(struct sk_buff *skb)
                neigh_update(neigh, lladdr, NUD_STALE,
                             NEIGH_UPDATE_F_WEAK_OVERRIDE|
                             NEIGH_UPDATE_F_OVERRIDE);
-       if (neigh || !dev->hard_header) {
+       if (neigh || !dev->header_ops) {
                ndisc_send_na(dev, neigh, saddr, &msg->target,
                              is_router,
                              1, (ifp != NULL && inc), inc);
@@ -1062,7 +1061,7 @@ static void ndisc_router_discovery(struct sk_buff *skb)
        pref = ra_msg->icmph.icmp6_router_pref;
        /* 10b is handled as if it were 00b (medium) */
        if (pref == ICMPV6_ROUTER_PREF_INVALID ||
-           in6_dev->cnf.accept_ra_rtr_pref)
+           !in6_dev->cnf.accept_ra_rtr_pref)
                pref = ICMPV6_ROUTER_PREF_MEDIUM;
 #endif
 
@@ -1268,9 +1267,10 @@ static void ndisc_redirect_rcv(struct sk_buff *skb)
 
        if (ipv6_addr_equal(dest, target)) {
                on_link = 1;
-       } else if (!(ipv6_addr_type(target) & IPV6_ADDR_LINKLOCAL)) {
+       } else if (ipv6_addr_type(target) !=
+                  (IPV6_ADDR_UNICAST|IPV6_ADDR_LINKLOCAL)) {
                ND_PRINTK2(KERN_WARNING
-                          "ICMPv6 Redirect: target address is not link-local.\n");
+                          "ICMPv6 Redirect: target address is not link-local unicast.\n");
                return;
        }
 
@@ -1344,9 +1344,9 @@ void ndisc_send_redirect(struct sk_buff *skb, struct neighbour *neigh,
        }
 
        if (!ipv6_addr_equal(&ipv6_hdr(skb)->daddr, target) &&
-           !(ipv6_addr_type(target) & IPV6_ADDR_LINKLOCAL)) {
+           ipv6_addr_type(target) != (IPV6_ADDR_UNICAST|IPV6_ADDR_LINKLOCAL)) {
                ND_PRINTK2(KERN_WARNING
-                       "ICMPv6 Redirect: target address is not link-local.\n");
+                       "ICMPv6 Redirect: target address is not link-local unicast.\n");
                return;
        }
 
@@ -1454,7 +1454,7 @@ void ndisc_send_redirect(struct sk_buff *skb, struct neighbour *neigh,
        IP6_INC_STATS(idev, IPSTATS_MIB_OUTREQUESTS);
        err = NF_HOOK(PF_INET6, NF_IP6_LOCAL_OUT, buff, NULL, dst->dev, dst_output);
        if (!err) {
-               ICMP6_INC_STATS(idev, ICMP6_MIB_OUTREDIRECTS);
+               ICMP6MSGOUT_INC_STATS(idev, NDISC_REDIRECT);
                ICMP6_INC_STATS(idev, ICMP6_MIB_OUTMSGS);
        }
 
@@ -1524,6 +1524,9 @@ static int ndisc_netdev_event(struct notifier_block *this, unsigned long event,
 {
        struct net_device *dev = ptr;
 
+       if (dev->nd_net != &init_net)
+               return NOTIFY_DONE;
+
        switch (event) {
        case NETDEV_CHANGEADDR:
                neigh_changeaddr(&nd_tbl, dev);