git: 70b5c918571b - main - net/if_dl.h: make self-contained
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 06 May 2025 11:10:40 UTC
The branch main has been updated by ivy:
URL: https://cgit.FreeBSD.org/src/commit/?id=70b5c918571b6c79459ee6de66ceb4c83974d542
commit 70b5c918571b6c79459ee6de66ceb4c83974d542
Author: Lexi Winter <ivy@FreeBSD.org>
AuthorDate: 2025-05-06 10:20:44 +0000
Commit: Lexi Winter <ivy@FreeBSD.org>
CommitDate: 2025-05-06 10: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
---
sys/net/if_dl.h | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/sys/net/if_dl.h b/sys/net/if_dl.h
index e57cdade9e59..f8c7c2f75956 100644
--- a/sys/net/if_dl.h
+++ b/sys/net/if_dl.h
@@ -32,6 +32,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
@@ -65,7 +67,7 @@ struct sockaddr_dl {
contains both if name and ll address */
};
-#define LLADDR(s) ((caddr_t)((s)->sdl_data + (s)->sdl_nlen))
+#define LLADDR(s) (&(s)->sdl_data[(s)->sdl_nlen])
#define LLINDEX(s) ((s)->sdl_index)
#ifdef _KERNEL