From 29b639ed7522594dac03bd10ad477f2f188ce4b6 Mon Sep 17 00:00:00 2001 From: Ethan Jackson Date: Fri, 3 Dec 2010 15:43:24 -0800 Subject: [PATCH] lib: Add zero padding field to flow_wildcards. Before this commit, the compiler would add two bytes of padding to the 'flow_wildcards' structure to achieve 32bit alignment. These two bytes had inconsistent values which caused 'flow_wildcards_hash' to behave inconsistently. This commit explicitly 32bit aligns 'flow_wildcards' with zero padding. This commit also fixes an issue where in-band rules were not getting deleted when in-band control was disabled. --- lib/flow.c | 2 ++ lib/flow.h | 1 + 2 files changed, 3 insertions(+) diff --git a/lib/flow.c b/lib/flow.c index 7198f7d7..ebbd927a 100644 --- a/lib/flow.c +++ b/lib/flow.c @@ -306,6 +306,7 @@ flow_wildcards_init_catchall(struct flow_wildcards *wc) wc->nw_dst_mask = htonl(0); memset(wc->reg_masks, 0, sizeof wc->reg_masks); wc->vlan_tci_mask = htons(0); + wc->zero = 0; } /* Initializes 'wc' as an exact-match set of wildcards; that is, 'wc' does not @@ -318,6 +319,7 @@ flow_wildcards_init_exact(struct flow_wildcards *wc) wc->nw_dst_mask = htonl(UINT32_MAX); memset(wc->reg_masks, 0xff, sizeof wc->reg_masks); wc->vlan_tci_mask = htons(UINT16_MAX); + wc->zero = 0; } /* Returns true if 'wc' is exact-match, false if 'wc' wildcards any bits or diff --git a/lib/flow.h b/lib/flow.h index fd3246b6..1509a7d1 100644 --- a/lib/flow.h +++ b/lib/flow.h @@ -124,6 +124,7 @@ struct flow_wildcards { ovs_be32 nw_src_mask; /* 1-bit in each significant nw_src bit. */ ovs_be32 nw_dst_mask; /* 1-bit in each significant nw_dst bit. */ ovs_be16 vlan_tci_mask; /* 1-bit in each significant vlan_tci bit. */ + uint16_t zero; /* Padding field set to zero. */ }; void flow_wildcards_init_catchall(struct flow_wildcards *); -- 2.30.2