mirror of
https://github.com/php/php-src.git
synced 2025-08-15 13:38:49 +02:00
Sync HAVE_IPV6 and HAVE_GETADDRINFO in #if/ifdef/defined (#14341)
Follow up of GH-5526 (-Wundef)
This commit is contained in:
parent
5109cf1010
commit
2d66562e4b
7 changed files with 24 additions and 24 deletions
|
@ -1243,7 +1243,7 @@ void to_zval_read_msghdr(const char *msghdr_c, zval *zv, res_context *ctx)
|
|||
to_zval_read_aggregation(msghdr_c, zv, descriptors, ctx);
|
||||
}
|
||||
|
||||
#if defined(IPV6_PKTINFO) && HAVE_IPV6
|
||||
#if defined(IPV6_PKTINFO) && defined(HAVE_IPV6)
|
||||
/* CONVERSIONS for if_index */
|
||||
static void from_zval_write_ifindex(const zval *zv, char *uinteger, ser_context *ctx)
|
||||
{
|
||||
|
|
|
@ -107,17 +107,17 @@ static void init_ancillary_registry(void)
|
|||
key.cmsg_type = type; \
|
||||
zend_hash_str_update_mem(&ancillary_registry.ht, (char*)&key, sizeof(key), (void*)&entry, sizeof(entry))
|
||||
|
||||
#if defined(IPV6_PKTINFO) && HAVE_IPV6
|
||||
#if defined(IPV6_PKTINFO) && defined(HAVE_IPV6)
|
||||
PUT_ENTRY(sizeof(struct in6_pktinfo), 0, 0, from_zval_write_in6_pktinfo,
|
||||
to_zval_read_in6_pktinfo, IPPROTO_IPV6, IPV6_PKTINFO);
|
||||
#endif
|
||||
|
||||
#if defined(IPV6_HOPLIMIT) && HAVE_IPV6
|
||||
#if defined(IPV6_HOPLIMIT) && defined(HAVE_IPV6)
|
||||
PUT_ENTRY(sizeof(int), 0, 0, from_zval_write_int,
|
||||
to_zval_read_int, IPPROTO_IPV6, IPV6_HOPLIMIT);
|
||||
#endif
|
||||
|
||||
#if defined(IPV6_TCLASS) && HAVE_IPV6
|
||||
#if defined(IPV6_TCLASS) && defined(HAVE_IPV6)
|
||||
PUT_ENTRY(sizeof(int), 0, 0, from_zval_write_int,
|
||||
to_zval_read_int, IPPROTO_IPV6, IPV6_TCLASS);
|
||||
#endif
|
||||
|
|
|
@ -16,7 +16,7 @@ extern zend_result php_string_to_if_index(const char *val, unsigned *out);
|
|||
int php_set_inet6_addr(struct sockaddr_in6 *sin6, char *string, php_socket *php_sock) /* {{{ */
|
||||
{
|
||||
struct in6_addr tmp;
|
||||
#if HAVE_GETADDRINFO
|
||||
#ifdef HAVE_GETADDRINFO
|
||||
struct addrinfo hints;
|
||||
struct addrinfo *addrinfo = NULL;
|
||||
#endif
|
||||
|
@ -25,7 +25,7 @@ int php_set_inet6_addr(struct sockaddr_in6 *sin6, char *string, php_socket *php_
|
|||
if (inet_pton(AF_INET6, string, &tmp)) {
|
||||
memcpy(&(sin6->sin6_addr.s6_addr), &(tmp.s6_addr), sizeof(struct in6_addr));
|
||||
} else {
|
||||
#if HAVE_GETADDRINFO
|
||||
#ifdef HAVE_GETADDRINFO
|
||||
|
||||
memset(&hints, 0, sizeof(struct addrinfo));
|
||||
hints.ai_family = AF_INET6;
|
||||
|
|
|
@ -1664,7 +1664,7 @@ const AI_NUMERICSERV = UNKNOWN;
|
|||
const SOL_LOCAL = UNKNOWN;
|
||||
#endif
|
||||
|
||||
#if (defined(IPV6_RECVPKTINFO) && HAVE_IPV6)
|
||||
#if (defined(IPV6_RECVPKTINFO) && defined(HAVE_IPV6))
|
||||
/**
|
||||
* IPv6 ancillary data
|
||||
* @var int
|
||||
|
@ -1677,7 +1677,7 @@ const IPV6_RECVPKTINFO = UNKNOWN;
|
|||
*/
|
||||
const IPV6_PKTINFO = UNKNOWN;
|
||||
#endif
|
||||
#if (defined(IPV6_RECVHOPLIMIT) && HAVE_IPV6)
|
||||
#if (defined(IPV6_RECVHOPLIMIT) && defined(HAVE_IPV6))
|
||||
/**
|
||||
* @var int
|
||||
* @cvalue IPV6_RECVHOPLIMIT
|
||||
|
@ -1690,7 +1690,7 @@ const IPV6_RECVHOPLIMIT = UNKNOWN;
|
|||
const IPV6_HOPLIMIT = UNKNOWN;
|
||||
#endif
|
||||
|
||||
#if (defined(IPV6_RECVTCLASS) && HAVE_IPV6)
|
||||
#if (defined(IPV6_RECVTCLASS) && defined(HAVE_IPV6))
|
||||
/**
|
||||
* @var int
|
||||
* @cvalue IPV6_RECVTCLASS
|
||||
|
|
14
ext/sockets/sockets_arginfo.h
generated
14
ext/sockets/sockets_arginfo.h
generated
|
@ -1,5 +1,5 @@
|
|||
/* This is a generated file, edit the .stub.php file instead.
|
||||
* Stub hash: 70a996a13d739c1d2d165c73427cff59ebae1c5f */
|
||||
* Stub hash: a551457ae505cd3d0a10da4e4b9897f556c390b4 */
|
||||
|
||||
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_socket_select, 0, 4, MAY_BE_LONG|MAY_BE_FALSE)
|
||||
ZEND_ARG_TYPE_INFO(1, read, IS_ARRAY, 1)
|
||||
|
@ -966,22 +966,22 @@ static void register_sockets_symbols(int module_number)
|
|||
#if defined(SOL_LOCAL)
|
||||
REGISTER_LONG_CONSTANT("SOL_LOCAL", SOL_LOCAL, CONST_PERSISTENT);
|
||||
#endif
|
||||
#if (defined(IPV6_RECVPKTINFO) && HAVE_IPV6)
|
||||
#if (defined(IPV6_RECVPKTINFO) && defined(HAVE_IPV6))
|
||||
REGISTER_LONG_CONSTANT("IPV6_RECVPKTINFO", IPV6_RECVPKTINFO, CONST_PERSISTENT);
|
||||
#endif
|
||||
#if (defined(IPV6_RECVPKTINFO) && HAVE_IPV6)
|
||||
#if (defined(IPV6_RECVPKTINFO) && defined(HAVE_IPV6))
|
||||
REGISTER_LONG_CONSTANT("IPV6_PKTINFO", IPV6_PKTINFO, CONST_PERSISTENT);
|
||||
#endif
|
||||
#if (defined(IPV6_RECVHOPLIMIT) && HAVE_IPV6)
|
||||
#if (defined(IPV6_RECVHOPLIMIT) && defined(HAVE_IPV6))
|
||||
REGISTER_LONG_CONSTANT("IPV6_RECVHOPLIMIT", IPV6_RECVHOPLIMIT, CONST_PERSISTENT);
|
||||
#endif
|
||||
#if (defined(IPV6_RECVHOPLIMIT) && HAVE_IPV6)
|
||||
#if (defined(IPV6_RECVHOPLIMIT) && defined(HAVE_IPV6))
|
||||
REGISTER_LONG_CONSTANT("IPV6_HOPLIMIT", IPV6_HOPLIMIT, CONST_PERSISTENT);
|
||||
#endif
|
||||
#if (defined(IPV6_RECVTCLASS) && HAVE_IPV6)
|
||||
#if (defined(IPV6_RECVTCLASS) && defined(HAVE_IPV6))
|
||||
REGISTER_LONG_CONSTANT("IPV6_RECVTCLASS", IPV6_RECVTCLASS, CONST_PERSISTENT);
|
||||
#endif
|
||||
#if (defined(IPV6_RECVTCLASS) && HAVE_IPV6)
|
||||
#if (defined(IPV6_RECVTCLASS) && defined(HAVE_IPV6))
|
||||
REGISTER_LONG_CONSTANT("IPV6_TCLASS", IPV6_TCLASS, CONST_PERSISTENT);
|
||||
#endif
|
||||
#if defined(SCM_RIGHTS)
|
||||
|
|
|
@ -87,7 +87,7 @@ const struct in6_addr in6addr_any = {0}; /* IN6ADDR_ANY_INIT; */
|
|||
# define PHP_TIMEOUT_ERROR_VALUE ETIMEDOUT
|
||||
#endif
|
||||
|
||||
#if HAVE_GETADDRINFO
|
||||
#ifdef HAVE_GETADDRINFO
|
||||
#ifdef HAVE_GAI_STRERROR
|
||||
# define PHP_GAI_STRERROR(x) (gai_strerror(x))
|
||||
#else
|
||||
|
@ -150,7 +150,7 @@ PHPAPI int php_network_getaddresses(const char *host, int socktype, struct socka
|
|||
{
|
||||
struct sockaddr **sap;
|
||||
int n;
|
||||
#if HAVE_GETADDRINFO
|
||||
#ifdef HAVE_GETADDRINFO
|
||||
# ifdef HAVE_IPV6
|
||||
static int ipv6_borked = -1; /* the way this is used *is* thread safe */
|
||||
# endif
|
||||
|
@ -163,7 +163,7 @@ PHPAPI int php_network_getaddresses(const char *host, int socktype, struct socka
|
|||
if (host == NULL) {
|
||||
return 0;
|
||||
}
|
||||
#if HAVE_GETADDRINFO
|
||||
#ifdef HAVE_GETADDRINFO
|
||||
memset(&hints, '\0', sizeof(hints));
|
||||
|
||||
hints.ai_family = AF_INET; /* default to regular inet (see below) */
|
||||
|
@ -422,7 +422,7 @@ php_socket_t php_network_bind_socket_to_local_addr(const char *host, unsigned po
|
|||
sa = *sal;
|
||||
|
||||
switch (sa->sa_family) {
|
||||
#if HAVE_GETADDRINFO && HAVE_IPV6
|
||||
#if defined(HAVE_GETADDRINFO) && defined(HAVE_IPV6)
|
||||
case AF_INET6:
|
||||
((struct sockaddr_in6 *)sa)->sin6_port = htons(port);
|
||||
socklen = sizeof(struct sockaddr_in6);
|
||||
|
@ -566,7 +566,7 @@ PHPAPI int php_network_parse_network_address_with_port(const char *addr, zend_lo
|
|||
|
||||
/* copy the details from the first item */
|
||||
switch ((*psal)->sa_family) {
|
||||
#if HAVE_GETADDRINFO && HAVE_IPV6
|
||||
#if defined(HAVE_GETADDRINFO) && defined(HAVE_IPV6)
|
||||
case AF_INET6:
|
||||
*in6 = **(struct sockaddr_in6**)psal;
|
||||
in6->sin6_port = htons(port);
|
||||
|
@ -802,7 +802,7 @@ php_socket_t php_network_connect_socket_to_host(const char *host, unsigned short
|
|||
sa = *sal;
|
||||
|
||||
switch (sa->sa_family) {
|
||||
#if HAVE_GETADDRINFO && HAVE_IPV6
|
||||
#if defined(HAVE_GETADDRINFO) && defined(HAVE_IPV6)
|
||||
case AF_INET6:
|
||||
if (!bindto || strchr(bindto, ':')) {
|
||||
((struct sockaddr_in6 *)sa)->sin6_port = htons(port);
|
||||
|
|
|
@ -1302,7 +1302,7 @@ static php_socket_t php_network_listen_socket(const char *host, int *port, int s
|
|||
}
|
||||
|
||||
switch ((*p)->sa_family) {
|
||||
#if HAVE_GETADDRINFO && HAVE_IPV6
|
||||
#if defined(HAVE_GETADDRINFO) && defined(HAVE_IPV6)
|
||||
case AF_INET6:
|
||||
sa = pemalloc(sizeof(struct sockaddr_in6), 1);
|
||||
*(struct sockaddr_in6 *)sa = *(struct sockaddr_in6 *)*p;
|
||||
|
@ -1348,7 +1348,7 @@ static php_socket_t php_network_listen_socket(const char *host, int *port, int s
|
|||
goto out;
|
||||
}
|
||||
switch (sa->sa_family) {
|
||||
#if HAVE_GETADDRINFO && HAVE_IPV6
|
||||
#if defined(HAVE_GETADDRINFO) && defined(HAVE_IPV6)
|
||||
case AF_INET6:
|
||||
*port = ntohs(((struct sockaddr_in6 *)sa)->sin6_port);
|
||||
break;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue