X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=ofproto%2Fofproto.c;h=07d4934b39120c834ba68c1fd1456f7d341ccffe;hb=3096dfb4112e422eac47a4afb55807f9c04bd553;hp=af35aba2cc781f93dda07ded49061d6cfc2f3c35;hpb=9075907cab7a9e91a260b7fae01c8ab24ef76d91;p=sliver-openvswitch.git diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c index af35aba2c..07d4934b3 100644 --- a/ofproto/ofproto.c +++ b/ofproto/ofproto.c @@ -2833,8 +2833,8 @@ static int handle_nxt_flow_mod_table_id(struct ofconn *ofconn, const struct ofp_header *oh) { - const struct nxt_flow_mod_table_id *msg - = (const struct nxt_flow_mod_table_id *) oh; + const struct nx_flow_mod_table_id *msg + = (const struct nx_flow_mod_table_id *) oh; ofconn_set_flow_mod_table_id(ofconn, msg->set != 0); return 0; @@ -2843,8 +2843,8 @@ handle_nxt_flow_mod_table_id(struct ofconn *ofconn, static int handle_nxt_set_flow_format(struct ofconn *ofconn, const struct ofp_header *oh) { - const struct nxt_set_flow_format *msg - = (const struct nxt_set_flow_format *) oh; + const struct nx_set_flow_format *msg + = (const struct nx_set_flow_format *) oh; uint32_t format; format = ntohl(msg->format); @@ -2862,6 +2862,29 @@ handle_nxt_set_flow_format(struct ofconn *ofconn, const struct ofp_header *oh) return 0; } +static int +handle_nxt_set_packet_in_format(struct ofconn *ofconn, + const struct ofp_header *oh) +{ + const struct nx_set_packet_in_format *msg; + uint32_t format; + + msg = (const struct nx_set_packet_in_format *) oh; + format = ntohl(msg->format); + if (format != NXFF_OPENFLOW10 && format != NXPIF_NXM) { + return ofp_mkerr(OFPET_BAD_REQUEST, OFPBRC_EPERM); + } + + if (format != ofconn_get_packet_in_format(ofconn) + && ofconn_has_pending_opgroups(ofconn)) { + /* Avoid sending async message in surprsing packet in format. */ + return OFPROTO_POSTPONE; + } + + ofconn_set_packet_in_format(ofconn, format); + return 0; +} + static int handle_barrier_request(struct ofconn *ofconn, const struct ofp_header *oh) { @@ -2929,6 +2952,9 @@ handle_openflow__(struct ofconn *ofconn, const struct ofpbuf *msg) case OFPUTIL_NXT_SET_FLOW_FORMAT: return handle_nxt_set_flow_format(ofconn, oh); + case OFPUTIL_NXT_SET_PACKET_IN_FORMAT: + return handle_nxt_set_packet_in_format(ofconn, oh); + case OFPUTIL_NXT_FLOW_MOD: return handle_flow_mod(ofconn, oh); @@ -2972,6 +2998,7 @@ handle_openflow__(struct ofconn *ofconn, const struct ofpbuf *msg) case OFPUTIL_OFPST_AGGREGATE_REPLY: case OFPUTIL_NXT_ROLE_REPLY: case OFPUTIL_NXT_FLOW_REMOVED: + case OFPUTIL_NXT_PACKET_IN: case OFPUTIL_NXST_FLOW_REPLY: case OFPUTIL_NXST_AGGREGATE_REPLY: default: