If a key used to find a port then we mark it as being not present
(previously this was accomplished by setting it to zero). However,
we also still pass the key to userspace which could lead to an
inconsistent state. This also zeros out the key as before in order
to make our reported results consistent.
Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Kyle Mestery <kmestery@cisco.com>
}
if (key_present && mutable->key.daddr &&
}
if (key_present && mutable->key.daddr &&
- !(mutable->flags & TNL_F_IN_KEY_MATCH))
+ !(mutable->flags & TNL_F_IN_KEY_MATCH)) {
tnl_tun_key_init(&tun_key, iph, key, key_present ? OVS_TNL_F_KEY : 0);
OVS_CB(skb)->tun_key = &tun_key;
tnl_tun_key_init(&tun_key, iph, key, key_present ? OVS_TNL_F_KEY : 0);
OVS_CB(skb)->tun_key = &tun_key;
}
static u32 gre_flags_to_tunnel_flags(const struct tnl_mutable_config *mutable,
}
static u32 gre_flags_to_tunnel_flags(const struct tnl_mutable_config *mutable,
+ __be16 gre_flags, __be64 *key)
{
u32 tunnel_flags = 0;
if (gre_flags & GRE_KEY) {
{
u32 tunnel_flags = 0;
if (gre_flags & GRE_KEY) {
- if (mutable->key.daddr && (mutable->flags & TNL_F_IN_KEY_MATCH))
- tunnel_flags = OVS_TNL_F_KEY;
- else if (!mutable->key.daddr)
+ if (mutable->flags & TNL_F_IN_KEY_MATCH ||
+ !mutable->key.daddr)
tunnel_flags = OVS_TNL_F_KEY;
tunnel_flags = OVS_TNL_F_KEY;
}
if (gre_flags & GRE_CSUM)
}
if (gre_flags & GRE_CSUM)
int hdr_len;
struct iphdr *iph;
struct ovs_key_ipv4_tunnel tun_key;
int hdr_len;
struct iphdr *iph;
struct ovs_key_ipv4_tunnel tun_key;
+ __be16 gre_flags;
+ u32 tnl_flags;
__be64 key;
u32 tunnel_type;
__be64 key;
u32 tunnel_type;
if (unlikely(!check_checksum(skb)))
goto error;
if (unlikely(!check_checksum(skb)))
goto error;
- hdr_len = parse_header(ip_hdr(skb), &flags, &key, &tunnel_type);
+ hdr_len = parse_header(ip_hdr(skb), &gre_flags, &key, &tunnel_type);
if (unlikely(hdr_len < 0))
goto error;
if (unlikely(hdr_len < 0))
goto error;
- tnl_tun_key_init(&tun_key, iph, key, gre_flags_to_tunnel_flags(mutable, flags));
+ tnl_flags = gre_flags_to_tunnel_flags(mutable, gre_flags, &key);
+ tnl_tun_key_init(&tun_key, iph, key, tnl_flags);
OVS_CB(skb)->tun_key = &tun_key;
__skb_pull(skb, hdr_len);
OVS_CB(skb)->tun_key = &tun_key;
__skb_pull(skb, hdr_len);