void
ofputil_wildcard_from_ofpfw10(uint32_t ofpfw, struct flow_wildcards *wc)
{
- BUILD_ASSERT_DECL(FLOW_WC_SEQ == 22);
+ BUILD_ASSERT_DECL(FLOW_WC_SEQ == 23);
/* Initialize most of wc. */
flow_wildcards_init_catchall(wc);
/* Get table ID.
*
- * OF1.1 entirely forbids table_id == 255.
- * OF1.2+ allows table_id == 255 only for deletes. */
+ * OF1.1 entirely forbids table_id == OFPTT_ALL.
+ * OF1.2+ allows table_id == OFPTT_ALL only for deletes. */
fm->table_id = ofm->table_id;
- if (fm->table_id == 255
+ if (fm->table_id == OFPTT_ALL
&& (oh->version == OFP11_VERSION
|| (ofm->command != OFPFC_DELETE &&
ofm->command != OFPFC_DELETE_STRICT))) {
: OFPERR_OFPFMFC_TABLE_FULL);
}
- return ofpacts_check(fm->ofpacts, fm->ofpacts_len, &fm->match.flow,
- oh->version > OFP10_VERSION, max_port,
- fm->table_id, max_table);
+ return ofpacts_check_consistency(fm->ofpacts, fm->ofpacts_len,
+ &fm->match.flow, max_port,
+ fm->table_id, max_table, protocol);
}
static enum ofperr
}
mb = ofpbuf_put_uninit(bands, sizeof *mb);
mb->type = ntohs(ombh->type);
+ if (mb->type != OFPMBT13_DROP && mb->type != OFPMBT13_DSCP_REMARK) {
+ return OFPERR_OFPMMFC_BAD_BAND;
+ }
mb->rate = ntohl(ombh->rate);
mb->burst_size = ntohl(ombh->burst_size);
mb->prec_level = (mb->type == OFPMBT13_DSCP_REMARK) ?
/* Translate the message. */
mm->command = ntohs(omm->command);
+ if (mm->command != OFPMC13_ADD &&
+ mm->command != OFPMC13_MODIFY &&
+ mm->command != OFPMC13_DELETE) {
+ return OFPERR_OFPMMFC_BAD_COMMAND;
+ }
mm->meter.meter_id = ntohl(omm->meter_id);
if (mm->command == OFPMC13_DELETE) {
enum ofperr error;
mm->meter.flags = ntohs(omm->flags);
+ if (mm->meter.flags & OFPMF13_KBPS &&
+ mm->meter.flags & OFPMF13_PKTPS) {
+ return OFPERR_OFPMMFC_BAD_FLAGS;
+ }
mm->meter.bands = bands->data;
error = ofputil_pull_bands(&b, b.size, &mm->meter.n_bands, bands);
ofm->cookie = fm->cookie;
}
ofm->cookie_mask = fm->cookie_mask;
- if (fm->table_id != 255
+ if (fm->table_id != OFPTT_ALL
|| (protocol != OFPUTIL_P_OF11_STD
&& (fm->command == OFPFC_DELETE ||
fm->command == OFPFC_DELETE_STRICT))) {