]> git.hungrycats.org Git - linux/commitdiff
netfilter: x_tables: replace pr_{info,err}() by pr_info_ratelimited()
authorPablo Neira Ayuso <pablo@netfilter.org>
Tue, 18 Aug 2026 08:31:24 +0000 (10:31 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 14 Sep 2026 11:36:14 +0000 (13:36 +0200)
[ Upstream commit 793d9eda4821f75b5f7cc9e6a870b72a58b44c2b ]

Several xtables extension still use pr_err() or pr_info() without
ratelimit.

For xt_cgroup, while at this, remove redundant "xt_cgroup:" prefix
since pr_fmt is already set on.

Fixes: c38c4597e4bf ("netfilter: implement xt_cgroup cgroup2 path match")
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/netfilter/xt_cgroup.c
net/netfilter/xt_hl.c

index 43d2ae2be628dc2b12fd3b122512479ae5c249e9..28e6cd51b2fb0de122fb6ed31a4e14d7cd0d088d 100644 (file)
@@ -23,7 +23,7 @@ MODULE_DESCRIPTION("Xtables: process control group matching");
 MODULE_ALIAS("ipt_cgroup");
 MODULE_ALIAS("ip6t_cgroup");
 
-#define NET_CLS_CLASSID_INVALID_MSG "xt_cgroup: classid invalid without net_cls cgroups\n"
+#define NET_CLS_CLASSID_INVALID_MSG "classid invalid without net_cls cgroups\n"
 
 static int cgroup_mt_check_v0(const struct xt_mtchk_param *par)
 {
@@ -33,7 +33,7 @@ static int cgroup_mt_check_v0(const struct xt_mtchk_param *par)
                return -EINVAL;
 
        if (!IS_ENABLED(CONFIG_CGROUP_NET_CLASSID)) {
-               pr_info(NET_CLS_CLASSID_INVALID_MSG);
+               pr_info_ratelimited(NET_CLS_CLASSID_INVALID_MSG);
                return -EINVAL;
        }
 
@@ -49,7 +49,7 @@ static int cgroup_mt_check_v1(const struct xt_mtchk_param *par)
                return -EINVAL;
 
        if (!info->has_path && !info->has_classid) {
-               pr_info("xt_cgroup: no path or classid specified\n");
+               pr_info_ratelimited("no path or classid specified\n");
                return -EINVAL;
        }
 
@@ -59,7 +59,7 @@ static int cgroup_mt_check_v1(const struct xt_mtchk_param *par)
        }
 
        if (info->has_classid && !IS_ENABLED(CONFIG_CGROUP_NET_CLASSID)) {
-               pr_info(NET_CLS_CLASSID_INVALID_MSG);
+               pr_info_ratelimited(NET_CLS_CLASSID_INVALID_MSG);
                return -EINVAL;
        }
 
@@ -89,7 +89,7 @@ static int cgroup_mt_check_v2(const struct xt_mtchk_param *par)
                return -EINVAL;
 
        if (!info->has_path && !info->has_classid) {
-               pr_info("xt_cgroup: no path or classid specified\n");
+               pr_info_ratelimited("no path or classid specified\n");
                return -EINVAL;
        }
 
@@ -99,7 +99,7 @@ static int cgroup_mt_check_v2(const struct xt_mtchk_param *par)
        }
 
        if (info->has_classid && !IS_ENABLED(CONFIG_CGROUP_NET_CLASSID)) {
-               pr_info(NET_CLS_CLASSID_INVALID_MSG);
+               pr_info_ratelimited(NET_CLS_CLASSID_INVALID_MSG);
                return -EINVAL;
        }
 
index 4a12a757ecbf86d4bacbf7b889ecc3c2a0d501fa..59e93d97b5072c63f1bf16d859e2391a52808181 100644 (file)
@@ -28,7 +28,7 @@ static int ttl_mt_check(const struct xt_mtchk_param *par)
        const struct ipt_ttl_info *info = par->matchinfo;
 
        if (info->mode > IPT_TTL_GT) {
-               pr_err("Unknown TTL match mode: %d\n", info->mode);
+               pr_info_ratelimited("Unknown TTL match mode: %d\n", info->mode);
                return -EINVAL;
        }
 
@@ -59,7 +59,7 @@ static int hl_mt6_check(const struct xt_mtchk_param *par)
        const struct ip6t_hl_info *info = par->matchinfo;
 
        if (info->mode > IP6T_HL_GT) {
-               pr_err("Unknown Hop Limit match mode: %d\n", info->mode);
+               pr_info_ratelimited("Unknown Hop Limit match mode: %d\n", info->mode);
                return -EINVAL;
        }