Skip to content

Commit

Permalink
ipfix: fix upcall cookie size checks to support 8 byte cookies
Browse files Browse the repository at this point in the history
Commit 96ed775 resizes all userspace metadata to be 8 bytes minimum.
Fix the upcall size checks accordingly.

Signed-off-by: Romain Lenglet <[email protected]>
Signed-off-by: Ben Pfaff <[email protected]>
  • Loading branch information
rlenglet authored and blp committed Feb 19, 2014
1 parent d393d96 commit d78d1be
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions ofproto/ofproto-dpif.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit d78d1be

Please sign in to comment.