summaryrefslogtreecommitdiffstats
path: root/kernel/net/sched/em_ipset.c
diff options
context:
space:
mode:
authorJozsef Kadlecsik <kadlec@blackhole.kfki.hu>2017-03-23 16:13:16 +0100
committerJozsef Kadlecsik <kadlec@blackhole.kfki.hu>2017-03-23 22:06:36 +0100
commit1d90b77974a41becda46a16a78f90ecd43e2c222 (patch)
tree47cea4f7fe5198d628e1a5cb66a3cadd7589a5f1 /kernel/net/sched/em_ipset.c
parentf5bb0ae5317175e47b50216d53da5342390a13b6 (diff)
Compatibility: handle changes in 4.10 kernel tree
Handle changes in struct xt_action_param and the new xt_family(), xt_net() interfaces (reported by Jan Engelhardt).
Diffstat (limited to 'kernel/net/sched/em_ipset.c')
-rw-r--r--kernel/net/sched/em_ipset.c24
1 files changed, 22 insertions, 2 deletions
diff --git a/kernel/net/sched/em_ipset.c b/kernel/net/sched/em_ipset.c
index a4ab08d..bd9566f 100644
--- a/kernel/net/sched/em_ipset.c
+++ b/kernel/net/sched/em_ipset.c
@@ -75,17 +75,27 @@ static int em_ipset_match(struct sk_buff *skb, struct tcf_ematch *em,
struct xt_action_param acpar;
const struct xt_set_info *set = (const void *) em->data;
struct net_device *dev, *indev = NULL;
+#ifdef HAVE_STATE_IN_XT_ACTION_PARAM
+ struct nf_hook_state state = {
+ .net = em->net,
+ };
+#endif
int ret, network_offset;
+#ifdef HAVE_STATE_IN_XT_ACTION_PARAM
+#define ACPAR_FAMILY(f) state.pf = f
+#else
+#define ACPAR_FAMILY(f) acpar.family = f
+#endif
switch (tc_skb_protocol(skb)) {
case htons(ETH_P_IP):
- acpar.family = NFPROTO_IPV4;
+ ACPAR_FAMILY(NFPROTO_IPV4);
if (!pskb_network_may_pull(skb, sizeof(struct iphdr)))
return 0;
acpar.thoff = ip_hdrlen(skb);
break;
case htons(ETH_P_IPV6):
- acpar.family = NFPROTO_IPV6;
+ ACPAR_FAMILY(NFPROTO_IPV6);
if (!pskb_network_may_pull(skb, sizeof(struct ipv6hdr)))
return 0;
/* doesn't call ipv6_find_hdr() because ipset doesn't use
@@ -97,9 +107,13 @@ static int em_ipset_match(struct sk_buff *skb, struct tcf_ematch *em,
return 0;
}
+#ifdef HAVE_STATE_IN_XT_ACTION_PARAM
+ opt.family = state.pf;
+#else
acpar.hooknum = 0;
opt.family = acpar.family;
+#endif
opt.dim = set->dim;
opt.flags = set->flags;
opt.cmdflags = 0;
@@ -119,11 +133,17 @@ static int em_ipset_match(struct sk_buff *skb, struct tcf_ematch *em,
indev = dev_get_by_index_rcu(dev_net(dev), skb->skb_iif);
#endif
+#ifdef HAVE_STATE_IN_XT_ACTION_PARAM
+ state.in = indev ? indev : dev;
+ state.out = dev;
+ acpar.state = &state;
+#else
#ifdef HAVE_NET_IN_XT_ACTION_PARAM
acpar.net = em->net;
#endif
acpar.in = indev ? indev : dev;
acpar.out = dev;
+#endif /* HAVE_STATE_IN_XT_ACTION_PARAM */
ret = ip_set_test(set->index, skb, &acpar, &opt);