Skip to content

Commit 8bee4ba

Browse files
author
Jan Engelhardt
committed
netfilter: xt extensions: use pr_<level>
Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
1 parent be91fd5 commit 8bee4ba

21 files changed

Lines changed: 88 additions & 107 deletions

‎net/netfilter/xt_CONNSECMARK.c‎

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,14 @@
1515
* published by the Free Software Foundation.
1616
*
1717
*/
18+
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
1819
#include <linux/module.h>
1920
#include <linux/skbuff.h>
2021
#include <linux/netfilter/x_tables.h>
2122
#include <linux/netfilter/xt_CONNSECMARK.h>
2223
#include <net/netfilter/nf_conntrack.h>
2324
#include <net/netfilter/nf_conntrack_ecache.h>
2425

25-
#define PFX "CONNSECMARK: "
26-
2726
MODULE_LICENSE("GPL");
2827
MODULE_AUTHOR("James Morris <jmorris@redhat.com>");
2928
MODULE_DESCRIPTION("Xtables: target for copying between connection and security mark");
@@ -91,8 +90,8 @@ static bool connsecmark_tg_check(const struct xt_tgchk_param *par)
9190

9291
if (strcmp(par->table, "mangle") != 0 &&
9392
strcmp(par->table, "security") != 0) {
94-
printk(KERN_INFO PFX "target only valid in the \'mangle\' "
95-
"or \'security\' tables, not \'%s\'.\n", par->table);
93+
pr_info("target only valid in the \'mangle\' "
94+
"or \'security\' tables, not \'%s\'.\n", par->table);
9695
return false;
9796
}
9897

@@ -102,13 +101,13 @@ static bool connsecmark_tg_check(const struct xt_tgchk_param *par)
102101
break;
103102

104103
default:
105-
printk(KERN_INFO PFX "invalid mode: %hu\n", info->mode);
104+
pr_info("invalid mode: %hu\n", info->mode);
106105
return false;
107106
}
108107

109108
if (nf_ct_l3proto_try_module_get(par->family) < 0) {
110-
printk(KERN_WARNING "can't load conntrack support for "
111-
"proto=%u\n", par->family);
109+
pr_info("cannot load conntrack support for proto=%u\n",
110+
par->family);
112111
return false;
113112
}
114113
return true;

‎net/netfilter/xt_DSCP.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*
1010
* See RFC2474 for a description of the DSCP field within the IP Header.
1111
*/
12-
12+
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
1313
#include <linux/module.h>
1414
#include <linux/skbuff.h>
1515
#include <linux/ip.h>
@@ -65,7 +65,7 @@ static bool dscp_tg_check(const struct xt_tgchk_param *par)
6565
const struct xt_DSCP_info *info = par->targinfo;
6666

6767
if (info->dscp > XT_DSCP_MAX) {
68-
printk(KERN_WARNING "DSCP: dscp %x out of range\n", info->dscp);
68+
pr_info("dscp %x out of range\n", info->dscp);
6969
return false;
7070
}
7171
return true;

‎net/netfilter/xt_HL.c‎

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* it under the terms of the GNU General Public License version 2 as
1010
* published by the Free Software Foundation.
1111
*/
12-
12+
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
1313
#include <linux/module.h>
1414
#include <linux/skbuff.h>
1515
#include <linux/ip.h>
@@ -106,8 +106,7 @@ static bool ttl_tg_check(const struct xt_tgchk_param *par)
106106
const struct ipt_TTL_info *info = par->targinfo;
107107

108108
if (info->mode > IPT_TTL_MAXMODE) {
109-
printk(KERN_WARNING "ipt_TTL: invalid or unknown Mode %u\n",
110-
info->mode);
109+
pr_info("TTL: invalid or unknown mode %u\n", info->mode);
111110
return false;
112111
}
113112
if (info->mode != IPT_TTL_SET && info->ttl == 0)
@@ -120,12 +119,11 @@ static bool hl_tg6_check(const struct xt_tgchk_param *par)
120119
const struct ip6t_HL_info *info = par->targinfo;
121120

