]> git.ipfire.org Git - thirdparty/ipset.git/commitdiff
Backward compatibility: handle renaming nla_strlcpy to nla_strscpy
authorJozsef Kadlecsik <kadlec@netfilter.org>
Sun, 20 Dec 2020 13:11:06 +0000 (14:11 +0100)
committerJozsef Kadlecsik <kadlec@netfilter.org>
Sun, 20 Dec 2020 13:11:06 +0000 (14:11 +0100)
Signed-off-by: Jozsef Kadlecsik <kadlec@netfilter.org>
configure.ac
kernel/include/linux/netfilter/ipset/ip_set_compat.h.in

index 2f065909dade45341566ef7834c96e0594162d99..c777eedf936aab0ed1810cab3256d03f3da3ac91 100644 (file)
@@ -725,6 +725,16 @@ else
        AC_SUBST(HAVE_LOCKDEP_NFNL_IS_HELD, undef)
 fi
 
+AC_MSG_CHECKING([kernel source for nla_strscpy() in netlink.h])
+if test -f $ksourcedir/include/net/netlink.h && \
+   $GREP -q ' nla_strscpy' $ksourcedir/include/net/netlink.h; then
+       AC_MSG_RESULT(yes)
+       AC_SUBST(HAVE_NLA_STRSCPY, define)
+else
+       AC_MSG_RESULT(no)
+       AC_SUBST(HAVE_NLA_STRSCPY, undef)
+fi
+
 AC_MSG_CHECKING([kernel source for strscpy() in string.h])
 if test -f $ksourcedir/include/linux/timer.h && \
    $GREP -q ' strscpy' $ksourcedir/include/linux/string.h; then
index eecf3302878e409458d3993045a8dbe353fb1b38..96a4cf4417829b94b732155aa9405883fefdffe5 100644 (file)
@@ -61,6 +61,7 @@
 #@HAVE_NLA_POLICY_EXACT_LEN@ HAVE_NLA_POLICY_EXACT_LEN
 #@HAVE_KVZALLOC@ HAVE_KVZALLOC
 #@HAVE_GFP_KERNEL_ACCOUNT@ HAVE_GFP_KERNEL_ACCOUNT
+#@HAVE_NLA_STRSCPY@ HAVE_NLA_STRSCPY
 
 #ifdef HAVE_EXPORT_SYMBOL_GPL_IN_MODULE_H
 #include <linux/module.h>
@@ -454,6 +455,10 @@ static inline ssize_t strscpy(char * dest, const char * src, size_t count)
 }
 #endif
 
+#ifndef HAVE_NLA_STRSCPY
+#define nla_strscpy    nla_strlcpy
+#endif
+
 #ifndef smp_mb__before_atomic
 #define smp_mb__before_atomic()        smp_mb()
 #define smp_mb__after_atomic() smp_mb()