Skip to content

Check sockaddr_storage.ss_family with AC_CHECK_MEMBERS #13407

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 2 additions & 14 deletions ext/sockets/config.m4
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,8 @@ if test "$PHP_SOCKETS" != "no"; then
AC_CHECK_HEADERS([sys/sockio.h linux/filter.h])
AC_DEFINE([HAVE_SOCKETS], 1, [ ])

dnl Check for fied ss_family in sockaddr_storage (missing in AIX until 5.3)
AC_CACHE_CHECK([for field ss_family in struct sockaddr_storage], ac_cv_ss_family,
[
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <sys/socket.h>
#include <sys/types.h>
#include <netdb.h>
]], [[struct sockaddr_storage sa_store; sa_store.ss_family = AF_INET6;]])],
[ac_cv_ss_family=yes], [ac_cv_ss_family=no])
])

if test "$ac_cv_ss_family" = yes; then
AC_DEFINE(HAVE_SA_SS_FAMILY,1,[Whether you have sockaddr_storage.ss_family])
fi
dnl Check for field ss_family in sockaddr_storage (missing in AIX until 5.3)
AC_CHECK_MEMBERS([struct sockaddr_storage.ss_family],,,[#include <sys/socket.h>])

dnl Check for AI_V4MAPPED flag
AC_CACHE_CHECK([if getaddrinfo supports AI_V4MAPPED],[ac_cv_gai_ai_v4mapped],
Expand Down
2 changes: 1 addition & 1 deletion ext/sockets/php_sockets.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ PHP_SOCKETS_API bool socket_import_file_descriptor(PHP_SOCKET socket, php_socket
#define phpext_sockets_ptr NULL
#endif

#if defined(_AIX) && !defined(HAVE_SA_SS_FAMILY)
#if defined(_AIX) && !defined(HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY)
# define ss_family __ss_family
#endif

Expand Down