Skip to content

Commit

Permalink
OF1.4 bundles: Verify xids.
Browse files Browse the repository at this point in the history
A switch may optionally verify that the 'xid' of an added message is
the same as the 'xid' of the bundle add message itself.  Do it.

Signed-off-by: Jarno Rajahalme <[email protected]>
Acked-by: Ben Pfaff <[email protected]>
  • Loading branch information
Jarno Rajahalme committed Dec 22, 2014
1 parent b58990a commit be6f639
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/ofp-util.c
Original file line number Diff line number Diff line change
Expand Up @@ -8509,6 +8509,9 @@ ofputil_decode_bundle_add(const struct ofp_header *oh,
if (inner_len < sizeof(struct ofp_header) || inner_len > ofpbuf_size(&b)) {
return OFPERR_OFPBFC_MSG_BAD_LEN;
}
if (msg->msg->xid != oh->xid) {
return OFPERR_OFPBFC_MSG_BAD_XID;
}

return 0;
}
Expand Down
10 changes: 10 additions & 0 deletions tests/ofp-print.at
Original file line number Diff line number Diff line change
Expand Up @@ -3210,6 +3210,16 @@ OFPT_BUNDLE_CONTROL (OF1.4) (xid=0x0):
])
AT_CLEANUP

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 \
"], [0], [dnl
OFPT_BUNDLE_ADD_MESSAGE (OF1.4) (xid=0x0): ***decode error: OFPBFC_MSG_BAD_XID***
])
AT_CLEANUP

AT_SETUP([OFPT_BUNDLE_ADD_MESSAGE - OFPT_HELLO])
AT_KEYWORDS([ofp-print])
AT_CHECK([ovs-ofctl ofp-print "\
Expand Down

0 comments on commit be6f639

Please sign in to comment.