From fa54c2d93ba08c61e97b7e04d1bc0c132ad1d81d Mon Sep 17 00:00:00 2001 From: Pravin B Shelar Date: Fri, 25 Jan 2013 18:09:07 -0800 Subject: [PATCH] datapath: Clear struct ovs_key_ipv4_tunnel padding. 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 Acked-by: Jesse Gross Bug #14843 --- datapath/flow.h | 5 +++++ datapath/tunnel.h | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/datapath/flow.h b/datapath/flow.h index dab698095..694964051 100644 --- a/datapath/flow.h +++ b/datapath/flow.h @@ -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; diff --git a/datapath/tunnel.h b/datapath/tunnel.h index b7de7a986..82c5cca62 100644 --- a/datapath/tunnel.h +++ b/datapath/tunnel.h @@ -201,6 +201,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, -- 2.43.0