linux(4): Assert that the FreeBSD size of struct sockaddr is equal to Linux

Our code depends on the fact that the size of struct sockaddr and
the size of sa_data is equal between FreeBSD and Linux.
This commit is contained in:
Dmitry Chagin 2023-03-04 12:11:39 +03:00
parent 9883961ed5
commit 945a7f0d21

View File

@ -57,6 +57,10 @@ __FBSDID("$FreeBSD$");
#include <compat/linux/linux_util.h>
_Static_assert(LINUX_IFNAMSIZ == IFNAMSIZ, "Linux IFNAMSIZ");
_Static_assert(sizeof(struct sockaddr) == sizeof(struct l_sockaddr),
"Linux struct sockaddr size");
_Static_assert(offsetof(struct sockaddr, sa_data) ==
offsetof(struct l_sockaddr, sa_data), "Linux struct sockaddr layout");
static bool use_real_ifnames = false;
SYSCTL_BOOL(_compat_linux, OID_AUTO, use_real_ifnames, CTLFLAG_RWTUN,