summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJozsef Kadlecsik <kadlec@blackhole.kfki.hu>2017-09-11 20:14:25 +0200
committerJozsef Kadlecsik <kadlec@blackhole.kfki.hu>2017-09-11 20:14:25 +0200
commit4469d05e3803d3145f47686491c5b76b97ab178a (patch)
treeacb9e5ef704305ed5c8d45d09c51794141d2e476
parent54802b2c28265769c2dc1b126419ac673316eb64 (diff)
Backport nfnl_msg_type()
-rw-r--r--configure.ac10
-rw-r--r--kernel/include/linux/netfilter/ipset/ip_set_compat.h.in8
-rw-r--r--kernel/net/netfilter/ipset/ip_set_core.c2
3 files changed, 19 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac
index c7a030c..6482670 100644
--- a/configure.ac
+++ b/configure.ac
@@ -539,6 +539,16 @@ else
AC_SUBST(HAVE_XT_NET, undef)
fi
+AC_MSG_CHECKING([kernel source for nfnl_msg_type() in nfnetlink.h])
+if test -f $ksourcedir/include/linux/netfilter/nfnetlink.h && \
+ $GREP -q 'nfnl_msg_type' $ksourcedir/include/linux/netfilter/nfnetlink.h; then
+ AC_MSG_RESULT(yes)
+ AC_SUBST(HAVE_NFNL_MSG_TYPE, define)
+else
+ AC_MSG_RESULT(no)
+ AC_SUBST(HAVE_NFNL_MSG_TYPE, undef)
+fi
+
AC_MSG_CHECKING([kernel source for struct net_generic])
if test -f $ksourcedir/include/net/netns/generic.h && \
$GREP -q 'struct net_generic' $ksourcedir/include/net/netns/generic.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 a6f9093..002e3db 100644
--- a/kernel/include/linux/netfilter/ipset/ip_set_compat.h.in
+++ b/kernel/include/linux/netfilter/ipset/ip_set_compat.h.in
@@ -38,6 +38,7 @@
#@HAVE_STATE_IN_XT_ACTION_PARAM@ HAVE_STATE_IN_XT_ACTION_PARAM
#@HAVE_XT_FAMILY@ HAVE_XT_FAMILY
#@HAVE_XT_NET@ HAVE_XT_NET
+#@HAVE_NFNL_MSG_TYPE@ HAVE_NFNL_MSG_TYPE
#ifdef HAVE_EXPORT_SYMBOL_GPL_IN_MODULE_H
#include <linux/module.h>
@@ -296,6 +297,13 @@ static inline __be16 tc_skb_protocol(const struct sk_buff *skb)
#define IPSET_DEV_NET(par) dev_net((par)->in ? (par)->in : (par)->out)
#endif
+#ifndef HAVE_NFNL_MSG_TYPE
+static inline u16 nfnl_msg_type(u8 subsys, u8 msg_type)
+{
+ return subsys << 8 | msg_type;
+}
+#endif
+
#ifdef HAVE_STATE_IN_XT_ACTION_PARAM
#define XAP_STATE(par) (par->state)
#else
diff --git a/kernel/net/netfilter/ipset/ip_set_core.c b/kernel/net/netfilter/ipset/ip_set_core.c
index 3bb832d..de43aa1 100644
--- a/kernel/net/netfilter/ipset/ip_set_core.c
+++ b/kernel/net/netfilter/ipset/ip_set_core.c
@@ -774,7 +774,7 @@ start_msg(struct sk_buff *skb, u32 portid, u32 seq, unsigned int flags,
struct nlmsghdr *nlh;
struct nfgenmsg *nfmsg;
- nlh = nlmsg_put(skb, portid, seq, cmd | (NFNL_SUBSYS_IPSET << 8),
+ nlh = nlmsg_put(skb, portid, seq, nfnl_msg_type(NFNL_SUBSYS_IPSET, cmd),
sizeof(*nfmsg), flags);
if (!nlh)
return NULL;