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)
This commit is contained in:
Lexi Winter 2025-05-06 11:20:44 +01:00 committed by Franco Fichtner
parent 8f5c1ee027
commit 7b4478faed

View File

@ -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