From: Jan Engelhardt Date: Thu, 9 Jun 2011 20:16:50 +0000 (+0200) Subject: netfilter: xtables: collapse conditions in xt_ecn X-Git-Tag: upstream/snapshot3+hdmi~8450^2~93^2~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=42c344a3bc6bb2eb4c0bef98d24d53adda255154;p=platform%2Fadaptation%2Frenesas_rcar%2Frenesas_kernel.git netfilter: xtables: collapse conditions in xt_ecn One simplification of an if clause. Signed-off-by: Jan Engelhardt Signed-off-by: Pablo Neira Ayuso --- diff --git a/net/netfilter/xt_ecn.c b/net/netfilter/xt_ecn.c index 6ccc35d..3c831a8 100644 --- a/net/netfilter/xt_ecn.c +++ b/net/netfilter/xt_ecn.c @@ -37,9 +37,8 @@ static bool match_tcp(const struct sk_buff *skb, struct xt_action_param *par) * be good citizens. */ th = skb_header_pointer(skb, par->thoff, sizeof(_tcph), &_tcph); - if (th == NULL) { + if (th == NULL) return false; - } if (einfo->operation & XT_ECN_OP_MATCH_ECE) { if (einfo->invert & XT_ECN_OP_MATCH_ECE) { @@ -75,14 +74,12 @@ static bool ecn_mt4(const struct sk_buff *skb, struct xt_action_param *par) { const struct xt_ecn_info *info = par->matchinfo; - if (info->operation & XT_ECN_OP_MATCH_IP) - if (!match_ip(skb, info)) - return false; + if (info->operation & XT_ECN_OP_MATCH_IP && !match_ip(skb, info)) + return false; - if (info->operation & (XT_ECN_OP_MATCH_ECE | XT_ECN_OP_MATCH_CWR)) { - if (!match_tcp(skb, par)) - return false; - } + if (info->operation & (XT_ECN_OP_MATCH_ECE | XT_ECN_OP_MATCH_CWR) && + !match_tcp(skb, par)) + return false; return true; }