Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5191d70f authored by Arushi Singhal's avatar Arushi Singhal Committed by Pablo Neira Ayuso
Browse files

netfilter: Replace printk() with pr_*() and define pr_fmt()



Using pr_<loglevel>() is more concise than printk(KERN_<LOGLEVEL>).
This patch:
* Replace printks having a log level with the appropriate
pr_*() macros.
* Define pr_fmt() to include relevant name.
* Remove redundant prefixes from pr_*() calls.
* Indent the code where possible.
* Remove the useless output messages.
* Remove periods from messages.

Signed-off-by: default avatarArushi Singhal <arushisinghal19971997@gmail.com>
Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
parent 472a73e0
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -8,6 +8,8 @@
 * published by the Free Software Foundation.
 */

#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt

#include <linux/netfilter.h>
#include <linux/slab.h>
#include <linux/kernel.h>
@@ -80,7 +82,7 @@ static int nf_conntrack_acct_init_sysctl(struct net *net)
	net->ct.acct_sysctl_header = register_net_sysctl(net, "net/netfilter",
							 table);
	if (!net->ct.acct_sysctl_header) {
		printk(KERN_ERR "nf_conntrack_acct: can't register to sysctl.\n");
		pr_err("can't register to sysctl\n");
		goto out_register;
	}
	return 0;
@@ -125,7 +127,7 @@ int nf_conntrack_acct_init(void)
{
	int ret = nf_ct_extend_register(&acct_extend);
	if (ret < 0)
		pr_err("nf_conntrack_acct: Unable to register extension\n");
		pr_err("Unable to register extension\n");
	return ret;
}

+4 −2
Original line number Diff line number Diff line
@@ -11,6 +11,8 @@
 * published by the Free Software Foundation.
 */

#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt

#include <linux/types.h>
#include <linux/netfilter.h>
#include <linux/skbuff.h>
@@ -372,7 +374,7 @@ static int nf_conntrack_event_init_sysctl(struct net *net)
	net->ct.event_sysctl_header =
		register_net_sysctl(net, "net/netfilter", table);
	if (!net->ct.event_sysctl_header) {
		printk(KERN_ERR "nf_ct_event: can't register to sysctl.\n");
		pr_err("can't register to sysctl\n");
		goto out_register;
	}
	return 0;
@@ -419,7 +421,7 @@ int nf_conntrack_ecache_init(void)
{
	int ret = nf_ct_extend_register(&event_extend);
	if (ret < 0)
		pr_err("nf_ct_event: Unable to register event extension.\n");
		pr_err("Unable to register event extension\n");

	BUILD_BUG_ON(__IPCT_MAX >= 16);	/* ctmask, missed use u16 */

+4 −2
Original line number Diff line number Diff line
@@ -6,6 +6,8 @@
 * published by the Free Software Foundation (or any later at your option).
 */

#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt

#include <linux/netfilter.h>
#include <linux/slab.h>
#include <linux/kernel.h>
@@ -58,7 +60,7 @@ static int nf_conntrack_tstamp_init_sysctl(struct net *net)
	net->ct.tstamp_sysctl_header = register_net_sysctl(net,	"net/netfilter",
							   table);
	if (!net->ct.tstamp_sysctl_header) {
		printk(KERN_ERR "nf_ct_tstamp: can't register to sysctl.\n");
		pr_err("can't register to sysctl\n");
		goto out_register;
	}
	return 0;
@@ -104,7 +106,7 @@ int nf_conntrack_tstamp_init(void)
	int ret;
	ret = nf_ct_extend_register(&tstamp_extend);
	if (ret < 0)
		pr_err("nf_ct_tstamp: Unable to register extension\n");
		pr_err("Unable to register extension\n");
	return ret;
}

+3 −1
Original line number Diff line number Diff line
@@ -8,6 +8,8 @@
 * published by the Free Software Foundation.
 */

#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt

#include <linux/module.h>
#include <linux/types.h>
#include <linux/timer.h>
@@ -814,7 +816,7 @@ static int __init nf_nat_init(void)
	ret = nf_ct_extend_register(&nat_extend);
	if (ret < 0) {
		nf_ct_free_hashtable(nf_nat_bysource, nf_nat_htable_size);
		printk(KERN_ERR "nf_nat_core: Unable to register extension\n");
		pr_err("Unable to register extension\n");
		return ret;
	}

+4 −3
Original line number Diff line number Diff line
@@ -8,6 +8,8 @@
 * published by the Free Software Foundation.
 */

#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt

#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/inet.h>
@@ -71,7 +73,7 @@ static unsigned int nf_nat_ftp(struct sk_buff *skb,
	char buffer[sizeof("|1||65535|") + INET6_ADDRSTRLEN];
	unsigned int buflen;

	pr_debug("FTP_NAT: type %i, off %u len %u\n", type, matchoff, matchlen);
	pr_debug("type %i, off %u len %u\n", type, matchoff, matchlen);

	/* Connection will come from wherever this packet goes, hence !dir */
	newaddr = ct->tuplehash[!dir].tuple.dst.u3;
@@ -136,8 +138,7 @@ static int __init nf_nat_ftp_init(void)
/* Prior to 2.6.11, we had a ports param.  No longer, but don't break users. */
static int warn_set(const char *val, const struct kernel_param *kp)
{
	printk(KERN_INFO KBUILD_MODNAME
	       ": kernel >= 2.6.10 only uses 'ports' for conntrack modules\n");
	pr_info("kernel >= 2.6.10 only uses 'ports' for conntrack modules\n");
	return 0;
}
module_param_call(ports, warn_set, NULL, NULL, 0);
Loading