Skip to content

Commit

Permalink
Improved detect in ipv6IsEnabled() (#555)
Browse files Browse the repository at this point in the history
* Improved detect in ipv6IsEnabled()

* Added comments in ipv6IsEnabled.

Problem described in #155
  • Loading branch information
Lars Ekman authored and murali-reddy committed Oct 27, 2018
1 parent 827bbbc commit f95cded
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion pkg/controllers/routing/utils.go
Expand Up @@ -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
}
Expand Down

0 comments on commit f95cded

Please sign in to comment.