From: Pravin B Shelar Date: Sat, 26 Jan 2013 02:09:07 +0000 (-0800) Subject: datapath: Clear struct ovs_key_ipv4_tunnel padding. X-Git-Tag: sliver-openvswitch-1.9.90-3~3^2~20 X-Git-Url: http://git.onelab.eu/?p=sliver-openvswitch.git;a=commitdiff_plain;h=fa54c2d93ba08c61e97b7e04d1bc0c132ad1d81d 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 --- 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,