diff options
author | Donald Sharp <sharpd@cumulusnetworks.com> | 2017-04-06 02:35:50 +0200 |
---|---|---|
committer | Donald Sharp <sharpd@cumulusnetworks.com> | 2017-04-06 02:35:50 +0200 |
commit | 2118601d5cf9335cd316cd53ebd74a399264c653 (patch) | |
tree | 5566c31a5e397c4155997128cb2ca2462a9c3907 /eigrpd/eigrp_topology.c | |
parent | eigrpd: Fix massive memory leak (diff) | |
download | frr-2118601d5cf9335cd316cd53ebd74a399264c653.tar.xz frr-2118601d5cf9335cd316cd53ebd74a399264c653.zip |
eigrpd: Fix add and delete of routes into the rib
Use the eigrp_topology_successors to give us the
list of successors we want to install.
Modify route add to send all the nexthops
Modify route delete to just delete the route
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'eigrpd/eigrp_topology.c')
-rw-r--r-- | eigrpd/eigrp_topology.c | 34 |
1 files changed, 20 insertions, 14 deletions
diff --git a/eigrpd/eigrp_topology.c b/eigrpd/eigrp_topology.c index 7015d5953..29664eaeb 100644 --- a/eigrpd/eigrp_topology.c +++ b/eigrpd/eigrp_topology.c @@ -317,6 +317,13 @@ eigrp_topology_table_lookup_ipv4(struct list *topology_table, return NULL; } +/* + * For a future optimization, put the successor list into it's + * own separate list from the full list? + * + * That way we can clean up all the list_new and list_delete's + * that we are doing. DBS + */ struct list * eigrp_topology_get_successor(struct eigrp_prefix_entry *table_node) { @@ -475,24 +482,23 @@ eigrp_topology_update_node_flags(struct eigrp_prefix_entry *dest) void eigrp_update_routing_table(struct eigrp_prefix_entry * prefix) { + struct list *successors = eigrp_topology_get_successor(prefix); struct listnode *node; struct eigrp_neighbor_entry *entry; - for (ALL_LIST_ELEMENTS_RO(prefix->entries, node, entry)) + if (successors) { - if (entry->flags & EIGRP_NEIGHBOR_ENTRY_SUCCESSOR_FLAG) - { - if (!(entry->flags & EIGRP_NEIGHBOR_ENTRY_INTABLE_FLAG)) - { - eigrp_zebra_route_add(prefix->destination_ipv4, entry); - entry->flags |= EIGRP_NEIGHBOR_ENTRY_INTABLE_FLAG; - } - } - else if (entry->flags & EIGRP_NEIGHBOR_ENTRY_INTABLE_FLAG) - { - eigrp_zebra_route_delete(prefix->destination_ipv4, entry); - entry->flags &= ~EIGRP_NEIGHBOR_ENTRY_INTABLE_FLAG; - } + eigrp_zebra_route_add(prefix->destination_ipv4, successors); + for (ALL_LIST_ELEMENTS_RO (successors, node, entry)) + entry->flags |= EIGRP_NEIGHBOR_ENTRY_INTABLE_FLAG; + + list_delete(successors); + } + else + { + eigrp_zebra_route_delete(prefix->destination_ipv4); + for (ALL_LIST_ELEMENTS_RO (prefix->entries, node, entry)) + entry->flags &= ~EIGRP_NEIGHBOR_ENTRY_INTABLE_FLAG; } } |