File 2213-erts-Add-check-for-field-of-sockaddr_dl.patch of Package erlang
From 0efa8bc41f27013c9a8ee5ad992e39f51684622d Mon Sep 17 00:00:00 2001
From: Micael Karlberg <bmk@erlang.org>
Date: Mon, 4 Apr 2022 16:31:44 +0200
Subject: [PATCH 3/5] [erts] Add check for field of sockaddr_dl
OTP-18020
---
erts/config.h.in | 6 ++++++
erts/configure | 17 +++++++++++++++++
erts/configure.in | 9 +++++++++
3 files changed, 32 insertions(+)
diff --git a/erts/config.h.in b/erts/config.h.in
index 7bed75a5d4..8292c52265 100644
--- a/erts/config.h.in
+++ b/erts/config.h.in
@@ -83,6 +83,9 @@
/* ESOCK counter size */
#undef ESOCK_COUNTER_SIZE
+/* Socket address dl length */
+#undef ESOCK_SDL_LEN
+
/* Interface hwaddr supported */
#undef ESOCK_USE_HWADDR
@@ -1033,6 +1036,9 @@
/* Define to 1 if `ssf_data' is a member of `struct sctp_send_failed'. */
#undef HAVE_STRUCT_SCTP_SEND_FAILED_SSF_DATA
+/* Define to 1 if `sdl_len' is a member of `struct sockaddr_dl'. */
+#undef HAVE_STRUCT_SOCKADDR_DL_SDL_LEN
+
/* Define to 1 if `sun_path' is a member of `struct sockaddr_un'. */
#undef HAVE_STRUCT_SOCKADDR_UN_SUN_PATH
diff --git a/erts/configure b/erts/configure
index c36bdb56c4..8baf141647 100755
--- a/erts/configure
+++ b/erts/configure
@@ -15917,6 +15917,23 @@ fi
+ac_fn_c_check_member "$LINENO" "struct sockaddr_dl" "sdl_len" "ac_cv_member_struct_sockaddr_dl_sdl_len" "#ifdef __WIN32__
+ #else
+ #include <net/if_dl.h>
+ #endif
+
+"
+if test "x$ac_cv_member_struct_sockaddr_dl_sdl_len" = xyes
+then :
+
+printf "%s\n" "#define HAVE_STRUCT_SOCKADDR_DL_SDL_LEN 1" >>confdefs.h
+
+
+printf "%s\n" "#define ESOCK_SDL_LEN /**/" >>confdefs.h
+
+fi
+
+
#--------------------------------------------------------------------
# Check for the existence of the -lsocket and -lnsl libraries.
# The order here is important, so that they end up in the right
diff --git a/erts/configure.in b/erts/configure.in
index 31789fc636..41f81e4897 100644
--- a/erts/configure.in
+++ b/erts/configure.in
@@ -1476,6 +1476,15 @@ AC_CHECK_MEMBERS([struct ifreq.ifr_index],
])
+AC_CHECK_MEMBERS([struct sockaddr_dl.sdl_len],
+ [AC_DEFINE(ESOCK_SDL_LEN, [], [Socket address dl length])],
+ [],
+ [#ifdef __WIN32__
+ #else
+ #include <net/if_dl.h>
+ #endif
+ ])
+
dnl
dnl This test kindly borrowed from Tcl
dnl
--
2.34.1