From a27741493db0d824a51775e387cf3972a471f64e Mon Sep 17 00:00:00 2001 From: Jozsef Kadlecsik Date: Mon, 24 Sep 2018 18:28:53 +0200 Subject: [PATCH] Add compatibility to support kvcalloc() --- configure.ac | 10 ++++++++++ .../include/linux/netfilter/ipset/ip_set_compat.h.in | 5 +++++ 2 files changed, 15 insertions(+) diff --git a/configure.ac b/configure.ac index 73a2f8c..2df76b2 100644 --- a/configure.ac +++ b/configure.ac @@ -383,6 +383,16 @@ else AC_SUBST(HAVE_RBTREE_POSTORDER_FOR_EACH_ENTRY_SAFE, undef) fi +AC_MSG_CHECKING([kernel source for kvcalloc]) +if test -f $ksourcedir/include/linux/mm.h && \ + $GREP -q 'kvcalloc' $ksourcedir/include/linux/mm.h; then + AC_MSG_RESULT(yes) + AC_SUBST(HAVE_KVCALLOC, define) +else + AC_MSG_RESULT(no) + AC_SUBST(HAVE_KVCALLOC, undef) +fi + AC_MSG_CHECKING([kernel source for kvfree]) if test -f $ksourcedir/include/linux/mm.h && \ $GREP -q 'kvfree' $ksourcedir/include/linux/mm.h; then diff --git a/kernel/include/linux/netfilter/ipset/ip_set_compat.h.in b/kernel/include/linux/netfilter/ipset/ip_set_compat.h.in index 72b77b3..53bd588 100644 --- a/kernel/include/linux/netfilter/ipset/ip_set_compat.h.in +++ b/kernel/include/linux/netfilter/ipset/ip_set_compat.h.in @@ -23,6 +23,7 @@ #@HAVE_NET_OPS_ID@ HAVE_NET_OPS_ID #@HAVE_USER_NS_IN_STRUCT_NET@ HAVE_USER_NS_IN_STRUCT_NET #@HAVE_RBTREE_POSTORDER_FOR_EACH_ENTRY_SAFE@ HAVE_RBTREE_POSTORDER_FOR_EACH_ENTRY_SAFE +#@HAVE_KVCALLOC@ HAVE_KVCALLOC #@HAVE_KVFREE@ HAVE_KVFREE #@HAVE_XT_MTCHK_PARAM_STRUCT_NET@ HAVE_XT_MTCHK_PARAM_STRUCT_NET #@HAVE_TCF_EMATCH_OPS_CHANGE_ARG_NET@ HAVE_TCF_EMATCH_OPS_CHANGE_ARG_NET @@ -215,6 +216,10 @@ static inline int nla_put_net64(struct sk_buff *skb, int attrtype, __be64 value) ipv6_skip_exthdr(skbuff, start, nexthdrp) #endif +#ifndef HAVE_KVCALLOC +#define kvcalloc(n, size, flags) kcalloc(n, size, flags) +#endif + #ifndef HAVE_KVFREE #include static inline void kvfree(const void *addr) -- 2.40.0