[Varnish] #832: Error resolving IPv6 literal w/o port
Varnish
varnish-bugs at varnish-cache.org
Sat Dec 11 19:25:54 CET 2010
#832: Error resolving IPv6 literal w/o port
----------------------+-----------------------------------------------------
Reporter: bz | Owner: phk
Type: defect | Status: new
Priority: low | Milestone:
Component: varnishd | Version: trunk
Severity: normal | Keywords: IPv6 getaddrinfo
----------------------+-----------------------------------------------------
There is a problem in Emit_Sockaddr() handling IPv6 literals without a
port (see tests below).
Currently we only use the host extracted in VSS_parse() for getaddrinfo()
if we also got a port, which is fine for IPv4 literals but not for IPv6 as
those still have the surrounding '[' ']' in that case.
As a solution prefer whatever host or port parts VSS_parse() returns over
the initial string.
Tests without patch:
----------------
# sh -c 'varnishd -V; echo; for addr in 192.0.2.1 192.0.2.1:80
"[2001:db8::1]" "[2001:db8::1]:80"; do echo "==> Testing address ${addr}";
varnishd -b ${addr} -C -n /tmp > /dev/null; echo; echo; done'
varnishd (varnish-2.1.4 SVN )
Copyright (c) 2006-2009 Linpro AS / Verdens Gang AS
==> Testing address 192.0.2.1
==> Testing address 192.0.2.1:80
==> Testing address [2001:db8::1]
Message from VCC-compiler:
Backend host '"[2001:db8::1]"' could not be resolved to an IP address:
hostname nor servname provided, or not known
(Sorry if that error message is gibberish.)
(input Line 2 Pos 13)
.host = "[2001:db8::1]";
------------###############-
In backend specification starting at:
(input Line 1 Pos 1)
backend default {
#######----------
Running VCC-compiler failed, exit 1
==> Testing address [2001:db8::1]:80
Applying the attached patch and re-running:
----------------------------------
# sh -c 'varnishd -V; echo; for addr in 192.0.2.1 192.0.2.1:80
"[2001:db8::1]" "[2001:db8::1]:80"; do echo "==> Testing address ${addr}";
varnishd -b ${addr} -C -n /tmp > /dev/null; echo; echo; done'
varnishd (varnish-2.1.4 SVN )
Copyright (c) 2006-2009 Linpro AS / Verdens Gang AS
==> Testing address 192.0.2.1
==> Testing address 192.0.2.1:80
==> Testing address [2001:db8::1]
==> Testing address [2001:db8::1]:80
--
Ticket URL: <http://www.varnish-cache.org/trac/ticket/832>
Varnish <http://varnish-cache.org/>
The Varnish HTTP Accelerator
More information about the varnish-bugs
mailing list