[ovs-dev] [PATCH] ovs-ofctl: Only allow usable protocols for group commands

Jarno Rajahalme jrajahalme at nicira.com
Thu Nov 6 00:05:46 UTC 2014


Thanks, Simon!

Acked-by: Jarno Rajahalme <jrajahalme at nicira.com>	

Pushed to master,

  Jarno

On Nov 4, 2014, at 8:57 PM, Simon Horman <simon.horman at netronome.com> wrote:

> parse_ofp_group_mod_str() may limit the usable protocols according
> to the group and in particular its actions. However, without this
> change ovs-ofctl ignores this calculation.
> 
> Signed-off-by: Simon Horman <simon.horman at netronome.com>
> ---
> utilities/ovs-ofctl.c | 13 ++++++++-----
> 1 file changed, 8 insertions(+), 5 deletions(-)
> 
> diff --git a/utilities/ovs-ofctl.c b/utilities/ovs-ofctl.c
> index 211c276..5835a70 100644
> --- a/utilities/ovs-ofctl.c
> +++ b/utilities/ovs-ofctl.c
> @@ -2083,19 +2083,22 @@ ofctl_benchmark(int argc OVS_UNUSED, char *argv[])
> 
> static void
> ofctl_group_mod__(const char *remote, struct ofputil_group_mod *gms,
> -                 size_t n_gms)
> +                  size_t n_gms, enum ofputil_protocol usable_protocols)
> {
> +    enum ofputil_protocol protocol;
>     struct ofputil_group_mod *gm;
> +    enum ofp_version version;
>     struct ofpbuf *request;
> 
>     struct vconn *vconn;
>     size_t i;
> 
> -    open_vconn(remote, &vconn);
> +    protocol = open_vconn_for_flow_mod(remote, &vconn, usable_protocols);
> +    version = ofputil_protocol_to_ofp_version(protocol);
> 
>     for (i = 0; i < n_gms; i++) {
>         gm = &gms[i];
> -        request = ofputil_encode_group_mod(vconn_get_version(vconn), gm);
> +        request = ofputil_encode_group_mod(version, gm);
>         if (request) {
>             transact_noreply(vconn, request);
>         }
> @@ -2120,7 +2123,7 @@ ofctl_group_mod_file(int argc OVS_UNUSED, char *argv[], uint16_t command)
>     if (error) {
>         ovs_fatal(0, "%s", error);
>     }
> -    ofctl_group_mod__(argv[1], gms, n_gms);
> +    ofctl_group_mod__(argv[1], gms, n_gms, usable_protocols);
>     for (i = 0; i < n_gms; i++) {
>         ofputil_bucket_list_destroy(&gms[i].buckets);
>     }
> @@ -2142,7 +2145,7 @@ ofctl_group_mod(int argc, char *argv[], uint16_t command)
>         if (error) {
>             ovs_fatal(0, "%s", error);
>         }
> -        ofctl_group_mod__(argv[1], &gm, 1);
> +        ofctl_group_mod__(argv[1], &gm, 1, usable_protocols);
>         ofputil_bucket_list_destroy(&gm.buckets);
>     }
> }
> -- 
> 2.1.1
> 
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev




More information about the dev mailing list