Prepare Open vSwitch 1.1.2 release.
[sliver-openvswitch.git] / datapath / tunnel.c
index a7d4943..899d1cd 100644 (file)
@@ -804,7 +804,7 @@ static void create_tunnel_header(const struct vport *vport,
        iph->saddr      = rt->rt_src;
        iph->ttl        = mutable->ttl;
        if (!iph->ttl)
-               iph->ttl = dst_metric(&rt_dst(rt), RTAX_HOPLIMIT);
+               iph->ttl = ip4_dst_hoplimit(&rt_dst(rt));
 
        tnl_vport->tnl_ops->build_header(vport, mutable, iph + 1);
 }
@@ -991,6 +991,7 @@ static struct rtable *find_route(struct vport *vport,
                return cur_cache->rt;
        } else {
                struct rtable *rt;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39)
                struct flowi fl = { .nl_u = { .ip4_u =
                                              { .daddr = mutable->daddr,
                                                .saddr = mutable->saddr,
@@ -999,6 +1000,16 @@ static struct rtable *find_route(struct vport *vport,
 
                if (unlikely(ip_route_output_key(&init_net, &rt, &fl)))
                        return NULL;
+#else
+               struct flowi4 fl = { .daddr = mutable->daddr,
+                                    .saddr = mutable->saddr,
+                                    .flowi4_tos = tos,
+                                    .flowi4_proto = tnl_vport->tnl_ops->ipproto };
+
+               rt = ip_route_output_key(&init_net, &fl);
+               if (IS_ERR(rt))
+                       return NULL;
+#endif
 
                if (likely(tos == mutable->tos))
                        *cache = build_cache(vport, mutable, rt);
@@ -1233,7 +1244,7 @@ int tnl_send(struct vport *vport, struct sk_buff *skb)
        /* TTL */
        ttl = mutable->ttl;
        if (!ttl)
-               ttl = dst_metric(&rt_dst(rt), RTAX_HOPLIMIT);
+               ttl = ip4_dst_hoplimit(&rt_dst(rt));
 
        if (mutable->flags & TNL_F_TTL_INHERIT) {
                if (skb->protocol == htons(ETH_P_IP))