summaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorJozsef Kadlecsik <kadlec@blackhole.kfki.hu>2014-11-03 18:35:28 +0100
committerJozsef Kadlecsik <kadlec@blackhole.kfki.hu>2014-11-03 18:35:28 +0100
commit3ee3e5ad6e6eb06f13297dd67054325a9af6926a (patch)
treeceae7c499334df542ce92298c2babcf05128061d /kernel
parent5248f4d6cb90f27334bd75309f3976902e638280 (diff)
Kernel API changes in em_ipset.c, support both old and new ones
Diffstat (limited to 'kernel')
-rw-r--r--kernel/include/linux/netfilter/ipset/ip_set_compat.h.in2
-rw-r--r--kernel/net/sched/em_ipset.c16
2 files changed, 18 insertions, 0 deletions
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 d38197c..9809e2a 100644
--- a/kernel/include/linux/netfilter/ipset/ip_set_compat.h.in
+++ b/kernel/include/linux/netfilter/ipset/ip_set_compat.h.in
@@ -36,6 +36,8 @@
#@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_KVFREE@ HAVE_KVFREE
+#@HAVE_TCF_EMATCH_OPS_CHANGE_ARG_NET@ HAVE_TCF_EMATCH_OPS_CHANGE_ARG_NET
+#@HAVE_TCF_EMATCH_STRUCT_NET@ HAVE_TCF_EMATCH_STRUCT_NET
/* Not everything could be moved here. Compatibility stuffs can be found in
* xt_set.c, ip_set_core.c, ip_set_getport.c, pfxlen.c too.
diff --git a/kernel/net/sched/em_ipset.c b/kernel/net/sched/em_ipset.c
index 527aeb7..2729d7e 100644
--- a/kernel/net/sched/em_ipset.c
+++ b/kernel/net/sched/em_ipset.c
@@ -15,16 +15,24 @@
#include <linux/string.h>
#include <linux/skbuff.h>
#include <linux/netfilter/xt_set.h>
+#include <linux/netfilter/ipset/ip_set_compat.h>
#include <linux/ipv6.h>
#include <net/ip.h>
#include <net/pkt_cls.h>
+#ifdef HAVE_TCF_EMATCH_OPS_CHANGE_ARG_NET
+static int em_ipset_change(struct net *net, void *data, int data_len,
+ struct tcf_ematch *em)
+#else
static int em_ipset_change(struct tcf_proto *tp, void *data, int data_len,
struct tcf_ematch *em)
+#endif
{
struct xt_set_info *set = data;
ip_set_id_t index;
+#ifndef HAVE_TCF_EMATCH_OPS_CHANGE_ARG_NET
struct net *net = dev_net(qdisc_dev(tp->q));
+#endif
if (data_len != sizeof(*set))
return -EINVAL;
@@ -42,11 +50,19 @@ static int em_ipset_change(struct tcf_proto *tp, void *data, int data_len,
return -ENOMEM;
}
+#ifdef HAVE_TCF_EMATCH_STRUCT_NET
+static void em_ipset_destroy(struct tcf_ematch *em)
+#else
static void em_ipset_destroy(struct tcf_proto *p, struct tcf_ematch *em)
+#endif
{
const struct xt_set_info *set = (const void *) em->data;
if (set) {
+#ifdef HAVE_TCF_EMATCH_STRUCT_NET
+ ip_set_nfnl_put(em->net, set->index);
+#else
ip_set_nfnl_put(dev_net(qdisc_dev(p->q)), set->index);
+#endif
kfree((void *) em->data);
}
}