netfilter: xtables: collapse conditions in xt_ecn
authorJan Engelhardt <jengelh@medozas.de>
Thu, 9 Jun 2011 20:16:50 +0000 (22:16 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Tue, 27 Dec 2011 19:45:25 +0000 (20:45 +0100)
One simplification of an if clause.

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

index 6ccc35d6cb1187bef07bd2a5ada03610e7b84b19..3c831a8efebc65840af55347c880cd188a465435 100644 (file)
@@ -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;
 }