com php-src: Fixed Bug #68420 listen=9000 listens to ipv6 localhost instead of all addresses: sapi/fpm/fpm/fpm_sockets.c
| From: | Remi Collet | Date: | Sat, 15 Nov 2014 07:08:23 +0000 |
| Subject: | com php-src: Fixed Bug #68420 listen=9000 listens to ipv6 localhost instead of all addresses: sapi/fpm/fpm/fpm_sockets.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-83104@lists.php.net to get a copy of this message | ||
Commit: 1d9bb287c566425a9ab4b8de62940565fe357270
Author: Remi Collet <remi@php.net> Sat, 15 Nov 2014 08:08:23 +0100
Parents: e4974f6cc6dab92926039fbc82027d1ef76a9f9e
Branches: PHP-5.5 PHP-5.6 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=1d9bb287c566425a9ab4b8de62940565fe357270
Log:
Fixed Bug #68420 listen=9000 listens to ipv6 localhost instead of all addresses
Restore default behavior when no address configured:
Listen on all IPv4 addresses.
At some time we could consider to switch to all IPv6
but this will be a BC break.
Bugs:
https://bugs.php.net/68420
Changed paths:
M sapi/fpm/fpm/fpm_sockets.c
Diff:
diff --git a/sapi/fpm/fpm/fpm_sockets.c b/sapi/fpm/fpm/fpm_sockets.c
index 3e4f09c..9d9def3 100644
--- a/sapi/fpm/fpm/fpm_sockets.c
+++ b/sapi/fpm/fpm/fpm_sockets.c
@@ -274,13 +274,23 @@ static int fpm_socket_af_inet_listening_socket(struct fpm_worker_pool_s *wp)
/*
return -1;
}
- // 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++;
- }
+ if (!addr) {
+ /* no address: default documented behavior, all IPv4 addresses */
+ struct sockaddr_in sa_in;
+
+ memset(&sa_in, 0, sizeof(sa_in));
+ sa_in.sin_family = AF_INET;
+ sa_in.sin_port = htons(port);
+ sa_in.sin_addr.s_addr = htonl(INADDR_ANY);
+ free(dup_address);
+ return fpm_sockets_get_listening_socket(wp, (struct sockaddr *) &sa_in, sizeof(struct
sockaddr_in));
+ }
+
+ /* strip brackets from address for getaddrinfo */
+ addr_len = strlen(addr);
+ if (addr[0] == '[' && addr[addr_len - 1] == ']') {
+ addr[addr_len - 1] = '\0';
+ addr++;
}
memset(&hints, 0, sizeof hints);