openvswitch: Remove Linux bridge compatibility.
[sliver-openvswitch.git] / datapath / tunnel.c
index efc8b1c..ae99cc1 100644 (file)
@@ -49,7 +49,6 @@
 #include "tunnel.h"
 #include "vlan.h"
 #include "vport.h"
-#include "vport-generic.h"
 #include "vport-internal_dev.h"
 
 #define PORT_TABLE_SIZE  1024
@@ -273,6 +272,7 @@ struct vport *ovs_tnl_find_port(struct net *net, __be32 saddr, __be32 daddr,
        if (null_ports) {
                lookup.daddr = 0;
                lookup.saddr = 0;
+               lookup.in_key = 0;
                lookup.tunnel_type = tunnel_type;
                vport = port_table_lookup(&lookup, mutable);
                if (vport)
@@ -636,7 +636,7 @@ static bool check_mtu(struct sk_buff *skb,
        if (OVS_CB(skb)->tun_key->ipv4_dst) {
                df_inherit = false;
                pmtud = false;
-               frag_off = OVS_CB(skb)->tun_key->tun_flags & OVS_FLOW_TNL_F_DONT_FRAGMENT ?
+               frag_off = OVS_CB(skb)->tun_key->tun_flags & OVS_TNL_F_DONT_FRAGMENT ?
                                  htons(IP_DF) : 0;
        } else {
                df_inherit = mutable->flags & TNL_F_DF_INHERIT;
@@ -1042,6 +1042,7 @@ static const struct nla_policy tnl_policy[OVS_TUNNEL_ATTR_MAX + 1] = {
        [OVS_TUNNEL_ATTR_IN_KEY]   = { .type = NLA_U64 },
        [OVS_TUNNEL_ATTR_TOS]      = { .type = NLA_U8 },
        [OVS_TUNNEL_ATTR_TTL]      = { .type = NLA_U8 },
+       [OVS_TUNNEL_ATTR_DST_PORT] = { .type = NLA_U16 },
 };
 
 /* Sets OVS_TUNNEL_ATTR_* fields in 'mutable', which must initially be
@@ -1087,6 +1088,10 @@ static int tnl_set_config(struct net *net, struct nlattr *options,
        if (a[OVS_TUNNEL_ATTR_TTL])
                mutable->ttl = nla_get_u8(a[OVS_TUNNEL_ATTR_TTL]);
 
+       if (a[OVS_TUNNEL_ATTR_DST_PORT])
+               mutable->dst_port =
+                       htons(nla_get_u16(a[OVS_TUNNEL_ATTR_DST_PORT]));
+
        if (!a[OVS_TUNNEL_ATTR_IN_KEY]) {
                mutable->key.tunnel_type |= TNL_T_KEY_MATCH;
                mutable->flags |= TNL_F_IN_KEY_MATCH;
@@ -1242,6 +1247,9 @@ int ovs_tnl_get_options(const struct vport *vport, struct sk_buff *skb)
                goto nla_put_failure;
        if (mutable->ttl && nla_put_u8(skb, OVS_TUNNEL_ATTR_TTL, mutable->ttl))
                goto nla_put_failure;
+       if (mutable->dst_port && nla_put_u16(skb, OVS_TUNNEL_ATTR_DST_PORT,
+                                            ntohs(mutable->dst_port)))
+               goto nla_put_failure;
 
        return 0;