ndisc: Remove tbl argument for __ipv6_neigh_lookup().
[deliverable/linux.git] / net / ipv6 / route.c
index 621b68ecf16f5c86cb01cace5a0659969a9855b8..5d9ca274d149cb5e8f3a469b7089292a6c3ec665 100644 (file)
@@ -145,7 +145,7 @@ static struct neighbour *ip6_neigh_lookup(const struct dst_entry *dst,
        struct neighbour *n;
 
        daddr = choose_neigh_daddr(rt, skb, daddr);
-       n = __ipv6_neigh_lookup(&nd_tbl, dst->dev, daddr);
+       n = __ipv6_neigh_lookup(dst->dev, daddr);
        if (n)
                return n;
        return neigh_create(&nd_tbl, daddr, dst->dev);
@@ -153,7 +153,7 @@ static struct neighbour *ip6_neigh_lookup(const struct dst_entry *dst,
 
 static int rt6_bind_neighbour(struct rt6_info *rt, struct net_device *dev)
 {
-       struct neighbour *n = __ipv6_neigh_lookup(&nd_tbl, dev, &rt->rt6i_gateway);
+       struct neighbour *n = __ipv6_neigh_lookup(dev, &rt->rt6i_gateway);
        if (!n) {
                n = neigh_create(&nd_tbl, &rt->rt6i_gateway, dev);
                if (IS_ERR(n))
@@ -388,15 +388,8 @@ static int rt6_info_hash_nhsfn(unsigned int candidate_count,
 {
        unsigned int val = fl6->flowi6_proto;
 
-       val ^= (__force u32)fl6->daddr.s6_addr32[0];
-       val ^= (__force u32)fl6->daddr.s6_addr32[1];
-       val ^= (__force u32)fl6->daddr.s6_addr32[2];
-       val ^= (__force u32)fl6->daddr.s6_addr32[3];
-
-       val ^= (__force u32)fl6->saddr.s6_addr32[0];
-       val ^= (__force u32)fl6->saddr.s6_addr32[1];
-       val ^= (__force u32)fl6->saddr.s6_addr32[2];
-       val ^= (__force u32)fl6->saddr.s6_addr32[3];
+       val ^= ipv6_addr_hash(&fl6->daddr);
+       val ^= ipv6_addr_hash(&fl6->saddr);
 
        /* Work only if this not encapsulated */
        switch (fl6->flowi6_proto) {
@@ -506,22 +499,26 @@ static void rt6_probe(struct rt6_info *rt)
         * to no more than one per minute.
         */
        neigh = rt ? rt->n : NULL;
-       if (!neigh || (neigh->nud_state & NUD_VALID))
+       if (!neigh)
+               return;
+       write_lock_bh(&neigh->lock);
+       if (neigh->nud_state & NUD_VALID) {
+               write_unlock_bh(&neigh->lock);
                return;
-       read_lock_bh(&neigh->lock);
+       }
        if (!(neigh->nud_state & NUD_VALID) &&
            time_after(jiffies, neigh->updated + rt->rt6i_idev->cnf.rtr_probe_interval)) {
                struct in6_addr mcaddr;
                struct in6_addr *target;
 
                neigh->updated = jiffies;
-               read_unlock_bh(&neigh->lock);
+               write_unlock_bh(&neigh->lock);
 
                target = (struct in6_addr *)&neigh->primary_key;
                addrconf_addr_solict_mult(target, &mcaddr);
                ndisc_send_ns(rt->dst.dev, NULL, target, &mcaddr, NULL);
        } else {
-               read_unlock_bh(&neigh->lock);
+               write_unlock_bh(&neigh->lock);
        }
 }
 #else
@@ -994,7 +991,7 @@ void ip6_route_input(struct sk_buff *skb)
                .flowi6_iif = skb->dev->ifindex,
                .daddr = iph->daddr,
                .saddr = iph->saddr,
-               .flowlabel = (* (__be32 *) iph) & IPV6_FLOWINFO_MASK,
+               .flowlabel = ip6_flowinfo(iph),
                .flowi6_mark = skb->mark,
                .flowi6_proto = iph->nexthdr,
        };
@@ -1159,7 +1156,7 @@ void ip6_update_pmtu(struct sk_buff *skb, struct net *net, __be32 mtu,
        fl6.flowi6_flags = 0;
        fl6.daddr = iph->daddr;
        fl6.saddr = iph->saddr;
-       fl6.flowlabel = (*(__be32 *) iph) & IPV6_FLOWINFO_MASK;
+       fl6.flowlabel = ip6_flowinfo(iph);
 
        dst = ip6_route_output(net, NULL, &fl6);
        if (!dst->error)
@@ -1187,7 +1184,7 @@ void ip6_redirect(struct sk_buff *skb, struct net *net, int oif, u32 mark)
        fl6.flowi6_flags = 0;
        fl6.daddr = iph->daddr;
        fl6.saddr = iph->saddr;
-       fl6.flowlabel = (*(__be32 *) iph) & IPV6_FLOWINFO_MASK;
+       fl6.flowlabel = ip6_flowinfo(iph);
 
        dst = ip6_route_output(net, NULL, &fl6);
        if (!dst->error)
@@ -1810,10 +1807,9 @@ static void rt6_do_redirect(struct dst_entry *dst, struct sock *sk, struct sk_bu
                goto out;
 
        netevent.old = &rt->dst;
-       netevent.old_neigh = old_neigh;
        netevent.new = &nrt->dst;
-       netevent.new_neigh = neigh;
        netevent.daddr = &msg->dest;
+       netevent.neigh = neigh;
        call_netevent_notifiers(NETEVENT_REDIRECT, &netevent);
 
        if (rt->rt6i_flags & RTF_CACHE) {
This page took 0.036031 seconds and 5 git commands to generate.