Skip to content

Commit

Permalink
netfilter: xt extensions: use pr_<level>
Browse files Browse the repository at this point in the history
Signed-off-by: Jan Engelhardt <[email protected]>
  • Loading branch information
Jan Engelhardt committed Mar 18, 2010
1 parent be91fd5 commit 8bee4ba
Show file tree
Hide file tree
Showing 21 changed files with 88 additions and 107 deletions.
13 changes: 6 additions & 7 deletions net/netfilter/xt_CONNSECMARK.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,14 @@
* published by the Free Software Foundation.
*
*/
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/module.h>
#include <linux/skbuff.h>
#include <linux/netfilter/x_tables.h>
#include <linux/netfilter/xt_CONNSECMARK.h>
#include <net/netfilter/nf_conntrack.h>
#include <net/netfilter/nf_conntrack_ecache.h>

#define PFX "CONNSECMARK: "

MODULE_LICENSE("GPL");
MODULE_AUTHOR("James Morris <[email protected]>");
MODULE_DESCRIPTION("Xtables: target for copying between connection and security mark");
Expand Down Expand Up @@ -91,8 +90,8 @@ static bool connsecmark_tg_check(const struct xt_tgchk_param *par)

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

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

default:
printk(KERN_INFO PFX "invalid mode: %hu\n", info->mode);
pr_info("invalid mode: %hu\n", info->mode);
return false;
}

if (nf_ct_l3proto_try_module_get(par->family) < 0) {
printk(KERN_WARNING "can't load conntrack support for "
"proto=%u\n", par->family);
pr_info("cannot load conntrack support for proto=%u\n",
par->family);
return false;
}
return true;
Expand Down
4 changes: 2 additions & 2 deletions net/netfilter/xt_DSCP.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*
* See RFC2474 for a description of the DSCP field within the IP Header.
*/

#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/module.h>
#include <linux/skbuff.h>
#include <linux/ip.h>
Expand Down Expand Up @@ -65,7 +65,7 @@ static bool dscp_tg_check(const struct xt_tgchk_param *par)
const struct xt_DSCP_info *info = par->targinfo;

if (info->dscp > XT_DSCP_MAX) {
printk(KERN_WARNING "DSCP: dscp %x out of range\n", info->dscp);
pr_info("dscp %x out of range\n", info->dscp);
return false;
}
return true;
Expand Down
10 changes: 4 additions & 6 deletions net/netfilter/xt_HL.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/

#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/module.h>
#include <linux/skbuff.h>
#include <linux/ip.h>
Expand Down Expand Up @@ -106,8 +106,7 @@ static bool ttl_tg_check(const struct xt_tgchk_param *par)
const struct ipt_TTL_info *info = par->targinfo;

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

if (info->mode > IP6T_HL_MAXMODE) {
printk(KERN_WARNING "ip6t_HL: invalid or unknown Mode %u\n",
info->mode);
pr_info("invalid or unknown mode %u\n", info->mode);
return false;
}
if (info->mode != IP6T_HL_SET && info->hop_limit == 0) {
printk(KERN_WARNING "ip6t_HL: increment/decrement doesn't "
pr_info("increment/decrement does not "
"make sense with value 0\n");
return false;
}
Expand Down
10 changes: 4 additions & 6 deletions net/netfilter/xt_LED.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* 02110-1301 USA.
*
*/

#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/module.h>
#include <linux/skbuff.h>
#include <linux/netfilter/x_tables.h>
Expand Down Expand Up @@ -87,7 +87,7 @@ static bool led_tg_check(const struct xt_tgchk_param *par)
int err;

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

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

err = led_trigger_register(&ledinternal->netfilter_led_trigger);
if (err) {
printk(KERN_CRIT KBUILD_MODNAME
": led_trigger_register() failed\n");
pr_warning("led_trigger_register() failed\n");
if (err == -EEXIST)
printk(KERN_ERR KBUILD_MODNAME
": Trigger name is already in use.\n");
pr_warning("Trigger name is already in use.\n");
goto exit_alloc;
}

Expand Down
20 changes: 10 additions & 10 deletions net/netfilter/xt_SECMARK.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
* published by the Free Software Foundation.
*
*/
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/module.h>
#include <linux/skbuff.h>
#include <linux/selinux.h>
Expand Down Expand Up @@ -59,20 +60,19 @@ static bool checkentry_selinux(struct xt_secmark_target_info *info)
err = selinux_string_to_sid(sel->selctx, &sel->selsid);
if (err) {
if (err == -EINVAL)
printk(KERN_INFO PFX "invalid SELinux context \'%s\'\n",
sel->selctx);
pr_info("invalid SELinux context \'%s\'\n",
sel->selctx);
return false;
}

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

err = selinux_secmark_relabel_packet_permission(sel->selsid);
if (err) {
printk(KERN_INFO PFX "unable to obtain relabeling permission\n");
pr_info("unable to obtain relabeling permission\n");
return false;
}

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

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

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

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

default:
printk(KERN_INFO PFX "invalid mode: %hu\n", info->mode);
pr_info("invalid mode: %hu\n", info->mode);
return false;
}

