All of lore.kernel.org
 help / color / mirror / Atom feed
From: Patrick McHardy <kaber@trash.net>
To: davem@davemloft.net
Cc: netfilter-devel@lists.netfilter.org, Patrick McHardy <kaber@trash.net>
Subject: [NETFILTER 10/22]: nfnetlink: remove early debugging messages from nfnetlink
Date: Wed, 14 Mar 2007 09:50:31 +0100 (MET)	[thread overview]
Message-ID: <20070314085015.15282.36815.sendpatchset@localhost.localdomain> (raw)
In-Reply-To: <20070314084946.15282.58609.sendpatchset@localhost.localdomain>

[NETFILTER]: nfnetlink: remove early debugging messages from nfnetlink

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Patrick McHardy <kaber@trash.net>

---
commit 750623a576cf1a6cd62d138be4da5b95a8419c35
tree 1ae7982c1e123a23f56e890c0d8110cfd23bf13a
parent f8184abb940940e7503c5b089e89d2d88b4eb34c
author Pablo Neira Ayuso <pablo@netfilter.org> Thu, 08 Mar 2007 18:25:20 +0100
committer Patrick McHardy <kaber@trash.net> Wed, 14 Mar 2007 09:30:46 +0100

 net/netfilter/nfnetlink.c |   42 ++++++------------------------------------
 1 files changed, 6 insertions(+), 36 deletions(-)

diff --git a/net/netfilter/nfnetlink.c b/net/netfilter/nfnetlink.c
index 5be6ac4..c8b4f0d 100644
--- a/net/netfilter/nfnetlink.c
+++ b/net/netfilter/nfnetlink.c
@@ -3,7 +3,7 @@
  *
  * (C) 2001 by Jay Schulist <jschlst@samba.org>,
  * (C) 2002-2005 by Harald Welte <laforge@gnumonks.org>
- * (C) 2005 by Pablo Neira Ayuso <pablo@eurodev.net>
+ * (C) 2005,2007 by Pablo Neira Ayuso <pablo@netfilter.org>
  *
  * Initial netfilter messages via netlink development funded and
  * generally made possible by Network Robots, Inc. (www.networkrobots.com)
