]> granicus.if.org Git - ipset/commitdiff
Fix detecting 'struct net' in 'struct tcf_ematch'
authorJozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Mon, 19 Oct 2015 18:20:19 +0000 (20:20 +0200)
committerJozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Mon, 19 Oct 2015 18:20:19 +0000 (20:20 +0200)
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.

configure.ac
kernel/net/sched/em_ipset.c

index 91567da673a421cc42f201692ca55e4c802d73f2..8829403b2904b6f49d991d1246313566d76319cd 100644 (file)
@@ -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)
index 31a0bd84ca82a0801ff71fb5d7cca371fdff4a51..bc1a2f1b7128060b679caec23ca4216f1919fbb2 100644 (file)
@@ -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;