summaryrefslogtreecommitdiff
path: root/ospfd/ospf_route.c
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@opensourcerouting.org>2013-01-11 21:46:18 +0100
committerDavid Lamparter <equinox@opensourcerouting.org>2013-01-11 21:46:22 +0100
commitb2e5bdbe10c4145f508fcf1486ffe29d5ce516f7 (patch)
treefae70e8c1580d99fee0c2a59d6bef831c4c9465c /ospfd/ospf_route.c
parenta16dcf7c11d80775b07a0fa6f3ac5527190fb486 (diff)
parente0630cb4d61557f956318a088f68f1fc4d261ef3 (diff)
Merge remote-tracking branch 'savannah/sf/ospfd'
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Diffstat (limited to 'ospfd/ospf_route.c')
-rw-r--r--ospfd/ospf_route.c33
1 files changed, 29 insertions, 4 deletions
diff --git a/ospfd/ospf_route.c b/ospfd/ospf_route.c
index c3acba34..eb7829ac 100644
--- a/ospfd/ospf_route.c
+++ b/ospfd/ospf_route.c
@@ -126,6 +126,31 @@ ospf_route_table_free (struct route_table *rt)
route_table_finish (rt);
}
+/* If a prefix exists in the new routing table, then return 1,
+ otherwise return 0. Since the ZEBRA-RIB does an implicit
+ withdraw, it is not necessary to send a delete, an add later
+ will act like an implicit delete. */
+static int
+ospf_route_exist_new_table (struct route_table *rt, struct prefix_ipv4 *prefix)
+{
+ struct route_node *rn;
+
+ assert (rt);
+ assert (prefix);
+
+ rn = route_node_lookup (rt, (struct prefix *) prefix);
+ if (!rn) {
+ return 0;
+ }
+ route_unlock_node (rn);
+
+ if (!rn->info) {
+ return 0;
+ }
+
+ return 1;
+}
+
/* If a prefix and a nexthop match any route in the routing table,
then return 1, otherwise return 0. */
int
@@ -223,13 +248,13 @@ ospf_route_delete_uniq (struct route_table *rt, struct route_table *cmprt)
{
if (or->type == OSPF_DESTINATION_NETWORK)
{
- if (! ospf_route_match_same (cmprt,
- (struct prefix_ipv4 *) &rn->p, or))
+ if (! ospf_route_exist_new_table (cmprt,
+ (struct prefix_ipv4 *) &rn->p))
ospf_zebra_delete ((struct prefix_ipv4 *) &rn->p, or);
}
else if (or->type == OSPF_DESTINATION_DISCARD)
- if (! ospf_route_match_same (cmprt,
- (struct prefix_ipv4 *) &rn->p, or))
+ if (! ospf_route_exist_new_table (cmprt,
+ (struct prefix_ipv4 *) &rn->p))
ospf_zebra_delete_discard ((struct prefix_ipv4 *) &rn->p);
}
}