2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-29 05:18:13 +00:00

ofp-util: Fix table features decoding of multiple tables.

Table features replies can be packed back-to-back within a single
multipart reply.  The code here didn't properly parse properties when this
occurred.  This fixes the problem.

There is no test in the current tree that exercises this decoding, but an
upcoming commit that adds ofproto support for table-features requests will
add one.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
This commit is contained in:
Ben Pfaff 2014-07-28 11:46:36 -07:00
parent 3c1bb39622
commit ae665de5e6

View File

@ -4607,6 +4607,7 @@ ofputil_decode_table_features(struct ofpbuf *msg,
{
const struct ofp_header *oh;
struct ofp13_table_features *otf;
struct ofpbuf properties;
unsigned int len;
memset(tf, 0, sizeof *tf);
@ -4629,7 +4630,8 @@ ofputil_decode_table_features(struct ofpbuf *msg,
if (len < sizeof *otf || len % 8 || len > ofpbuf_size(msg)) {
return OFPERR_OFPBPC_BAD_LEN;
}
ofpbuf_pull(msg, sizeof *otf);
ofpbuf_use_const(&properties, ofpbuf_pull(msg, len), len);
ofpbuf_pull(&properties, sizeof *otf);
tf->table_id = otf->table_id;
if (tf->table_id == OFPTT_ALL) {
@ -4642,12 +4644,12 @@ ofputil_decode_table_features(struct ofpbuf *msg,
tf->miss_config = ofputil_table_miss_from_config(otf->config, oh->version);
tf->max_entries = ntohl(otf->max_entries);
while (ofpbuf_size(msg) > 0) {
while (ofpbuf_size(&properties) > 0) {
struct ofpbuf payload;
enum ofperr error;
uint16_t type;
error = pull_table_feature_property(msg, &payload, &type);
error = pull_table_feature_property(&properties, &payload, &type);
if (error) {
return error;
}