提交 42c344a3 编写于 作者: J Jan Engelhardt 提交者: Pablo Neira Ayuso

netfilter: xtables: collapse conditions in xt_ecn

One simplification of an if clause.
Signed-off-by: NJan Engelhardt <jengelh@medozas.de>
Signed-off-by: NPablo Neira Ayuso <pablo@netfilter.org>
上级 af0d29cd
...@@ -37,9 +37,8 @@ static bool match_tcp(const struct sk_buff *skb, struct xt_action_param *par) ...@@ -37,9 +37,8 @@ static bool match_tcp(const struct sk_buff *skb, struct xt_action_param *par)
* be good citizens. * be good citizens.
*/ */
th = skb_header_pointer(skb, par->thoff, sizeof(_tcph), &_tcph); th = skb_header_pointer(skb, par->thoff, sizeof(_tcph), &_tcph);
if (th == NULL) { if (th == NULL)
return false; return false;
}
if (einfo->operation & XT_ECN_OP_MATCH_ECE) { if (einfo->operation & XT_ECN_OP_MATCH_ECE) {
if (einfo->invert & 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) ...@@ -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; const struct xt_ecn_info *info = par->matchinfo;
if (info->operation & XT_ECN_OP_MATCH_IP) if (info->operation & XT_ECN_OP_MATCH_IP && !match_ip(skb, info))
if (!match_ip(skb, info))
return false; return false;
if (info->operation & (XT_ECN_OP_MATCH_ECE | XT_ECN_OP_MATCH_CWR)) { if (info->operation & (XT_ECN_OP_MATCH_ECE | XT_ECN_OP_MATCH_CWR) &&
if (!match_tcp(skb, par)) !match_tcp(skb, par))
return false; return false;
}
return true; return true;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册