ofp-util: Set Packet In Format: Use prevailing OpenFlow version
authorSimon Horman <horms@verge.net.au>
Thu, 4 Oct 2012 02:41:16 +0000 (11:41 +0900)
committerBen Pfaff <blp@nicira.com>
Thu, 4 Oct 2012 17:40:11 +0000 (10:40 -0700)
Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
lib/ofp-util.c
lib/ofp-util.h
utilities/ovs-ofctl.c

index 5e0839a..00dfea3 100644 (file)
@@ -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);
 
index 8ef2206..c5812c6 100644 (file)
@@ -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);
index dea8878..39aed86 100644 (file)
@@ -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) {