From: Jesse Gross Date: Mon, 31 Dec 2012 20:28:41 +0000 (-0800) Subject: datapath: Initialize tunnel_key pad member. X-Git-Tag: v1.9.0~37 X-Git-Url: http://git.cascardo.eti.br/?p=cascardo%2Fovs.git;a=commitdiff_plain;h=968b25dc15d34373e6f98f8fe6aa8d4dc1356524 datapath: Initialize tunnel_key pad member. When a packet is received on a tunnel the pad member is currently left uninitialized. This didn't previously cause problems because userspace didn't interprete the IPV4_TUNNEL attribute and blindly copied back the uninitialized data. However, now that userspace knows how to serialize this attribute it was zeroing it out, which prevented flows that had been previously installed from being deleted. In addition to zeroing out the padding on packet reception, it also does the same thing on flow setup since we should be ignoring the value. Reported-by: Anand Krishnamurthy Reported-by: Saul St. John Signed-off-by: Jesse Gross Acked-by: Ben Pfaff Conflicts: datapath/flow.c --- diff --git a/datapath/flow.c b/datapath/flow.c index 65d6cce98..4cded7758 100644 --- a/datapath/flow.c +++ b/datapath/flow.c @@ -1054,6 +1054,8 @@ int ovs_flow_from_nlattrs(struct sw_flow_key *swkey, int *key_lenp, memcpy(&swkey->phy.tun.tun_key, tun_key, sizeof(swkey->phy.tun.tun_key)); + memset(swkey->phy.tun.tun_key.pad, 0, + sizeof(swkey->phy.tun.tun_key.pad)); attrs &= ~(1ULL << OVS_KEY_ATTR_TUN_ID); attrs &= ~(1ULL << OVS_KEY_ATTR_IPV4_TUNNEL); @@ -1066,6 +1068,8 @@ int ovs_flow_from_nlattrs(struct sw_flow_key *swkey, int *key_lenp, memcpy(&swkey->phy.tun.tun_key, tun_key, sizeof(swkey->phy.tun.tun_key)); + memset(swkey->phy.tun.tun_key.pad, 0, + sizeof(swkey->phy.tun.tun_key.pad)); attrs &= ~(1ULL << OVS_KEY_ATTR_IPV4_TUNNEL); } diff --git a/datapath/tunnel.h b/datapath/tunnel.h index c2680571f..cd252f45a 100644 --- a/datapath/tunnel.h +++ b/datapath/tunnel.h @@ -199,6 +199,7 @@ static inline void tnl_tun_key_init(struct ovs_key_ipv4_tunnel *tun_key, tun_key->ipv4_tos = iph->tos; tun_key->ipv4_ttl = iph->ttl; tun_key->tun_flags = tun_flags; + memset(tun_key->pad, 0, sizeof(tun_key->pad)); } static inline void tnl_get_param(const struct tnl_mutable_config *mutable,