summaryrefslogtreecommitdiff
path: root/nest/rt-table.c
diff options
context:
space:
mode:
authorOndrej Zajicek <santiago@crfreenet.org>2012-04-24 23:39:57 +0200
committerOndrej Zajicek <santiago@crfreenet.org>2012-04-24 23:39:57 +0200
commitd9b77cc28115e5c1ef64c69722c9d1fd1392dcd1 (patch)
tree5dae59203a8455874fdcdabc0b74ff69d9e67f6e /nest/rt-table.c
parent3589546af4baa4d349409a318f8c9658dd11b3cc (diff)
Implements generalized export limits.
And also fixes some minor bugs in limits.
Diffstat (limited to 'nest/rt-table.c')
-rw-r--r--nest/rt-table.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/nest/rt-table.c b/nest/rt-table.c
index 6d82e1d3..06121ea3 100644
--- a/nest/rt-table.c
+++ b/nest/rt-table.c
@@ -273,6 +273,23 @@ do_rte_announce(struct announce_hook *ah, int type UNUSED, net *net, rte *new, r
if (!new && !old)
return;
+ struct proto_limit *l = ah->out_limit;
+ if (l && new && (!old || refeed))
+ {
+ if (stats->exp_routes >= l->limit)
+ proto_notify_limit(ah, l, stats->exp_routes);
+
+ if (l->state == PLS_BLOCKED)
+ {
+ /* Exported route counter ignores whether the route was
+ blocked by limit, to be consistent when limits change */
+ stats->exp_routes++;
+ stats->exp_updates_rejected++;
+ rte_trace_out(D_FILTERS, p, new, "rejected [limit]");
+ goto done;
+ }
+ }
+
if (new)
stats->exp_updates_accepted++;
else
@@ -307,6 +324,8 @@ do_rte_announce(struct announce_hook *ah, int type UNUSED, net *net, rte *new, r
}
else
p->rt_notify(p, ah->table, net, new, old, new->attrs->eattrs);
+
+ done:
if (new && new != new0) /* Discard temporary rte's */
rte_free(new);
if (old && old != old0)