Thread (10 messages) 10 messages, 2 authors, 2013-11-27
STALE4595d REVIEWED: 1 (0M)
Revisions (2)
  1. v6 [diff vs current]
  2. v7 current

[PATCH net-next 7/8] openvswitch: Drop user features if old user space attempted to create datapath

From: Thomas Graf <tgraf@suug.ch>
Date: 2013-11-22 16:56:34
Subsystem: networking [general], openvswitch, the rest · Maintainers: "David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, Aaron Conole, Eelco Chaudron, Ilya Maximets, Linus Torvalds

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@suug.ch>
Reviewed-by: Daniel Borkmann <redacted>
---
 include/uapi/linux/openvswitch.h | 10 +++++++++-
 net/openvswitch/datapath.c       |  9 +++++++++
 2 files changed, 18 insertions(+), 1 deletion(-)
diff --git a/include/uapi/linux/openvswitch.h b/include/uapi/linux/openvswitch.h
index 07ef2c3..a6863e2 100644
--- a/include/uapi/linux/openvswitch.h
+++ b/include/uapi/linux/openvswitch.h
@@ -40,7 +40,15 @@ struct ovs_header {
 
 #define OVS_DATAPATH_FAMILY  "ovs_datapath"
 #define OVS_DATAPATH_MCGROUP "ovs_datapath"
-#define OVS_DATAPATH_VERSION 0x1
+
+/* V2:
+ *   - 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..f6c1b1e 100644
--- a/net/openvswitch/datapath.c
+++ b/net/openvswitch/datapath.c
@@ -1198,6 +1198,15 @@ 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(dp->user_features, "Dropping previously announced user features\n");
+			dp->user_features = 0;
+		}
+
 		err = -EEXIST;
 		goto err_unlock_ovs;
 	}
-- 
1.8.3.1
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help