diff options
author | Ondrej Filip <feela@network.cz> | 2012-04-26 17:03:53 +0200 |
---|---|---|
committer | Ondrej Filip <feela@network.cz> | 2012-04-26 17:03:53 +0200 |
commit | 1f85226ecb76d3803b8fe37eb0891c45a6557dcd (patch) | |
tree | b0e51334e0f5a788a7203a22e19b7069806c6a47 /nest/rt-table.c | |
parent | 92f8f7e3a3a5a42768c18c1f3d4d8f9f98150c61 (diff) | |
parent | d9b77cc28115e5c1ef64c69722c9d1fd1392dcd1 (diff) |
Merge branch 'master' of ssh://git.nic.cz/bird
Diffstat (limited to 'nest/rt-table.c')
-rw-r--r-- | nest/rt-table.c | 35 |
1 files changed, 30 insertions, 5 deletions
diff --git a/nest/rt-table.c b/nest/rt-table.c index 6a28fd43..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) @@ -485,12 +504,18 @@ rte_recalculate(struct announce_hook *ah, net *net, rte *new, ea_list *tmpa, str } struct proto_limit *l = ah->in_limit; - if (l && !old && new && (stats->imp_routes >= l->limit) && proto_notify_limit(ah, l)) + if (l && !old && new) { - stats->imp_updates_ignored++; - rte_trace_in(D_FILTERS, p, new, "ignored [limit]"); - rte_free_quick(new); - return; + if (stats->imp_routes >= l->limit) + proto_notify_limit(ah, l, stats->imp_routes); + + if (l->state == PLS_BLOCKED) + { + stats->imp_updates_ignored++; + rte_trace_in(D_FILTERS, p, new, "ignored [limit]"); + rte_free_quick(new); + return; + } } if (new) |