diff options
| author | Jan Engelhardt <jengelh@medozas.de> | 2011-06-09 16:16:50 -0400 |
|---|---|---|
| committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2011-12-27 14:45:25 -0500 |
| commit | 42c344a3bc6bb2eb4c0bef98d24d53adda255154 (patch) | |
| tree | 22e7e84bd68531ac4fe51cebc813ef9ac41dfd13 /net/netfilter | |
| parent | af0d29cd2a732f70882e6122b9f9df8b0d84515e (diff) | |
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>
Diffstat (limited to 'net/netfilter')
| -rw-r--r-- | net/netfilter/xt_ecn.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/net/netfilter/xt_ecn.c b/net/netfilter/xt_ecn.c index 6ccc35d6cb11..3c831a8efebc 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) | |||
| 37 | * be good citizens. | 37 | * be good citizens. |
| 38 | */ | 38 | */ |
| 39 | th = skb_header_pointer(skb, par->thoff, sizeof(_tcph), &_tcph); | 39 | th = skb_header_pointer(skb, par->thoff, sizeof(_tcph), &_tcph); |
| 40 | if (th == NULL) { | 40 | if (th == NULL) |
| 41 | return false; | 41 | return false; |
| 42 | } | ||
| 43 | 42 | ||
| 44 | if (einfo->operation & XT_ECN_OP_MATCH_ECE) { | 43 | if (einfo->operation & XT_ECN_OP_MATCH_ECE) { |
| 45 | if (einfo->invert & XT_ECN_OP_MATCH_ECE) { | 44 | 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) | |||
| 75 | { | 74 | { |
| 76 | const struct xt_ecn_info *info = par->matchinfo; | 75 | const struct xt_ecn_info *info = par->matchinfo; |
| 77 | 76 | ||
| 78 | if (info->operation & XT_ECN_OP_MATCH_IP) | 77 | if (info->operation & XT_ECN_OP_MATCH_IP && !match_ip(skb, info)) |
| 79 | if (!match_ip(skb, info)) | 78 | return false; |
| 80 | return false; | ||
| 81 | 79 | ||
| 82 | if (info->operation & (XT_ECN_OP_MATCH_ECE | XT_ECN_OP_MATCH_CWR)) { | 80 | if (info->operation & (XT_ECN_OP_MATCH_ECE | XT_ECN_OP_MATCH_CWR) && |
| 83 | if (!match_tcp(skb, par)) | 81 | !match_tcp(skb, par)) |
| 84 | return false; | 82 | return false; |
| 85 | } | ||
| 86 | 83 | ||
| 87 | return true; | 84 | return true; |
| 88 | } | 85 | } |
