diff options
Diffstat (limited to 'lib/nexthop.c')
| -rw-r--r-- | lib/nexthop.c | 52 |
1 files changed, 4 insertions, 48 deletions
diff --git a/lib/nexthop.c b/lib/nexthop.c index a094c0e38d..cee34e85c7 100644 --- a/lib/nexthop.c +++ b/lib/nexthop.c @@ -71,18 +71,16 @@ int nexthop_same_no_recurse(const struct nexthop *next1, return 1; } -int -nexthop_same_firsthop (struct nexthop *next1, struct nexthop *next2) +int nexthop_same_firsthop(struct nexthop *next1, struct nexthop *next2) { int type1 = NEXTHOP_FIRSTHOPTYPE(next1->type); int type2 = NEXTHOP_FIRSTHOPTYPE(next2->type); if (type1 != type2) return 0; - switch (type1) - { + switch (type1) { case NEXTHOP_TYPE_IPV4_IFINDEX: - if (! IPV4_ADDR_SAME (&next1->gate.ipv4, &next2->gate.ipv4)) + if (!IPV4_ADDR_SAME(&next1->gate.ipv4, &next2->gate.ipv4)) return 0; if (next1->ifindex != next2->ifindex) return 0; @@ -92,7 +90,7 @@ nexthop_same_firsthop (struct nexthop *next1, struct nexthop *next2) return 0; break; case NEXTHOP_TYPE_IPV6_IFINDEX: - if (! IPV6_ADDR_SAME (&next1->gate.ipv6, &next2->gate.ipv6)) + if (!IPV6_ADDR_SAME(&next1->gate.ipv6, &next2->gate.ipv6)) return 0; if (next1->ifindex != next2->ifindex) return 0; @@ -145,48 +143,6 @@ struct nexthop *nexthop_new(void) return XCALLOC(MTYPE_NEXTHOP, sizeof(struct nexthop)); } -/* Add nexthop to the end of a nexthop list. */ -void nexthop_add(struct nexthop **target, struct nexthop *nexthop) -{ - struct nexthop *last; - - for (last = *target; last && last->next; last = last->next) - ; - if (last) - last->next = nexthop; - else - *target = nexthop; - nexthop->prev = last; -} - -void copy_nexthops(struct nexthop **tnh, struct nexthop *nh, - struct nexthop *rparent) -{ - struct nexthop *nexthop; - struct nexthop *nh1; - - for (nh1 = nh; nh1; nh1 = nh1->next) { - nexthop = nexthop_new(); - nexthop->vrf_id = nh1->vrf_id; - nexthop->ifindex = nh1->ifindex; - nexthop->type = nh1->type; - nexthop->flags = nh1->flags; - memcpy(&nexthop->gate, &nh1->gate, sizeof(nh1->gate)); - memcpy(&nexthop->src, &nh1->src, sizeof(nh1->src)); - memcpy(&nexthop->rmap_src, &nh1->rmap_src, sizeof(nh1->rmap_src)); - nexthop->rparent = rparent; - if (nh1->nh_label) - nexthop_add_labels(nexthop, nh1->nh_label_type, - nh1->nh_label->num_labels, - &nh1->nh_label->label[0]); - nexthop_add(tnh, nexthop); - - if (CHECK_FLAG(nh1->flags, NEXTHOP_FLAG_RECURSIVE)) - copy_nexthops(&nexthop->resolved, nh1->resolved, - nexthop); - } -} - /* Free nexthop. */ void nexthop_free(struct nexthop *nexthop) { |
