From d78d1be130dd6d1dde0d9b62d9af87a78f2da764 Mon Sep 17 00:00:00 2001 From: Romain Lenglet Date: Tue, 11 Feb 2014 15:21:08 -0800 Subject: [PATCH] ipfix: fix upcall cookie size checks to support 8 byte cookies Commit 96ed775f resizes all userspace metadata to be 8 bytes minimum. Fix the upcall size checks accordingly. Signed-off-by: Romain Lenglet Signed-off-by: Ben Pfaff --- ofproto/ofproto-dpif.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c index 61f55c944f0..af314b84340 100644 --- a/ofproto/ofproto-dpif.c +++ b/ofproto/ofproto-dpif.c @@ -4251,16 +4251,16 @@ classify_upcall(const struct dpif_upcall *upcall) } memset(&cookie, 0, sizeof cookie); memcpy(&cookie, nl_attr_get(upcall->userdata), userdata_len); - if (userdata_len == sizeof cookie.sflow + if (userdata_len == MAX(8, sizeof cookie.sflow) && cookie.type == USER_ACTION_COOKIE_SFLOW) { return SFLOW_UPCALL; - } else if (userdata_len == sizeof cookie.slow_path + } else if (userdata_len == MAX(8, sizeof cookie.slow_path) && cookie.type == USER_ACTION_COOKIE_SLOW_PATH) { return MISS_UPCALL; - } else if (userdata_len == sizeof cookie.flow_sample + } else if (userdata_len == MAX(8, sizeof cookie.flow_sample) && cookie.type == USER_ACTION_COOKIE_FLOW_SAMPLE) { return FLOW_SAMPLE_UPCALL; - } else if (userdata_len == sizeof cookie.ipfix + } else if (userdata_len == MAX(8, sizeof cookie.ipfix) && cookie.type == USER_ACTION_COOKIE_IPFIX) { return IPFIX_UPCALL; } else {