Bug #77482 [Com]: Wont bind to IPv4 if IPv6 enabled

From: Date: Fri, 25 Jan 2019 07:31:51 +0000
Subject: Bug #77482 [Com]: Wont bind to IPv4 if IPv6 enabled
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-219188@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=77482&edit=1 ID: 77482 Comment by: ard_1 at mail dot ru Reported by: php at darkain dot com Summary: Wont bind to IPv4 if IPv6 enabled Status: Open Type: Bug Package: FPM related Operating System: FreeBSD PHP Version: 7.2 Block user comment: N Private report: N New Comment: This bug should also hit OpenBSD users since as far as I know there is no support for IPv4 mapped addresses exist in OpenBSD at all. Also if I'm getting the root cause of this problem right, setting sysctl net.ipv6.bindv6only=1 in Linux should perform a similar effect and PHP-FPM would not bind to IPv4 ANYADDR too. Previous Comments: ------------------------------------------------------------------------ [2019-01-25 05:56:11] ard_1 at mail dot ru Looking at the fpm_socket.c code and the comments in it I can see that some incorrect assumptions are being made. The current code is performing the following steps to bind to the TCP socket: ------- /* Bind ANYADDR * * Try "::" first as that covers IPv6 ANYADDR and mapped IPv4 ANYADDR * silencing warnings since failure is an option * * If that fails (because AF_INET6 is unsupported) retry with 0.0.0.0 */ ------- As far is I know IPv4 mapped addresses are disabled by default in FreeBSD, also if IPv6 support is enabled in the kernel (which is enabled by default in GENERIC kernel) than there always be at least one IPv6 interface - it is lo0 (localhost). That leads to the AF_INET6 is reported as being supported and the code will not fail to bind to IPv6 ANYADDR. So there would be no attempt to bind to IPv4 ANYADDR. ------------------------------------------------------------------------ [2019-01-25 04:32:27] ard_1 at mail dot ru This bug affects PHP version 7.2.14 as well. The jail is not required to reproduce this problem - PHP installations without a jail are also affected. The corresponding FreeBSD bug on this issue: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=235141 ------------------------------------------------------------------------ [2019-01-22 17:37:10] requinix@php.net Related To: Bug #77501 ------------------------------------------------------------------------ [2019-01-22 17:27:01] laszlo at karolyi dot hu +1, Same as #77501. Adding the information here that listening on both interfaces is only available with specifying two separate fpm configurations, with the respective listen directives. ------------------------------------------------------------------------ [2019-01-17 19:44:52] php at darkain dot com Changing listen to "0.0.0.0:9000" will properly listen on IPv4 without IPv6 as expected. Manually specifying an IP address (either v4 or v6) works as expected as well. It is only when specifying port ONLY that it is broken according to the docs. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=77482 -- Edit this bug report at https://bugs.php.net/bug.php?id=77482&edit=1

« previous php.bugs (#219188) next »