mirror of https://github.com/fail2ban/fail2ban
improve auto detection of IPv6 - try to check sysctl net.ipv6.conf.all.disable_ipv6 (prefer value read from `/proc/sys/net/ipv6/conf/all/disable_ipv6`)
parent
58834b6734
commit
d8a9812adc
|
@ -212,6 +212,13 @@ class DNSUtils:
|
||||||
def _IPv6IsSupportedBySystem():
|
def _IPv6IsSupportedBySystem():
|
||||||
if not socket.has_ipv6:
|
if not socket.has_ipv6:
|
||||||
return False
|
return False
|
||||||
|
# try to check sysctl net.ipv6.conf.all.disable_ipv6:
|
||||||
|
try:
|
||||||
|
with open('/proc/sys/net/ipv6/conf/all/disable_ipv6', 'rb') as f:
|
||||||
|
# if 1 - disabled, 0 - enabled
|
||||||
|
return not int(f.read())
|
||||||
|
except:
|
||||||
|
pass
|
||||||
s = None
|
s = None
|
||||||
try:
|
try:
|
||||||
# try to create INET6 socket:
|
# try to create INET6 socket:
|
||||||
|
|
Loading…
Reference in New Issue