From: Jozsef Kadlecsik Date: Mon, 19 Oct 2015 18:20:19 +0000 (+0200) Subject: Fix detecting 'struct net' in 'struct tcf_ematch' X-Git-Tag: v6.27~9 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4ed4c5f9f3f5cf007f9d2f168d310e83fb16408a;p=ipset Fix detecting 'struct net' in 'struct tcf_ematch' Nikolay Borisov reported that the detection is broken. Fix checking in the right sctructure and wrap the call to dev_get_by_index_rcu() too. --- diff --git a/configure.ac b/configure.ac index 91567da..8829403 100644 --- a/configure.ac +++ b/configure.ac @@ -367,7 +367,7 @@ fi AC_MSG_CHECKING([kernel source for struct net in struct tcf_ematch]) if test -f $ksourcedir/include/net/pkt_cls.h && \ - $AWK '/^struct tcf_ematch_ops / {for(i=1; i<=7; i++) {getline; print}}' $ksourcedir/include/net/pkt_cls.h | \ + $AWK '/^struct tcf_ematch / {for(i=1; i<=7; i++) {getline; print}}' $ksourcedir/include/net/pkt_cls.h | \ $GREP -q 'struct net'; then AC_MSG_RESULT(yes) AC_SUBST(HAVE_TCF_EMATCH_STRUCT_NET, define) diff --git a/kernel/net/sched/em_ipset.c b/kernel/net/sched/em_ipset.c index 31a0bd8..bc1a2f1 100644 --- a/kernel/net/sched/em_ipset.c +++ b/kernel/net/sched/em_ipset.c @@ -113,7 +113,11 @@ static int em_ipset_match(struct sk_buff *skb, struct tcf_ematch *em, rcu_read_lock(); if (skb->skb_iif) +#ifdef HAVE_TCF_EMATCH_STRUCT_NET indev = dev_get_by_index_rcu(em->net, skb->skb_iif); +#else + indev = dev_get_by_index_rcu(dev_net(dev), skb->skb_iif); +#endif acpar.in = indev ? indev : dev; acpar.out = dev;