[pve-devel] [PATCH] prevent the use of AI_ADDRCONFIG

Wolfgang Bumiller w.bumiller at proxmox.com
Wed May 20 14:20:49 CEST 2015


perl's IO::Socket::IP passes this if no GetAddrInfoFlags are passed,
which is often useful but also causes it to error when explicitly trying to
bind to 127.0.0.1 when there are no _other_ IPv4 addresses present.
---
 src/PVE/Daemon.pm | 1 +
 src/PVE/Tools.pm  | 3 ++-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/PVE/Daemon.pm b/src/PVE/Daemon.pm
index ddbe656..8a90020 100644
--- a/src/PVE/Daemon.pm
+++ b/src/PVE/Daemon.pm
@@ -807,6 +807,7 @@ sub create_reusable_socket {
 	    Listen => SOMAXCONN,
 	    Family => $family,
 	    Proto  => 'tcp',
+	    GetAddrInfoFlags => 0,
 	    ReuseAddr => 1) ||
 	    die "unable to create socket - $@\n";
 
diff --git a/src/PVE/Tools.pm b/src/PVE/Tools.pm
index 01823c2..1bc9eec 100644
--- a/src/PVE/Tools.pm
+++ b/src/PVE/Tools.pm
@@ -696,7 +696,8 @@ sub next_unused_port {
 					   LocalPort => $p,
 					   ReuseAddr => 1,
 					   Family    => $family,
-					   Proto     => 0);
+					   Proto     => 0,
+					   GetAddrInfoFlags => 0);
 
 	    if ($sock) {
 		close($sock);
-- 
2.1.4





More information about the pve-devel mailing list