mirror of
git://git.code.sf.net/p/xtables-addons/xtables-addons
synced 2025-09-08 05:34:58 +02:00
pknock: add_rule must happen after info struct checks
This avoids unnecessarily creating pknock rules if there is an error with any of the match parameters.
This commit is contained in:
@@ -1034,9 +1034,6 @@ static bool pknock_mt_check(const struct xt_mtchk_param *par)
|
||||
get_random_bytes(&ipt_pknock_hash_rnd, sizeof (ipt_pknock_hash_rnd));
|
||||
}
|
||||
|
||||
if (!add_rule(info))
|
||||
RETURN_ERR("add_rule() error in checkentry() function.\n");
|
||||
|
||||
if (!(info->option & XT_PKNOCK_NAME))
|
||||
RETURN_ERR("You must specify --name option.\n");
|
||||
|
||||
@@ -1081,6 +1078,9 @@ static bool pknock_mt_check(const struct xt_mtchk_param *par)
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!add_rule(info))
|
||||
RETURN_ERR("add_rule() error in checkentry() function.\n");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user