Improved detect in ipv6IsEnabled() (#555)

* Improved detect in ipv6IsEnabled()

* Added comments in ipv6IsEnabled.

Problem described in #155
This commit is contained in:
Lars Ekman 2018-10-27 05:51:38 +02:00 committed by Murali Reddy
parent 827bbbcd4d
commit f95cdedfaa

View File

@ -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
}