Update to 5.4.36 release and drop broken fpm-ipv6 patch.

If you need it, update to php 5.6 (that will be the default one soon) or 5.5.
This commit is contained in:
Alex Dupre 2014-12-29 09:59:56 +00:00
parent 2d5f3565ef
commit 3ea04f6a33
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=375781
3 changed files with 4 additions and 223 deletions

View file

@ -2,7 +2,7 @@
# $FreeBSD$
PORTNAME= php5
PORTVERSION= 5.4.35
PORTVERSION= 5.4.36
PORTREVISION?= 0
CATEGORIES?= lang devel www
MASTER_SITES= ${MASTER_SITE_PHP}
@ -37,14 +37,13 @@ CONFIGURE_ARGS+=--with-layout=GNU \
USE_GNOME= libxml2
OPTIONS_DEFINE+=CLI CGI FPM FPM_IPV6 EMBED DEBUG DTRACE IPV6 MAILHEAD LINKTHR ZTS
OPTIONS_DEFINE+=CLI CGI FPM EMBED DEBUG DTRACE IPV6 MAILHEAD LINKTHR ZTS
OPTIONS_DEFAULT=CLI CGI FPM IPV6 LINKTHR
OPTIONS_SUB= yes
CLI_DESC= Build CLI version
CGI_DESC= Build CGI version
FPM_DESC= Build FPM version
FPM_IPV6_DESC= Enable ipv6 patch for FPM
EMBED_DESC= Build embedded library
DEBUG_DESC= Enable debug
DTRACE_DESC= Enable DTrace support
@ -87,9 +86,6 @@ USE_RC_SUBR+= php-fpm
CONFIGURE_ARGS+=--enable-fpm \
--with-fpm-user=${WWWOWN} \
--with-fpm-group=${WWWGRP}
.if ${PORT_OPTIONS:MIPV6} && ${PORT_OPTIONS:MFPM_IPV6}
EXTRA_PATCHES+= ${FILESDIR}/extra-patch-php-fpm-ipv6:-p1
.endif
.endif
.if defined(OPTIONS_FILE_SET) && ${OPTIONS_FILE_SET:MAPACHE}

View file

@ -1,4 +1,4 @@
SHA256 (php-5.4.35.tar.bz2) = 8cdb4265cd0f778befacd1e6b5939ec23315fff38400e17e77a36e4c55b9746b
SIZE (php-5.4.35.tar.bz2) = 12279065
SHA256 (php-5.4.36.tar.bz2) = b0951608c3e8afb978a624c7f79a889980210f5258f666c1d997bd6491e13241
SIZE (php-5.4.36.tar.bz2) = 11892431
SHA256 (php-5.4.x-mail-header.patch) = 005ae1cd8ed17c72d7b09dee9c4466e8b16d4ecba7fe11276731ed6ff9fbb344
SIZE (php-5.4.x-mail-header.patch) = 3379

View file

