Commit 1792bab4 authored by Patrick McHardy's avatar Patrick McHardy Committed by David S. Miller

[NETFILTER]: nfnetlink_log: remove excessive debugging

Signed-off-by: default avatarPatrick McHardy <kaber@trash.net>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent cd21f0ac
...@@ -45,14 +45,6 @@ ...@@ -45,14 +45,6 @@
#define PRINTR(x, args...) do { if (net_ratelimit()) \ #define PRINTR(x, args...) do { if (net_ratelimit()) \
printk(x, ## args); } while (0); printk(x, ## args); } while (0);
#if 0
#define UDEBUG(x, args ...) printk(KERN_DEBUG "%s(%d):%s(): " x, \
__FILE__, __LINE__, __FUNCTION__, \
## args)
#else
#define UDEBUG(x, ...)
#endif
struct nfulnl_instance { struct nfulnl_instance {
struct hlist_node hlist; /* global list of instances */ struct hlist_node hlist; /* global list of instances */
spinlock_t lock; spinlock_t lock;
...@@ -93,8 +85,6 @@ __instance_lookup(u_int16_t group_num) ...@@ -93,8 +85,6 @@ __instance_lookup(u_int16_t group_num)
struct hlist_node *pos; struct hlist_node *pos;
struct nfulnl_instance *inst; struct nfulnl_instance *inst;
UDEBUG("entering (group_num=%u)\n", group_num);
head = &instance_table[instance_hashfn(group_num)]; head = &instance_table[instance_hashfn(group_num)];
hlist_for_each_entry(inst, pos, head, hlist) { hlist_for_each_entry(inst, pos, head, hlist) {
if (inst->group_num == group_num) if (inst->group_num == group_num)
...@@ -127,7 +117,6 @@ static void ...@@ -127,7 +117,6 @@ static void
instance_put(struct nfulnl_instance *inst) instance_put(struct nfulnl_instance *inst)
{ {
if (inst && atomic_dec_and_test(&inst->use)) { if (inst && atomic_dec_and_test(&inst->use)) {
UDEBUG("kfree(inst=%p)\n", inst);
kfree(inst); kfree(inst);
module_put(THIS_MODULE); module_put(THIS_MODULE);
} }
...@@ -140,13 +129,9 @@ instance_create(u_int16_t group_num, int pid) ...@@ -140,13 +129,9 @@ instance_create(u_int16_t group_num, int pid)
{ {
struct nfulnl_instance *inst; struct nfulnl_instance *inst;
UDEBUG("entering (group_num=%u, pid=%d)\n", group_num,
pid);
write_lock_bh(&instances_lock); write_lock_bh(&instances_lock);
if (__instance_lookup(group_num)) { if (__instance_lookup(group_num)) {
inst = NULL; inst = NULL;
UDEBUG("aborting, instance already exists\n");
goto out_unlock; goto out_unlock;
} }
...@@ -178,9 +163,6 @@ instance_create(u_int16_t group_num, int pid) ...@@ -178,9 +163,6 @@ instance_create(u_int16_t group_num, int pid)
hlist_add_head(&inst->hlist, hlist_add_head(&inst->hlist,
&instance_table[instance_hashfn(group_num)]); &instance_table[instance_hashfn(group_num)]);
UDEBUG("newly added node: %p, next=%p\n", &inst->hlist,
inst->hlist.next);
write_unlock_bh(&instances_lock); write_unlock_bh(&instances_lock);
return inst; return inst;
...@@ -196,9 +178,6 @@ static void ...@@ -196,9 +178,6 @@ static void
__instance_destroy(struct nfulnl_instance *inst) __instance_destroy(struct nfulnl_instance *inst)
{ {
/* first pull it out of the global list */ /* first pull it out of the global list */
UDEBUG("removing instance %p (queuenum=%u) from hash\n",
inst, inst->group_num);
hlist_del(&inst->hlist); hlist_del(&inst->hlist);
/* then flush all pending packets from skb */ /* then flush all pending packets from skb */
...@@ -306,8 +285,6 @@ nfulnl_alloc_skb(unsigned int inst_size, unsigned int pkt_size) ...@@ -306,8 +285,6 @@ nfulnl_alloc_skb(unsigned int inst_size, unsigned int pkt_size)
struct sk_buff *skb; struct sk_buff *skb;
unsigned int n; unsigned int n;
UDEBUG("entered (%u, %u)\n", inst_size, pkt_size);
/* alloc skb which should be big enough for a whole multipart /* alloc skb which should be big enough for a whole multipart
* message. WARNING: has to be <= 128k due to slab restrictions */ * message. WARNING: has to be <= 128k due to slab restrictions */
...@@ -342,10 +319,6 @@ __nfulnl_send(struct nfulnl_instance *inst) ...@@ -342,10 +319,6 @@ __nfulnl_send(struct nfulnl_instance *inst)
sizeof(struct nfgenmsg)); sizeof(struct nfgenmsg));
status = nfnetlink_unicast(inst->skb, inst->peer_pid, MSG_DONTWAIT); status = nfnetlink_unicast(inst->skb, inst->peer_pid, MSG_DONTWAIT);
if (status < 0) {
UDEBUG("netlink_unicast() failed\n");
/* FIXME: statistics */
}
inst->qlen = 0; inst->qlen = 0;
inst->skb = NULL; inst->skb = NULL;
...@@ -369,8 +342,6 @@ nfulnl_timer(unsigned long data) ...@@ -369,8 +342,6 @@ nfulnl_timer(unsigned long data)
{ {
struct nfulnl_instance *inst = (struct nfulnl_instance *)data; struct nfulnl_instance *inst = (struct nfulnl_instance *)data;
UDEBUG("timer function called, flushing buffer\n");
spin_lock_bh(&inst->lock); spin_lock_bh(&inst->lock);
if (inst->skb) if (inst->skb)
__nfulnl_send(inst); __nfulnl_send(inst);
...@@ -397,8 +368,6 @@ __build_packet_message(struct nfulnl_instance *inst, ...@@ -397,8 +368,6 @@ __build_packet_message(struct nfulnl_instance *inst,
__be32 tmp_uint; __be32 tmp_uint;
sk_buff_data_t old_tail = inst->skb->tail; sk_buff_data_t old_tail = inst->skb->tail;
UDEBUG("entered\n");
nlh = NLMSG_PUT(inst->skb, 0, 0, nlh = NLMSG_PUT(inst->skb, 0, 0,
NFNL_SUBSYS_ULOG << 8 | NFULNL_MSG_PACKET, NFNL_SUBSYS_ULOG << 8 | NFULNL_MSG_PACKET,
sizeof(struct nfgenmsg)); sizeof(struct nfgenmsg));
...@@ -544,7 +513,6 @@ __build_packet_message(struct nfulnl_instance *inst, ...@@ -544,7 +513,6 @@ __build_packet_message(struct nfulnl_instance *inst,
return 0; return 0;
nlmsg_failure: nlmsg_failure:
UDEBUG("nlmsg_failure\n");
nla_put_failure: nla_put_failure:
PRINTR(KERN_ERR "nfnetlink_log: error creating log nlmsg\n"); PRINTR(KERN_ERR "nfnetlink_log: error creating log nlmsg\n");
return -1; return -1;
...@@ -609,8 +577,6 @@ nfulnl_log_packet(unsigned int pf, ...@@ -609,8 +577,6 @@ nfulnl_log_packet(unsigned int pf,
+ nla_total_size(sizeof(struct nfulnl_msg_packet_hw)) + nla_total_size(sizeof(struct nfulnl_msg_packet_hw))
+ nla_total_size(sizeof(struct nfulnl_msg_packet_timestamp)); + nla_total_size(sizeof(struct nfulnl_msg_packet_timestamp));
UDEBUG("initial size=%u\n", size);
spin_lock_bh(&inst->lock); spin_lock_bh(&inst->lock);
if (inst->flags & NFULNL_CFG_F_SEQ) if (inst->flags & NFULNL_CFG_F_SEQ)
...@@ -637,7 +603,6 @@ nfulnl_log_packet(unsigned int pf, ...@@ -637,7 +603,6 @@ nfulnl_log_packet(unsigned int pf,
data_len = inst->copy_range; data_len = inst->copy_range;
size += nla_total_size(data_len); size += nla_total_size(data_len);
UDEBUG("copy_packet, therefore size now %u\n", size);
break; break;
default: default:
...@@ -648,8 +613,6 @@ nfulnl_log_packet(unsigned int pf, ...@@ -648,8 +613,6 @@ nfulnl_log_packet(unsigned int pf,
size > skb_tailroom(inst->skb) - sizeof(struct nfgenmsg)) { size > skb_tailroom(inst->skb) - sizeof(struct nfgenmsg)) {
/* either the queue len is too high or we don't have /* either the queue len is too high or we don't have
* enough room in the skb left. flush to userspace. */ * enough room in the skb left. flush to userspace. */
UDEBUG("flushing old skb\n");
__nfulnl_flush(inst); __nfulnl_flush(inst);
} }
...@@ -659,7 +622,6 @@ nfulnl_log_packet(unsigned int pf, ...@@ -659,7 +622,6 @@ nfulnl_log_packet(unsigned int pf,
goto alloc_failure; goto alloc_failure;
} }
UDEBUG("qlen %d, qthreshold %d\n", inst->qlen, qthreshold);
inst->qlen++; inst->qlen++;
__build_packet_message(inst, skb, data_len, pf, __build_packet_message(inst, skb, data_len, pf,
...@@ -681,7 +643,6 @@ nfulnl_log_packet(unsigned int pf, ...@@ -681,7 +643,6 @@ nfulnl_log_packet(unsigned int pf,
return; return;
alloc_failure: alloc_failure:
UDEBUG("error allocating skb\n");
/* FIXME: statistics */ /* FIXME: statistics */
goto unlock_and_release; goto unlock_and_release;
} }
...@@ -704,7 +665,6 @@ nfulnl_rcv_nl_event(struct notifier_block *this, ...@@ -704,7 +665,6 @@ nfulnl_rcv_nl_event(struct notifier_block *this,
struct hlist_head *head = &instance_table[i]; struct hlist_head *head = &instance_table[i];
hlist_for_each_entry_safe(inst, tmp, t2, head, hlist) { hlist_for_each_entry_safe(inst, tmp, t2, head, hlist) {
UDEBUG("node = %p\n", inst);
if ((n->net == &init_net) && if ((n->net == &init_net) &&
(n->pid == inst->peer_pid)) (n->pid == inst->peer_pid))
__instance_destroy(inst); __instance_destroy(inst);
...@@ -750,8 +710,6 @@ nfulnl_recv_config(struct sock *ctnl, struct sk_buff *skb, ...@@ -750,8 +710,6 @@ nfulnl_recv_config(struct sock *ctnl, struct sk_buff *skb,
struct nfulnl_instance *inst; struct nfulnl_instance *inst;
int ret = 0; int ret = 0;
UDEBUG("entering for msg %u\n", NFNL_MSG_TYPE(nlh->nlmsg_type));
inst = instance_lookup_get(group_num); inst = instance_lookup_get(group_num);
if (inst && inst->peer_pid != NETLINK_CB(skb).pid) { if (inst && inst->peer_pid != NETLINK_CB(skb).pid) {
ret = -EPERM; ret = -EPERM;
...@@ -763,7 +721,6 @@ nfulnl_recv_config(struct sock *ctnl, struct sk_buff *skb, ...@@ -763,7 +721,6 @@ nfulnl_recv_config(struct sock *ctnl, struct sk_buff *skb,
struct nfulnl_msg_config_cmd *cmd; struct nfulnl_msg_config_cmd *cmd;
cmd = nla_data(nfula[NFULA_CFG_CMD]); cmd = nla_data(nfula[NFULA_CFG_CMD]);
UDEBUG("found CFG_CMD for\n");
switch (cmd->command) { switch (cmd->command) {
case NFULNL_CFG_CMD_BIND: case NFULNL_CFG_CMD_BIND:
...@@ -788,11 +745,9 @@ nfulnl_recv_config(struct sock *ctnl, struct sk_buff *skb, ...@@ -788,11 +745,9 @@ nfulnl_recv_config(struct sock *ctnl, struct sk_buff *skb,
instance_destroy(inst); instance_destroy(inst);
goto out; goto out;
case NFULNL_CFG_CMD_PF_BIND: case NFULNL_CFG_CMD_PF_BIND:
UDEBUG("registering log handler for pf=%u\n", pf);
ret = nf_log_register(pf, &nfulnl_logger); ret = nf_log_register(pf, &nfulnl_logger);
break; break;
case NFULNL_CFG_CMD_PF_UNBIND: case NFULNL_CFG_CMD_PF_UNBIND:
UDEBUG("unregistering log handler for pf=%u\n", pf);
/* This is a bug and a feature. We cannot unregister /* This is a bug and a feature. We cannot unregister
* other handlers, like nfnetlink_inst can */ * other handlers, like nfnetlink_inst can */
nf_log_unregister_pf(pf); nf_log_unregister_pf(pf);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment