[ovs-dev] [PATCH 1/2] datapath: Increase size of max nlattr-formatted flow to 132.

Justin Pettit jpettit at nicira.com
Mon Feb 7 06:54:27 UTC 2011


The addition of IPv6 matching increased the maximum size of a
nlattr-formatted flow.  This was not properly reflected in the userspace
and kernel #defines that reserve space for the flows and could lead to
crashes.  This commit increases the size uniformly to 132 bytes.
---
 datapath/flow.h |    4 ++--
 lib/odp-util.h  |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/datapath/flow.h b/datapath/flow.h
index 21df5fb..c003393 100644
--- a/datapath/flow.h
+++ b/datapath/flow.h
@@ -108,9 +108,9 @@ u32 flow_hash(const struct sw_flow_key *);
 int flow_cmp(const struct tbl_node *, void *target);
 
 /* By my calculations currently the longest valid nlattr-formatted flow key is
- * 80 bytes long, so this leaves some safety margin.
+ * 132 bytes long, so this leaves some safety margin.
  */
-#define FLOW_BUFSIZE 96
+#define FLOW_BUFSIZE 148
 
 int flow_to_nlattrs(const struct sw_flow_key *, struct sk_buff *);
 int flow_from_nlattrs(struct sw_flow_key *swkey, const struct nlattr *);
diff --git a/lib/odp-util.h b/lib/odp-util.h
index 074df87..452c5cf 100644
--- a/lib/odp-util.h
+++ b/lib/odp-util.h
@@ -64,13 +64,13 @@ void format_odp_actions(struct ds *, const struct nlattr *odp_actions,
                         size_t actions_len);
 
 /* By my calculations currently the longest valid nlattr-formatted flow key is
- * 124 bytes long, so this leaves some safety margin.
+ * 132 bytes long, so this leaves some safety margin.
  *
  * We allocate temporary on-stack buffers for flow keys as arrays of uint32_t
  * to ensure proper 32-bit alignment for Netlink attributes.  (An array of
  * "struct nlattr" might not, in theory, be sufficiently aligned because it
  * only contains 16-bit types.) */
-#define ODPUTIL_FLOW_KEY_BYTES 144
+#define ODPUTIL_FLOW_KEY_BYTES 148
 #define ODPUTIL_FLOW_KEY_U32S DIV_ROUND_UP(ODPUTIL_FLOW_KEY_BYTES, 4)
 
 void odp_flow_key_format(const struct nlattr *, size_t, struct ds *);
-- 
1.7.1





More information about the dev mailing list