From 7d332293f8f8d3faa50ba6faf415af864d32b686 Mon Sep 17 00:00:00 2001 From: Justin Pettit Date: Sun, 6 Feb 2011 22:39:09 -0800 Subject: [PATCH] datapath: Increase size of max nlattr-formatted flow to 132. 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. Signed-off-by: Justin Pettit Acked-by: Jesse Gross --- 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 21df5fbee..9cf5c678c 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. */ -#define FLOW_BUFSIZE 96 +#define FLOW_BUFSIZE 132 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 074df87fb..d991b19a6 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. * * 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 132 #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 *); -- 2.43.0