54 lines
1.6 KiB
Diff
54 lines
1.6 KiB
Diff
|
From 1d9bb287c566425a9ab4b8de62940565fe357270 Mon Sep 17 00:00:00 2001
|
||
|
From: Remi Collet <remi@php.net>
|
||
|
Date: Sat, 15 Nov 2014 08:08:23 +0100
|
||
|
Subject: [PATCH] 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.
|
||
|
---
|
||
|
sapi/fpm/fpm/fpm_sockets.c | 24 +++++++++++++++++-------
|
||
|
1 file changed, 17 insertions(+), 7 deletions(-)
|
||
|
|
||
|
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);
|
||
|
--
|
||
|
2.1.0
|
||
|
|