summaryrefslogtreecommitdiff
path: root/datapath
diff options
context:
space:
mode:
authorGreg Rose <gvrose8192@gmail.com>2017-09-11 14:11:03 -0700
committerAndy Zhou <azhou@ovn.org>2017-09-22 12:32:54 -0700
commit22562e9f87a38444a6a94ade7cb3e42f02977eae (patch)
treec699969067b1587fd2daff1907f4758136753aa7 /datapath
parent6b51641a517bb23b49d83f595b9d9cefb828a590 (diff)
downloadopenvswitch-22562e9f87a38444a6a94ade7cb3e42f02977eae.tar.gz
datapath: Fixup RTNL ops for kernel 4.13
The RTNL ops validate and newlink functions now take the extended netlink ack parameter. Use the new HAVE_EXT_ACK_IN_RTNL_LINKOPS define to check if the additional parameter is present and add the parameter if so. While in the modules remove the checks for Linux kernels < 2.3.39 since they are no longer supported since 2.5.x. Signed-off-by: Greg Rose <gvrose8192@gmail.com> Signed-off-by: Andy Zhou <azhou@ovn.org>
Diffstat (limited to 'datapath')
-rw-r--r--datapath/linux/compat/lisp.c21
-rw-r--r--datapath/linux/compat/stt.c11
2 files changed, 21 insertions, 11 deletions
diff --git a/datapath/linux/compat/lisp.c b/datapath/linux/compat/lisp.c
index c505fad83..34f82324a 100644
--- a/datapath/linux/compat/lisp.c
+++ b/datapath/linux/compat/lisp.c
@@ -608,7 +608,12 @@ static const struct nla_policy lisp_policy[IFLA_LISP_MAX + 1] = {
[IFLA_LISP_PORT] = { .type = NLA_U16 },
};
+#ifdef HAVE_EXT_ACK_IN_RTNL_LINKOPS
+static int lisp_validate(struct nlattr *tb[], struct nlattr *data[],
+ struct netlink_ext_ack __always_unused *extack)
+#else
static int lisp_validate(struct nlattr *tb[], struct nlattr *data[])
+#endif
{
if (tb[IFLA_ADDRESS]) {
if (nla_len(tb[IFLA_ADDRESS]) != ETH_ALEN)
@@ -660,17 +665,15 @@ static int lisp_configure(struct net *net, struct net_device *dev,
return 0;
}
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39)
+#ifdef HAVE_EXT_ACK_IN_RTNL_LINKOPS
static int lisp_newlink(struct net *net, struct net_device *dev,
- struct nlattr *tb[], struct nlattr *data[])
-{
+ struct nlattr *tb[], struct nlattr *data[],
+ struct netlink_ext_ack __always_unused *extack)
#else
-static int lisp_newlink(struct net_device *dev,
+static int lisp_newlink(struct net *net, struct net_device *dev,
struct nlattr *tb[], struct nlattr *data[])
-
-{
- struct net *net = &init_net;
#endif
+{
__be16 dst_port = htons(LISP_UDP_PORT);
if (data[IFLA_LISP_PORT])
@@ -679,11 +682,7 @@ static int lisp_newlink(struct net_device *dev,
return lisp_configure(net, dev, dst_port);
}
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39)
static void lisp_dellink(struct net_device *dev, struct list_head *head)
-#else
-static void lisp_dellink(struct net_device *dev)
-#endif
{
struct lisp_dev *lisp = netdev_priv(dev);
diff --git a/datapath/linux/compat/stt.c b/datapath/linux/compat/stt.c
index 964d993df..07f589218 100644
--- a/datapath/linux/compat/stt.c
+++ b/datapath/linux/compat/stt.c
@@ -1909,7 +1909,12 @@ static const struct nla_policy stt_policy[IFLA_STT_MAX + 1] = {
[IFLA_STT_PORT] = { .type = NLA_U16 },
};
+#ifdef HAVE_EXT_ACK_IN_RTNL_LINKOPS
+static int stt_validate(struct nlattr *tb[], struct nlattr *data[],
+ struct netlink_ext_ack __always_unused *extack)
+#else
static int stt_validate(struct nlattr *tb[], struct nlattr *data[])
+#endif
{
if (tb[IFLA_ADDRESS]) {
if (nla_len(tb[IFLA_ADDRESS]) != ETH_ALEN)
@@ -1961,8 +1966,14 @@ static int stt_configure(struct net *net, struct net_device *dev,
return 0;
}
+#ifdef HAVE_EXT_ACK_IN_RTNL_LINKOPS
+static int stt_newlink(struct net *net, struct net_device *dev,
+ struct nlattr *tb[], struct nlattr *data[],
+ struct netlink_ext_ack __always_unused *extack)
+#else
static int stt_newlink(struct net *net, struct net_device *dev,
struct nlattr *tb[], struct nlattr *data[])
+#endif
{
__be16 dst_port = htons(STT_DST_PORT);