mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-06 17:48:35 +00:00
lib: fix ifindex comparison overflow
Very small (negative!) ifindexes, when subtracted, can overflow. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
This commit is contained in:
parent
b833cc1ff4
commit
e33d7b6a03
7
lib/if.c
7
lib/if.c
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user