[pve-devel] [PATCH v4 common 1/3] daemon: listen also on ipv6

Oguz Bektas o.bektas at proxmox.com
Wed Mar 24 14:20:36 CET 2021


see [0]
when we set 'Domain' to PF_INET6 by default, it will prefer IPv6. since
we don't set 'V6Only' it will also listen on IPv4 interfaces.

'Family' parameter isn't needed anymore.

this change depends on the changes in pve-manager and pve-http-server to
work correctly.

[0]:
https://perldoc.perl.org/IO::Socket::IP#REPLACING-IO::Socket-DEFAULT-BEHAVIOUR

Signed-off-by: Oguz Bektas <o.bektas at proxmox.com>
---
v3->v4:
* remove $family parameter

 src/PVE/Daemon.pm | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/PVE/Daemon.pm b/src/PVE/Daemon.pm
index 64f8126..905635a 100644
--- a/src/PVE/Daemon.pm
+++ b/src/PVE/Daemon.pm
@@ -799,7 +799,7 @@ sub register_status_command {
 # some useful helper
 
 sub create_reusable_socket {
-    my ($self, $port, $host, $family) = @_;
+    my ($self, $port, $host) = @_;
 
     die "no port specifed" if !$port;
 
@@ -820,10 +820,10 @@ sub create_reusable_socket {
     } else {
 
 	$socket = IO::Socket::IP->new(
-	    LocalAddr => $host,
+	    Domain => PF_INET6,
+	    LocalHost => $host,
 	    LocalPort => $port,
 	    Listen => SOMAXCONN,
-	    Family => $family,
 	    Proto  => 'tcp',
 	    GetAddrInfoFlags => 0,
 	    ReuseAddr => 1) ||
-- 
2.20.1





More information about the pve-devel mailing list