2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-31 14:25:26 +00:00

ofp-util: Allow decoding of Open Flow 1.1 and 1.2 Packet Out Messages

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
This commit is contained in:
Simon Horman
2012-08-08 06:49:45 +09:00
committed by Ben Pfaff
parent 8a6bc7cd70
commit eb5ee596d9
2 changed files with 34 additions and 3 deletions

View File

@@ -2149,13 +2149,31 @@ ofputil_decode_packet_out(struct ofputil_packet_out *po,
const struct ofp_header *oh,
struct ofpbuf *ofpacts)
{
enum ofperr bad_in_port_err;
enum ofpraw raw;
struct ofpbuf b;
ofpbuf_use_const(&b, oh, ntohs(oh->length));
raw = ofpraw_pull_assert(&b);
if (raw == OFPRAW_OFPT10_PACKET_OUT) {
if (raw == OFPRAW_OFPT11_PACKET_OUT) {
enum ofperr error;
const struct ofp11_packet_out *opo = ofpbuf_pull(&b, sizeof *opo);
po->buffer_id = ntohl(opo->buffer_id);
error = ofputil_port_from_ofp11(opo->in_port, &po->in_port);
if (error) {
return error;
}
error = ofpacts_pull_openflow11_actions(&b, ntohs(opo->actions_len),
ofpacts);
if (error) {
return error;
}
bad_in_port_err = OFPERR_OFPBMC_BAD_VALUE;
} else if (raw == OFPRAW_OFPT10_PACKET_OUT) {
enum ofperr error;
const struct ofp_packet_out *opo = ofpbuf_pull(&b, sizeof *opo);
@@ -2166,6 +2184,8 @@ ofputil_decode_packet_out(struct ofputil_packet_out *po,
if (error) {
return error;
}
bad_in_port_err = OFPERR_NXBRC_BAD_IN_PORT;
} else {
NOT_REACHED();
}
@@ -2174,7 +2194,7 @@ ofputil_decode_packet_out(struct ofputil_packet_out *po,
&& po->in_port != OFPP_NONE && po->in_port != OFPP_CONTROLLER) {
VLOG_WARN_RL(&bad_ofmsg_rl, "packet-out has bad input port %#"PRIx16,
po->in_port);
return OFPERR_NXBRC_BAD_IN_PORT;
return bad_in_port_err;
}
po->ofpacts = ofpacts->data;