From 45fa794da047da8df938702a0131a6fe17d68736 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Wed, 27 Mar 2013 23:32:34 +0100 Subject: portmanager: use_ipv6 defaults to true if luasocket has ipv6 support --- core/portmanager.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'core') diff --git a/core/portmanager.lua b/core/portmanager.lua index b02ba53b..4c13f1ad 100644 --- a/core/portmanager.lua +++ b/core/portmanager.lua @@ -1,6 +1,7 @@ local config = require "core.configmanager"; local certmanager = require "core.certmanager"; local server = require "net.server"; +local socket = require "socket"; local log = require "util.logger".init("portmanager"); local multitable = require "util.multitable"; @@ -19,7 +20,7 @@ module "portmanager"; local default_interfaces = { "*" }; local default_local_interfaces = { "127.0.0.1" }; -if config.get("*", "use_ipv6") then +if socket.tcp6 and config.get("*", "use_ipv6") ~= false then table.insert(default_interfaces, "::"); table.insert(default_local_interfaces, "::1"); end -- cgit v1.2.3 From 077cfbe8a4e8ecb1a271a8991cedd5c150b9563d Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Wed, 27 Mar 2013 23:48:39 +0100 Subject: portmanager: Add use_ipv4 option, default to true. --- core/portmanager.lua | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'core') diff --git a/core/portmanager.lua b/core/portmanager.lua index 4c13f1ad..9684e9db 100644 --- a/core/portmanager.lua +++ b/core/portmanager.lua @@ -18,8 +18,12 @@ module "portmanager"; --- Config -local default_interfaces = { "*" }; -local default_local_interfaces = { "127.0.0.1" }; +local default_interfaces = { }; +local default_local_interfaces = { }; +if config.get("*", "use_ipv4") ~= false then + table.insert(default_interfaces, "*"); + table.insert(default_local_interfaces, "127.0.0.1"); +end if socket.tcp6 and config.get("*", "use_ipv6") ~= false then table.insert(default_interfaces, "::"); table.insert(default_local_interfaces, "::1"); -- cgit v1.2.3