Mark,

+1 I'm happy with this hard requirement.

If we get push-back from downstream somewhere, we can revert parts of it and just over-allocate. It's obvious that 128 bytes will contain any practical sockaddr "subclass" which I suppose is why sizeof(struct sockaddr_storage) is so big compared to the "real" sizes of the "real" types.

Thanks for catching the missing changes to jk_global.h.

-chris

On 6/9/26 11:25 AM, [email protected] wrote:
This is an automated email from the ASF dual-hosted git repository.

markt-asf pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat-connectors.git


The following commit(s) were added to refs/heads/main by this push:
      new 4ebff9243 "struct sockaddr" is now required
4ebff9243 is described below

commit 4ebff92436892c5a232dae6be1b25bb15a22ae90
Author: Mark Thomas <[email protected]>
AuthorDate: Tue Jun 9 16:24:49 2026 +0100

     "struct sockaddr" is now required
---
  native/common/jk_global.h |  7 -------
  native/configure.ac       | 24 ++++++------------------
  2 files changed, 6 insertions(+), 25 deletions(-)

diff --git a/native/common/jk_global.h b/native/common/jk_global.h
index f4680ef8b..7a0d2f1a5 100644
--- a/native/common/jk_global.h
+++ b/native/common/jk_global.h
@@ -352,7 +352,6 @@ extern "C"
                                 (tv)->tv_usec = tb.millitm * 1000; }
  #define HAVE_VSNPRINTF
  #define HAVE_SNPRINTF
-#define HAVE_SOCKADDR_STORAGE
  #define HAVE_AF_INET6
  #define HAVE_GETADDRINFO
  #ifdef HAVE_APR
@@ -473,13 +472,7 @@ struct jk_sockaddr_t {
          /** IPv6 sockaddr structure */
          struct sockaddr_in6 sin6;
  #endif
-        /** Placeholder to ensure that the size of this union is not
-         * dependent on whether JK_HAVE_IPV6 is defined. */
-#ifdef HAVE_SOCKADDR_STORAGE
          struct sockaddr_storage sas;
-#else
-        char sas[128];
-#endif
      } sa;
  };
diff --git a/native/configure.ac b/native/configure.ac
index 238e7e1e7..ecfa76ef5 100644
--- a/native/configure.ac
+++ b/native/configure.ac
@@ -413,24 +413,12 @@ int main(void)
  )
  ])dnl
-AC_DEFUN([JK_CHECK_SASTORAGE], [
-AC_MSG_CHECKING(for struct sockaddr_storage)
-AC_TRY_RUN([
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <stdlib.h>
-
-int main(void)
-{
-    struct sockaddr_storage sa;
-    exit(sizeof(sa) == 0);
-}
-]
-, [ AC_MSG_RESULT([yes]) AC_DEFINE(HAVE_SOCKADDR_STORAGE, 1, [Define to 1 if 
you have struct sockaddr_storage]) ]
-, [ AC_MSG_RESULT([no]) ]
-)
-])dnl
+AC_CHECK_TYPE([struct sockaddr_storage], [], [
+  AC_MSG_ERROR([struct sockaddr_storage is required but not found])
+], [
+  #include <sys/types.h>
+  #include <sys/socket.h>
+])
JK_HAVE_IPV6
  JK_CHECK_SASTORAGE


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to