Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

netfilter: xtables: collapse conditions in xt_ecn

One simplification of an if clause.

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>

authored by

Jan Engelhardt and committed by
Pablo Neira Ayuso
42c344a3 af0d29cd

+6 -9
+6 -9
net/netfilter/xt_ecn.c
··· 37 37 * be good citizens. 38 38 */ 39 39 th = skb_header_pointer(skb, par->thoff, sizeof(_tcph), &_tcph); 40 - if (th == NULL) { 40 + if (th == NULL) 41 41 return false; 42 - } 43 42 44 43 if (einfo->operation & XT_ECN_OP_MATCH_ECE) { 45 44 if (einfo->invert & XT_ECN_OP_MATCH_ECE) { ··· 74 75 { 75 76 const struct xt_ecn_info *info = par->matchinfo; 76 77 77 - if (info->operation & XT_ECN_OP_MATCH_IP) 78 - if (!match_ip(skb, info)) 79 - return false; 78 + if (info->operation & XT_ECN_OP_MATCH_IP && !match_ip(skb, info)) 79 + return false; 80 80 81 - if (info->operation & (XT_ECN_OP_MATCH_ECE | XT_ECN_OP_MATCH_CWR)) { 82 - if (!match_tcp(skb, par)) 83 - return false; 84 - } 81 + if (info->operation & (XT_ECN_OP_MATCH_ECE | XT_ECN_OP_MATCH_CWR) && 82 + !match_tcp(skb, par)) 83 + return false; 85 84 86 85 return true; 87 86 }