Skip to content

Commit

Permalink
netfilter: qtaguid: rate limit some of the printks
Browse files Browse the repository at this point in the history
Some of the printks are in the packet handling path.
We now ratelimit the very unlikely errors to avoid
kmsg spamming.

Signed-off-by: JP Abgrall <jpa@google.com>
  • Loading branch information
jpa468 authored and rmcc committed Aug 24, 2013
1 parent 676a460 commit a4be596
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions net/netfilter/xt_qtaguid.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include <linux/module.h>
#include <linux/netfilter/x_tables.h>
#include <linux/netfilter/xt_qtaguid.h>
#include <linux/ratelimit.h>
#include <linux/skbuff.h>
#include <linux/workqueue.h>
#include <net/addrconf.h>
Expand Down Expand Up @@ -1328,12 +1329,12 @@ static void iface_stat_update_from_skb(const struct sk_buff *skb,
}

if (unlikely(!el_dev)) {
pr_err("qtaguid[%d]: %s(): no par->in/out?!!\n",
par->hooknum, __func__);
pr_err_ratelimited("qtaguid[%d]: %s(): no par->in/out?!!\n",
par->hooknum, __func__);
BUG();
} else if (unlikely(!el_dev->name)) {
pr_err("qtaguid[%d]: %s(): no dev->name?!!\n",
par->hooknum, __func__);
pr_err_ratelimited("qtaguid[%d]: %s(): no dev->name?!!\n",
par->hooknum, __func__);
BUG();
} else {
proto = ipx_proto(skb, par);
Expand Down Expand Up @@ -1416,8 +1417,8 @@ static void if_tag_stat_update(const char *ifname, uid_t uid,

iface_entry = get_iface_entry(ifname);
if (!iface_entry) {
pr_err("qtaguid: iface_stat: stat_update() %s not found\n",
ifname);
pr_err_ratelimited("qtaguid: iface_stat: stat_update() "
"%s not found\n", ifname);
return;
}
/* It is ok to process data when an iface_entry is inactive */
Expand Down

0 comments on commit a4be596

Please sign in to comment.