diff options
| author | Donald Sharp <sharpd@nvidia.com> | 2024-10-30 10:15:42 -0400 |
|---|---|---|
| committer | Donald Sharp <sharpd@nvidia.com> | 2024-10-31 10:04:19 -0400 |
| commit | 7ebda3892c446154e10dc13ea488e4e2ebd40d21 (patch) | |
| tree | c63b97cfe16a6f9e11f23769a90ca696867663e9 /lib/sockunion.c | |
| parent | 35dbbacc3b7fb31f095a2382af3ef469f417dc19 (diff) | |
lib: Replace usage of in6addr_cmp with memcmp
memcmp will return and act exactly the same as in6addr_cmp
but it does it significantly faster than how in6addr_cmp
does it. Let this be a lesson for implementing something
that is a duplicate of what is provided by the c library.
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
Diffstat (limited to 'lib/sockunion.c')
| -rw-r--r-- | lib/sockunion.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/sockunion.c b/lib/sockunion.c index c37ab1d6dd..1b08a06e93 100644 --- a/lib/sockunion.c +++ b/lib/sockunion.c @@ -621,7 +621,8 @@ int sockunion_cmp(const union sockunion *su1, const union sockunion *su2) return -1; } if (su1->sa.sa_family == AF_INET6) - return in6addr_cmp(&su1->sin6.sin6_addr, &su2->sin6.sin6_addr); + return IN6_ADDR_CMP(&su1->sin6.sin6_addr, &su2->sin6.sin6_addr); + return 0; } |
