summaryrefslogtreecommitdiffstats
path: root/eigrpd
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2019-06-15 21:02:58 +0200
committerRafael Zalamena <rzalamena@opensourcerouting.org>2019-08-07 03:41:37 +0200
commit0da93ecfd79973603462b91512eb69bb916ccb2e (patch)
treef5d32e5f76e3feffe4a8c71c7ad7c09dcf6fd080 /eigrpd
parenteigrpd: Convert eigrp_zebra.c to use appropriate vrf_id (diff)
downloadfrr-0da93ecfd79973603462b91512eb69bb916ccb2e.tar.xz
frr-0da93ecfd79973603462b91512eb69bb916ccb2e.zip
eigrpd: Update eigrp_topology.c to not use VRF_DEFAULT
Push out the pass in of struct eigrp to all functions in eigrp_topology.c so we do not lookup the eigrp pointer. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'eigrpd')
-rw-r--r--eigrpd/eigrp_fsm.c18
-rw-r--r--eigrpd/eigrp_interface.c6
-rw-r--r--eigrpd/eigrp_topology.c45
-rw-r--r--eigrpd/eigrp_topology.h43
-rw-r--r--eigrpd/eigrp_update.c4
-rw-r--r--eigrpd/eigrpd.c2
6 files changed, 61 insertions, 57 deletions
diff --git a/eigrpd/eigrp_fsm.c b/eigrpd/eigrp_fsm.c
index 77fd3a9d7..c60320f98 100644
--- a/eigrpd/eigrp_fsm.c
+++ b/eigrpd/eigrp_fsm.c
@@ -504,8 +504,8 @@ int eigrp_fsm_event_keep_state(struct eigrp_fsm_action_message *msg)
listnode_add(eigrp->topology_changes_internalIPV4,
prefix);
}
- eigrp_topology_update_node_flags(prefix);
- eigrp_update_routing_table(prefix);
+ eigrp_topology_update_node_flags(eigrp, prefix);
+ eigrp_update_routing_table(eigrp, prefix);
}
if (msg->packet_type == EIGRP_OPC_QUERY)
@@ -536,9 +536,10 @@ int eigrp_fsm_event_lr(struct eigrp_fsm_action_message *msg)
prefix->state = EIGRP_FSM_STATE_PASSIVE;
prefix->req_action |= EIGRP_FSM_NEED_UPDATE;
listnode_add(eigrp->topology_changes_internalIPV4, prefix);
- eigrp_topology_update_node_flags(prefix);
- eigrp_update_routing_table(prefix);
- eigrp_update_topology_table_prefix(eigrp->topology_table, prefix);
+ eigrp_topology_update_node_flags(eigrp, prefix);
+ eigrp_update_routing_table(eigrp, prefix);
+ eigrp_update_topology_table_prefix(eigrp, eigrp->topology_table,
+ prefix);
return 1;
}
@@ -588,9 +589,10 @@ int eigrp_fsm_event_lr_fcs(struct eigrp_fsm_action_message *msg)
}
prefix->req_action |= EIGRP_FSM_NEED_UPDATE;
listnode_add(eigrp->topology_changes_internalIPV4, prefix);
- eigrp_topology_update_node_flags(prefix);
- eigrp_update_routing_table(prefix);
- eigrp_update_topology_table_prefix(eigrp->topology_table, prefix);
+ eigrp_topology_update_node_flags(eigrp, prefix);
+ eigrp_update_routing_table(eigrp, prefix);
+ eigrp_update_topology_table_prefix(eigrp, eigrp->topology_table,
+ prefix);
return 1;
}
diff --git a/eigrpd/eigrp_interface.c b/eigrpd/eigrp_interface.c
index 8b2bd9dc4..fd1d3f5cb 100644
--- a/eigrpd/eigrp_interface.c
+++ b/eigrpd/eigrp_interface.c
@@ -206,7 +206,7 @@ int eigrp_if_up(struct eigrp_interface *ei)
eigrp_prefix_entry_add(eigrp->topology_table, pe);
listnode_add(eigrp->topology_changes_internalIPV4, pe);
- eigrp_nexthop_entry_add(pe, ne);
+ eigrp_nexthop_entry_add(eigrp, pe, ne);
for (ALL_LIST_ELEMENTS(eigrp->eiflist, node, nnode, ei2)) {
eigrp_update_send(ei2);
@@ -218,7 +218,7 @@ int eigrp_if_up(struct eigrp_interface *ei)
struct eigrp_fsm_action_message msg;
ne->prefix = pe;
- eigrp_nexthop_entry_add(pe, ne);
+ eigrp_nexthop_entry_add(eigrp, pe, ne);
msg.packet_type = EIGRP_OPC_UPDATE;
msg.eigrp = eigrp;
@@ -341,7 +341,7 @@ void eigrp_if_free(struct eigrp_interface *ei, int source)
pe = eigrp_topology_table_lookup_ipv4(eigrp->topology_table,
&dest_addr);
if (pe)
- eigrp_prefix_entry_delete(eigrp->topology_table, pe);
+ eigrp_prefix_entry_delete(eigrp, eigrp->topology_table, pe);
eigrp_if_down(ei);
diff --git a/eigrpd/eigrp_topology.c b/eigrpd/eigrp_topology.c
index 394a14f8c..9cc612eaf 100644
--- a/eigrpd/eigrp_topology.c
+++ b/eigrpd/eigrp_topology.c
@@ -117,9 +117,9 @@ struct eigrp_nexthop_entry *eigrp_nexthop_entry_new(void)
/*
* Freeing topology table list
*/
-void eigrp_topology_free(struct route_table *table)
+void eigrp_topology_free(struct eigrp *eigrp, struct route_table *table)
{
- eigrp_topology_delete_all(table);
+ eigrp_topology_delete_all(eigrp, table);
route_table_finish(table);
}
@@ -150,11 +150,11 @@ void eigrp_prefix_entry_add(struct route_table *topology,
/*
* Adding topology entry to topology node
*/
-void eigrp_nexthop_entry_add(struct eigrp_prefix_entry *node,
+void eigrp_nexthop_entry_add(struct eigrp *eigrp,
+ struct eigrp_prefix_entry *node,
struct eigrp_nexthop_entry *entry)
{
struct list *l = list_new();
- struct eigrp *eigrp = eigrp_lookup(VRF_DEFAULT);
listnode_add(l, entry);
@@ -172,10 +172,9 @@ void eigrp_nexthop_entry_add(struct eigrp_prefix_entry *node,
/*
* Deleting topology node from topology table
*/
-void eigrp_prefix_entry_delete(struct route_table *table,
+void eigrp_prefix_entry_delete(struct eigrp *eigrp, struct route_table *table,
struct eigrp_prefix_entry *pe)
{
- struct eigrp *eigrp = eigrp_lookup(VRF_DEFAULT);
struct eigrp_nexthop_entry *ne;
struct listnode *node, *nnode;
struct route_node *rn;
@@ -194,7 +193,7 @@ void eigrp_prefix_entry_delete(struct route_table *table,
listnode_delete(eigrp->topology_changes_internalIPV4, pe);
for (ALL_LIST_ELEMENTS(pe->entries, node, nnode, ne))
- eigrp_nexthop_entry_delete(pe, ne);
+ eigrp_nexthop_entry_delete(eigrp, pe, ne);
list_delete(&pe->entries);
list_delete(&pe->rij);
eigrp_zebra_route_delete(eigrp, pe->destination);
@@ -209,11 +208,10 @@ void eigrp_prefix_entry_delete(struct route_table *table,
/*
* Deleting topology entry from topology node
*/
-void eigrp_nexthop_entry_delete(struct eigrp_prefix_entry *node,
+void eigrp_nexthop_entry_delete(struct eigrp *eigrp,
+ struct eigrp_prefix_entry *node,
struct eigrp_nexthop_entry *entry)
{
- struct eigrp *eigrp = eigrp_lookup(VRF_DEFAULT);
-
if (listnode_lookup(node->entries, entry) != NULL) {
listnode_delete(node->entries, entry);
eigrp_zebra_route_delete(eigrp, node->destination);
@@ -224,7 +222,8 @@ void eigrp_nexthop_entry_delete(struct eigrp_prefix_entry *node,
/*
* Deleting all nodes from topology table
*/
-void eigrp_topology_delete_all(struct route_table *topology)
+void eigrp_topology_delete_all(struct eigrp *eigrp,
+ struct route_table *topology)
{
struct route_node *rn;
struct eigrp_prefix_entry *pe;
@@ -235,7 +234,7 @@ void eigrp_topology_delete_all(struct route_table *topology)
if (!pe)
continue;
- eigrp_prefix_entry_delete(topology, pe);
+ eigrp_prefix_entry_delete(eigrp, topology, pe);
}
}
@@ -430,17 +429,15 @@ void eigrp_topology_update_all_node_flags(struct eigrp *eigrp)
if (!pe)
continue;
- eigrp_topology_update_node_flags(pe);
+ eigrp_topology_update_node_flags(eigrp, pe);
}
}
-void eigrp_topology_update_node_flags(struct eigrp_prefix_entry *dest)
+void eigrp_topology_update_node_flags(struct eigrp *eigrp,
+ struct eigrp_prefix_entry *dest)
{
struct listnode *node;
struct eigrp_nexthop_entry *entry;
- struct eigrp *eigrp = eigrp_lookup(VRF_DEFAULT);
-
- assert(eigrp);
for (ALL_LIST_ELEMENTS_RO(dest->entries, node, entry)) {
if (entry->reported_distance < dest->fdistance) {
@@ -468,16 +465,13 @@ void eigrp_topology_update_node_flags(struct eigrp_prefix_entry *dest)
}
}
-void eigrp_update_routing_table(struct eigrp_prefix_entry *prefix)
+void eigrp_update_routing_table(struct eigrp *eigrp,
+ struct eigrp_prefix_entry *prefix)
{
- struct eigrp *eigrp = eigrp_lookup(VRF_DEFAULT);
struct list *successors;
struct listnode *node;
struct eigrp_nexthop_entry *entry;
- if (!eigrp)
- return;
-
successors = eigrp_topology_get_successor_max(prefix, eigrp->max_paths);
if (successors) {
@@ -529,7 +523,8 @@ void eigrp_topology_neighbor_down(struct eigrp *eigrp,
eigrp_update_send_all(eigrp, nbr->ei);
}
-void eigrp_update_topology_table_prefix(struct route_table *table,
+void eigrp_update_topology_table_prefix(struct eigrp *eigrp,
+ struct route_table *table,
struct eigrp_prefix_entry *prefix)
{
struct listnode *node1, *node2;
@@ -537,11 +532,11 @@ void eigrp_update_topology_table_prefix(struct route_table *table,
struct eigrp_nexthop_entry *entry;
for (ALL_LIST_ELEMENTS(prefix->entries, node1, node2, entry)) {
if (entry->distance == EIGRP_MAX_METRIC) {
- eigrp_nexthop_entry_delete(prefix, entry);
+ eigrp_nexthop_entry_delete(eigrp, prefix, entry);
}
}
if (prefix->distance == EIGRP_MAX_METRIC
&& prefix->nt != EIGRP_TOPOLOGY_TYPE_CONNECTED) {
- eigrp_prefix_entry_delete(table, prefix);
+ eigrp_prefix_entry_delete(eigrp, table, prefix);
}
}
diff --git a/eigrpd/eigrp_topology.h b/eigrpd/eigrp_topology.h
index 16bf2261c..718cece40 100644
--- a/eigrpd/eigrp_topology.h
+++ b/eigrpd/eigrp_topology.h
@@ -37,34 +37,41 @@ extern struct route_table *eigrp_topology_new(void);
extern void eigrp_topology_init(struct route_table *table);
extern struct eigrp_prefix_entry *eigrp_prefix_entry_new(void);
extern struct eigrp_nexthop_entry *eigrp_nexthop_entry_new(void);
-extern void eigrp_topology_free(struct route_table *table);
+extern void eigrp_topology_free(struct eigrp *eigrp, struct route_table *table);
extern void eigrp_prefix_entry_add(struct route_table *table,
struct eigrp_prefix_entry *pe);
-extern void eigrp_nexthop_entry_add(struct eigrp_prefix_entry *,
- struct eigrp_nexthop_entry *);
-extern void eigrp_prefix_entry_delete(struct route_table *table,
+extern void eigrp_nexthop_entry_add(struct eigrp *eigrp,
+ struct eigrp_prefix_entry *pe,
+ struct eigrp_nexthop_entry *ne);
+extern void eigrp_prefix_entry_delete(struct eigrp *eigrp,
+ struct route_table *table,
struct eigrp_prefix_entry *pe);
-extern void eigrp_nexthop_entry_delete(struct eigrp_prefix_entry *,
- struct eigrp_nexthop_entry *);
-extern void eigrp_topology_delete_all(struct route_table *table);
+extern void eigrp_nexthop_entry_delete(struct eigrp *eigrp,
+ struct eigrp_prefix_entry *pe,
+ struct eigrp_nexthop_entry *ne);
+extern void eigrp_topology_delete_all(struct eigrp *eigrp,
+ struct route_table *table);
extern struct eigrp_prefix_entry *
eigrp_topology_table_lookup_ipv4(struct route_table *table, struct prefix *p);
-extern struct list *eigrp_topology_get_successor(struct eigrp_prefix_entry *);
+extern struct list *eigrp_topology_get_successor(struct eigrp_prefix_entry *pe);
extern struct list *
eigrp_topology_get_successor_max(struct eigrp_prefix_entry *pe,
unsigned int maxpaths);
extern struct eigrp_nexthop_entry *
-eigrp_prefix_entry_lookup(struct list *, struct eigrp_neighbor *);
-extern struct list *eigrp_neighbor_prefixes_lookup(struct eigrp *,
- struct eigrp_neighbor *);
-extern void eigrp_topology_update_all_node_flags(struct eigrp *);
-extern void eigrp_topology_update_node_flags(struct eigrp_prefix_entry *);
+eigrp_prefix_entry_lookup(struct list *entries, struct eigrp_neighbor *neigh);
+extern struct list *eigrp_neighbor_prefixes_lookup(struct eigrp *eigrp,
+ struct eigrp_neighbor *n);
+extern void eigrp_topology_update_all_node_flags(struct eigrp *eigrp);
+extern void eigrp_topology_update_node_flags(struct eigrp *eigrp,
+ struct eigrp_prefix_entry *pe);
extern enum metric_change
-eigrp_topology_update_distance(struct eigrp_fsm_action_message *);
-extern void eigrp_update_routing_table(struct eigrp_prefix_entry *);
-extern void eigrp_topology_neighbor_down(struct eigrp *,
- struct eigrp_neighbor *);
-extern void eigrp_update_topology_table_prefix(struct route_table *table,
+eigrp_topology_update_distance(struct eigrp_fsm_action_message *msg);
+extern void eigrp_update_routing_table(struct eigrp *eigrp,
+ struct eigrp_prefix_entry *pe);
+extern void eigrp_topology_neighbor_down(struct eigrp *eigrp,
+ struct eigrp_neighbor *neigh);
+extern void eigrp_update_topology_table_prefix(struct eigrp *eigrp,
+ struct route_table *table,
struct eigrp_prefix_entry *pe);
#endif
diff --git a/eigrpd/eigrp_update.c b/eigrpd/eigrp_update.c
index 6a7c0357c..6e2a81e32 100644
--- a/eigrpd/eigrp_update.c
+++ b/eigrpd/eigrp_update.c
@@ -366,11 +366,11 @@ void eigrp_update_receive(struct eigrp *eigrp, struct ip *iph,
eigrp_prefix_entry_add(eigrp->topology_table,
pe);
- eigrp_nexthop_entry_add(pe, ne);
+ eigrp_nexthop_entry_add(eigrp, pe, ne);
pe->distance = pe->fdistance = pe->rdistance =
ne->distance;
pe->reported_metric = ne->total_metric;
- eigrp_topology_update_node_flags(pe);
+ eigrp_topology_update_node_flags(eigrp, pe);
pe->req_action |= EIGRP_FSM_NEED_UPDATE;
listnode_add(
diff --git a/eigrpd/eigrpd.c b/eigrpd/eigrpd.c
index eb99016d5..e93dc0cbf 100644
--- a/eigrpd/eigrpd.c
+++ b/eigrpd/eigrpd.c
@@ -283,7 +283,7 @@ void eigrp_finish_final(struct eigrp *eigrp)
list_delete(&eigrp->eiflist);
list_delete(&eigrp->oi_write_q);
- eigrp_topology_free(eigrp->topology_table);
+ eigrp_topology_free(eigrp, eigrp->topology_table);
eigrp_nbr_delete(eigrp->neighbor_self);