Merge branch 'mvebu/fixes' into mvebu/dt
[cascardo/linux.git] / net / ipv6 / route.c
index 826e6aa..ed44663 100644 (file)
@@ -62,6 +62,7 @@
 #include <net/lwtunnel.h>
 #include <net/ip_tunnels.h>
 #include <net/l3mdev.h>
+#include <trace/events/fib6.h>
 
 #include <asm/uaccess.h>
 
@@ -865,6 +866,9 @@ restart:
        }
        dst_use(&rt->dst, jiffies);
        read_unlock_bh(&table->tb6_lock);
+
+       trace_fib6_table_lookup(net, rt, table->tb6_id, fl6);
+
        return rt;
 
 }
@@ -1078,6 +1082,8 @@ redo_rt6_select:
                read_unlock_bh(&table->tb6_lock);
 
                rt6_dst_from_metrics_check(rt);
+
+               trace_fib6_table_lookup(net, rt, table->tb6_id, fl6);
                return rt;
        } else if (unlikely((fl6->flowi6_flags & FLOWI_FLAG_KNOWN_NH) &&
                            !(rt->rt6i_flags & RTF_GATEWAY))) {
@@ -1101,6 +1107,8 @@ redo_rt6_select:
                        uncached_rt = net->ipv6.ip6_null_entry;
 
                dst_hold(&uncached_rt->dst);
+
+               trace_fib6_table_lookup(net, uncached_rt, table->tb6_id, fl6);
                return uncached_rt;
 
        } else {
@@ -1125,6 +1133,7 @@ redo_rt6_select:
                        dst_release(&rt->dst);
                }
 
+               trace_fib6_table_lookup(net, pcpu_rt, table->tb6_id, fl6);
                return pcpu_rt;
 
        }
@@ -1174,11 +1183,10 @@ static struct rt6_info *ip6_pol_route_output(struct net *net, struct fib6_table
        return ip6_pol_route(net, table, fl6->flowi6_oif, fl6, flags);
 }
 
-struct dst_entry *ip6_route_output(struct net *net, const struct sock *sk,
-                                   struct flowi6 *fl6)
+struct dst_entry *ip6_route_output_flags(struct net *net, const struct sock *sk,
+                                        struct flowi6 *fl6, int flags)
 {
        struct dst_entry *dst;
-       int flags = 0;
        bool any_src;
 
        dst = l3mdev_rt6_dst_by_oif(net, fl6);
@@ -1199,7 +1207,7 @@ struct dst_entry *ip6_route_output(struct net *net, const struct sock *sk,
 
        return fib6_rule_lookup(net, fl6, flags, ip6_pol_route_output);
 }
-EXPORT_SYMBOL(ip6_route_output);
+EXPORT_SYMBOL_GPL(ip6_route_output_flags);
 
 struct dst_entry *ip6_blackhole_route(struct net *net, struct dst_entry *dst_orig)
 {
@@ -1474,6 +1482,7 @@ out:
 
        read_unlock_bh(&table->tb6_lock);
 
+       trace_fib6_table_lookup(net, rt, table->tb6_id, fl6);
        return rt;
 };
 
@@ -2699,6 +2708,7 @@ static const struct nla_policy rtm_ipv6_policy[RTA_MAX+1] = {
        [RTA_PREF]              = { .type = NLA_U8 },
        [RTA_ENCAP_TYPE]        = { .type = NLA_U16 },
        [RTA_ENCAP]             = { .type = NLA_NESTED },
+       [RTA_EXPIRES]           = { .type = NLA_U32 },
 };
 
 static int rtm_to_fib6_config(struct sk_buff *skb, struct nlmsghdr *nlh,
@@ -2799,6 +2809,15 @@ static int rtm_to_fib6_config(struct sk_buff *skb, struct nlmsghdr *nlh,
        if (tb[RTA_ENCAP_TYPE])
                cfg->fc_encap_type = nla_get_u16(tb[RTA_ENCAP_TYPE]);
 
+       if (tb[RTA_EXPIRES]) {
+               unsigned long timeout = addrconf_timeout_fixup(nla_get_u32(tb[RTA_EXPIRES]), HZ);
+
+               if (addrconf_finite_timeout(timeout)) {
+                       cfg->fc_expires = jiffies_to_clock_t(timeout * HZ);
+                       cfg->fc_flags |= RTF_EXPIRES;
+               }
+       }
+
        err = 0;
 errout:
        return err;