]> granicus.if.org Git - ipset/commitdiff
Backport nfnl_msg_type()
authorJozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Mon, 11 Sep 2017 18:14:25 +0000 (20:14 +0200)
committerJozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Mon, 11 Sep 2017 18:14:25 +0000 (20:14 +0200)
configure.ac
kernel/include/linux/netfilter/ipset/ip_set_compat.h.in
kernel/net/netfilter/ipset/ip_set_core.c

index c7a030c053bee5d50e700eabfd499c0d9a4af649..6482670ecd949d0ecb341644dacbf0fb32f7aab5 100644 (file)
@@ -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
index a6f90934bd0ba1e70dadb604d83377fbc501579c..002e3dbef992a4c035fc8c089e075f0c75407f8a 100644 (file)
@@ -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
index 3bb832da4e5dce0b5ff28f793b93ce661719eb32..de43aa14cfb24945029496d906ddb2bdef1a2fbf 100644 (file)
@@ -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;