aboutsummaryrefslogtreecommitdiff
path: root/tests/test-odp.c
diff options
context:
space:
mode:
authorBen Pfaff <blp@nicira.com>2012-05-15 12:50:57 -0700
committerBen Pfaff <blp@nicira.com>2012-05-16 12:29:42 -0700
commit11f84dce005dd14a374ab2ef5f8c25bcf8285a36 (patch)
tree93bc032ebdd7c4b2cef901ac9ce2c5814be2bc91 /tests/test-odp.c
parent776cf91b42f631b4929fffe8ddd2aa06b40ea24c (diff)
odp-util: Update ODPUTIL_FLOW_KEY_BYTES for current kernel flow format.
Before we submitted the kernel module upstream, we updated the flow format by adding two fields to the description of packets with VLAN headers, but we forgot to update ODPUTIL_FLOW_KEY_BYTES to reflect these changes. The result was that a maximum-length flow did not fit in the given space. This fixes a crash processing IPv6 neighbor discovery packets with VLAN headers received in a tunnel configured with key=flow or in_key=flow. This updates some comments to better describe the implications of ODPUTIL_FLOW_KEY_BYTES (suggested by Justin). This also updates test-odp.c so that it would have caught this problem, and updates odp.at to demonstrate that a full 156 bytes are necessary. (To see that, revert the change to ODPUTIL_FLOW_KEY_BYTES and run the test.) Reported-by: Dan Wendlandt <dan@nicira.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
Diffstat (limited to 'tests/test-odp.c')
-rw-r--r--tests/test-odp.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/tests/test-odp.c b/tests/test-odp.c
index 9ae897c5..46533ea9 100644
--- a/tests/test-odp.c
+++ b/tests/test-odp.c
@@ -27,6 +27,7 @@
int
main(void)
{
+ int exit_code = 0;
struct ds in;
ds_init(&in);
@@ -85,6 +86,12 @@ main(void)
ofpbuf_init(&odp_key, 0);
odp_flow_key_from_flow(&odp_key, &flow);
+ if (odp_key.size > ODPUTIL_FLOW_KEY_BYTES) {
+ printf ("too long: %zu > %d\n",
+ odp_key.size, ODPUTIL_FLOW_KEY_BYTES);
+ exit_code = 1;
+ }
+
/* Convert odp_key to string. */
ds_init(&out);
odp_flow_key_format(odp_key.data, odp_key.size, &out);
@@ -96,5 +103,5 @@ main(void)
}
ds_destroy(&in);
- return 0;
+ return exit_code;
}