]> git.puffer.fish Git - matthieu/frr.git/commitdiff
eigrpd: Modify code to pass down metric to zebra
authorDonald Sharp <sharpd@cumulusnetworks.com>
Sun, 3 Feb 2019 14:56:20 +0000 (09:56 -0500)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Sun, 3 Feb 2019 22:45:08 +0000 (17:45 -0500)
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>
eigrpd/eigrp_topology.c
eigrpd/eigrp_zebra.c
eigrpd/eigrp_zebra.h
tests/topotests/eigrp-topo1/r1/show_ip_route.json_ref
tests/topotests/eigrp-topo1/r2/show_ip_route.json_ref
tests/topotests/eigrp-topo1/r3/show_ip_route.json_ref
tests/topotests/eigrp-topo1/test_eigrp_topo1.py

index 2d0ebf1bc56b083b56cb4073d2bad2383e5f6e3e..23f5a705eb40cfc02af4230a491aca5b0d55b0a0 100644 (file)
@@ -161,7 +161,7 @@ void eigrp_nexthop_entry_add(struct eigrp_prefix_entry *node,
                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);
@@ -477,7 +477,8 @@ void eigrp_update_routing_table(struct eigrp_prefix_entry *prefix)
        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;
 
index a810e0146851090d6b0cbb9c53ef01919496b694..09d876afaa2c4ddd0e07916f038943b6dacd16ce 100644 (file)
@@ -353,7 +353,8 @@ static struct interface *zebra_interface_if_lookup(struct stream *s)
        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;
@@ -368,9 +369,11 @@ void eigrp_zebra_route_add(struct prefix *p, struct list *successors)
        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)) {
index 1c418dddef61c2f38833c32ef78c7117e58a7a61..86b337cfe685f686c91207e8388bf7a9c297c9f3 100644 (file)
@@ -33,7 +33,8 @@
 
 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);
index 36dd5da5979599ca905598cfab63306775a70cf0..26fa7ca415e1226034fa631190865aef833c4137 100644 (file)
@@ -3,7 +3,7 @@
     {
       "prefix":"192.168.1.0/24",
       "protocol":"eigrp",
-      "metric":0,
+      "metric":28160,
       "nexthops":[
         {
           "directlyConnected":true,
@@ -31,7 +31,7 @@
       "prefix":"192.168.3.0/24",
       "protocol":"eigrp",
       "selected":true,
-      "metric":0,
+      "metric":33280,
       "nexthops":[
         {
           "fib":true,
@@ -47,7 +47,7 @@
     {
       "prefix":"193.1.1.0/26",
       "protocol":"eigrp",
-      "metric":0,
+      "metric":28160,
       "nexthops":[
         {
           "directlyConnected":true,
@@ -75,7 +75,7 @@
       "prefix":"193.1.2.0/24",
       "protocol":"eigrp",
       "selected":true,
-      "metric":0,
+      "metric":30720,
       "nexthops":[
         {
           "fib":true,
index 44903ce3ff6314899b379e91dcae9ac6b8a496d6..71c931b17a6728a11631d1794d4e8b6697fd243e 100644 (file)
@@ -4,7 +4,7 @@
       "prefix":"192.168.1.0/24",
       "protocol":"eigrp",
       "selected":true,
-      "metric":0,
+      "metric":30720,
       "nexthops":[
         {
           "fib":true,
@@ -21,7 +21,7 @@
       "prefix":"192.168.3.0/24",
       "protocol":"eigrp",
       "selected":true,
-      "metric":0,
+      "metric":30720,
       "nexthops":[
         {
           "fib":true,
@@ -37,7 +37,7 @@
     {
       "prefix":"193.1.1.0/26",
       "protocol":"eigrp",
-      "metric":0,
+      "metric":28160,
       "nexthops":[
         {
           "directlyConnected":true,
@@ -64,7 +64,7 @@
     {
       "prefix":"193.1.2.0/24",
       "protocol":"eigrp",
-      "metric":0,
+      "metric":28160,
       "nexthops":[
         {
           "directlyConnected":true,
index d80e1d97e62c7f4b94e357852cc5a3a3ce860b77..5e0b79d8113257ea7093dd03e4ef845b57b7835c 100644 (file)
@@ -4,7 +4,7 @@
       "prefix":"192.168.1.0/24",
       "protocol":"eigrp",
       "selected":true,
-      "metric":0,
+      "metric":33280,
       "nexthops":[
         {
           "fib":true,
@@ -38,7 +38,7 @@
     {
       "prefix":"192.168.3.0/24",
       "protocol":"eigrp",
-      "metric":0,
+      "metric":28160,
       "nexthops":[
         {
           "directlyConnected":true,
@@ -66,7 +66,7 @@
       "prefix":"193.1.1.0/26",
       "protocol":"eigrp",
       "selected":true,
-      "metric":0,
+      "metric":30720,
       "nexthops":[
         {
           "fib":true,
@@ -82,7 +82,7 @@
     {
       "prefix":"193.1.2.0/24",
       "protocol":"eigrp",
-      "metric":0,
+      "metric":28160,
       "nexthops":[
         {
           "directlyConnected":true,
index de8cb81f8ff25720d9a01831f4301b119d2ce568..8ea2f0b506e263c9194ad340855533b9dc535d04 100755 (executable)
@@ -153,7 +153,6 @@ def test_eigrp_routes():
         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'"