summaryrefslogtreecommitdiff
path: root/lib/nexthop.c
diff options
context:
space:
mode:
authorMark Stapp <mjs@voltanet.io>2019-12-11 11:02:15 -0500
committerGitHub <noreply@github.com>2019-12-11 11:02:15 -0500
commitc81c2303e631a8ccd80229621265baef716ea778 (patch)
tree16da85304572827fefadd14b32b6acbf466923df /lib/nexthop.c
parent9880c0f3ae2706de0bc07c10133b0c37b14feea5 (diff)
parent597371a615b9f062642dfd97b4d81c05e7a9bd55 (diff)
Merge pull request #5497 from donaldsharp/unequality_ecmp
Unequality ecmp
Diffstat (limited to 'lib/nexthop.c')
-rw-r--r--lib/nexthop.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/nexthop.c b/lib/nexthop.c
index ce8034846f..718cda7355 100644
--- a/lib/nexthop.c
+++ b/lib/nexthop.c
@@ -118,6 +118,12 @@ static int _nexthop_cmp_no_labels(const struct nexthop *next1,
if (next1->type > next2->type)
return 1;
+ if (next1->weight < next2->weight)
+ return -1;
+
+ if (next1->weight > next2->weight)
+ return 1;
+
switch (next1->type) {
case NEXTHOP_TYPE_IPV4:
case NEXTHOP_TYPE_IPV6:
@@ -550,6 +556,7 @@ void nexthop_copy(struct nexthop *copy, const struct nexthop *nexthop,
copy->ifindex = nexthop->ifindex;
copy->type = nexthop->type;
copy->flags = nexthop->flags;
+ copy->weight = nexthop->weight;
memcpy(&copy->gate, &nexthop->gate, sizeof(nexthop->gate));
memcpy(&copy->src, &nexthop->src, sizeof(nexthop->src));
memcpy(&copy->rmap_src, &nexthop->rmap_src, sizeof(nexthop->rmap_src));