From 3f4a1939ad520d55324471b492231976789b7a74 Mon Sep 17 00:00:00 2001 From: Simon Horman Date: Thu, 4 Oct 2012 11:41:16 +0900 Subject: [PATCH] ofp-util: Set Packet In Format: Use prevailing OpenFlow version Signed-off-by: Simon Horman Signed-off-by: Ben Pfaff --- lib/ofp-util.c | 5 +++-- lib/ofp-util.h | 3 ++- utilities/ovs-ofctl.c | 8 ++++++-- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/lib/ofp-util.c b/lib/ofp-util.c index 5e0839a3..00dfea3e 100644 --- a/lib/ofp-util.c +++ b/lib/ofp-util.c @@ -1084,12 +1084,13 @@ ofputil_nx_flow_format_to_string(enum nx_flow_format flow_format) } struct ofpbuf * -ofputil_make_set_packet_in_format(enum nx_packet_in_format packet_in_format) +ofputil_make_set_packet_in_format(enum ofp_version ofp_version, + enum nx_packet_in_format packet_in_format) { struct nx_set_packet_in_format *spif; struct ofpbuf *msg; - msg = ofpraw_alloc(OFPRAW_NXT_SET_PACKET_IN_FORMAT, OFP10_VERSION, 0); + msg = ofpraw_alloc(OFPRAW_NXT_SET_PACKET_IN_FORMAT, ofp_version, 0); spif = ofpbuf_put_zeros(msg, sizeof *spif); spif->format = htonl(packet_in_format); diff --git a/lib/ofp-util.h b/lib/ofp-util.h index 8ef22068..c5812c67 100644 --- a/lib/ofp-util.h +++ b/lib/ofp-util.h @@ -131,7 +131,8 @@ ovs_be16 ofputil_dl_type_from_openflow(ovs_be16 ofp_dl_type); bool ofputil_packet_in_format_is_valid(enum nx_packet_in_format); int ofputil_packet_in_format_from_string(const char *); const char *ofputil_packet_in_format_to_string(enum nx_packet_in_format); -struct ofpbuf *ofputil_make_set_packet_in_format(enum nx_packet_in_format); +struct ofpbuf *ofputil_make_set_packet_in_format(enum ofp_version, + enum nx_packet_in_format); /* NXT_FLOW_MOD_TABLE_ID extension. */ struct ofpbuf *ofputil_make_flow_mod_table_id(bool flow_mod_table_id); diff --git a/utilities/ovs-ofctl.c b/utilities/ovs-ofctl.c index dea88787..39aed861 100644 --- a/utilities/ovs-ofctl.c +++ b/utilities/ovs-ofctl.c @@ -1085,7 +1085,10 @@ static void set_packet_in_format(struct vconn *vconn, enum nx_packet_in_format packet_in_format) { - struct ofpbuf *spif = ofputil_make_set_packet_in_format(packet_in_format); + struct ofpbuf *spif; + + spif = ofputil_make_set_packet_in_format(vconn_get_version(vconn), + packet_in_format); transact_noreply(vconn, spif); VLOG_DBG("%s: using user-specified packet in format %s", vconn_get_name(vconn), @@ -1386,7 +1389,8 @@ ofctl_monitor(int argc, char *argv[]) } else { struct ofpbuf *spif, *reply; - spif = ofputil_make_set_packet_in_format(NXPIF_NXM); + spif = ofputil_make_set_packet_in_format(vconn_get_version(vconn), + NXPIF_NXM); run(vconn_transact_noreply(vconn, spif, &reply), "talking to %s", vconn_get_name(vconn)); if (reply) { -- 2.30.2