diff options
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/if.c | 7 | ||||
| -rw-r--r-- | lib/zclient.c | 11 |
2 files changed, 17 insertions, 1 deletions
@@ -137,7 +137,12 @@ static int if_cmp_func(const struct interface *ifp1, static int if_cmp_index_func(const struct interface *ifp1, const struct interface *ifp2) { - return ifp1->ifindex - ifp2->ifindex; + if (ifp1->ifindex == ifp2->ifindex) + return 0; + else if (ifp1->ifindex > ifp2->ifindex) + return 1; + else + return -1; } static void ifp_connected_free(void *arg) diff --git a/lib/zclient.c b/lib/zclient.c index 6982d287a2..fd1b181e58 100644 --- a/lib/zclient.c +++ b/lib/zclient.c @@ -2679,6 +2679,17 @@ int zapi_labels_decode(struct stream *s, struct zapi_labels *zl) } STREAM_GETW(s, zl->nexthop_num); + + if (zl->nexthop_num > MULTIPATH_NUM) { + flog_warn( + EC_LIB_ZAPI_ENCODE, + "%s: Prefix %pFX has %d nexthops, but we can only use the first %d", + __func__, &zl->route.prefix, zl->nexthop_num, + MULTIPATH_NUM); + } + + zl->nexthop_num = MIN(MULTIPATH_NUM, zl->nexthop_num); + for (int i = 0; i < zl->nexthop_num; i++) { znh = &zl->nexthops[i]; |
