[ovs-dev] [PATCH 1/5] datapath: Check extack argument of rtnl_create_link()

Yifeng Sun pkusunyifeng at gmail.com
Mon Jun 10 23:43:07 UTC 2019


Upstream commit d0522f1cd25edb796548f91e04766fa3cbc3b6df ("net:
Add extack argument to rtnl_create_link") added new argument
to rtnl_create_link(). This introduced compiling errors in
the code of kernel datapath.

This patch fixes this issue.

Signed-off-by: Yifeng Sun <pkusunyifeng at gmail.com>
---
 acinclude.m4                                  | 3 +++
 datapath/linux/compat/include/net/rtnetlink.h | 4 ++++
 2 files changed, 7 insertions(+)

diff --git a/acinclude.m4 b/acinclude.m4
index 08686044f635..6783512a68f3 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -681,6 +681,9 @@ AC_DEFUN([OVS_CHECK_LINUX_COMPAT], [
                                    [rcu_read_lock_held])])
   OVS_GREP_IFELSE([$KSRC/include/linux/rtnetlink.h], [lockdep_rtnl_is_held])
   OVS_GREP_IFELSE([$KSRC/include/linux/rtnetlink.h], [net_rwsem])
+  OVS_FIND_PARAM_IFELSE([$KSRC/include/net/rtnetlink.h],
+                        [rtnl_create_link], [extack],
+                        [OVS_DEFINE([HAVE_RTNL_CREATE_LINK_TAKES_EXTACK])])
 
   # Check for the proto_data_valid member in struct sk_buff.  The [^@]
   # is necessary because some versions of this header remove the
diff --git a/datapath/linux/compat/include/net/rtnetlink.h b/datapath/linux/compat/include/net/rtnetlink.h
index 74d6a27b799f..e026cab9530d 100644
--- a/datapath/linux/compat/include/net/rtnetlink.h
+++ b/datapath/linux/compat/include/net/rtnetlink.h
@@ -32,7 +32,11 @@ static inline struct net_device *rpl_rtnl_create_link(struct net *net, const cha
                                     const struct rtnl_link_ops *ops,
                                     struct nlattr *tb[])
 {
+#ifdef HAVE_RTNL_CREATE_LINK_TAKES_EXTACK
+	return rtnl_create_link(net, (char *) ifname, name_assign_type, ops, tb, NULL);
+#else
 	return rtnl_create_link(net, (char *) ifname, name_assign_type, ops, tb);
+#endif
 }
 #endif
 
-- 
2.7.4



More information about the dev mailing list