zebra: use copy_nexthops in route_entry_copy_nexthops

Signed-off-by: Christian Franke <chris@opensourcerouting.org>
This commit is contained in:
Christian Franke 2017-07-12 18:28:05 +02:00
parent 8fad3ca3a0
commit 8050720788
3 changed files with 6 additions and 22 deletions

View File

@ -552,10 +552,7 @@ zebra_add_import_table_entry (struct route_node *rn, struct route_entry *re, con
newre->nexthop_num = 0;
newre->uptime = time(NULL);
newre->instance = re->table;
/* Assuming these routes are never recursive */
for (nhop = re->nexthop; nhop; nhop = nhop->next)
route_entry_copy_nexthops(newre, nhop);
route_entry_copy_nexthops(newre, re->nexthop);
rib_add_multipath(AFI_IP, SAFI_UNICAST, &p, NULL, newre);
}

View File

@ -198,21 +198,10 @@ route_entry_nexthop_add (struct route_entry *re, struct nexthop *nexthop)
void
route_entry_copy_nexthops (struct route_entry *re, struct nexthop *nh)
{
struct nexthop *nexthop;
nexthop = nexthop_new();
nexthop->flags = nh->flags;
nexthop->type = nh->type;
nexthop->ifindex = nh->ifindex;
memcpy(&(nexthop->gate), &(nh->gate), sizeof(union g_addr));
memcpy(&(nexthop->src), &(nh->src), sizeof(union g_addr));
if (nh->nh_label)
nexthop_add_labels (nexthop, nh->nh_label_type, nh->nh_label->num_labels,
&nh->nh_label->label[0]);
nexthop->rparent = NULL;
route_entry_nexthop_add(re, nexthop);
if (CHECK_FLAG(nh->flags, NEXTHOP_FLAG_RECURSIVE))
copy_nexthops(&nexthop->resolved, nh->resolved, nexthop);
assert(!re->nexthop);
copy_nexthops(&re->nexthop, nh, NULL);
for (struct nexthop *nexthop = nh; nh; nh = nh->next)
re->nexthop_num++;
}
/* Delete specified nexthop from the list. */

View File

@ -830,7 +830,6 @@ static void
copy_state (struct rnh *rnh, struct route_entry *re, struct route_node *rn)
{
struct route_entry *state;
struct nexthop *nh;
if (rnh->state)
{
@ -845,8 +844,7 @@ copy_state (struct rnh *rnh, struct route_entry *re, struct route_node *rn)
state->type = re->type;
state->metric = re->metric;
for (nh = re->nexthop; nh; nh = nh->next)
route_entry_copy_nexthops(state, nh);
route_entry_copy_nexthops(state, re->nexthop);
rnh->state = state;
}