eigrpd: Fix distance comparison

The distance comparison for when we received an
internal and we already had an internal was
overriding the metrics of the connected.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
This commit is contained in:
Donald Sharp 2017-08-24 07:34:21 -04:00
parent 4a64eed577
commit 532e75e6ee

View File

@ -379,6 +379,10 @@ enum metric_change eigrp_topology_update_distance(struct eigrp_fsm_action_messag
change = METRIC_DECREASE; change = METRIC_DECREASE;
break; break;
case EIGRP_INT: case EIGRP_INT:
if (prefix->nt == EIGRP_TOPOLOGY_TYPE_CONNECTED) {
change = METRIC_INCREASE;
goto distance_done;
}
if (eigrp_metrics_is_same(msg->metrics, if (eigrp_metrics_is_same(msg->metrics,
entry->reported_metric)) { entry->reported_metric)) {
return change; // No change return change; // No change
@ -387,9 +391,10 @@ enum metric_change eigrp_topology_update_distance(struct eigrp_fsm_action_messag
new_reported_distance = eigrp_calculate_metrics(eigrp, new_reported_distance = eigrp_calculate_metrics(eigrp,
msg->metrics); msg->metrics);
if (entry->reported_distance < new_reported_distance) if (entry->reported_distance < new_reported_distance) {
change = METRIC_INCREASE; change = METRIC_INCREASE;
else goto distance_done;
} else
change = METRIC_DECREASE; change = METRIC_DECREASE;
entry->reported_metric = msg->metrics; entry->reported_metric = msg->metrics;
@ -404,12 +409,14 @@ enum metric_change eigrp_topology_update_distance(struct eigrp_fsm_action_messag
return change; return change;
} else { } else {
change = METRIC_INCREASE; change = METRIC_INCREASE;
goto distance_done;
} }
break; break;
default: default:
zlog_err("%s: Please implement handler", __PRETTY_FUNCTION__); zlog_err("%s: Please implement handler", __PRETTY_FUNCTION__);
break; break;
} }
distance_done:
/* /*
* Move to correct position in list according to new distance * Move to correct position in list according to new distance
*/ */