Expand Down
18 changes: 9 additions & 9 deletions net/netfilter/xt_TCPMSS.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/

#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/module.h>
#include <linux/skbuff.h>
#include <linux/ip.h>
Expand Down Expand Up @@ -67,14 +67,14 @@ tcpmss_mangle_packet(struct sk_buff *skb,
if (info->mss == XT_TCPMSS_CLAMP_PMTU) {
if (dst_mtu(skb_dst(skb)) <= minlen) {
if (net_ratelimit())
printk(KERN_ERR "xt_TCPMSS: "
pr_err("xt_TCPMSS: "
"unknown or invalid path-MTU (%u)\n",
dst_mtu(skb_dst(skb)));
return -1;
}
if (in_mtu <= minlen) {
if (net_ratelimit())
printk(KERN_ERR "xt_TCPMSS: unknown or "
pr_err("xt_TCPMSS: unknown or "
"invalid path-MTU (%u)\n", in_mtu);
return -1;
}
Expand Down Expand Up @@ -245,14 +245,14 @@ static bool tcpmss_tg4_check(const struct xt_tgchk_param *par)
(par->hook_mask & ~((1 << NF_INET_FORWARD) |
(1 << NF_INET_LOCAL_OUT) |
(1 << NF_INET_POST_ROUTING))) != 0) {
printk("xt_TCPMSS: path-MTU clamping only supported in "
"FORWARD, OUTPUT and POSTROUTING hooks\n");
pr_info("path-MTU clamping only supported in "
"FORWARD, OUTPUT and POSTROUTING hooks\n");
return false;
}
xt_ematch_foreach(ematch, e)
if (find_syn_match(ematch))
return true;
printk("xt_TCPMSS: Only works on TCP SYN packets\n");
pr_info("Only works on TCP SYN packets\n");
return false;
}

Expand All @@ -267,14 +267,14 @@ static bool tcpmss_tg6_check(const struct xt_tgchk_param *par)
(par->hook_mask & ~((1 << NF_INET_FORWARD) |
(1 << NF_INET_LOCAL_OUT) |
(1 << NF_INET_POST_ROUTING))) != 0) {
printk("xt_TCPMSS: path-MTU clamping only supported in "
"FORWARD, OUTPUT and POSTROUTING hooks\n");
pr_info("path-MTU clamping only supported in "
"FORWARD, OUTPUT and POSTROUTING hooks\n");
return false;
}
xt_ematch_foreach(ematch, e)
if (find_syn_match(ematch))
return true;
printk("xt_TCPMSS: Only works on TCP SYN packets\n");
pr_info("Only works on TCP SYN packets\n");
return false;
}
#endif
Expand Down
11 changes: 6 additions & 5 deletions net/netfilter/xt_cluster.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/module.h>
#include <linux/skbuff.h>
#include <linux/jhash.h>
Expand Down Expand Up @@ -136,14 +137,14 @@ static bool xt_cluster_mt_checkentry(const struct xt_mtchk_param *par)
struct xt_cluster_match_info *info = par->matchinfo;