@ -1,215 +0,0 @@
diff --git a/sapi/fpm/fpm/fpm_sockets.c b/sapi/fpm/fpm/fpm_sockets.c
index e056565..da14d63 100644
--- a/sapi/fpm/fpm/fpm_sockets.c
+++ b/sapi/fpm/fpm/fpm_sockets.c
@@ -39,29 +39,6 @@ struct listening_socket_s {
static struct fpm_array_s sockets_list;
-static int fpm_sockets_resolve_af_inet(char *node, char *service, struct sockaddr_in *addr) /* {{{ */
-{
- struct addrinfo *res;
- struct addrinfo hints;
- int ret;
-
- memset(&hints, 0, sizeof(hints));
- hints.ai_family = AF_INET;
- ret = getaddrinfo(node, service, &hints, &res);
-
- if (ret != 0) {
- zlog(ZLOG_ERROR, "can't resolve hostname '%s%s%s': getaddrinfo said: %s%s%s\n",
- node, service ? ":" : "", service ? service : "",
- gai_strerror(ret), ret == EAI_SYSTEM ? ", system error: " : "", ret == EAI_SYSTEM ? strerror(errno) : "");
- return -1;
- }
-
- *addr = *(struct sockaddr_in *) res->ai_addr;
- freeaddrinfo(res);
- return 0;
-}
-/* }}} */
-
enum { FPM_GET_USE_SOCKET = 1, FPM_STORE_SOCKET = 2, FPM_STORE_USE_SOCKET = 3 };
static void fpm_sockets_cleanup(int which, void *arg) /* {{{ */
@@ -98,14 +75,23 @@ static void fpm_sockets_cleanup(int which, void *arg) /* {{{ */
}
/* }}} */
+static void *fpm_get_in_addr(struct sockaddr *sa) /* {{{ */
+{
+ if (sa->sa_family == AF_INET) {
+ return &(((struct sockaddr_in*)sa)->sin_addr);
+ }
+
+ return &(((struct sockaddr_in6*)sa)->sin6_addr);
+}
+/* }}} */
+
static int fpm_sockets_hash_op(int sock, struct sockaddr *sa, char *key, int type, int op) /* {{{ */
{
if (key == NULL) {
switch (type) {
case FPM_AF_INET : {
- struct sockaddr_in *sa_in = (struct sockaddr_in *) sa;
- key = alloca(sizeof("xxx.xxx.xxx.xxx:ppppp"));
- sprintf(key, "%u.%u.%u.%u:%u", IPQUAD(&sa_in->sin_addr), (unsigned int) ntohs(sa_in->sin_port));
+ key = alloca(INET6_ADDRSTRLEN);
+ inet_ntop(sa->sa_family, fpm_get_in_addr(sa), key, sizeof key);
break;
}
@@ -254,11 +240,14 @@ enum fpm_address_domain fpm_sockets_domain_from_address(char *address) /* {{{ */
static int fpm_socket_af_inet_listening_socket(struct fpm_worker_pool_s *wp) /* {{{ */
{
- struct sockaddr_in sa_in;
+ struct addrinfo hints, *servinfo, *p;
char *dup_address = strdup(wp->config->listen_address);
- char *port_str = strchr(dup_address, ':');
+ char *port_str = strrchr(dup_address, ':');
char *addr = NULL;
+ int addr_len;
int port = 0;
+ int sock;
+ int status;
if (port_str) { /* this is host:port pair */
*port_str++ = '\0';
@@ -274,23 +263,35 @@ static int fpm_socket_af_inet_listening_socket(struct fpm_worker_pool_s *wp) /*
return -1;
}
- memset(&sa_in, 0, sizeof(sa_in));
-
- if (addr) {
- sa_in.sin_addr.s_addr = inet_addr(addr);
- if (sa_in.sin_addr.s_addr == INADDR_NONE) { /* do resolve */
- if (0 > fpm_sockets_resolve_af_inet(addr, NULL, &sa_in)) {
- return -1;
- }
- zlog(ZLOG_NOTICE, "address '%s' resolved as %u.%u.%u.%u", addr, IPQUAD(&sa_in.sin_addr));
+ // strip brackets from address for getaddrinfo
+ if (addr != NULL) {
+ addr_len = strlen(addr);
+ if (addr[0] == '[' && addr[addr_len - 1] == ']') {
+ addr[addr_len - 1] = '\0';
+ addr++;
}
- } else {
- sa_in.sin_addr.s_addr = htonl(INADDR_ANY);
}
- sa_in.sin_family = AF_INET;
- sa_in.sin_port = htons(port);
+
+ memset(&hints, 0, sizeof hints);
+ hints.ai_family = AF_UNSPEC;
+ hints.ai_socktype = SOCK_STREAM;
+
+ if ((status = getaddrinfo(addr, port_str, &hints, &servinfo)) != 0) {
+ zlog(ZLOG_ERROR, "getaddrinfo: %s\n", gai_strerror(status));
+ return -1;
+ }
+
free(dup_address);
- return fpm_sockets_get_listening_socket(wp, (struct sockaddr *) &sa_in, sizeof(struct sockaddr_in));
+
+ for (p = servinfo; p != NULL; p = p->ai_next) {
+ if ((sock = fpm_sockets_get_listening_socket(wp, p->ai_addr, p->ai_addrlen)) != -1) {
+ break;
+ }
+ }
+
+ freeaddrinfo(servinfo);
+
+ return sock;
}
/* }}} */
diff --git a/sapi/fpm/fpm/fpm_sockets.h b/sapi/fpm/fpm/fpm_sockets.h
index 121c016..446c78e 100644
--- a/sapi/fpm/fpm/fpm_sockets.h
+++ b/sapi/fpm/fpm/fpm_sockets.h
@@ -45,10 +45,4 @@ static inline int fd_set_blocked(int fd, int blocked) /* {{{ */
}
/* }}} */
-#define IPQUAD(sin_addr) \
- (unsigned int) ((unsigned char *) &(sin_addr)->s_addr)[0], \
- (unsigned int) ((unsigned char *) &(sin_addr)->s_addr)[1], \
- (unsigned int) ((unsigned char *) &(sin_addr)->s_addr)[2], \
- (unsigned int) ((unsigned char *) &(sin_addr)->s_addr)[3]
-
#endif
diff --git a/sapi/fpm/php-fpm.conf.in b/sapi/fpm/php-fpm.conf.in
index ab03736..8e242aa 100644
--- a/sapi/fpm/php-fpm.conf.in
+++ b/sapi/fpm/php-fpm.conf.in
@@ -152,6 +152,8 @@ group = @php_fpm_group@
; Valid syntaxes are:
; 'ip.add.re.ss:port' - to listen on a TCP socket to a specific address on
; a specific port;
+; '[ip:6:addr:ess]:port' - to listen on a TCP socket to a specific IPv6 address on
+; a specific port;
; 'port' - to listen on a TCP socket to all addresses on a
; specific port;
; '/path/to/unix/socket' - to listen on a unix socket.
diff --git a/sapi/fpm/tests/003.phpt b/sapi/fpm/tests/003.phpt
new file mode 100644
index 0000000..389cb24
--- /dev/null
+++ b/sapi/fpm/tests/003.phpt
@@ -0,0 +1,53 @@
+--TEST--
+FPM: Test IPv6 support
+--SKIPIF--
+<?php include "skipif.inc"; ?>
+--FILE--
+<?php
+
+include "include.inc";
+
+$logfile = dirname(__FILE__).'/php-fpm.log.tmp';
+
+$cfg = <<<EOT
+[global]
+error_log = $logfile
+[unconfined]
+listen = [::1]:9000
+pm = dynamic
+pm.max_children = 5
+pm.start_servers = 2
+pm.min_spare_servers = 1
+pm.max_spare_servers = 3
+EOT;
+
+$fpm = run_fpm($cfg, $tail);
+if (is_resource($fpm)) {
+ var_dump(fgets($tail));
+ var_dump(fgets($tail));
+ $i = 0;
+ while (($i++ < 30) && !($fp = fsockopen('[::1]', 9000))) {
+ usleep(10000);
+ }
+ if ($fp) {
+ echo "Done\n";
+ fclose($fp);
+ }
+ proc_terminate($fpm);
+ stream_get_contents($tail);
+ fclose($tail);
+ proc_close($fpm);
+}
+
+?>
+--EXPECTF--
+string(%d) "[%d-%s-%d %d:%d:%d] NOTICE: fpm is running, pid %d
+"
+string(%d) "[%d-%s-%d %d:%d:%d] NOTICE: ready to handle connections
+"
+Done
+--CLEAN--
+<?php
+ $logfile = dirname(__FILE__).'/php-fpm.log.tmp';
+ @unlink($logfile);
+?>