All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: greearb@candelatech.com
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH] sk-filter:  Rate-limit WARNing, print dbg info.
Date: Tue, 17 May 2011 11:52:29 -0700	[thread overview]
Message-ID: <1305658349.1722.30.camel@Joe-Laptop> (raw)
In-Reply-To: <1305657014-32736-1-git-send-email-greearb@candelatech.com>

On Tue, 2011-05-17 at 11:30 -0700, greearb@candelatech.com wrote:
> From: Ben Greear <greearb@candelatech.com>
> A mis-configured filter can spam the logs with
> lots of stack traces.  Rate-limit the warnings
> and add printout of the bogus filter information.
> -			WARN_ON(1);
> +			if (net_ratelimit()) {
> +				pr_err("filter: Unknown code: %hu jt: %u tf: %u"
> +				       " k: %u\n",
> +				       fentry->code, (unsigned int)(fentry->jt),
> +				       (unsigned int)(fentry->jf), fentry->k);
> +				WARN_ON(1);
> +			}

Maybe just using WARN is better.
I believe the casts aren't necessary.

 net/core/filter.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/net/core/filter.c b/net/core/filter.c
index 0eb8c44..5b967d0 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -350,7 +350,10 @@ load_b:
 			continue;
 		}
 		default:
-			WARN_ON(1);
+			if (net_ratelimit())
+				WARN(1, "Unknown code:%u jt:%u tf:%u k:%u\n",
+				     fentry->code, fentry->jt,
+				     fentry->jf, fentry->k);
 			return 0;
 		}
 	}



  reply	other threads:[~2011-05-17 18:52 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-17 18:30 [PATCH] sk-filter: Rate-limit WARNing, print dbg info greearb
2011-05-17 18:52 ` Joe Perches [this message]
2011-05-17 19:23   ` David Miller
2011-05-17 19:34     ` Ben Greear
2011-05-17 19:39       ` David Miller
2011-05-17 19:53       ` Joe Perches
     [not found]         ` <4DD2DB9D.6050306@candelatech.com>
2011-05-17 21:13           ` RFC: Add WARN_RATELIMIT to bug.h (was: Re: [PATCH] sk-filter: Rate-limit WARNing, print dbg info.) Joe Perches
2011-05-21 17:48             ` [PATCH 0/2] Add and use WARN_RATELIMIT Joe Perches
2011-05-21 17:48               ` [PATCH 1/2] bug.h: Add WARN_RATELIMIT Joe Perches
2011-05-21 17:48               ` [PATCH 2/2] net: filter: Use WARN_RATELIMIT Joe Perches
2011-05-26 12:31                 ` [patch] net/core/filter.c: Fix build error Ingo Molnar
2011-05-26 12:31                   ` Ingo Molnar
2011-05-26 15:31                   ` Joe Perches
2011-05-26 18:38                     ` David Miller
2011-05-26 18:57                       ` Randy Dunlap
2011-05-26 19:00                         ` David Miller
2011-05-26 19:07                       ` Joe Perches
2011-05-26 19:09                       ` Ingo Molnar
2011-05-26 19:12                         ` Ingo Molnar
2011-05-23 21:38               ` [PATCH 0/2] Add and use WARN_RATELIMIT 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=1305658349.1722.30.camel@Joe-Laptop \
    --to=joe@perches.com \
    --cc=greearb@candelatech.com \
    --cc=netdev@vger.kernel.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.