taskserver
taskserver copied to clipboard
[TD-128] Make Taskwarrior listen on IPv4 and IPv6 simultaneously
Dirk Deimeke on 2017-02-04T16:16:42Z says:
I would be great to have Taskwarrior listen on IPv4 and IPv6 simultaneously.
Migrated metadata:
Created: 2017-02-04T16:16:42Z
Modified: 2017-10-12T02:26:11Z
Konstantin on 2017-03-16T07:32:24Z says:
For my Docker environment, I patch taskd with the following patch. It allows to set server
variable to, for example *:53589
in order to listen on all interfaces:
{code}
- -- src/TLSServer.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/TLSServer.cpp b/src/TLSServer.cpp index e3354f9..6b2f760 100644
-
-- a/src/TLSServer.cpp +++ b/src/TLSServer.cpp @@ -226,7 +226,10 @@ void TLSServer::bind ( hints.ai_flags = AI_PASSIVE; // use my IP
struct addrinfo* res;
-
int ret = ::getaddrinfo (host.c_str (), port.c_str (), &hints, &res);
- char *host_str = NULL;
- if (host.compare("*") != 0)
- host_str = (char *)host.c_str ();
- int ret = ::getaddrinfo (host_str, port.c_str (), &hints, &res); if (ret != 0) throw std::string (::gai_strerror (ret));
{code}
This won't work unless sys.net.ipv6.bindv6only
is off, which is a hack. The correct way would IMHO be to accept any number of server lines, and to bind to all of them in turn.
Thanks for the analysis.
I believe (but cannot remember, it's all a blur) that there is already a fix for IPv4 & IPv6 binding in place.
Found it: Commit ece8ec856c995d8fbe4b4966e59d5549ff983177 adds dual-stack support. Does that change anything?
I commented there. I think that also requires the bindv6only
hack.