122121
if (info->mode > IP6T_HL_MAXMODE) {
123-
printk(KERN_WARNING "ip6t_HL: invalid or unknown Mode %u\n",
124-
info->mode);
122+
pr_info("invalid or unknown mode %u\n", info->mode);
125123
return false;
126124
}
127125
if (info->mode != IP6T_HL_SET && info->hop_limit == 0) {
128-
printk(KERN_WARNING "ip6t_HL: increment/decrement doesn't "
126+
pr_info("increment/decrement does not "
129127
"make sense with value 0\n");
130128
return false;
131129
}

‎net/netfilter/xt_LED.c‎

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
* 02110-1301 USA.
1919
*
2020
*/
21-
21+
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
2222
#include <linux/module.h>
2323
#include <linux/skbuff.h>
2424
#include <linux/netfilter/x_tables.h>
@@ -87,7 +87,7 @@ static bool led_tg_check(const struct xt_tgchk_param *par)
8787
int err;
8888

8989
if (ledinfo->id[0] == '\0') {
90-
printk(KERN_ERR KBUILD_MODNAME ": No 'id' parameter given.\n");
90+
pr_info("No 'id' parameter given.\n");
9191
return false;
9292
}
9393

@@ -99,11 +99,9 @@ static bool led_tg_check(const struct xt_tgchk_param *par)
9999

100100
err = led_trigger_register(&ledinternal->netfilter_led_trigger);
101101
if (err) {
102-
printk(KERN_CRIT KBUILD_MODNAME
103-
": led_trigger_register() failed\n");
102+
pr_warning("led_trigger_register() failed\n");
104103
if (err == -EEXIST)
105-
printk(KERN_ERR KBUILD_MODNAME
106-
": Trigger name is already in use.\n");
104+
pr_warning("Trigger name is already in use.\n");
107105
goto exit_alloc;
108106
}
109107

‎net/netfilter/xt_SECMARK.c‎

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
* published by the Free Software Foundation.
1313
*
1414
*/
15+
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
1516
#include <linux/module.h>
1617
#include <linux/skbuff.h>
1718
#include <linux/selinux.h>
@@ -59,20 +60,19 @@ static bool checkentry_selinux(struct xt_secmark_target_info *info)
5960
err = selinux_string_to_sid(sel->selctx, &sel->selsid);
6061
if (err) {
6162
if (err == -EINVAL)
62-
printk(KERN_INFO PFX "invalid SELinux context \'%s\'\n",
63-
sel->selctx);
63+
pr_info("invalid SELinux context \'%s\'\n",
64+
sel->selctx);
6465
return false;
6566
}
6667

6768
if (!sel->selsid) {
68-
printk(KERN_INFO PFX "unable to map SELinux context \'%s\'\n",
69-
sel->selctx);
69+
pr_info("unable to map SELinux context \'%s\'\n", sel->selctx);
7070
return false;
7171
}
7272

7373
err = selinux_secmark_relabel_packet_permission(sel->selsid);
7474
if (err) {
75-
printk(KERN_INFO PFX "unable to obtain relabeling permission\n");
75+
pr_info("unable to obtain relabeling permission\n");
7676
return false;
7777
}
7878

@@ -86,14 +86,14 @@ static bool secmark_tg_check(const struct xt_tgchk_param *par)
8686

8787
if (strcmp(par->table, "mangle") != 0 &&
8888
strcmp(par->table, "security") != 0) {
89-
printk(KERN_INFO PFX "target only valid in the \'mangle\' "
90-
"or \'security\' tables, not \'%s\'.\n", par->table);
89+
pr_info("target only valid in the \'mangle\' "
90+
"or \'security\' tables, not \'%s\'.\n", par->table);
9191
return false;
9292
}
9393

9494
if (mode && mode != info->mode) {
95-
printk(KERN_INFO PFX "mode already set to %hu cannot mix with "
96-
"rules for mode %hu\n", mode, info->mode);
95+
pr_info("mode already set to %hu cannot mix with "
96+
"rules for mode %hu\n", mode, info->mode);
9797
return false;
9898
}
9999

@@ -104,7 +104,7 @@ static bool secmark_tg_check(const struct xt_tgchk_param *par)
104104
break;
105105

106106
default:
107-
printk(KERN_INFO PFX "invalid mode: %hu\n", info->mode);
107+
pr_info("invalid mode: %hu\n", info->mode);
108108
return false;
109109
}
110110

