X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=utilities%2Fovs-ofctl.c;h=deba9dd78f73243939df4ba6b07d61b758fbea18;hb=6dc5374435cc25bc4051b27bd52635e609a8872a;hp=d2d0687ffa28749f4771da824cc144af46bb03ee;hpb=1f317cb5c2aa446c4b0252634a4a70dcc3682f93;p=sliver-openvswitch.git diff --git a/utilities/ovs-ofctl.c b/utilities/ovs-ofctl.c index d2d0687ff..deba9dd78 100644 --- a/utilities/ovs-ofctl.c +++ b/utilities/ovs-ofctl.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013 Nicira, Inc. + * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014 Nicira, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -174,6 +174,23 @@ parse_options(int argc, char *argv[]) uint32_t versions; enum ofputil_protocol version_protocols; + /* For now, ovs-ofctl only enables OpenFlow 1.0 by default. This is + * because ovs-ofctl implements command such as "add-flow" as raw OpenFlow + * requests, but those requests have subtly different semantics in + * different OpenFlow versions. For example: + * + * - In OpenFlow 1.0, a "mod-flow" operation that does not find any + * existing flow to modify adds a new flow. + * + * - In OpenFlow 1.1, a "mod-flow" operation that does not find any + * existing flow to modify adds a new flow, but only if the mod-flow + * did not match on the flow cookie. + * + * - In OpenFlow 1.2 and a later, a "mod-flow" operation never adds a + * new flow. + */ + set_allowed_ofp_versions("OpenFlow10"); + for (;;) { unsigned long int timeout; int c; @@ -1026,7 +1043,7 @@ ofctl_dump_flows(int argc, char *argv[]) ds_destroy(&s); for (i = 0; i < n_fses; i++) { - free(fses[i].ofpacts); + free(CONST_CAST(struct ofpact *, fses[i].ofpacts)); } free(fses); @@ -1136,7 +1153,7 @@ ofctl_flow_mod__(const char *remote, struct ofputil_flow_mod *fms, struct ofputil_flow_mod *fm = &fms[i]; transact_noreply(vconn, ofputil_encode_flow_mod(fm, protocol)); - free(fm->ofpacts); + free(CONST_CAST(struct ofpact *, fm->ofpacts)); } vconn_close(vconn); } @@ -1964,7 +1981,7 @@ ofctl_ping(int argc, char *argv[]) if (ofptype_pull(&type, reply) || type != OFPTYPE_ECHO_REPLY || ofpbuf_size(reply) != payload - || memcmp(ofpbuf_get_l3(request), ofpbuf_get_l3(reply), payload)) { + || memcmp(ofpbuf_l3(request), ofpbuf_l3(reply), payload)) { printf("Reply does not match request. Request:\n"); ofp_print(stdout, request, ofpbuf_size(request), verbosity + 2); printf("Reply:\n"); @@ -2199,7 +2216,7 @@ static void fte_version_free(struct fte_version *version) { if (version) { - free(version->ofpacts); + free(CONST_CAST(struct ofpact *, version->ofpacts)); free(version); } } @@ -2396,7 +2413,7 @@ recv_flow_stats_reply(struct vconn *vconn, ovs_be32 send_xid, return true; case EOF: - more = ofpmp_more(reply->l2); + more = ofpmp_more(reply->frame); ofpbuf_delete(reply); reply = NULL; if (!more) { @@ -2739,7 +2756,7 @@ ofctl_parse_flows__(struct ofputil_flow_mod *fms, size_t n_fms, ofp_print(stdout, ofpbuf_data(msg), ofpbuf_size(msg), verbosity); ofpbuf_delete(msg); - free(fm->ofpacts); + free(CONST_CAST(struct ofpact *, fm->ofpacts)); } }