From 5c4b6e577c33432b1e1eb9b2f30231a555111f0b Mon Sep 17 00:00:00 2001 From: Don Slice Date: Wed, 4 Oct 2017 06:41:49 -0700 Subject: zebra: resolve issue with importing table entries correctly 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 Reviewed By: CCR-6731 Testing Done: Manual testing successful, deb given to submitter, bgp-smoke had no new failures --- zebra/redistribute.c | 42 +++++++++++++++--------------------------- 1 file changed, 15 insertions(+), 27 deletions(-) (limited to 'zebra/redistribute.c') diff --git a/zebra/redistribute.c b/zebra/redistribute.c index 890ad887d..cc679142f 100644 --- a/zebra/redistribute.c +++ b/zebra/redistribute.c @@ -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; -- cgit v1.2.3