[ovs-dev] [PATCH] datapath: Clear struct ovs_key_ipv4_tunnel padding.
Pravin B Shelar
pshelar at nicira.com
Sat Jan 26 01:54:00 UTC 2013
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 at nicira.com>
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 dab6980..6949640 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 b7de7a9..82c5cca 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,
--
1.7.10
More information about the dev
mailing list