X25: Move interrupt flag to bitfield
[safe/jmp/linux-2.6] / net / ipv6 / route.c
index 8500156..05ebd78 100644 (file)
@@ -40,6 +40,7 @@
 #include <linux/proc_fs.h>
 #include <linux/seq_file.h>
 #include <linux/nsproxy.h>
+#include <linux/slab.h>
 #include <net/net_namespace.h>
 #include <net/snmp.h>
 #include <net/ipv6.h>
@@ -814,20 +815,13 @@ struct dst_entry * ip6_route_output(struct net *net, struct sock *sk,
 {
        int flags = 0;
 
-       if (rt6_need_strict(&fl->fl6_dst))
+       if (fl->oif || rt6_need_strict(&fl->fl6_dst))
                flags |= RT6_LOOKUP_F_IFACE;
 
        if (!ipv6_addr_any(&fl->fl6_src))
                flags |= RT6_LOOKUP_F_HAS_SADDR;
-       else if (sk) {
-               unsigned int prefs = inet6_sk(sk)->srcprefs;
-               if (prefs & IPV6_PREFER_SRC_TMP)
-                       flags |= RT6_LOOKUP_F_SRCPREF_TMP;
-               if (prefs & IPV6_PREFER_SRC_PUBLIC)
-                       flags |= RT6_LOOKUP_F_SRCPREF_PUBLIC;
-               if (prefs & IPV6_PREFER_SRC_COA)
-                       flags |= RT6_LOOKUP_F_SRCPREF_COA;
-       }
+       else if (sk)
+               flags |= rt6_srcprefs2flags(inet6_sk(sk)->srcprefs);
 
        return fib6_rule_lookup(net, fl, flags, ip6_pol_route_output);
 }
@@ -886,7 +880,7 @@ static struct dst_entry *ip6_dst_check(struct dst_entry *dst, u32 cookie)
 
        rt = (struct rt6_info *) dst;
 
-       if (rt && rt->rt6i_node && (rt->rt6i_node->fn_sernum == cookie))
+       if (rt->rt6i_node && (rt->rt6i_node->fn_sernum == cookie))
                return dst;
 
        return NULL;
@@ -897,19 +891,24 @@ static struct dst_entry *ip6_negative_advice(struct dst_entry *dst)
        struct rt6_info *rt = (struct rt6_info *) dst;
 
        if (rt) {
-               if (rt->rt6i_flags & RTF_CACHE)
-                       ip6_del_rt(rt);
-               else
+               if (rt->rt6i_flags & RTF_CACHE) {
+                       if (rt6_check_expired(rt)) {
+                               ip6_del_rt(rt);
+                               dst = NULL;
+                       }
+               } else {
                        dst_release(dst);
+                       dst = NULL;
+               }
        }
-       return NULL;
+       return dst;
 }
 
 static void ip6_link_failure(struct sk_buff *skb)
 {
        struct rt6_info *rt;
 
-       icmpv6_send(skb, ICMPV6_DEST_UNREACH, ICMPV6_ADDR_UNREACH, 0, skb->dev);
+       icmpv6_send(skb, ICMPV6_DEST_UNREACH, ICMPV6_ADDR_UNREACH, 0);
 
        rt = (struct rt6_info *) skb_dst(skb);
        if (rt) {
@@ -1873,7 +1872,7 @@ static int ip6_pkt_drop(struct sk_buff *skb, u8 code, int ipstats_mib_noroutes)
        switch (ipstats_mib_noroutes) {
        case IPSTATS_MIB_INNOROUTES:
                type = ipv6_addr_type(&ipv6_hdr(skb)->daddr);
-               if (type == IPV6_ADDR_ANY || type == IPV6_ADDR_RESERVED) {
+               if (type == IPV6_ADDR_ANY) {
                        IP6_INC_STATS(dev_net(dst->dev), ip6_dst_idev(dst),
                                      IPSTATS_MIB_INADDRERRORS);
                        break;
@@ -1884,7 +1883,7 @@ static int ip6_pkt_drop(struct sk_buff *skb, u8 code, int ipstats_mib_noroutes)
                              ipstats_mib_noroutes);
                break;
        }
-       icmpv6_send(skb, ICMPV6_DEST_UNREACH, code, 0, skb->dev);
+       icmpv6_send(skb, ICMPV6_DEST_UNREACH, code, 0);
        kfree_skb(skb);
        return 0;
 }