[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1385058197.1586.15.camel@bwh-desktop.uk.level5networks.com>
Date: Thu, 21 Nov 2013 18:23:17 +0000
From: Ben Hutchings <bhutchings@...arflare.com>
To: Thomas Graf <tgraf@...g.ch>
CC: <jesse@...ira.com>, <davem@...emloft.net>, <dev@...nvswitch.org>,
<netdev@...r.kernel.org>, <dborkman@...hat.com>,
<ffusco@...hat.com>, <fleitner@...hat.com>,
<eric.dumazet@...il.com>
Subject: Re: [PATCH net-next 7/8] openvswitch: Drop user features if old
user space attempted to create datapath
On Thu, 2013-11-21 at 19:13 +0100, Thomas Graf wrote:
> Drop user features if an outdated user space instance that does not
> understand the concept of user_features attempted to create a new
> datapath.
>
> Signed-off-by: Thomas Graf <tgraf@...g.ch>
> Reviewed-by: Daniel Borkmann <dborkman@...hat.com>
> ---
> include/uapi/linux/openvswitch.h | 11 ++++++++++-
> net/openvswitch/datapath.c | 10 ++++++++++
> 2 files changed, 20 insertions(+), 1 deletion(-)
>
> diff --git a/include/uapi/linux/openvswitch.h b/include/uapi/linux/openvswitch.h
> index 07ef2c3..4f74c2c 100644
> --- a/include/uapi/linux/openvswitch.h
> +++ b/include/uapi/linux/openvswitch.h
> @@ -40,7 +40,16 @@ struct ovs_header {
>
> #define OVS_DATAPATH_FAMILY "ovs_datapath"
> #define OVS_DATAPATH_MCGROUP "ovs_datapath"
> -#define OVS_DATAPATH_VERSION 0x1
> +
> +/**
> + * V2:
This is not kernel-doc format so don't use '/**'.
> + * - API users are expected to provide OVS_DP_ATTR_USER_FEATURES
> + * with NLM_F_REPLACE when creating the datapath.
> + */
> +#define OVS_DATAPATH_VERSION 2
> +
> +/* First OVS datapath version to support features */
> +#define OVS_DP_VER_FEATURES 2
>
> enum ovs_datapath_cmd {
> OVS_DP_CMD_UNSPEC,
> diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c
> index 3f1fb87..72cdffb 100644
> --- a/net/openvswitch/datapath.c
> +++ b/net/openvswitch/datapath.c
> @@ -1198,6 +1198,16 @@ static int ovs_dp_create_or_update(struct sk_buff *skb, struct genl_info *info,
> if (info->nlhdr->nlmsg_flags & NLM_F_REPLACE)
> goto update;
>
> + /* An outdated user space instance that does not understand
> + * the concept of user_features has attempted to create a new
> + * datapath. Drop all user features.
> + */
> + if (info->genlhdr->version < OVS_DP_VER_FEATURES) {
> + WARN_ONCE(dp->user_features, "Dropping previously "
> + "announced user features");
Log messages shouldn't be split like this as it makes them harder to
find. There should also be a newline at the end of the message.
Ben.
> + dp->user_features = 0;
> + }
> +
> err = -EEXIST;
> goto err_unlock_ovs;
> }
--
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists