summaryrefslogtreecommitdiffstats
path: root/proto
diff options
context:
space:
mode:
authorOndrej Zajicek <santiago@crfreenet.org>2009-02-26 14:23:54 +0100
committerOndrej Zajicek <santiago@crfreenet.org>2009-02-26 14:23:54 +0100
commitcb5303927188de9504a6e18aedec299956a22b6f (patch)
tree0d8ac146c9d84b85e382fb994d9e10688c2e3e36 /proto
parenta9dc5e1ef2fd08c53bceb54690f6dac83ddf0c81 (diff)
downloadbird-cb5303927188de9504a6e18aedec299956a22b6f.tar
bird-cb5303927188de9504a6e18aedec299956a22b6f.zip
Rate limit for most abundant log messages
Diffstat (limited to 'proto')
-rw-r--r--proto/bgp/bgp.h4
-rw-r--r--proto/bgp/packets.c9
2 files changed, 10 insertions, 3 deletions
diff --git a/proto/bgp/bgp.h b/proto/bgp/bgp.h
index b706caf..b0ead9d 100644
--- a/proto/bgp/bgp.h
+++ b/proto/bgp/bgp.h
@@ -139,6 +139,10 @@ void bgp_store_error(struct bgp_proto *p, struct bgp_conn *c, u8 class, u32 code
#define BGP_TRACE(flags, msg, args...) do { if ((p->p.debug & flags) || BGP_FORCE_DEBUG) \
log(L_TRACE "%s: " msg, p->p.name , ## args ); } while(0)
+#define BGP_TRACE_RL(rl, flags, msg, args...) do { if ((p->p.debug & flags) || BGP_FORCE_DEBUG) \
+ log_rl(rl, L_TRACE "%s: " msg, p->p.name , ## args ); } while(0)
+
+
/* attrs.c */
void bgp_attach_attr(struct ea_list **to, struct linpool *pool, unsigned attr, uintptr_t val);
diff --git a/proto/bgp/packets.c b/proto/bgp/packets.c
index 27c0755..fe7472b 100644
--- a/proto/bgp/packets.c
+++ b/proto/bgp/packets.c
@@ -21,6 +21,8 @@
#include "bgp.h"
+static struct rate_limit rl_rcv_update, rl_snd_update;
+
static byte *
bgp_create_notification(struct bgp_conn *conn, byte *buf)
{
@@ -175,7 +177,7 @@ bgp_create_update(struct bgp_conn *conn, byte *buf)
}
if (wd_size || r_size)
{
- BGP_TRACE(D_PACKETS, "Sending UPDATE");
+ BGP_TRACE_RL(&rl_snd_update, D_PACKETS, "Sending UPDATE");
return w;
}
else
@@ -282,7 +284,7 @@ bgp_create_update(struct bgp_conn *conn, byte *buf)
lp_flush(bgp_linpool);
if (size)
{
- BGP_TRACE(D_PACKETS, "Sending UPDATE");
+ BGP_TRACE_RL(&rl_snd_update, D_PACKETS, "Sending UPDATE");
return w;
}
else
@@ -762,7 +764,8 @@ bgp_rx_update(struct bgp_conn *conn, byte *pkt, int len)
byte *withdrawn, *attrs, *nlri;
int withdrawn_len, attr_len, nlri_len;
- BGP_TRACE(D_PACKETS, "Got UPDATE");
+ BGP_TRACE_RL(&rl_rcv_update, D_PACKETS, "Got UPDATE");
+
if (conn->state != BS_ESTABLISHED)
{ bgp_error(conn, 5, 0, NULL, 0); return; }
bgp_start_timer(conn->hold_timer, conn->hold_time);