summaryrefslogtreecommitdiff
path: root/nest/rt-table.c
diff options
context:
space:
mode:
authorOndrej Zajicek <santiago@crfreenet.org>2012-04-15 15:28:29 +0200
committerOndrej Zajicek <santiago@crfreenet.org>2012-04-15 15:28:29 +0200
commitebecb6f6a11bb418dd054cf12a2673ca0d9eac37 (patch)
tree9454aad3bd2e84fc65b518574aa9d112a0e5155c /nest/rt-table.c
parentae8b300164a975597f9b6caea0b205af2e4db30b (diff)
Implements generalized import hooks.
Thanks to Alexander V. Chernikov for the original patch.
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 310c1afd..6a28fd43 100644
--- a/nest/rt-table.c
+++ b/nest/rt-table.c
@@ -182,6 +182,16 @@ rte_trace_out(unsigned int flag, struct proto *p, rte *e, char *msg)
rte_trace(p, e, '<', msg);
}
+/**
+ * do_rte_announce - announce new rte to protocol
+ * @ah: pointer to announce hook
+ * @type: announce type (RA_ANY or RA_OPTIMAL)
+ * @net: pointer to announced network
+ * @new: new rte or NULL
+ * @old: previous rte or NULL
+ * @tmpa: new rte attributes (possibly modified by filter)
+ * @refeed: whether we are refeeding protocol
+ */
static inline void
do_rte_announce(struct announce_hook *ah, int type UNUSED, net *net, rte *new, rte *old, ea_list *tmpa, int refeed)
{
@@ -474,6 +484,15 @@ rte_recalculate(struct announce_hook *ah, net *net, rte *new, ea_list *tmpa, str
return;
}
+ struct proto_limit *l = ah->in_limit;
+ if (l && !old && new && (stats->imp_routes >= l->limit) && proto_notify_limit(ah, l))
+ {
+ stats->imp_updates_ignored++;
+ rte_trace_in(D_FILTERS, p, new, "ignored [limit]");
+ rte_free_quick(new);
+ return;
+ }
+
if (new)
stats->imp_updates_accepted++;
else