Modify EIGRP code to pass its used metric down to zebra.
Additionally update topotests to pass with these changes.
Fixes: #3703
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
listnode_add_sort(node->entries, entry);
entry->prefix = node;
- eigrp_zebra_route_add(node->destination, l);
+ eigrp_zebra_route_add(node->destination, l, node->fdistance);
}
list_delete(&l);
successors = eigrp_topology_get_successor_max(prefix, eigrp->max_paths);
if (successors) {
- eigrp_zebra_route_add(prefix->destination, successors);
+ eigrp_zebra_route_add(prefix->destination, successors,
+ prefix->fdistance);
for (ALL_LIST_ELEMENTS_RO(successors, node, entry))
entry->flags |= EIGRP_NEXTHOP_ENTRY_INTABLE_FLAG;
return if_lookup_by_name(ifname_tmp, VRF_DEFAULT);
}
-void eigrp_zebra_route_add(struct prefix *p, struct list *successors)
+void eigrp_zebra_route_add(struct prefix *p, struct list *successors,
+ uint32_t distance)
{
struct zapi_route api;
struct zapi_nexthop *api_nh;
api.vrf_id = VRF_DEFAULT;
api.type = ZEBRA_ROUTE_EIGRP;
api.safi = SAFI_UNICAST;
+ api.metric = distance;
memcpy(&api.prefix, p, sizeof(*p));
SET_FLAG(api.message, ZAPI_MESSAGE_NEXTHOP);
+ SET_FLAG(api.message, ZAPI_MESSAGE_METRIC);
/* Nexthop, ifindex, distance and metric information. */
for (ALL_LIST_ELEMENTS_RO(successors, node, te)) {
extern void eigrp_zebra_init(void);
-extern void eigrp_zebra_route_add(struct prefix *, struct list *);
+extern void eigrp_zebra_route_add(struct prefix *, struct list *,
+ uint32_t distance);
extern void eigrp_zebra_route_delete(struct prefix *);
extern int eigrp_redistribute_set(struct eigrp *, int, struct eigrp_metrics);
extern int eigrp_redistribute_unset(struct eigrp *, int);
{
"prefix":"192.168.1.0/24",
"protocol":"eigrp",
- "metric":0,
+ "metric":28160,
"nexthops":[
{
"directlyConnected":true,
"prefix":"192.168.3.0/24",
"protocol":"eigrp",
"selected":true,
- "metric":0,
+ "metric":33280,
"nexthops":[
{
"fib":true,
{
"prefix":"193.1.1.0/26",
"protocol":"eigrp",
- "metric":0,
+ "metric":28160,
"nexthops":[
{
"directlyConnected":true,
"prefix":"193.1.2.0/24",
"protocol":"eigrp",
"selected":true,
- "metric":0,
+ "metric":30720,
"nexthops":[
{
"fib":true,
"prefix":"192.168.1.0/24",
"protocol":"eigrp",
"selected":true,
- "metric":0,
+ "metric":30720,
"nexthops":[
{
"fib":true,
"prefix":"192.168.3.0/24",
"protocol":"eigrp",
"selected":true,
- "metric":0,
+ "metric":30720,
"nexthops":[
{
"fib":true,
{
"prefix":"193.1.1.0/26",
"protocol":"eigrp",
- "metric":0,
+ "metric":28160,
"nexthops":[
{
"directlyConnected":true,
{
"prefix":"193.1.2.0/24",
"protocol":"eigrp",
- "metric":0,
+ "metric":28160,
"nexthops":[
{
"directlyConnected":true,
"prefix":"192.168.1.0/24",
"protocol":"eigrp",
"selected":true,
- "metric":0,
+ "metric":33280,
"nexthops":[
{
"fib":true,
{
"prefix":"192.168.3.0/24",
"protocol":"eigrp",
- "metric":0,
+ "metric":28160,
"nexthops":[
{
"directlyConnected":true,
"prefix":"193.1.1.0/26",
"protocol":"eigrp",
"selected":true,
- "metric":0,
+ "metric":30720,
"nexthops":[
{
"fib":true,
{
"prefix":"193.1.2.0/24",
"protocol":"eigrp",
- "metric":0,
+ "metric":28160,
"nexthops":[
{
"directlyConnected":true,
assertmsg = '"show ip eigrp topo" mismatches on {}'.format(router.name)
assert topotest.json_cmp(actual, expected) is None, assertmsg
-
def test_zebra_ipv4_routingTable():
"Test 'show ip route'"