‎net/netfilter/xt_TCPMSS.c‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* it under the terms of the GNU General Public License version 2 as
88
* published by the Free Software Foundation.
99
*/
10-
10+
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
1111
#include <linux/module.h>
1212
#include <linux/skbuff.h>
1313
#include <linux/ip.h>
@@ -67,14 +67,14 @@ tcpmss_mangle_packet(struct sk_buff *skb,
6767
if (info->mss == XT_TCPMSS_CLAMP_PMTU) {
6868
if (dst_mtu(skb_dst(skb)) <= minlen) {
6969
if (net_ratelimit())
70-
printk(KERN_ERR "xt_TCPMSS: "
70+
pr_err("xt_TCPMSS: "
7171
"unknown or invalid path-MTU (%u)\n",
7272
dst_mtu(skb_dst(skb)));
7373
return -1;
7474
}
7575
if (in_mtu <= minlen) {
7676
if (net_ratelimit())
77-
printk(KERN_ERR "xt_TCPMSS: unknown or "
77+
pr_err("xt_TCPMSS: unknown or "
7878
"invalid path-MTU (%u)\n", in_mtu);
7979
return -1;
8080
}
@@ -245,14 +245,14 @@ static bool tcpmss_tg4_check(const struct xt_tgchk_param *par)
245245
(par->hook_mask & ~((1 << NF_INET_FORWARD) |
246246
(1 << NF_INET_LOCAL_OUT) |
247247
(1 << NF_INET_POST_ROUTING))) != 0) {
248-
printk("xt_TCPMSS: path-MTU clamping only supported in "
249-
"FORWARD, OUTPUT and POSTROUTING hooks\n");
248+
pr_info("path-MTU clamping only supported in "
249+
"FORWARD, OUTPUT and POSTROUTING hooks\n");
250250
return false;
251251
}
252252
xt_ematch_foreach(ematch, e)
253253
if (find_syn_match(ematch))
254254
return true;
255-
printk("xt_TCPMSS: Only works on TCP SYN packets\n");
255+
pr_info("Only works on TCP SYN packets\n");
256256
return false;
257257
}
258258

@@ -267,14 +267,14 @@ static bool tcpmss_tg6_check(const struct xt_tgchk_param *par)
267267
(par->hook_mask & ~((1 << NF_INET_FORWARD) |
268268
(1 << NF_INET_LOCAL_OUT) |
269269
(1 << NF_INET_POST_ROUTING))) != 0) {
270-
printk("xt_TCPMSS: path-MTU clamping only supported in "
271-
"FORWARD, OUTPUT and POSTROUTING hooks\n");
270+
pr_info("path-MTU clamping only supported in "
271+
"FORWARD, OUTPUT and POSTROUTING hooks\n");
272272
return false;
273273
}
274274
xt_ematch_foreach(ematch, e)
275275
if (find_syn_match(ematch))
276276
return true;
277-
printk("xt_TCPMSS: Only works on TCP SYN packets\n");
277+
pr_info("Only works on TCP SYN packets\n");
278278
return false;
279279
}
280280
#endif

