Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Starting varnish on Linux with boot param ipv6.disable=1 fails #1991

Closed
denisbr opened this issue Jun 22, 2016 · 8 comments

Comments

Projects
None yet
6 participants
@denisbr
Copy link

commented Jun 22, 2016

On linux (tested on CentOS7 with linux 3.10.0-327.13.1.el7.x86_64) if IPv6 is disabled via kernel boot parameter ipv6.disable=1 starting varnishd without specifying an IPv4 address to -a will fail with the error Error: Cannot open socket: :6081: Address family not supported by protocol.

Expected Behavior

Expected behaviour when IPv6 is not available on any system, and no IPv6 address was specified as a listening address, would be that varnishd binds to the specified IPv4 port.

Current Behavior

varnishd tries to start, successfully binds to 0.0.0.0 IPv4, but then fails to perform calls on the IPv6 socket (see stracelogs.zip attached) and stops with error Error: Cannot open socket: :6081: Address family not supported by protocol.

Possible Solution

varnishd needs to handle the complete absence of IPv6 gracefully. The difference between disabling via systemctl and the boot parameter seems to be that /proc/sys/net/ipv6 is completely absent.

Steps to Reproduce (for bugs)

  1. Boot linux with ipv6.disable=1 kernel option
  2. Verify that /proc/sys/net/ipv6 is absent
  3. Start varnishd with -a :6081
  4. Observe the error

Context

Not sure where using the boot parameter is the normal thing to do, could be virtualization environments that inject this parameter.

Your Environment

  • Version used: varnish-cache-plus 4.1.2, and also reproduced with varnish-cache master.
  • Operating System and version: CentOS Linux release 7.2.1511 (Core)
@Dridi

This comment has been minimized.

Copy link
Member

commented Jun 22, 2016

I'm suspecting a bug in glibc instead, Varnish merely uses getaddrinfo(3).

What's the output of ifconfig when you boot with ipv6.disable=1?

@denisbr

This comment has been minimized.

Copy link
Author

commented Jun 22, 2016

@Dridi:

[root@c7-vcp41-master vagrant]# ls -la /proc/sys/net/ipv6
ls: cannot access /proc/sys/net/ipv6: No such file or directory

[root@c7-vcp41-master vagrant]# ifconfig lo
lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        loop  txqueuelen 0  (Local Loopback)
        RX packets 22719  bytes 5925788 (5.6 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 22719  bytes 5925788 (5.6 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
@fgsch

This comment has been minimized.

Copy link
Member

commented Jun 22, 2016

Bug or not we should not fail if the (ipv6) address is not specified, i.e. -a :6081.

@denisbr

This comment has been minimized.

Copy link
Author

commented Jun 22, 2016

FWIW: reproduced this on Ubuntu 16.04 (Xenial) with varnish-cache master too.
Xenial has glibc 2.23-0ubuntu2.

@denisbr

This comment has been minimized.

Copy link
Author

commented Jun 27, 2016

Suspect commits based on light digging (in order of guesstimated likelihood):
fde2d23
a4a7384
1ff5897

@bsdphk

This comment has been minimized.

Copy link
Contributor

commented Dec 9, 2016

What is the errno from the socket operation which fails in this case ?

Can we tell "definitively does not support IPv6" from "cannot use that IPv6" somehow ?

@denisbr

This comment has been minimized.

Copy link
Author

commented Dec 12, 2016

The actual error is:

write(2, "Error: Cannot open socket: :6081"..., 75) = 75

Googling the kernel-parameter gave this:
https://www.kernel.org/doc/Documentation/networking/ipv6.txt

The ipv6-module is loaded, but:

No IPv6 addresses will be added to interfaces, and
it will not be possible to open an IPv6 socket.

@bsdphk bsdphk closed this in c7e5e1d Jan 2, 2017

bsdphk added a commit that referenced this issue Jan 2, 2017

@hermunn

This comment has been minimized.

Copy link
Contributor

commented Mar 31, 2017

Backport review: This will not be backported to 4.1 unless demand increases (or @denisbr says so).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.