From f95cdedfaab81d783d641b7bc74e82bdafa0504b Mon Sep 17 00:00:00 2001 From: Lars Ekman Date: Sat, 27 Oct 2018 05:51:38 +0200 Subject: [PATCH] Improved detect in ipv6IsEnabled() (#555) * Improved detect in ipv6IsEnabled() * Added comments in ipv6IsEnabled. Problem described in #155 --- pkg/controllers/routing/utils.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pkg/controllers/routing/utils.go b/pkg/controllers/routing/utils.go index 2bf53d25..c05dc13a 100644 --- a/pkg/controllers/routing/utils.go +++ b/pkg/controllers/routing/utils.go @@ -83,7 +83,14 @@ func ipv4IsEnabled() bool { } func ipv6IsEnabled() bool { - l, err := net.Listen("tcp6", "") + // If ipv6 is disabled with; + // + // sysctl -w net.ipv6.conf.all.disable_ipv6=1 + // + // It is still possible to listen on the any-address "::". So this + // function tries the loopback address "::1" which must be present + // if ipv6 is enabled. + l, err := net.Listen("tcp6", "[::1]:0") if err != nil { return false }