git: 4b0b2b5650ed - stable/14 - net/if_dl.h: make self-contained

From: Lexi Winter <ivy_at_FreeBSD.org>
Date: Wed, 07 May 2025 21:07:49 UTC
The branch stable/14 has been updated by ivy:

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

commit 4b0b2b5650ed2edeac00d3c6d1e1b402914ff032
Author:     Lexi Winter <ivy@FreeBSD.org>
AuthorDate: 2025-05-06 10:20:44 +0000
Commit:     Lexi Winter <ivy@FreeBSD.org>
CommitDate: 2025-05-07 19:20:44 +0000

    net/if_dl.h: make self-contained
    
    include <sys/_types.h> for u_char and u_short.
    
    to avoid including <sys/types.h>, remove the caddr_t cast from LLADDR.
    we are trying to get rid of caddr_t anyway, and since sdl_data is
    already an array of char, the cast is unnecessary.  this also makes
    LLADDR const-correct, i.e. passing a const sockaddr_dl will return a
    const pointer.
    
    Reviewed by:    des
    Approved by:    des (mentor)
    Differential Revision:  https://reviews.freebsd.org/D50065
    
    (cherry picked from commit 70b5c918571b6c79459ee6de66ceb4c83974d542)
---
 sys/net/if_dl.h | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/sys/net/if_dl.h b/sys/net/if_dl.h
index 035a3346dc08..31579efdeda4 100644
--- a/sys/net/if_dl.h
+++ b/sys/net/if_dl.h
@@ -34,6 +34,8 @@
 #ifndef _NET_IF_DL_H_
 #define _NET_IF_DL_H_
 
+#include <sys/_types.h>
+
 /*
  * A Link-Level Sockaddr may specify the interface in one of two
  * ways: either by means of a system-provided index number (computed
@@ -67,8 +69,8 @@ struct sockaddr_dl {
 				   contains both if name and ll address */
 };
 
-#define LLADDR(s) ((caddr_t)((s)->sdl_data + (s)->sdl_nlen))
-#define CLLADDR(s) ((c_caddr_t)((s)->sdl_data + (s)->sdl_nlen))
+#define LLADDR(s) (&(s)->sdl_data[(s)->sdl_nlen])
+#define CLLADDR(s) ((const char *)LLADDR(s))
 #define LLINDEX(s) ((s)->sdl_index)
 
 #ifdef _KERNEL