From 22562e9f87a38444a6a94ade7cb3e42f02977eae Mon Sep 17 00:00:00 2001 From: Greg Rose Date: Mon, 11 Sep 2017 14:11:03 -0700 Subject: 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 Signed-off-by: Andy Zhou --- datapath/linux/compat/lisp.c | 21 ++++++++++----------- datapath/linux/compat/stt.c | 11 +++++++++++ 2 files changed, 21 insertions(+), 11 deletions(-) (limited to 'datapath') 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); -- cgit v1.2.1