Skip to content

Commit

Permalink
ofp-util: Require inner and outer message in bundle add to be same ve…
Browse files Browse the repository at this point in the history
…rsion.

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: Ben Pfaff <[email protected]>
Acked-by: Jarno Rajahalme <[email protected]>
  • Loading branch information
blp committed Jul 7, 2015
1 parent 64795a0 commit 46be713
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
4 changes: 4 additions & 0 deletions lib/ofp-errors.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 ## */
/* ## ------------------------- ## */
Expand Down
3 changes: 3 additions & 0 deletions lib/ofp-util.c
Original file line number Diff line number Diff line change
Expand Up @@ -9096,6 +9096,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;
Expand Down
8 changes: 4 additions & 4 deletions tests/ofp-print.at
Original file line number Diff line number Diff line change
Expand Up @@ -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***
])
Expand All @@ -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***
])
Expand All @@ -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 \
Expand All @@ -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

Expand Down

0 comments on commit 46be713

Please sign in to comment.