@@ -42,14 +42,6 @@ MODULE_ALIAS_NET_PF_PROTO(PF_NETLINK, NE
 
 static char __initdata nfversion[] = "0.30";
 
-#if 0
-#define DEBUGP(format, args...)	\
-		printk(KERN_DEBUG "%s(%d):%s(): " format, __FILE__, \
-			__LINE__, __FUNCTION__, ## args)
-#else
-#define DEBUGP(format, args...)
-#endif
-
 static struct sock *nfnl = NULL;
 static struct nfnetlink_subsystem *subsys_table[NFNL_SUBSYS_COUNT];
 static DEFINE_MUTEX(nfnl_mutex);
@@ -78,8 +70,6 @@ static void nfnl_unlock(void)
 
 int nfnetlink_subsys_register(struct nfnetlink_subsystem *n)
 {
-	DEBUGP("registering subsystem ID %u\n", n->subsys_id);
-
 	nfnl_lock();
 	if (subsys_table[n->subsys_id]) {
 		nfnl_unlock();
@@ -93,8 +83,6 @@ int nfnetlink_subsys_register(struct nfn
 
 int nfnetlink_subsys_unregister(struct nfnetlink_subsystem *n)
 {
-	DEBUGP("unregistering subsystem ID %u\n", n->subsys_id);
-
 	nfnl_lock();
 	subsys_table[n->subsys_id] = NULL;
 	nfnl_unlock();
@@ -118,10 +106,8 @@ nfnetlink_find_client(u_int16_t type, st
 {
 	u_int8_t cb_id = NFNL_MSG_TYPE(type);
 
-	if (cb_id >= ss->cb_count) {
-		DEBUGP("msgtype %u >= %u, returning\n", type, ss->cb_count);
+	if (cb_id >= ss->cb_count)
 		return NULL;
-	}
 
 	return &ss->cb[cb_id];
 }
@@ -167,11 +153,8 @@ nfnetlink_check_attributes(struct nfnetl
 	u_int16_t attr_count;
 	u_int8_t cb_id = NFNL_MSG_TYPE(nlh->nlmsg_type);
 
-	if (unlikely(cb_id >= subsys->cb_count)) {
-		DEBUGP("msgtype %u >= %u, returning\n",
-			cb_id, subsys->cb_count);
+	if (unlikely(cb_id >= subsys->cb_count))
 		return -EINVAL;
-	}
 
 	min_len = NLMSG_SPACE(sizeof(struct nfgenmsg));
 	if (unlikely(nlh->nlmsg_len < min_len))
@@ -235,27 +218,18 @@ static int nfnetlink_rcv_msg(struct sk_b
 	struct nfnetlink_subsystem *ss;
 	int type, err = 0;
 
-	DEBUGP("entered; subsys=%u, msgtype=%u\n",
-		 NFNL_SUBSYS_ID(nlh->nlmsg_type),
-		 NFNL_MSG_TYPE(nlh->nlmsg_type));
-
 	if (security_netlink_recv(skb, CAP_NET_ADMIN)) {
-		DEBUGP("missing CAP_NET_ADMIN\n");
 		*errp = -EPERM;
 		return -1;
 	}
 
 	/* Only requests are handled by kernel now. */
-	if (!(nlh->nlmsg_flags & NLM_F_REQUEST)) {
-		DEBUGP("received non-request message\n");
+	if (!(nlh->nlmsg_flags & NLM_F_REQUEST))
 		return 0;
-	}
 
 	/* All the messages must at least contain nfgenmsg */
-	if (nlh->nlmsg_len < NLMSG_SPACE(sizeof(struct nfgenmsg))) {
-		DEBUGP("received message was too short\n");
+	if (nlh->nlmsg_len < NLMSG_SPACE(sizeof(struct nfgenmsg)))
 		return 0;
-	}
 
 	type = nlh->nlmsg_type;
 	ss = nfnetlink_get_subsys(type);
@@ -273,10 +247,8 @@ #endif
 	}
 
 	nc = nfnetlink_find_client(type, ss);
-	if (!nc) {
-		DEBUGP("unable to find client for type %d\n", type);
+	if (!nc)
 		goto err_inval;
-	}
 
 	{
 		u_int16_t attr_count =
@@ -289,14 +261,12 @@ #endif
 		if (err < 0)
 			goto err_inval;
 
-		DEBUGP("calling handler\n");
 		err = nc->call(nfnl, skb, nlh, cda, errp);
 		*errp = err;
 		return err;
 	}
 
 err_inval:
-	DEBUGP("returning -EINVAL\n");
 	*errp = -EINVAL;
 	return -1;
 }

  parent reply	other threads:[~2007-03-14  8:50 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-14  8:50 [NETFILTER 00/22]: Netfilter update for 2.6.22 Patrick McHardy
2007-03-14  8:50 ` [NETFILTER 01/22]: x_tables: remove duplicate of xt_prefix Patrick McHardy
2007-03-14  8:50 ` [NETFILTER 03/22]: nf_conntrack: switch protocol registration/unregistration to mutex Patrick McHardy
2007-03-14  8:50 ` [NETFILTER 04/22]: nf_conntrack: remove ugly hack in l4proto registration Patrick McHardy
2007-03-14  8:50 ` [NETFILTER 05/22]: nf_conntrack: simplify protocol locking Patrick McHardy
2007-03-14  8:50 ` [NETFILTER 06/22]: nf_conntrack: simplify l4 protocol array allocation Patrick McHardy
2007-03-14  8:50 ` [NETFILTER 07/22]: nfnetlink: use mutex instead of semaphore Patrick McHardy
2007-03-14  8:50 ` [NETFILTER 08/22]: nfnetlink: use netlink_run_queue() Patrick McHardy
2007-03-14  8:50 ` [NETFILTER 09/22]: nf_conntrack: uninline notifier registration functions Patrick McHardy
2007-03-14  8:50 ` Patrick McHardy [this message]
2007-03-14  8:50 ` [NETFILTER 11/22]: nfnetlink: remove duplicate checks in nfnetlink_check_attributes Patrick McHardy
2007-03-14  8:50 ` [NETFILTER 12/22]: nfnetlink: remove unrequired check in nfnetlink_get_subsys Patrick McHardy
2007-03-14  8:50 ` [NETFILTER 13/22]: nfnetlink: remove unused includes in nfnetlink.c Patrick McHardy
2007-03-14  8:50 ` [NETFILTER 14/22]: nfnetlink: move EXPORT_SYMBOL declarations next to the exported symbol Patrick McHardy
2007-03-14  8:50 ` [JHASH 15/22]: Use const in jhash2 Patrick McHardy
2007-03-14  8:50 ` [NETFILTER 16/22]: nf_conntrack: use jhash2 in __hash_conntrack Patrick McHardy
2007-03-14  8:50 ` [NETFILTER 17/22]: conntrack: add __nf_copy() to copy members in skb Patrick McHardy
2007-03-14  8:50 ` [NETFILTER 18/22]: conntrack: add nf_copy() to safely " Patrick McHardy
2007-03-14  8:50 ` [NETFILTER 19/22]: tcp_conntrack: accept RST|PSH as valid Patrick McHardy
2007-03-14  8:50 ` [NETFILTER 20/22]: tcp_conntrack: factorize out the PUSH flag Patrick McHardy
2007-03-14  8:50 ` [NETFILTER 21/22]: ctnetlink: add support for internal tcp connection tracking flags handling Patrick McHardy
2007-03-14  8:50 ` [NETFILTER 22/22]: nfnetlink: parse attributes with nfattr_parse in nfnetlink_check_attribute Patrick McHardy
2007-03-14 23:05 ` [NETFILTER 00/22]: Netfilter update for 2.6.22 David Miller
2007-03-14 23:14   ` Patrick McHardy
2007-03-14 23:52     ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070314085015.15282.36815.sendpatchset@localhost.localdomain \
    --to=kaber@trash.net \
    --cc=davem@davemloft.net \
    --cc=netfilter-devel@lists.netfilter.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.