--allowed-ofp-versions allows configuration of the versions that may be used when establishing an OpenFlow connection.
The default is 'OpenFlow10' which is consistent with the behaviour prior to this patch. The useful values at this time are: 'OpenFlow10', 'OpenFlow12' and 'OpenFlow10,OpenFlow12'. Signed-off-by: Simon Horman <ho...@verge.net.au> --- lib/ofp-version.man | 10 ++++---- manpages.mk | 2 ++ utilities/ovs-ofctl.8.in | 1 + utilities/ovs-ofctl.c | 58 +++++++++++++++++++++++----------------------- 4 files changed, 38 insertions(+), 33 deletions(-) diff --git a/lib/ofp-version.man b/lib/ofp-version.man index a87a744..a290346 100644 --- a/lib/ofp-version.man +++ b/lib/ofp-version.man @@ -1,10 +1,6 @@ .IP "\fB\-\-allowed\-ofp-versions=\fI[version[,version]...]\fR" -\-allowed\-ofp-versions designates the versions that are allowed when establishing an OpenFlow session. By default 'OpenFlow10' is used. -The allowed versions of ovs-vswitchd should be configured using -the 'openflow-versions' column of the 'other-config' row -of the Bridges table in ovsdb. The syntax of its value -is the same as the value of -\-allowed\-ofp-versions. . .IP The known versions are: @@ -24,3 +20,9 @@ N.B: Currently only \fBOpenFlow10\fR is considered to be ready for general consumption. The option to enable \fBOpenFlow11\fR and \fBOpenFlow12\fR is currently provided for development purposes. . +.IP +The allowed versions of ovs-vswitchd should be configured using +the 'openflow-versions' column of the 'other-config' row +of the Bridges table in ovsdb. The syntax of its value +is the same as the value of -\-allowed\-ofp-versions. +. diff --git a/manpages.mk b/manpages.mk index 01700c3..a62bacc 100644 --- a/manpages.mk +++ b/manpages.mk @@ -134,12 +134,14 @@ utilities/ovs-ofctl.8: \ utilities/ovs-ofctl.8.in \ lib/common.man \ lib/daemon.man \ + lib/ofp-version.man \ lib/ssl.man \ lib/vconn-active.man \ lib/vlog.man utilities/ovs-ofctl.8.in: lib/common.man: lib/daemon.man: +lib/ofp-version.man: lib/ssl.man: lib/vconn-active.man: lib/vlog.man: diff --git a/utilities/ovs-ofctl.8.in b/utilities/ovs-ofctl.8.in index 63aa659..fe81132 100644 --- a/utilities/ovs-ofctl.8.in +++ b/utilities/ovs-ofctl.8.in @@ -1435,6 +1435,7 @@ These options currently affect only \fBdump\-flows\fR output. .so lib/ssl.man .so lib/vlog.man .so lib/common.man +.so lib/ofp-version.man . .SH "RUNTIME MANAGEMENT COMMANDS" \fBovs\-appctl\fR(8) can send commands to a running \fBovs\-ofctl\fR diff --git a/utilities/ovs-ofctl.c b/utilities/ovs-ofctl.c index 4753d9e..5ab670b 100644 --- a/utilities/ovs-ofctl.c +++ b/utilities/ovs-ofctl.c @@ -44,6 +44,7 @@ #include "ofp-parse.h" #include "ofp-print.h" #include "ofp-util.h" +#include "ofp-version-opt.h" #include "ofpbuf.h" #include "ofproto/ofproto.h" #include "openflow/nicira-ext.h" @@ -146,6 +147,7 @@ parse_options(int argc, char *argv[]) OPT_SORT, OPT_RSORT, DAEMON_OPTION_ENUMS, + OFP_VERSION_OPTION_ENUMS, VLOG_OPTION_ENUMS }; static struct option long_options[] = { @@ -159,8 +161,8 @@ parse_options(int argc, char *argv[]) {"sort", optional_argument, NULL, OPT_SORT}, {"rsort", optional_argument, NULL, OPT_RSORT}, {"help", no_argument, NULL, 'h'}, - {"version", no_argument, NULL, 'V'}, DAEMON_LONG_OPTIONS, + OFP_VERSION_LONG_OPTIONS, VLOG_LONG_OPTIONS, STREAM_SSL_LONG_OPTIONS, {NULL, 0, NULL, 0}, @@ -209,10 +211,6 @@ parse_options(int argc, char *argv[]) case 'h': usage(); - case 'V': - ovs_print_version(OFP10_VERSION, OFP10_VERSION); - exit(EXIT_SUCCESS); - case OPT_STRICT: strict = true; break; @@ -234,6 +232,7 @@ parse_options(int argc, char *argv[]) break; DAEMON_OPTION_HANDLERS + OFP_VERSION_OPTION_HANDLERS VLOG_OPTION_HANDLERS STREAM_SSL_OPTION_HANDLERS @@ -291,6 +290,7 @@ usage(void) program_name, program_name); vconn_usage(true, false, false); daemon_usage(); + ofp_version_usage(); vlog_usage(); printf("\nOther options:\n" " --strict use strict match for flow commands\n" @@ -334,13 +334,10 @@ static void run(int retval, const char *message, ...) static void open_vconn_socket(const char *name, struct vconn **vconnp) { - struct ofputil_version_bitmap ovb = OFPUTIL_VERSION_BITMAP_INITIALIZER; char *vconn_name = xasprintf("unix:%s", name); VLOG_DBG("connecting to %s", vconn_name); - ofputil_version_bitmap_set1(&ovb, OFP10_VERSION); - run(vconn_open_block(vconn_name, &ovb, vconnp), + run(vconn_open_block(vconn_name, get_allowed_ofp_versions(), vconnp), "connecting to %s", vconn_name); - ofputil_version_bitmap_free_data(&ovb); free(vconn_name); } @@ -363,10 +360,8 @@ open_vconn__(const char *name, const char *default_suffix, free(datapath_type); if (strchr(name, ':')) { - struct ofputil_version_bitmap ovb = OFPUTIL_VERSION_BITMAP_INITIALIZER; - ofputil_version_bitmap_set1(&ovb, OFP10_VERSION); - run(vconn_open_block(name, &ovb, vconnp), "connecting to %s", name); - ofputil_version_bitmap_free_data(&ovb); + run(vconn_open_block(name, get_allowed_ofp_versions(), vconnp), + "connecting to %s", name); } else if (!stat(name, &s) && S_ISSOCK(s.st_mode)) { open_vconn_socket(name, vconnp); } else if (!stat(bridge_path, &s) && S_ISSOCK(s.st_mode)) { @@ -407,25 +402,27 @@ send_openflow_buffer(struct vconn *vconn, struct ofpbuf *buffer) } static void -dump_transaction(const char *vconn_name, struct ofpbuf *request) +dump_transaction(struct vconn *vconn, struct ofpbuf *request) { - struct vconn *vconn; struct ofpbuf *reply; ofpmsg_update_length(request); - open_vconn(vconn_name, &vconn); - run(vconn_transact(vconn, request, &reply), "talking to %s", vconn_name); + run(vconn_transact(vconn, request, &reply), "talking to %s", + vconn_get_name(vconn)); ofp_print(stdout, reply->data, reply->size, verbosity + 1); ofpbuf_delete(reply); - vconn_close(vconn); } static void dump_trivial_transaction(const char *vconn_name, enum ofpraw raw) { struct ofpbuf *request; - request = ofpraw_alloc(raw, OFP10_VERSION, 0); - dump_transaction(vconn_name, request); + struct vconn *vconn; + + open_vconn(vconn_name, &vconn); + request = ofpraw_alloc(raw, vconn_get_version(vconn), 0); + dump_transaction(vconn, request); + vconn_close(vconn); } static void @@ -529,7 +526,8 @@ fetch_switch_config(struct vconn *vconn, struct ofp_switch_config *config_) struct ofpbuf *reply; enum ofptype type; - request = ofpraw_alloc(OFPRAW_OFPT_GET_CONFIG_REQUEST, OFP10_VERSION, 0); + request = ofpraw_alloc(OFPRAW_OFPT_GET_CONFIG_REQUEST, + vconn_get_version(vconn), 0); run(vconn_transact(vconn, request, &reply), "talking to %s", vconn_get_name(vconn)); @@ -548,7 +546,7 @@ set_switch_config(struct vconn *vconn, const struct ofp_switch_config *config) { struct ofpbuf *request; - request = ofpraw_alloc(OFPRAW_OFPT_SET_CONFIG, OFP10_VERSION, 0); + request = ofpraw_alloc(OFPRAW_OFPT_SET_CONFIG, vconn_get_version(vconn), 0); ofpbuf_put(request, config, sizeof *config); transact_noreply(vconn, request); @@ -563,15 +561,15 @@ ofctl_show(int argc OVS_UNUSED, char *argv[]) struct ofpbuf *reply; bool trunc; - request = ofpraw_alloc(OFPRAW_OFPT_FEATURES_REQUEST, OFP10_VERSION, 0); open_vconn(vconn_name, &vconn); + request = ofpraw_alloc(OFPRAW_OFPT_FEATURES_REQUEST, + vconn_get_version(vconn), 0); run(vconn_transact(vconn, request, &reply), "talking to %s", vconn_name); trunc = ofputil_switch_features_ports_trunc(reply); ofp_print(stdout, reply->data, reply->size, verbosity + 1); ofpbuf_delete(reply); - vconn_close(vconn); if (trunc) { /* The Features Reply may not contain all the ports, so send a @@ -581,6 +579,7 @@ ofctl_show(int argc OVS_UNUSED, char *argv[]) OFPRAW_OFPST_PORT_DESC_REQUEST); } dump_trivial_transaction(vconn_name, OFPRAW_OFPT_GET_CONFIG_REQUEST); + vconn_close(vconn); } static void @@ -610,8 +609,9 @@ fetch_port_by_features(const char *vconn_name, bool found = false; /* Fetch the switch's ofp_switch_features. */ - request = ofpraw_alloc(OFPRAW_OFPT_FEATURES_REQUEST, OFP10_VERSION, 0); open_vconn(vconn_name, &vconn); + request = ofpraw_alloc(OFPRAW_OFPT_FEATURES_REQUEST, + vconn_get_version(vconn), 0); run(vconn_transact(vconn, request, &reply), "talking to %s", vconn_name); vconn_close(vconn); @@ -1615,8 +1615,8 @@ ofctl_ping(int argc, char *argv[]) const struct ofp_header *rpy_hdr; enum ofptype type; - request = ofpraw_alloc(OFPRAW_OFPT_ECHO_REQUEST, OFP10_VERSION, - payload); + request = ofpraw_alloc(OFPRAW_OFPT_ECHO_REQUEST, + vconn_get_version(vconn), payload); random_bytes(ofpbuf_put_uninit(request, payload), payload); xgettimeofday(&start); @@ -1670,8 +1670,8 @@ ofctl_benchmark(int argc OVS_UNUSED, char *argv[]) for (i = 0; i < count; i++) { struct ofpbuf *request, *reply; - request = ofpraw_alloc(OFPRAW_OFPT_ECHO_REQUEST, OFP10_VERSION, - payload_size); + request = ofpraw_alloc(OFPRAW_OFPT_ECHO_REQUEST, + vconn_get_version(vconn), payload_size); ofpbuf_put_zeros(request, payload_size); run(vconn_transact(vconn, request, &reply), "transact"); ofpbuf_delete(reply); -- 1.7.10.4 _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev