Commit 9f567317 authored by Jan Engelhardt's avatar Jan Engelhardt

netfilter: xtables: untangle spaghetti if clauses in checkentry

As I'm changing the return values soon, I want to have a clear visual
path.
Signed-off-by: default avatarJan Engelhardt <jengelh@medozas.de>
parent 7911b5c7
...@@ -127,9 +127,13 @@ static bool dccp_mt_check(const struct xt_mtchk_param *par) ...@@ -127,9 +127,13 @@ static bool dccp_mt_check(const struct xt_mtchk_param *par)
{ {
const struct xt_dccp_info *info = par->matchinfo; const struct xt_dccp_info *info = par->matchinfo;
return !(info->flags & ~XT_DCCP_VALID_FLAGS) if (info->flags & ~XT_DCCP_VALID_FLAGS)
&& !(info->invflags & ~XT_DCCP_VALID_FLAGS) return false;
&& !(info->invflags & ~info->flags); if (info->invflags & ~XT_DCCP_VALID_FLAGS)
return false;
if (info->invflags & ~info->flags)
return false;
return true;
} }
static struct xt_match dccp_mt_reg[] __read_mostly = { static struct xt_match dccp_mt_reg[] __read_mostly = {
......
...@@ -148,14 +148,18 @@ static bool sctp_mt_check(const struct xt_mtchk_param *par) ...@@ -148,14 +148,18 @@ static bool sctp_mt_check(const struct xt_mtchk_param *par)
{ {
const struct xt_sctp_info *info = par->matchinfo; const struct xt_sctp_info *info = par->matchinfo;
return !(info->flags & ~XT_SCTP_VALID_FLAGS) if (info->flags & ~XT_SCTP_VALID_FLAGS)
&& !(info->invflags & ~XT_SCTP_VALID_FLAGS) return false;
&& !(info->invflags & ~info->flags) if (info->invflags & ~XT_SCTP_VALID_FLAGS)
&& ((!(info->flags & XT_SCTP_CHUNK_TYPES)) || return false;
(info->chunk_match_type & if (info->invflags & ~info->flags)
(SCTP_CHUNK_MATCH_ALL return false;
| SCTP_CHUNK_MATCH_ANY if (!(info->flags & XT_SCTP_CHUNK_TYPES))
| SCTP_CHUNK_MATCH_ONLY))); return true;
if (info->chunk_match_type & (SCTP_CHUNK_MATCH_ALL |
SCTP_CHUNK_MATCH_ANY | SCTP_CHUNK_MATCH_ONLY))
return true;
return false;
} }
static struct xt_match sctp_mt_reg[] __read_mostly = { static struct xt_match sctp_mt_reg[] __read_mostly = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment