summaryrefslogtreecommitdiffstats
path: root/eigrpd
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2017-10-29 00:45:08 +0200
committerDonald Sharp <sharpd@cumulusnetworks.com>2017-10-29 00:45:08 +0200
commit377f30c31fa07db75b316088bcd172d3e1182eaf (patch)
tree48f1540bc7214b581df12d553461b947cb43b549 /eigrpd
parenteigrpd: Add ability to show packet type in log (diff)
downloadfrr-377f30c31fa07db75b316088bcd172d3e1182eaf.tar.xz
frr-377f30c31fa07db75b316088bcd172d3e1182eaf.zip
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 <sharpd@cumulusnetworks.com>
Diffstat (limited to 'eigrpd')
-rw-r--r--eigrpd/eigrp_fsm.c28
-rw-r--r--eigrpd/eigrp_structs.h1
2 files changed, 25 insertions, 4 deletions
diff --git a/eigrpd/eigrp_fsm.c b/eigrpd/eigrp_fsm.c
index 44fdbf7d1..b4978bc06 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 324181c21..aae56c8ff 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_ */