mirror of https://gitee.com/openkylin/linux.git
netfilter: xt_set: use pr ratelimiting
also convert this to info for consistency. These errors are informational message to user, given iptables doesn't have netlink extack equivalent. Signed-off-by: Florian Westphal <fw@strlen.de> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
This commit is contained in:
parent
e016c5e43d
commit
c82b31c5f5
|
@ -92,12 +92,12 @@ set_match_v0_checkentry(const struct xt_mtchk_param *par)
|
||||||
index = ip_set_nfnl_get_byindex(par->net, info->match_set.index);
|
index = ip_set_nfnl_get_byindex(par->net, info->match_set.index);
|
||||||
|
|
||||||
if (index == IPSET_INVALID_ID) {
|
if (index == IPSET_INVALID_ID) {
|
||||||
pr_warn("Cannot find set identified by id %u to match\n",
|
pr_info_ratelimited("Cannot find set identified by id %u to match\n",
|
||||||
info->match_set.index);
|
info->match_set.index);
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
}
|
}
|
||||||
if (info->match_set.u.flags[IPSET_DIM_MAX - 1] != 0) {
|
if (info->match_set.u.flags[IPSET_DIM_MAX - 1] != 0) {
|
||||||
pr_warn("Protocol error: set match dimension is over the limit!\n");
|
pr_info_ratelimited("set match dimension is over the limit!\n");
|
||||||
ip_set_nfnl_put(par->net, info->match_set.index);
|
ip_set_nfnl_put(par->net, info->match_set.index);
|
||||||
return -ERANGE;
|
return -ERANGE;
|
||||||
}
|
}
|
||||||
|
@ -143,12 +143,12 @@ set_match_v1_checkentry(const struct xt_mtchk_param *par)
|
||||||
index = ip_set_nfnl_get_byindex(par->net, info->match_set.index);
|
index = ip_set_nfnl_get_byindex(par->net, info->match_set.index);
|
||||||
|
|
||||||
if (index == IPSET_INVALID_ID) {
|
if (index == IPSET_INVALID_ID) {
|
||||||
pr_warn("Cannot find set identified by id %u to match\n",
|
pr_info_ratelimited("Cannot find set identified by id %u to match\n",
|
||||||
info->match_set.index);
|
info->match_set.index);
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
}
|
}
|
||||||
if (info->match_set.dim > IPSET_DIM_MAX) {
|
if (info->match_set.dim > IPSET_DIM_MAX) {
|
||||||
pr_warn("Protocol error: set match dimension is over the limit!\n");
|
pr_info_ratelimited("set match dimension is over the limit!\n");
|
||||||
ip_set_nfnl_put(par->net, info->match_set.index);
|
ip_set_nfnl_put(par->net, info->match_set.index);
|
||||||
return -ERANGE;
|
return -ERANGE;
|
||||||
}
|
}
|
||||||
|
@ -241,7 +241,7 @@ set_target_v0_checkentry(const struct xt_tgchk_param *par)
|
||||||
if (info->add_set.index != IPSET_INVALID_ID) {
|
if (info->add_set.index != IPSET_INVALID_ID) {
|
||||||
index = ip_set_nfnl_get_byindex(par->net, info->add_set.index);
|
index = ip_set_nfnl_get_byindex(par->net, info->add_set.index);
|
||||||
if (index == IPSET_INVALID_ID) {
|
if (index == IPSET_INVALID_ID) {
|
||||||
pr_warn("Cannot find add_set index %u as target\n",
|
pr_info_ratelimited("Cannot find add_set index %u as target\n",
|
||||||
info->add_set.index);
|
info->add_set.index);
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
}
|
}
|
||||||
|
@ -250,7 +250,7 @@ set_target_v0_checkentry(const struct xt_tgchk_param *par)
|
||||||
if (info->del_set.index != IPSET_INVALID_ID) {
|
if (info->del_set.index != IPSET_INVALID_ID) {
|
||||||
index = ip_set_nfnl_get_byindex(par->net, info->del_set.index);
|
index = ip_set_nfnl_get_byindex(par->net, info->del_set.index);
|
||||||
if (index == IPSET_INVALID_ID) {
|
if (index == IPSET_INVALID_ID) {
|
||||||
pr_warn("Cannot find del_set index %u as target\n",
|
pr_info_ratelimited("Cannot find del_set index %u as target\n",
|
||||||
info->del_set.index);
|
info->del_set.index);
|
||||||
if (info->add_set.index != IPSET_INVALID_ID)
|
if (info->add_set.index != IPSET_INVALID_ID)
|
||||||
ip_set_nfnl_put(par->net, info->add_set.index);
|
ip_set_nfnl_put(par->net, info->add_set.index);
|
||||||
|
@ -259,7 +259,7 @@ set_target_v0_checkentry(const struct xt_tgchk_param *par)
|
||||||
}
|
}
|
||||||
if (info->add_set.u.flags[IPSET_DIM_MAX - 1] != 0 ||
|
if (info->add_set.u.flags[IPSET_DIM_MAX - 1] != 0 ||
|
||||||
info->del_set.u.flags[IPSET_DIM_MAX - 1] != 0) {
|
info->del_set.u.flags[IPSET_DIM_MAX - 1] != 0) {
|
||||||
pr_warn("Protocol error: SET target dimension is over the limit!\n");
|
pr_info_ratelimited("SET target dimension over the limit!\n");
|
||||||
if (info->add_set.index != IPSET_INVALID_ID)
|
if (info->add_set.index != IPSET_INVALID_ID)
|
||||||
ip_set_nfnl_put(par->net, info->add_set.index);
|
ip_set_nfnl_put(par->net, info->add_set.index);
|
||||||
if (info->del_set.index != IPSET_INVALID_ID)
|
if (info->del_set.index != IPSET_INVALID_ID)
|
||||||
|
@ -316,7 +316,7 @@ set_target_v1_checkentry(const struct xt_tgchk_param *par)
|
||||||
if (info->add_set.index != IPSET_INVALID_ID) {
|
if (info->add_set.index != IPSET_INVALID_ID) {
|
||||||
index = ip_set_nfnl_get_byindex(par->net, info->add_set.index);
|
index = ip_set_nfnl_get_byindex(par->net, info->add_set.index);
|
||||||
if (index == IPSET_INVALID_ID) {
|
if (index == IPSET_INVALID_ID) {
|
||||||
pr_warn("Cannot find add_set index %u as target\n",
|
pr_info_ratelimited("Cannot find add_set index %u as target\n",
|
||||||
info->add_set.index);
|
info->add_set.index);
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
}
|
}
|
||||||
|
@ -325,7 +325,7 @@ set_target_v1_checkentry(const struct xt_tgchk_param *par)
|
||||||
if (info->del_set.index != IPSET_INVALID_ID) {
|
if (info->del_set.index != IPSET_INVALID_ID) {
|
||||||
index = ip_set_nfnl_get_byindex(par->net, info->del_set.index);
|
index = ip_set_nfnl_get_byindex(par->net, info->del_set.index);
|
||||||
if (index == IPSET_INVALID_ID) {
|
if (index == IPSET_INVALID_ID) {
|
||||||
pr_warn("Cannot find del_set index %u as target\n",
|
pr_info_ratelimited("Cannot find del_set index %u as target\n",
|
||||||
info->del_set.index);
|
info->del_set.index);
|
||||||
if (info->add_set.index != IPSET_INVALID_ID)
|
if (info->add_set.index != IPSET_INVALID_ID)
|
||||||
ip_set_nfnl_put(par->net, info->add_set.index);
|
ip_set_nfnl_put(par->net, info->add_set.index);
|
||||||
|
@ -334,7 +334,7 @@ set_target_v1_checkentry(const struct xt_tgchk_param *par)
|
||||||
}
|
}
|
||||||
if (info->add_set.dim > IPSET_DIM_MAX ||
|
if (info->add_set.dim > IPSET_DIM_MAX ||
|
||||||
info->del_set.dim > IPSET_DIM_MAX) {
|
info->del_set.dim > IPSET_DIM_MAX) {
|
||||||
pr_warn("Protocol error: SET target dimension is over the limit!\n");
|
pr_info_ratelimited("SET target dimension over the limit!\n");
|
||||||
if (info->add_set.index != IPSET_INVALID_ID)
|
if (info->add_set.index != IPSET_INVALID_ID)
|
||||||
ip_set_nfnl_put(par->net, info->add_set.index);
|
ip_set_nfnl_put(par->net, info->add_set.index);
|
||||||
if (info->del_set.index != IPSET_INVALID_ID)
|
if (info->del_set.index != IPSET_INVALID_ID)
|
||||||
|
@ -444,7 +444,7 @@ set_target_v3_checkentry(const struct xt_tgchk_param *par)
|
||||||
index = ip_set_nfnl_get_byindex(par->net,
|
index = ip_set_nfnl_get_byindex(par->net,
|
||||||
info->add_set.index);
|
info->add_set.index);
|
||||||
if (index == IPSET_INVALID_ID) {
|
if (index == IPSET_INVALID_ID) {
|
||||||
pr_warn("Cannot find add_set index %u as target\n",
|
pr_info_ratelimited("Cannot find add_set index %u as target\n",
|
||||||
info->add_set.index);
|
info->add_set.index);
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
}
|
}
|
||||||
|
@ -454,7 +454,7 @@ set_target_v3_checkentry(const struct xt_tgchk_param *par)
|
||||||
index = ip_set_nfnl_get_byindex(par->net,
|
index = ip_set_nfnl_get_byindex(par->net,
|
||||||
info->del_set.index);
|
info->del_set.index);
|
||||||
if (index == IPSET_INVALID_ID) {
|
if (index == IPSET_INVALID_ID) {
|
||||||
pr_warn("Cannot find del_set index %u as target\n",
|
pr_info_ratelimited("Cannot find del_set index %u as target\n",
|
||||||
info->del_set.index);
|
info->del_set.index);
|
||||||
if (info->add_set.index != IPSET_INVALID_ID)
|
if (info->add_set.index != IPSET_INVALID_ID)
|
||||||
ip_set_nfnl_put(par->net,
|
ip_set_nfnl_put(par->net,
|
||||||
|
@ -465,7 +465,7 @@ set_target_v3_checkentry(const struct xt_tgchk_param *par)
|
||||||
|
|
||||||
if (info->map_set.index != IPSET_INVALID_ID) {
|
if (info->map_set.index != IPSET_INVALID_ID) {
|
||||||
if (strncmp(par->table, "mangle", 7)) {
|
if (strncmp(par->table, "mangle", 7)) {
|
||||||
pr_warn("--map-set only usable from mangle table\n");
|
pr_info_ratelimited("--map-set only usable from mangle table\n");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
if (((info->flags & IPSET_FLAG_MAP_SKBPRIO) |
|
if (((info->flags & IPSET_FLAG_MAP_SKBPRIO) |
|
||||||
|
@ -473,13 +473,13 @@ set_target_v3_checkentry(const struct xt_tgchk_param *par)
|
||||||
!(par->hook_mask & (1 << NF_INET_FORWARD |
|
!(par->hook_mask & (1 << NF_INET_FORWARD |
|
||||||
1 << NF_INET_LOCAL_OUT |
|
1 << NF_INET_LOCAL_OUT |
|
||||||
1 << NF_INET_POST_ROUTING))) {
|
1 << NF_INET_POST_ROUTING))) {
|
||||||
pr_warn("mapping of prio or/and queue is allowed only from OUTPUT/FORWARD/POSTROUTING chains\n");
|
pr_info_ratelimited("mapping of prio or/and queue is allowed only from OUTPUT/FORWARD/POSTROUTING chains\n");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
index = ip_set_nfnl_get_byindex(par->net,
|
index = ip_set_nfnl_get_byindex(par->net,
|
||||||
info->map_set.index);
|
info->map_set.index);
|
||||||
if (index == IPSET_INVALID_ID) {
|
if (index == IPSET_INVALID_ID) {
|
||||||
pr_warn("Cannot find map_set index %u as target\n",
|
pr_info_ratelimited("Cannot find map_set index %u as target\n",
|
||||||
info->map_set.index);
|
info->map_set.index);
|
||||||
if (info->add_set.index != IPSET_INVALID_ID)
|
if (info->add_set.index != IPSET_INVALID_ID)
|
||||||
ip_set_nfnl_put(par->net,
|
ip_set_nfnl_put(par->net,
|
||||||
|
@ -494,7 +494,7 @@ set_target_v3_checkentry(const struct xt_tgchk_param *par)
|
||||||
if (info->add_set.dim > IPSET_DIM_MAX ||
|
if (info->add_set.dim > IPSET_DIM_MAX ||
|
||||||
info->del_set.dim > IPSET_DIM_MAX ||
|
info->del_set.dim > IPSET_DIM_MAX ||
|
||||||
info->map_set.dim > IPSET_DIM_MAX) {
|
info->map_set.dim > IPSET_DIM_MAX) {
|
||||||
pr_warn("Protocol error: SET target dimension is over the limit!\n");
|
pr_info_ratelimited("SET target dimension over the limit!\n");
|
||||||
if (info->add_set.index != IPSET_INVALID_ID)
|
if (info->add_set.index != IPSET_INVALID_ID)
|
||||||
ip_set_nfnl_put(par->net, info->add_set.index);
|
ip_set_nfnl_put(par->net, info->add_set.index);
|
||||||
if (info->del_set.index != IPSET_INVALID_ID)
|
if (info->del_set.index != IPSET_INVALID_ID)
|
||||||
|
|
Loading…
Reference in New Issue