Commit f8231335 authored by Ben Pfaff's avatar Ben Pfaff

ofp-util: Require inner and outer message in bundle add to be same version.

It doesn't make sense for the messages added to a bundle to have a
different OpenFlow version from the outer OpenFlow version.
Signed-off-by: default avatarBen Pfaff <blp@nicira.com>
Acked-by: default avatarJarno Rajahalme <jrajahalme@nicira.com>
parent d50b88bf
......@@ -675,6 +675,10 @@ enum ofperr {
/* OF1.4+(17,15). Bundle is locking the resource. */
OFPERR_OFPBFC_BUNDLE_IN_PROGRESS,
/* NX1.4+(22). In an OFPT_BUNDLE_ADD_MESSAGE, the OpenFlow version in the
* inner and outer messages differ. */
OFPERR_NXBFC_BAD_VERSION,
/* ## ------------------------- ## */
/* ## OFPET_FLOW_MONITOR_FAILED ## */
/* ## ------------------------- ## */
......
......@@ -8849,6 +8849,9 @@ ofputil_decode_bundle_add(const struct ofp_header *oh,
msg->flags = ntohs(m->flags);
msg->msg = b.data;
if (msg->msg->version != oh->version) {
return OFPERR_NXBFC_BAD_VERSION;
}
inner_len = ntohs(msg->msg->length);
if (inner_len < sizeof(struct ofp_header) || inner_len > b.size) {
return OFPERR_OFPBFC_MSG_BAD_LEN;
......
......@@ -3239,7 +3239,7 @@ AT_SETUP([OFPT_BUNDLE_ADD_MESSAGE - verify xid])
AT_KEYWORDS([ofp-print])
AT_CHECK([ovs-ofctl ofp-print "\
05 22 00 20 00 00 00 00 00 00 00 01 00 00 00 01 \
02 00 00 08 00 00 00 01 00 00 00 00 00 00 00 00 \
05 00 00 08 00 00 00 01 00 00 00 00 00 00 00 00 \
"], [0], [dnl
OFPT_BUNDLE_ADD_MESSAGE (OF1.4) (xid=0x0): ***decode error: OFPBFC_MSG_BAD_XID***
])
......@@ -3249,7 +3249,7 @@ AT_SETUP([OFPT_BUNDLE_ADD_MESSAGE - reject OFPT_HELLO])
AT_KEYWORDS([ofp-print])
AT_CHECK([ovs-ofctl ofp-print "\
05 22 00 20 00 00 00 00 00 00 00 01 00 00 00 01 \
02 00 00 10 00 00 00 00 00 00 00 00 00 00 00 00 \
05 00 00 10 00 00 00 00 00 00 00 00 00 00 00 00 \
"], [0], [dnl
OFPT_BUNDLE_ADD_MESSAGE (OF1.4) (xid=0x0): ***decode error: OFPBFC_MSG_UNSUP***
])
......@@ -3259,7 +3259,7 @@ AT_SETUP([OFPT_BUNDLE_ADD_MESSAGE - FLOW_MOD])
AT_KEYWORDS([ofp-print])
AT_CHECK([ovs-ofctl ofp-print "\
05 22 00 a0 00 00 00 02 00 00 00 01 00 00 00 01 \
03 0e 00 90 00 00 00 02 00 00 00 00 00 00 00 00 \
05 0e 00 90 00 00 00 02 00 00 00 00 00 00 00 00 \
00 00 00 00 00 00 00 00 01 00 00 00 00 00 ff ff \
ff ff ff ff ff ff ff ff ff ff ff ff 00 00 00 00 \
00 01 00 42 80 00 00 04 00 00 00 01 80 00 08 06 \
......@@ -3271,7 +3271,7 @@ ff ff ff ff ff ff ff ff ff ff ff ff 00 00 00 00 \
"], [0], [dnl
OFPT_BUNDLE_ADD_MESSAGE (OF1.4) (xid=0x2):
bundle_id=0x1 flags=atomic
OFPT_FLOW_MOD (OF1.2) (xid=0x2): ADD table:1 priority=65535,arp,in_port=1,vlan_tci=0x0000/0x1fff,dl_src=50:54:00:00:00:06,dl_dst=50:54:00:00:00:05,arp_spa=192.168.0.2,arp_tpa=192.168.0.1,arp_op=2 actions=output:3
OFPT_FLOW_MOD (OF1.4) (xid=0x2): ADD table:1 priority=65535,arp,in_port=1,vlan_tci=0x0000/0x1fff,dl_src=50:54:00:00:00:06,dl_dst=50:54:00:00:00:05,arp_spa=192.168.0.2,arp_tpa=192.168.0.1,arp_op=2 actions=output:3
])
AT_CLEANUP
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment