]> git.proxmox.com Git - mirror_frr.git/commitdiff
zebra: resolve issue with importing table entries correctly
authorDon Slice <dslice@cumulusnetworks.com>
Wed, 4 Oct 2017 13:41:49 +0000 (06:41 -0700)
committerDon Slice <dslice@cumulusnetworks.com>
Thu, 5 Oct 2017 16:08:46 +0000 (16:08 +0000)
Problem reported when a table entry originated by rdnbrd was moved from one
interface to another on the same switch.  Both would be deleted, leaving
no imported entry in the table.  Modified zebra_add_import_table_entry to
used rib_add_multipath as well as correct the call to delete a duplicate
entry to include the nexthop associated with the route_entry.

Ticket: CM-18154
Signed-off-by: Don Slice <dslice@cumulusnetworks.com>
Reviewed By: CCR-6731
Testing Done: Manual testing successful, deb given to submitter, bgp-smoke
had no new failures

zebra/redistribute.c

index 890ad887daca4af4f7685fc86d6b22c9451db2c1..cc679142f7ec0dc65d9f2586496c45106a947767 100644 (file)
@@ -519,32 +519,20 @@ int zebra_add_import_table_entry(struct route_node *rn, struct route_entry *re,
        if (same)
                zebra_del_import_table_entry(rn, same);
 
-       if (re->nexthop_num == 1) {
-               rib_add(afi, SAFI_UNICAST, re->vrf_id,
-                       ZEBRA_ROUTE_TABLE, re->table, 0, &p,
-                       NULL, re->nexthop,
-                       zebrad.rtm_table_default, re->metric,
-                       re->mtu,
-                       zebra_import_table_distance[afi]
-                       [re->table]);
-       } else if (re->nexthop_num > 1) {
-               newre = XCALLOC(MTYPE_RE,
-                               sizeof(struct route_entry));
-               newre->type = ZEBRA_ROUTE_TABLE;
-               newre->distance =
-                       zebra_import_table_distance[afi][re->table];
-               newre->flags = re->flags;
-               newre->metric = re->metric;
-               newre->mtu = re->mtu;
-               newre->table = zebrad.rtm_table_default;
-               newre->nexthop_num = 0;
-               newre->uptime = time(NULL);
-               newre->instance = re->table;
-               route_entry_copy_nexthops(newre, re->nexthop);
-
-               rib_add_multipath(afi, SAFI_UNICAST, &p,
-                                 NULL, newre);
-       }
+       newre = XCALLOC(MTYPE_RE,sizeof(struct route_entry));
+       newre->type = ZEBRA_ROUTE_TABLE;
+       newre->distance = zebra_import_table_distance[afi][re->table];
+       newre->flags = re->flags;
+       newre->metric = re->metric;
+       newre->mtu = re->mtu;
+       newre->table = zebrad.rtm_table_default;
+       newre->nexthop_num = 0;
+       newre->uptime = time(NULL);
+       newre->instance = re->table;
+       route_entry_copy_nexthops(newre, re->nexthop);
+
+       rib_add_multipath(afi, SAFI_UNICAST, &p, NULL, newre);
+
        return 0;
 }
 
@@ -557,7 +545,7 @@ int zebra_del_import_table_entry(struct route_node *rn, struct route_entry *re)
        prefix_copy(&p, &rn->p);
 
        rib_delete(afi, SAFI_UNICAST, re->vrf_id, ZEBRA_ROUTE_TABLE,
-                  re->table, re->flags, &p, NULL, NULL,
+                  re->table, re->flags, &p, NULL, re->nexthop,
                   zebrad.rtm_table_default, re->metric, false);
 
        return 0;