tun_key should always be present and correct in ovs_tnl_send()

It ought to be possible to handle the ttl entirely
in user-space. This is not implemented yet. However, the
TNL_F_TOS_INHERIT is currently never set.

Cc: Kyle Mestery <kmest...@cisco.com>
Signed-off-by: Simon Horman <ho...@verge.net.au>
---
 datapath/tunnel.c |   10 ++--------
 datapath/tunnel.h |    4 ----
 2 files changed, 2 insertions(+), 12 deletions(-)

diff --git a/datapath/tunnel.c b/datapath/tunnel.c
index 9722f64..146bb57 100644
--- a/datapath/tunnel.c
+++ b/datapath/tunnel.c
@@ -897,10 +897,8 @@ int ovs_tnl_send(struct vport *vport, struct sk_buff *skb)
 
        if (mutable->flags & TNL_F_TOS_INHERIT)
                tos = inner_tos;
-       else if (OVS_CB(skb)->tun_key)
-               tos = OVS_CB(skb)->tun_key->ipv4_tos;
        else
-               tos = mutable->tos;
+               tos = OVS_CB(skb)->tun_key->ipv4_tos;
 
        tos = INET_ECN_encapsulate(tos, inner_tos);
 
@@ -937,11 +935,7 @@ int ovs_tnl_send(struct vport *vport, struct sk_buff *skb)
                dst_hold(unattached_dst);
        }
 
-       /* TTL */
-       if (OVS_CB(skb)->tun_key)
-               ttl = OVS_CB(skb)->tun_key->ipv4_ttl;
-       else
-               ttl = mutable->ttl;
+       ttl = OVS_CB(skb)->tun_key->ipv4_ttl;
        if (!ttl)
                ttl = ip4_dst_hoplimit(&rt_dst(rt));
        if (mutable->flags & TNL_F_TTL_INHERIT) {
diff --git a/datapath/tunnel.h b/datapath/tunnel.h
index ed3b4ec..330df27 100644
--- a/datapath/tunnel.h
+++ b/datapath/tunnel.h
@@ -99,8 +99,6 @@ static inline void port_key_set_net(struct port_lookup_key 
*key, struct net *net
  * (e.g. ICMP fragmentation needed messages).
  * @out_key: Key to use on output, 0 if this tunnel has no fixed output key.
  * @flags: TNL_F_* flags.
- * @tos: IPv4 TOS value to use for tunnel, 0 if no fixed TOS.
- * @ttl: IPv4 TTL value to use for tunnel, 0 if no fixed TTL.
  */
 struct tnl_mutable_config {
        struct port_lookup_key key;
@@ -115,8 +113,6 @@ struct tnl_mutable_config {
        /* Configured via OVS_TUNNEL_ATTR_* attributes. */
        __be64  out_key;
        u32     flags;
-       u8      tos;
-       u8      ttl;
 };
 
 struct tnl_ops {
-- 
1.7.10

_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to