aboutsummaryrefslogtreecommitdiff
path: root/utilities
diff options
context:
space:
mode:
authorSimon Horman <horms@verge.net.au>2012-11-19 14:59:34 +0900
committerBen Pfaff <blp@nicira.com>2012-11-29 08:08:17 -0800
commitf02b12c4ff762e4cb38150c5d2c757ee847a9ecb (patch)
tree840385349d46f61f52525bb3d22e80c5fab2a639 /utilities
parentbe721d87f4978f7625b9948591c7ffb079262fd9 (diff)
ovs-ofctl: By default, do not set flow format for OpenFlow 1.1+
Only set the default format for ovs-ofctl monitor if OpenFlow 1.0 is the prevailing version. IMHO that is the only case where it makes sense. Signed-off-by: Simon Horman <horms@verge.net.au> Signed-off-by: Ben Pfaff <blp@nicira.com>
Diffstat (limited to 'utilities')
-rw-r--r--utilities/ovs-ofctl.c39
1 files changed, 26 insertions, 13 deletions
diff --git a/utilities/ovs-ofctl.c b/utilities/ovs-ofctl.c
index 80a202fc..df2c6aa0 100644
--- a/utilities/ovs-ofctl.c
+++ b/utilities/ovs-ofctl.c
@@ -1419,19 +1419,32 @@ ofctl_monitor(int argc, char *argv[])
if (preferred_packet_in_format >= 0) {
set_packet_in_format(vconn, preferred_packet_in_format);
} else {
- struct ofpbuf *spif, *reply;
-
- 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) {
- char *s = ofp_to_string(reply->data, reply->size, 2);
- VLOG_DBG("%s: failed to set packet in format to nxm, controller"
- " replied: %s. Falling back to the switch default.",
- vconn_get_name(vconn), s);
- free(s);
- ofpbuf_delete(reply);
+ enum ofp_version version = vconn_get_version(vconn);
+
+ switch (version) {
+ case OFP10_VERSION: {
+ struct ofpbuf *spif, *reply;
+
+ 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) {
+ char *s = ofp_to_string(reply->data, reply->size, 2);
+ VLOG_DBG("%s: failed to set packet in format to nxm, controller"
+ " replied: %s. Falling back to the switch default.",
+ vconn_get_name(vconn), s);
+ free(s);
+ ofpbuf_delete(reply);
+ }
+ break;
+ }
+ case OFP11_VERSION:
+ case OFP12_VERSION:
+ case OFP13_VERSION:
+ break;
+ default:
+ NOT_REACHED();
}
}