From: Patrick McHardy Date: Fri, 19 Feb 2010 07:03:28 +0000 (+0100) Subject: netfilter: restore POST_ROUTING hook in NF_HOOK_COND X-Git-Tag: v2.6.34-rc1~233^2~126^2~2 X-Git-Url: https://bbs.cooldavid.org/git/?p=net-next-2.6.git;a=commitdiff_plain;h=4bac6b180771f7ef5275b1a6d88e630ca3a3d6f0 netfilter: restore POST_ROUTING hook in NF_HOOK_COND Commit 2249065 ("netfilter: get rid of the grossness in netfilter.h") inverted the logic for conditional hook invocation, breaking the POST_ROUTING hook invoked by ip_output(). Correct the logic and remove an unnecessary initialization. Reported-by: Stephen Hemminger Signed-off-by: Patrick McHardy --- diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h index 70079454ffd..89341c32631 100644 --- a/include/linux/netfilter.h +++ b/include/linux/netfilter.h @@ -212,8 +212,9 @@ NF_HOOK_COND(uint8_t pf, unsigned int hook, struct sk_buff *skb, struct net_device *in, struct net_device *out, int (*okfn)(struct sk_buff *), bool cond) { - int ret = 1; - if (cond || + int ret; + + if (!cond || (ret = nf_hook_thresh(pf, hook, skb, in, out, okfn, INT_MIN) == 1)) ret = okfn(skb); return ret;