Merge pull request #838 from dwalton76/lib-copy-nexthops

lib: copy_nexthops() only copies the first nexthop
This commit is contained in:
David Lamparter 2017-07-25 16:20:08 +02:00 committed by GitHub
commit 4ff218ac39

View File

@ -133,17 +133,17 @@ void copy_nexthops(struct nexthop **tnh, struct nexthop *nh,
for (nh1 = nh; nh1; nh1 = nh1->next) { for (nh1 = nh; nh1; nh1 = nh1->next) {
nexthop = nexthop_new(); nexthop = nexthop_new();
nexthop->ifindex = nh->ifindex; nexthop->ifindex = nh1->ifindex;
nexthop->type = nh->type; nexthop->type = nh1->type;
nexthop->flags = nh->flags; nexthop->flags = nh1->flags;
memcpy(&nexthop->gate, &nh->gate, sizeof(nh->gate)); memcpy(&nexthop->gate, &nh1->gate, sizeof(nh1->gate));
memcpy(&nexthop->src, &nh->src, sizeof(nh->src)); memcpy(&nexthop->src, &nh1->src, sizeof(nh1->src));
memcpy(&nexthop->rmap_src, &nh->rmap_src, sizeof(nh->rmap_src)); memcpy(&nexthop->rmap_src, &nh1->rmap_src, sizeof(nh1->rmap_src));
nexthop->rparent = rparent; nexthop->rparent = rparent;
if (nh->nh_label) if (nh1->nh_label)
nexthop_add_labels(nexthop, nh->nh_label_type, nexthop_add_labels(nexthop, nh1->nh_label_type,
nh->nh_label->num_labels, nh1->nh_label->num_labels,
&nh->nh_label->label[0]); &nh1->nh_label->label[0]);
nexthop_add(tnh, nexthop); nexthop_add(tnh, nexthop);
if (CHECK_FLAG(nh1->flags, NEXTHOP_FLAG_RECURSIVE)) if (CHECK_FLAG(nh1->flags, NEXTHOP_FLAG_RECURSIVE))