‎net/netfilter/xt_cluster.c‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
* it under the terms of the GNU General Public License version 2 as
66
* published by the Free Software Foundation.
77
*/
8+
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
89
#include <linux/module.h>
910
#include <linux/skbuff.h>
1011
#include <linux/jhash.h>
@@ -136,14 +137,14 @@ static bool xt_cluster_mt_checkentry(const struct xt_mtchk_param *par)
136137
struct xt_cluster_match_info *info = par->matchinfo;
137138

138139
if (info->total_nodes > XT_CLUSTER_NODES_MAX) {
139-
printk(KERN_ERR "xt_cluster: you have exceeded the maximum "
140-
"number of cluster nodes (%u > %u)\n",
141-
info->total_nodes, XT_CLUSTER_NODES_MAX);
140+
pr_info("you have exceeded the maximum "
141+
"number of cluster nodes (%u > %u)\n",
142+
info->total_nodes, XT_CLUSTER_NODES_MAX);
142143
return false;
143144
}
144145
if (info->node_mask >= (1ULL << info->total_nodes)) {
145-
printk(KERN_ERR "xt_cluster: this node mask cannot be "
146-
"higher than the total number of nodes\n");
146+
pr_info("this node mask cannot be "
147+
"higher than the total number of nodes\n");
147148
return false;
148149
}
149150
return true;

‎net/netfilter/xt_connbytes.c‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/* Kernel module to match connection tracking byte counter.
22
* GPL (C) 2002 Martin Devera (devik@cdi.cz).
33
*/
4+
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
45
#include <linux/module.h>
56
#include <linux/bitops.h>
67
#include <linux/skbuff.h>
@@ -107,8 +108,8 @@ static bool connbytes_mt_check(const struct xt_mtchk_param *par)
107108
return false;
108109

109110
if (nf_ct_l3proto_try_module_get(par->family) < 0) {
110-
printk(KERN_WARNING "can't load conntrack support for "
111-
"proto=%u\n", par->family);
111+
pr_info("cannot load conntrack support for proto=%u\n",
112+
par->family);
112113
return false;
113114
}
114115

‎net/netfilter/xt_connlimit.c‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
* Kernel module to match connection tracking information.
1212
* GPL (C) 1999 Rusty Russell (rusty@rustcorp.com.au).
1313
*/
14+
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
1415
#include <linux/in.h>
1516
#include <linux/in6.h>
1617
#include <linux/ip.h>
@@ -225,8 +226,8 @@ static bool connlimit_mt_check(const struct xt_mtchk_param *par)
225226
connlimit_rnd_inited = true;
226227
}
227228
if (nf_ct_l3proto_try_module_get(par->family) < 0) {
228-
printk(KERN_WARNING "cannot load conntrack support for "
229-
"address family %u\n", par->family);
229+
pr_info("cannot load conntrack support for "
230+
"address family %u\n", par->family);
230231
return false;
231232
}
232233

‎net/netfilter/xt_connmark.c‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@ connmark_tg(struct sk_buff *skb, const struct xt_target_param *par)
7777
static bool connmark_tg_check(const struct xt_tgchk_param *par)
7878
{
7979
if (nf_ct_l3proto_try_module_get(par->family) < 0) {
80-
printk(KERN_WARNING "cannot load conntrack support for "
81-
"proto=%u\n", par->family);
80+
pr_info("cannot load conntrack support for proto=%u\n",
81+
par->family);
8282
return false;
8383
}
8484
return true;
@@ -106,8 +106,8 @@ connmark_mt(const struct sk_buff *skb, const struct xt_match_param *par)
106106
static bool connmark_mt_check(const struct xt_mtchk_param *par)
107107
{
108108
if (nf_ct_l3proto_try_module_get(par->family) < 0) {
109-
printk(KERN_WARNING "cannot load conntrack support for "
110-
"proto=%u\n", par->family);
109+
pr_info("cannot load conntrack support for proto=%u\n",
110+
par->family);
111111
return false;
112112
}
113113
return true;

0 commit comments

Comments
 (0)