moby/libnetwork/netutils
Rob Murray a8f7c5ee48 Detect IPv6 support in containers.
Some configuration in a container depends on whether it has support for
IPv6 (including default entries for '::1' etc in '/etc/hosts').

Before this change, the container's support for IPv6 was determined by
whether it was connected to any IPv6-enabled networks. But, that can
change over time, it isn't a property of the container itself.

So, instead, detect IPv6 support by looking for '::1' on the container's
loopback interface. It will not be present if the kernel does not have
IPv6 support, or the user has disabled it in new namespaces by other
means.

Once IPv6 support has been determined for the container, its '/etc/hosts'
is re-generated accordingly.

The daemon no longer disables IPv6 on all interfaces during initialisation.
It now disables IPv6 only for interfaces that have not been assigned an
IPv6 address. (But, even if IPv6 is disabled for the container using the
sysctl 'net.ipv6.conf.all.disable_ipv6=1', interfaces connected to IPv6
networks still get IPv6 addresses that appear in the internal DNS. There's
more to-do!)

Signed-off-by: Rob Murray <rob.murray@docker.com>
2024-01-19 20:24:07 +00:00
..
utils.go Detect IPv6 support in containers. 2024-01-19 20:24:07 +00:00
utils_freebsd.go libnetwork/netutils: drop ElectInterfaceAddresses 2023-03-31 09:37:03 +02:00
utils_linux.go remove pre-go1.17 build-tags 2023-05-19 20:38:51 +02:00
utils_linux_test.go tests: Move libnetwork/testutils to internal/testutils/netnsutils 2023-07-26 21:06:36 +02:00
utils_windows.go libnetwork/netutils: drop ElectInterfaceAddresses 2023-03-31 09:37:03 +02:00