On Wed, Nov 28, 2012 at 11:06:55PM -0800, Ben Pfaff wrote:
> From: Simon Horman <[email protected]>
>
> 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 <[email protected]>
> Signed-off-by: Ben Pfaff <[email protected]>
No objections here.
> ---
> utilities/ovs-ofctl.c | 39 ++++++++++++++++++++++++++-------------
> 1 file changed, 26 insertions(+), 13 deletions(-)
>
> diff --git a/utilities/ovs-ofctl.c b/utilities/ovs-ofctl.c
> index 80a202f..df2c6aa 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();
> }
> }
>
> --
> 1.7.10.4
>
_______________________________________________
dev mailing list
[email protected]
http://openvswitch.org/mailman/listinfo/dev