summaryrefslogtreecommitdiffstats
path: root/nest/rt-table.c
diff options
context:
space:
mode:
authorMartin Mares <mj@ucw.cz>2000-05-06 23:21:19 +0200
committerMartin Mares <mj@ucw.cz>2000-05-06 23:21:19 +0200
commit67be5b23cd80646c2aa5a9c6a3d373ceecb275b6 (patch)
tree23de235cdd950f3ef3e2c2d1965ffe19d47fa3e2 /nest/rt-table.c
parentab1129c1bdea41ff06fd21390cde5667d07f6e65 (diff)
downloadbird-67be5b23cd80646c2aa5a9c6a3d373ceecb275b6.tar
bird-67be5b23cd80646c2aa5a9c6a3d373ceecb275b6.zip
When rte_update is called for an identical route, don't announce anything.
Please implement the rte_same hook in your protocols. It should just compare your metrics stored directly in rte, the rest is done by the core.
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 832e9ef..4214d07 100644
--- a/nest/rt-table.c
+++ b/nest/rt-table.c
@@ -272,6 +272,17 @@ rte_free_quick(rte *e)
sl_free(rte_slab, e);
}
+static int
+rte_same(rte *x, rte *y)
+{
+ return
+ x->attrs == y->attrs &&
+ x->flags == y->flags &&
+ x->pflags == y->pflags &&
+ x->pref == y->pref &&
+ (!x->attrs->proto->rte_same || x->attrs->proto->rte_same(x, y));
+}
+
static void
rte_recalculate(rtable *table, net *net, struct proto *p, rte *new, ea_list *tmpa)
{
@@ -284,6 +295,14 @@ rte_recalculate(rtable *table, net *net, struct proto *p, rte *new, ea_list *tmp
{
if (old->attrs->proto == p)
{
+ if (rte_same(old, new))
+ {
+ /* No changes, ignore the new route */
+ rte_trace_in(D_ROUTES, p, new, "ignored");
+ rte_free_quick(new);
+ old->lastmod = now;
+ return;
+ }
*k = old->next;
break;
}