From: Donald Sharp Date: Sat, 28 Oct 2017 22:45:08 +0000 (-0400) Subject: eigrpd: Fix an issue found with metric change X-Git-Tag: frr-4.0-dev~177^2~4 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=377f30c31fa07db75b316088bcd172d3e1182eaf;p=matthieu%2Ffrr.git eigrpd: Fix an issue found with metric change A past commit modified the change value to an enum but did not bother to fix all the places where change was used. Fix this. Additionally add some more output to the fsm prefix string about the change. Signed-off-by: Donald Sharp --- diff --git a/eigrpd/eigrp_fsm.c b/eigrpd/eigrp_fsm.c index 44fdbf7d1b..b4978bc06f 100644 --- a/eigrpd/eigrp_fsm.c +++ b/eigrpd/eigrp_fsm.c @@ -235,6 +235,20 @@ static const char *fsm_state2str(enum eigrp_fsm_events event) return "Unknown"; } + +static const char *change2str(enum metric_change change) +{ + switch (change) { + case METRIC_DECREASE: + return "Decrease"; + case METRIC_SAME: + return "Same"; + case METRIC_INCREASE: + return "Increase"; + } + + return "Unknown"; +} /* * Main function in which are make decisions which event occurred. * msg - argument of type struct eigrp_fsm_action_message contain @@ -267,6 +281,9 @@ static enum eigrp_fsm_events eigrp_get_fsm_event( */ change = eigrp_topology_update_distance(msg); + /* Store for display later */ + msg->change = change; + switch (actual_state) { case EIGRP_FSM_STATE_PASSIVE: { struct eigrp_nexthop_entry *head = @@ -331,7 +348,8 @@ static enum eigrp_fsm_events eigrp_get_fsm_event( zlog_info("All reply received\n"); return EIGRP_FSM_EVENT_LR; } - } else if (msg->packet_type == EIGRP_OPC_UPDATE && change == 1 + } else if (msg->packet_type == EIGRP_OPC_UPDATE + && change == METRIC_INCREASE && (entry->flags & EIGRP_NEXTHOP_ENTRY_SUCCESSOR_FLAG)) { return EIGRP_FSM_EVENT_DINC; @@ -376,7 +394,8 @@ static enum eigrp_fsm_events eigrp_get_fsm_event( zlog_info("All reply received\n"); return EIGRP_FSM_EVENT_LR; } - } else if (msg->packet_type == EIGRP_OPC_UPDATE && change == 1 + } else if (msg->packet_type == EIGRP_OPC_UPDATE + && change == METRIC_INCREASE && (entry->flags & EIGRP_NEXTHOP_ENTRY_SUCCESSOR_FLAG)) { return EIGRP_FSM_EVENT_DINC; @@ -398,12 +417,13 @@ int eigrp_fsm_event(struct eigrp_fsm_action_message *msg) { enum eigrp_fsm_events event = eigrp_get_fsm_event(msg); - zlog_info("EIGRP AS: %d State: %s Event: %s Network: %s Packet Type: %s Reply RIJ Count: %d", + zlog_info("EIGRP AS: %d State: %s Event: %s Network: %s Packet Type: %s Reply RIJ Count: %d change: %s", msg->eigrp->AS, prefix_state2str(msg->prefix->state), fsm_state2str(event), eigrp_topology_ip_string(msg->prefix), packet_type2str(msg->packet_type), - msg->prefix->rij->count); + msg->prefix->rij->count, + change2str(msg->change)); (*(NSM[msg->prefix->state][event].func))(msg); return 1; diff --git a/eigrpd/eigrp_structs.h b/eigrpd/eigrp_structs.h index 324181c21e..aae56c8ffe 100644 --- a/eigrpd/eigrp_structs.h +++ b/eigrpd/eigrp_structs.h @@ -499,6 +499,7 @@ struct eigrp_fsm_action_message { struct eigrp_prefix_entry *prefix; msg_data_t data_type; // internal or external tlv type struct eigrp_metrics metrics; + enum metric_change change; }; #endif /* _ZEBRA_EIGRP_STRUCTURES_H_ */