eigrpd: Convert eigrp_neighor.c to not use VRF_DEFAULT

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
This commit is contained in:
Donald Sharp 2019-06-15 15:10:00 -04:00 committed by Rafael Zalamena
parent 17c0e58653
commit 2ea6b572b5
3 changed files with 27 additions and 37 deletions

View file

@ -445,7 +445,7 @@ int eigrp_fsm_event_nq_fcn(struct eigrp_fsm_action_message *msg)
prefix->rdistance = prefix->distance = prefix->fdistance = ne->distance; prefix->rdistance = prefix->distance = prefix->fdistance = ne->distance;
prefix->reported_metric = ne->total_metric; prefix->reported_metric = ne->total_metric;
if (eigrp_nbr_count_get()) { if (eigrp_nbr_count_get(eigrp)) {
prefix->req_action |= EIGRP_FSM_NEED_QUERY; prefix->req_action |= EIGRP_FSM_NEED_QUERY;
listnode_add(eigrp->topology_changes_internalIPV4, prefix); listnode_add(eigrp->topology_changes_internalIPV4, prefix);
} else { } else {
@ -471,7 +471,7 @@ int eigrp_fsm_event_q_fcn(struct eigrp_fsm_action_message *msg)
prefix->state = EIGRP_FSM_STATE_ACTIVE_3; prefix->state = EIGRP_FSM_STATE_ACTIVE_3;
prefix->rdistance = prefix->distance = prefix->fdistance = ne->distance; prefix->rdistance = prefix->distance = prefix->fdistance = ne->distance;
prefix->reported_metric = ne->total_metric; prefix->reported_metric = ne->total_metric;
if (eigrp_nbr_count_get()) { if (eigrp_nbr_count_get(eigrp)) {
prefix->req_action |= EIGRP_FSM_NEED_QUERY; prefix->req_action |= EIGRP_FSM_NEED_QUERY;
listnode_add(eigrp->topology_changes_internalIPV4, prefix); listnode_add(eigrp->topology_changes_internalIPV4, prefix);
} else { } else {
@ -612,7 +612,7 @@ int eigrp_fsm_event_lr_fcn(struct eigrp_fsm_action_message *msg)
prefix->rdistance = prefix->distance = best_successor->distance; prefix->rdistance = prefix->distance = best_successor->distance;
prefix->reported_metric = best_successor->total_metric; prefix->reported_metric = best_successor->total_metric;
if (eigrp_nbr_count_get()) { if (eigrp_nbr_count_get(eigrp)) {
prefix->req_action |= EIGRP_FSM_NEED_QUERY; prefix->req_action |= EIGRP_FSM_NEED_QUERY;
listnode_add(eigrp->topology_changes_internalIPV4, prefix); listnode_add(eigrp->topology_changes_internalIPV4, prefix);
} else { } else {

View file

@ -194,13 +194,12 @@ void eigrp_nbr_delete(struct eigrp_neighbor *nbr)
int holddown_timer_expired(struct thread *thread) int holddown_timer_expired(struct thread *thread)
{ {
struct eigrp_neighbor *nbr; struct eigrp_neighbor *nbr = THREAD_ARG(thread);
struct eigrp *eigrp = nbr->ei->eigrp;
nbr = THREAD_ARG(thread);
zlog_info("Neighbor %s (%s) is down: holding time expired", zlog_info("Neighbor %s (%s) is down: holding time expired",
inet_ntoa(nbr->src), inet_ntoa(nbr->src),
ifindex2ifname(nbr->ei->ifp->ifindex, VRF_DEFAULT)); ifindex2ifname(nbr->ei->ifp->ifindex, eigrp->vrf_id));
nbr->state = EIGRP_NEIGHBOR_DOWN; nbr->state = EIGRP_NEIGHBOR_DOWN;
eigrp_nbr_delete(nbr); eigrp_nbr_delete(nbr);
@ -297,19 +296,13 @@ void eigrp_nbr_state_update(struct eigrp_neighbor *nbr)
} }
} }
int eigrp_nbr_count_get(void) int eigrp_nbr_count_get(struct eigrp *eigrp)
{ {
struct eigrp_interface *iface; struct eigrp_interface *iface;
struct listnode *node, *node2, *nnode2; struct listnode *node, *node2, *nnode2;
struct eigrp_neighbor *nbr; struct eigrp_neighbor *nbr;
struct eigrp *eigrp = eigrp_lookup(VRF_DEFAULT);
uint32_t counter; uint32_t counter;
if (eigrp == NULL) {
zlog_debug("EIGRP Routing Process not enabled");
return 0;
}
counter = 0; counter = 0;
for (ALL_LIST_ELEMENTS_RO(eigrp->eiflist, node, iface)) { for (ALL_LIST_ELEMENTS_RO(eigrp->eiflist, node, iface)) {
for (ALL_LIST_ELEMENTS(iface->nbrs, node2, nnode2, nbr)) { for (ALL_LIST_ELEMENTS(iface->nbrs, node2, nnode2, nbr)) {
@ -335,20 +328,16 @@ int eigrp_nbr_count_get(void)
*/ */
void eigrp_nbr_hard_restart(struct eigrp_neighbor *nbr, struct vty *vty) void eigrp_nbr_hard_restart(struct eigrp_neighbor *nbr, struct vty *vty)
{ {
if (nbr == NULL) { struct eigrp *eigrp = nbr->ei->eigrp;
flog_err(EC_EIGRP_CONFIG,
"Nbr Hard restart: Neighbor not specified.");
return;
}
zlog_debug("Neighbor %s (%s) is down: manually cleared", zlog_debug("Neighbor %s (%s) is down: manually cleared",
inet_ntoa(nbr->src), inet_ntoa(nbr->src),
ifindex2ifname(nbr->ei->ifp->ifindex, VRF_DEFAULT)); ifindex2ifname(nbr->ei->ifp->ifindex, eigrp->vrf_id));
if (vty != NULL) { if (vty != NULL) {
vty_time_print(vty, 0); vty_time_print(vty, 0);
vty_out(vty, "Neighbor %s (%s) is down: manually cleared\n", vty_out(vty, "Neighbor %s (%s) is down: manually cleared\n",
inet_ntoa(nbr->src), inet_ntoa(nbr->src),
ifindex2ifname(nbr->ei->ifp->ifindex, VRF_DEFAULT)); ifindex2ifname(nbr->ei->ifp->ifindex, eigrp->vrf_id));
} }
/* send Hello with Peer Termination TLV */ /* send Hello with Peer Termination TLV */

View file

@ -33,24 +33,25 @@
#define _ZEBRA_EIGRP_NEIGHBOR_H #define _ZEBRA_EIGRP_NEIGHBOR_H
/* Prototypes */ /* Prototypes */
extern struct eigrp_neighbor *eigrp_nbr_get(struct eigrp_interface *, extern struct eigrp_neighbor *eigrp_nbr_get(struct eigrp_interface *ei,
struct eigrp_header *, struct ip *); struct eigrp_header *,
extern struct eigrp_neighbor *eigrp_nbr_new(struct eigrp_interface *); struct ip *addr);
extern void eigrp_nbr_delete(struct eigrp_neighbor *); extern struct eigrp_neighbor *eigrp_nbr_new(struct eigrp_interface *ei);
extern void eigrp_nbr_delete(struct eigrp_neighbor *neigh);
extern int holddown_timer_expired(struct thread *); extern int holddown_timer_expired(struct thread *thread);
extern int eigrp_neighborship_check(struct eigrp_neighbor *, extern int eigrp_neighborship_check(struct eigrp_neighbor *neigh,
struct TLV_Parameter_Type *); struct TLV_Parameter_Type *tlv);
extern void eigrp_nbr_state_update(struct eigrp_neighbor *); extern void eigrp_nbr_state_update(struct eigrp_neighbor *neigh);
extern void eigrp_nbr_state_set(struct eigrp_neighbor *, uint8_t state); extern void eigrp_nbr_state_set(struct eigrp_neighbor *neigh, uint8_t state);
extern uint8_t eigrp_nbr_state_get(struct eigrp_neighbor *); extern uint8_t eigrp_nbr_state_get(struct eigrp_neighbor *neigh);
extern int eigrp_nbr_count_get(void); extern int eigrp_nbr_count_get(struct eigrp *eigrp);
extern const char *eigrp_nbr_state_str(struct eigrp_neighbor *); extern const char *eigrp_nbr_state_str(struct eigrp_neighbor *neigh);
extern struct eigrp_neighbor *eigrp_nbr_lookup_by_addr(struct eigrp_interface *, extern struct eigrp_neighbor *
struct in_addr *); eigrp_nbr_lookup_by_addr(struct eigrp_interface *ei, struct in_addr *addr);
extern struct eigrp_neighbor *eigrp_nbr_lookup_by_addr_process(struct eigrp *, extern struct eigrp_neighbor *
struct in_addr); eigrp_nbr_lookup_by_addr_process(struct eigrp *eigrp, struct in_addr addr);
extern void eigrp_nbr_hard_restart(struct eigrp_neighbor *nbr, struct vty *vty); extern void eigrp_nbr_hard_restart(struct eigrp_neighbor *nbr, struct vty *vty);
extern int eigrp_nbr_split_horizon_check(struct eigrp_nexthop_entry *ne, extern int eigrp_nbr_split_horizon_check(struct eigrp_nexthop_entry *ne,