2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-31 06:15:47 +00:00

ofp-util: Announce OpenFlow 1.3 table features only in OpenFlow 1.3.

The translation into OpenFlow 1.2 didn't trim off the OpenFlow 1.3 specific
bits.  This fixes the problem.

It would probably be wise to introduce an ofputil_table_stats structure.
Using ofp12_table_stats is somewhat confusing.

Reported-by: Torbjorn Tornkvist <kruskakli@gmail.com>
Tested-by: Torbjorn Tornkvist <kruskakli@gmail.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
This commit is contained in:
Ben Pfaff
2013-09-13 08:42:55 -07:00
parent 1b63b91eb0
commit 6240624b3b
4 changed files with 49 additions and 42 deletions

View File

@@ -4010,6 +4010,19 @@ ofputil_put_ofp11_table_stats(const struct ofp12_table_stats *in,
out->matched_count = in->matched_count;
}
static void
ofputil_put_ofp12_table_stats(const struct ofp12_table_stats *in,
struct ofpbuf *buf)
{
struct ofp12_table_stats *out = ofpbuf_put(buf, in, sizeof *in);
/* Trim off OF1.3-only capabilities. */
out->match &= htonll(OFPXMT12_MASK);
out->wildcards &= htonll(OFPXMT12_MASK);
out->write_setfields &= htonll(OFPXMT12_MASK);
out->apply_setfields &= htonll(OFPXMT12_MASK);
}
static void
ofputil_put_ofp13_table_stats(const struct ofp12_table_stats *in,
struct ofpbuf *buf)
@@ -4035,31 +4048,27 @@ ofputil_encode_table_stats_reply(const struct ofp12_table_stats stats[], int n,
reply = ofpraw_alloc_stats_reply(request, n * sizeof *stats);
switch ((enum ofp_version) request->version) {
case OFP10_VERSION:
for (i = 0; i < n; i++) {
for (i = 0; i < n; i++) {
switch ((enum ofp_version) request->version) {
case OFP10_VERSION:
ofputil_put_ofp10_table_stats(&stats[i], reply);
}
break;
break;
case OFP11_VERSION:
for (i = 0; i < n; i++) {
case OFP11_VERSION:
ofputil_put_ofp11_table_stats(&stats[i], reply);
}
break;
break;
case OFP12_VERSION:
ofpbuf_put(reply, stats, n * sizeof *stats);
break;
case OFP12_VERSION:
ofputil_put_ofp12_table_stats(&stats[i], reply);
break;
case OFP13_VERSION:
for (i = 0; i < n; i++) {
case OFP13_VERSION:
ofputil_put_ofp13_table_stats(&stats[i], reply);
}
break;
break;
default:
NOT_REACHED();
default:
NOT_REACHED();
}
}
return reply;