datapath: Clear struct ovs_key_ipv4_tunnel padding.
authorPravin B Shelar <pshelar@nicira.com>
Sat, 26 Jan 2013 02:09:07 +0000 (18:09 -0800)
committerPravin B Shelar <pshelar@nicira.com>
Sat, 26 Jan 2013 02:10:13 +0000 (18:10 -0800)
Following patch memset ovs_key_ipv4_tunnel padding area so that
packets from a flow would be mapped to same flow in kernel datapath
flow table.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
Bug #14843

datapath/flow.h
datapath/tunnel.h

index 4bc185b..924d99a 100644 (file)
@@ -45,6 +45,11 @@ struct sw_flow_actions {
 #define OVS_TNL_F_CSUM                 (1 << 1)
 #define OVS_TNL_F_KEY                  (1 << 2)
 
+/* Used to memset ovs_key_ipv4_tunnel padding. */
+#define OVS_TUNNEL_KEY_SIZE                                    \
+        (offsetof(struct ovs_key_ipv4_tunnel, ipv4_ttl) +      \
+         FIELD_SIZEOF(struct ovs_key_ipv4_tunnel, ipv4_ttl))
+
 struct ovs_key_ipv4_tunnel {
        __be64 tun_id;
        __be32 ipv4_src;
index c268057..1aa57bc 100644 (file)
@@ -199,6 +199,10 @@ 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;
+
+       /* clear struct padding. */
+       memset((unsigned char*) tun_key + OVS_TUNNEL_KEY_SIZE, 0,
+              sizeof(*tun_key) - OVS_TUNNEL_KEY_SIZE);
 }
 
 static inline void tnl_get_param(const struct tnl_mutable_config *mutable,