diff options
| author | Mark Stapp <mjs@voltanet.io> | 2020-01-06 14:04:33 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-01-06 14:04:33 -0500 |
| commit | 1fa69569c654a96b39238df24c475bf25a94bf81 (patch) | |
| tree | d1ac1000a1f41deec2a4d7949a886bf43c40a846 /lib/if.c | |
| parent | e2efe03a3ee08d6af2a0f5cc08148e7cea44d878 (diff) | |
| parent | e33d7b6a0365b7d1c5708dd4015ae662f64bc104 (diff) | |
Merge pull request #5622 from qlyoung/fix-iface-ifindex-compare
lib: fix ifindex comparison overflow
Diffstat (limited to 'lib/if.c')
| -rw-r--r-- | lib/if.c | 7 |
1 files changed, 6 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) |
