netfilter: qtaguid: rate limit some of the printks

Some of the printks are in the packet handling path.
We now ratelimit the very unlikely errors to avoid
kmsg spamming.

Change-Id: If03d6b90bf367a356069f46aa5926a96fa508966
Signed-off-by: JP Abgrall <jpa@google.com>
Git-commit: bd91f6b21861cde78d800deede8ebeca0cc0cdd2
Git-repo: https://android.googlesource.com/kernel/common/
[subbaram@codeaurora.org: resolve trivial merge conflicts]
Signed-off-by: Subbaraman Narayanamurthy <subbaram@codeaurora.org>
This commit is contained in:
JP Abgrall
2013-08-02 17:11:40 -07:00
committed by Gerrit - the friendly Code Review server
parent 0cc5fddcc0
commit 42facc5459
+7 -6
View File
@@ -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>
@@ -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);
@@ -1418,8 +1419,8 @@ static void if_tag_stat_update(const char *ifname, uid_t uid,
iface_entry = get_iface_entry(ifname);
if (!iface_entry) {
spin_unlock_bh(&iface_stat_list_lock);
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;
}
spin_unlock_bh(&iface_stat_list_lock);