#include <stdlib.h>
#include "byte-order.h"
#include "classifier.h"
+#include "multipath.h"
#include "nx-match.h"
#include "ofp-util.h"
#include "ofpbuf.h"
}
}
- VLOG_WARN_RL(&bad_ofmsg_rl, "received %s of unknown type %u",
+ VLOG_WARN_RL(&bad_ofmsg_rl, "received %s of unknown type %"PRIu32,
cat->name, value);
return cat->missing_error;
}
};
static const struct ofputil_msg_category nxst_request_category = {
- "Nicira extension statistics",
+ "Nicira extension statistics request",
nxst_requests, ARRAY_SIZE(nxst_requests),
OFP_MKERR(OFPET_BAD_REQUEST, OFPBRC_BAD_SUBTYPE)
};
};
static const struct ofputil_msg_category nxst_reply_category = {
- "Nicira extension statistics",
+ "Nicira extension statistics reply",
nxst_replies, ARRAY_SIZE(nxst_replies),
OFP_MKERR(OFPET_BAD_REQUEST, OFPBRC_BAD_SUBTYPE)
};
unsigned int required_len)
{
if (len != required_len) {
- VLOG_DBG_RL(&bad_ofmsg_rl,
- "action %u has invalid length %"PRIu16" (must be %u)\n",
- a->type, ntohs(a->header.len), required_len);
+ VLOG_WARN_RL(&bad_ofmsg_rl, "action %"PRIu16" has invalid length "
+ "%"PRIu16" (must be %u)\n",
+ ntohs(a->type), ntohs(a->header.len), required_len);
+ return ofp_mkerr(OFPET_BAD_ACTION, OFPBAC_BAD_LEN);
+ }
+ return 0;
+}
+
+static int
+check_nx_action_exact_len(const struct nx_action_header *a,
+ unsigned int len, unsigned int required_len)
+{
+ if (len != required_len) {
+ VLOG_WARN_RL(&bad_ofmsg_rl,
+ "Nicira action %"PRIu16" has invalid length %"PRIu16" "
+ "(must be %u)\n",
+ ntohs(a->subtype), ntohs(a->len), required_len);
return ofp_mkerr(OFPET_BAD_ACTION, OFPBAC_BAD_LEN);
}
return 0;
int error;
if (len < 16) {
- VLOG_DBG_RL(&bad_ofmsg_rl,
- "Nicira vendor action only %u bytes", len);
+ VLOG_WARN_RL(&bad_ofmsg_rl,
+ "Nicira vendor action only %u bytes", len);
return ofp_mkerr(OFPET_BAD_ACTION, OFPBAC_BAD_LEN);
}
nah = (const struct nx_action_header *) a;
case NXAST_DROP_SPOOFED_ARP:
case NXAST_SET_QUEUE:
case NXAST_POP_QUEUE:
- return check_action_exact_len(a, len, 16);
+ return check_nx_action_exact_len(nah, len, 16);
case NXAST_REG_MOVE:
- error = check_action_exact_len(a, len,
- sizeof(struct nx_action_reg_move));
+ error = check_nx_action_exact_len(nah, len,
+ sizeof(struct nx_action_reg_move));
if (error) {
return error;
}
return nxm_check_reg_move((const struct nx_action_reg_move *) a, flow);
case NXAST_REG_LOAD:
- error = check_action_exact_len(a, len,
- sizeof(struct nx_action_reg_load));
+ error = check_nx_action_exact_len(nah, len,
+ sizeof(struct nx_action_reg_load));
if (error) {
return error;
}
return 0;
case NXAST_SET_TUNNEL64:
- return check_action_exact_len(a, len,
- sizeof(struct nx_action_set_tunnel64));
+ return check_nx_action_exact_len(
+ nah, len, sizeof(struct nx_action_set_tunnel64));
+
+ case NXAST_MULTIPATH:
+ error = check_nx_action_exact_len(
+ nah, len, sizeof(struct nx_action_multipath));
+ if (error) {
+ return error;
+ }
+ return multipath_check((const struct nx_action_multipath *) a);
case NXAST_SNAT__OBSOLETE:
default:
+ VLOG_WARN_RL(&bad_ofmsg_rl,
+ "unknown Nicira vendor action subtype %"PRIu16,
+ ntohs(nah->subtype));
return ofp_mkerr(OFPET_BAD_ACTION, OFPBAC_BAD_VENDOR_TYPE);
}
}
int error;
if (n_slots > slots_left) {
- VLOG_DBG_RL(&bad_ofmsg_rl,
- "action requires %u slots but only %u remain",
- n_slots, slots_left);
+ VLOG_WARN_RL(&bad_ofmsg_rl,
+ "action requires %u slots but only %u remain",
+ n_slots, slots_left);
return ofp_mkerr(OFPET_BAD_ACTION, OFPBAC_BAD_LEN);
} else if (!len) {
- VLOG_DBG_RL(&bad_ofmsg_rl, "action has invalid length 0");
+ VLOG_WARN_RL(&bad_ofmsg_rl, "action has invalid length 0");
return ofp_mkerr(OFPET_BAD_ACTION, OFPBAC_BAD_LEN);
} else if (len % OFP_ACTION_ALIGN) {
- VLOG_DBG_RL(&bad_ofmsg_rl, "action length %u is not a multiple "
- "of %d", len, OFP_ACTION_ALIGN);
+ VLOG_WARN_RL(&bad_ofmsg_rl, "action length %u is not a multiple "
+ "of %d", len, OFP_ACTION_ALIGN);
return ofp_mkerr(OFPET_BAD_ACTION, OFPBAC_BAD_LEN);
}
union ofp_action **actionsp, size_t *n_actionsp)
{
if (actions_len % OFP_ACTION_ALIGN != 0) {
- VLOG_DBG_RL(&bad_ofmsg_rl, "OpenFlow message actions length %u "
- "is not a multiple of %d", actions_len, OFP_ACTION_ALIGN);
+ VLOG_WARN_RL(&bad_ofmsg_rl, "OpenFlow message actions length %u "
+ "is not a multiple of %d", actions_len, OFP_ACTION_ALIGN);
goto error;
}
*actionsp = ofpbuf_try_pull(b, actions_len);
if (*actionsp == NULL) {
- VLOG_DBG_RL(&bad_ofmsg_rl, "OpenFlow message actions length %u "
- "exceeds remaining message length (%zu)",
- actions_len, b->size);
+ VLOG_WARN_RL(&bad_ofmsg_rl, "OpenFlow message actions length %u "
+ "exceeds remaining message length (%zu)",
+ actions_len, b->size);
goto error;
}