mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-17 21:38:11 +00:00
zebra: use copy_nexthops in route_entry_copy_nexthops
Signed-off-by: Christian Franke <chris@opensourcerouting.org>
This commit is contained in:
parent
8fad3ca3a0
commit
8050720788
@ -552,10 +552,7 @@ zebra_add_import_table_entry (struct route_node *rn, struct route_entry *re, con
|
|||||||
newre->nexthop_num = 0;
|
newre->nexthop_num = 0;
|
||||||
newre->uptime = time(NULL);
|
newre->uptime = time(NULL);
|
||||||
newre->instance = re->table;
|
newre->instance = re->table;
|
||||||
|
route_entry_copy_nexthops(newre, re->nexthop);
|
||||||
/* Assuming these routes are never recursive */
|
|
||||||
for (nhop = re->nexthop; nhop; nhop = nhop->next)
|
|
||||||
route_entry_copy_nexthops(newre, nhop);
|
|
||||||
|
|
||||||
rib_add_multipath(AFI_IP, SAFI_UNICAST, &p, NULL, newre);
|
rib_add_multipath(AFI_IP, SAFI_UNICAST, &p, NULL, newre);
|
||||||
}
|
}
|
||||||
|
@ -198,21 +198,10 @@ route_entry_nexthop_add (struct route_entry *re, struct nexthop *nexthop)
|
|||||||
void
|
void
|
||||||
route_entry_copy_nexthops (struct route_entry *re, struct nexthop *nh)
|
route_entry_copy_nexthops (struct route_entry *re, struct nexthop *nh)
|
||||||
{
|
{
|
||||||
struct nexthop *nexthop;
|
assert(!re->nexthop);
|
||||||
|
copy_nexthops(&re->nexthop, nh, NULL);
|
||||||
nexthop = nexthop_new();
|
for (struct nexthop *nexthop = nh; nh; nh = nh->next)
|
||||||
nexthop->flags = nh->flags;
|
re->nexthop_num++;
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Delete specified nexthop from the list. */
|
/* Delete specified nexthop from the list. */
|
||||||
|
@ -830,7 +830,6 @@ static void
|
|||||||
copy_state (struct rnh *rnh, struct route_entry *re, struct route_node *rn)
|
copy_state (struct rnh *rnh, struct route_entry *re, struct route_node *rn)
|
||||||
{
|
{
|
||||||
struct route_entry *state;
|
struct route_entry *state;
|
||||||
struct nexthop *nh;
|
|
||||||
|
|
||||||
if (rnh->state)
|
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->type = re->type;
|
||||||
state->metric = re->metric;
|
state->metric = re->metric;
|
||||||
|
|
||||||
for (nh = re->nexthop; nh; nh = nh->next)
|
route_entry_copy_nexthops(state, re->nexthop);
|
||||||
route_entry_copy_nexthops(state, nh);
|
|
||||||
rnh->state = state;
|
rnh->state = state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user