if (info->total_nodes > XT_CLUSTER_NODES_MAX) {
printk(KERN_ERR "xt_cluster: you have exceeded the maximum "
"number of cluster nodes (%u > %u)\n",
info->total_nodes, XT_CLUSTER_NODES_MAX);
pr_info("you have exceeded the maximum "
"number of cluster nodes (%u > %u)\n",
info->total_nodes, XT_CLUSTER_NODES_MAX);
return false;
}
if (info->node_mask >= (1ULL << info->total_nodes)) {
printk(KERN_ERR "xt_cluster: this node mask cannot be "
"higher than the total number of nodes\n");
pr_info("this node mask cannot be "
"higher than the total number of nodes\n");
return false;
}
return true;
Expand Down
5 changes: 3 additions & 2 deletions net/netfilter/xt_connbytes.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* Kernel module to match connection tracking byte counter.
* GPL (C) 2002 Martin Devera ([email protected]).
*/
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/module.h>
#include <linux/bitops.h>
#include <linux/skbuff.h>
Expand Down Expand Up @@ -107,8 +108,8 @@ static bool connbytes_mt_check(const struct xt_mtchk_param *par)
return false;

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

Expand Down
5 changes: 3 additions & 2 deletions net/netfilter/xt_connlimit.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
* Kernel module to match connection tracking information.
* GPL (C) 1999 Rusty Russell ([email protected]).
*/
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/in.h>
#include <linux/in6.h>
#include <linux/ip.h>
Expand Down Expand Up @@ -225,8 +226,8 @@ static bool connlimit_mt_check(const struct xt_mtchk_param *par)
connlimit_rnd_inited = true;
}
if (nf_ct_l3proto_try_module_get(par->family) < 0) {
printk(KERN_WARNING "cannot load conntrack support for "
"address family %u\n", par->family);
pr_info("cannot load conntrack support for "
"address family %u\n", par->family);
return false;
}

Expand Down
8 changes: 4 additions & 4 deletions net/netfilter/xt_connmark.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ connmark_tg(struct sk_buff *skb, const struct xt_target_param *par)
static bool connmark_tg_check(const struct xt_tgchk_param *par)
{
if (nf_ct_l3proto_try_module_get(par->family) < 0) {
printk(KERN_WARNING "cannot load conntrack support for "
"proto=%u\n", par->family);
pr_info("cannot load conntrack support for proto=%u\n",
par->family);
return false;
}
return true;
Expand Down Expand Up @@ -106,8 +106,8 @@ connmark_mt(const struct sk_buff *skb, const struct xt_match_param *par)
static bool connmark_mt_check(const struct xt_mtchk_param *par)
{
if (nf_ct_l3proto_try_module_get(par->family) < 0) {
printk(KERN_WARNING "cannot load conntrack support for "
"proto=%u\n", par->family);
pr_info("cannot load conntrack support for proto=%u\n",
par->family);
return false;
}
return true;
Expand Down
6 changes: 3 additions & 3 deletions net/netfilter/xt_conntrack.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/

#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/module.h>
#include <linux/skbuff.h>
#include <net/ipv6.h>
Expand Down Expand Up @@ -209,8 +209,8 @@ conntrack_mt_v2(const struct sk_buff *skb, const struct xt_match_param *par)
static bool conntrack_mt_check(const struct xt_mtchk_param *par)
{
if (nf_ct_l3proto_try_module_get(par->family) < 0) {
printk(KERN_WARNING "can't load conntrack support for "
"proto=%u\n", par->family);
pr_info("cannot load conntrack support for proto=%u\n",
par->family);
return false;
}
return true;
Expand Down
4 changes: 2 additions & 2 deletions net/netfilter/xt_dscp.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/

#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/module.h>
#include <linux/skbuff.h>
#include <linux/ip.h>
Expand Down Expand Up @@ -47,7 +47,7 @@ static bool dscp_mt_check(const struct xt_mtchk_param *par)
const struct xt_dscp_info *info = par->matchinfo;

if (info->dscp > XT_DSCP_MAX) {
printk(KERN_ERR "xt_dscp: dscp %x out of range\n", info->dscp);
pr_info("dscp %x out of range\n", info->dscp);
return false;
}

Expand Down
Loading

0 comments on commit 8bee4ba

Please sign in to comment.