aboutsummaryrefslogtreecommitdiff
path: root/tests
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:23:06 -0700
commit2804161f53be93be4518531418eeec73c6276f76 (patch)
tree675fc08d1b074e7a28590bbde899cc8a931443a2 /tests
parentfda1b93b2e3ac564c3338d9af4e4d9d06e58ce38 (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')
-rw-r--r--tests/odp.at6
-rw-r--r--tests/test-odp.c9
2 files changed, 14 insertions, 1 deletions
diff --git a/tests/odp.at b/tests/odp.at
index 90a11920..3e7a8adb 100644
--- a/tests/odp.at
+++ b/tests/odp.at
@@ -48,6 +48,12 @@ s/\(eth([[^)]]*)\),*/\1,eth_type(0x8100),vlan(vid=99,pcp=7),encap(/
s/$/)/' odp-base.txt
echo
+ echo '# Valid forms with QOS priority, tun_id, and VLAN headers.'
+ sed 's/^/priority(1234),tun_id(0xfedcba9876543210),/
+s/\(eth([[^)]]*)\),*/\1,eth_type(0x8100),vlan(vid=99,pcp=7),encap(/
+s/$/)/' odp-base.txt
+
+ echo
echo '# Valid forms with IP first fragment.'
sed -n 's/,frag=no),/,frag=first),/p' odp-base.txt
diff --git a/tests/test-odp.c b/tests/test-odp.c
index 123db71a..d2612cfc 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;
}