]> git.puffer.fish Git - mirror/frr.git/commitdiff
lib: Replace usage of in6addr_cmp with memcmp
authorDonald Sharp <sharpd@nvidia.com>
Wed, 30 Oct 2024 14:15:42 +0000 (10:15 -0400)
committerDonald Sharp <sharpd@nvidia.com>
Thu, 31 Oct 2024 14:04:19 +0000 (10:04 -0400)
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>
lib/sockunion.c

index c37ab1d6dd5316f6a73ffa802c238062e4e4ddbf..1b08a06e9362fcedd4db2ae6eaef959510839d9d 100644 (file)
@@ -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;
 }