git: d3f035f8d96a - main - ifnet: make sa_dl_equal() a static function

From: Gleb Smirnoff <glebius_at_FreeBSD.org>
Date: Mon, 09 Dec 2024 16:19:26 UTC
The branch main has been updated by glebius:

URL: https://cgit.FreeBSD.org/src/commit/?id=d3f035f8d96ae0e1c49ab725aa9d86be63d293d6

commit d3f035f8d96ae0e1c49ab725aa9d86be63d293d6
Author:     Gleb Smirnoff <glebius@FreeBSD.org>
AuthorDate: 2024-12-09 16:18:56 +0000
Commit:     Gleb Smirnoff <glebius@FreeBSD.org>
CommitDate: 2024-12-09 16:18:56 +0000

    ifnet: make sa_dl_equal() a static function
    
    No functional change.  Also clears last use of CLLADDR() macro.
---
 sys/net/if.c    | 15 +++++++++------
 sys/net/if_dl.h |  1 -
 2 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/sys/net/if.c b/sys/net/if.c
index 8dc212ae4ac7..25cad0222c06 100644
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -1799,13 +1799,16 @@ ifa_free(struct ifaddr *ifa)
  * structs used to represent other address families, it is necessary
  * to perform a different comparison.
  */
+static bool
+sa_dl_equal(const struct sockaddr *a, const struct sockaddr *b)
+{
+	const struct sockaddr_dl *sdl1 = (const struct sockaddr_dl *)a;
+	const struct sockaddr_dl *sdl2 = (const struct sockaddr_dl *)b;
 
-#define	sa_dl_equal(a1, a2)	\
-	((((const struct sockaddr_dl *)(a1))->sdl_len ==		\
-	 ((const struct sockaddr_dl *)(a2))->sdl_len) &&		\
-	 (bcmp(CLLADDR((const struct sockaddr_dl *)(a1)),		\
-	       CLLADDR((const struct sockaddr_dl *)(a2)),		\
-	       ((const struct sockaddr_dl *)(a1))->sdl_alen) == 0))
+	return (sdl1->sdl_len == sdl2->sdl_len &&
+	    bcmp(sdl1->sdl_data + sdl1->sdl_nlen,
+	    sdl2->sdl_data + sdl2->sdl_nlen, sdl1->sdl_alen) == 0);
+}
 
 /*
  * Locate an interface based on a complete address.
diff --git a/sys/net/if_dl.h b/sys/net/if_dl.h
index e19f4a84a7c1..77663c2a20d7 100644
--- a/sys/net/if_dl.h
+++ b/sys/net/if_dl.h
@@ -66,7 +66,6 @@ struct sockaddr_dl {
 };
 
 #define LLADDR(s) ((caddr_t)((s)->sdl_data + (s)->sdl_nlen))
-#define CLLADDR(s) ((c_caddr_t)((s)->sdl_data + (s)->sdl_nlen))
 #define LLINDEX(s) ((s)->sdl_index)
 
 struct ifnet;