Merge pull request #5622 from qlyoung/fix-iface-ifindex-compare

lib: fix ifindex comparison overflow
This commit is contained in:
Mark Stapp 2020-01-06 14:04:33 -05:00 committed by GitHub
commit 1fa69569c6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -137,7 +137,12 @@ static int if_cmp_func(const struct interface *ifp1,
static int if_cmp_index_func(const struct interface *ifp1, static int if_cmp_index_func(const struct interface *ifp1,
const struct interface *ifp2) 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) static void ifp_connected_free(void *arg)