git: b18da5008e97 - stable/13 - net/if_dl.h: make self-contained
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 07 May 2025 21:07:30 UTC
The branch stable/13 has been updated by ivy:
URL: https://cgit.FreeBSD.org/src/commit/?id=b18da5008e97446db7238bcfa310d2c576e5e52f
commit b18da5008e97446db7238bcfa310d2c576e5e52f
Author: Lexi Winter <ivy@FreeBSD.org>
AuthorDate: 2025-05-06 10:20:44 +0000
Commit: Lexi Winter <ivy@FreeBSD.org>
CommitDate: 2025-05-07 21:01:28 +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..ee9ace3803f0 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