prevent the use of AI_ADDRCONFIG
authorWolfgang Bumiller <w.bumiller@proxmox.com>
Wed, 27 May 2015 11:16:34 +0000 (13:16 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Wed, 27 May 2015 13:32:08 +0000 (15:32 +0200)
perl's IO::Socket::IP passes AI_ADDRCONFIG 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
src/PVE/Tools.pm

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