fix protocol issue

This commit is contained in:
Muzahid 2021-06-22 18:23:55 +05:30
parent ae075d9c16
commit f01dfb54c9
Signed by untrusted user: cis-muzahid
GPG Key ID: 1DC85E7D3AB613EA

View File

@ -225,7 +225,7 @@ def checkIPv6Address(host, hostStandardFormat, private=False):
Returns hostStandardFormat if it is an IPv6 address, Returns hostStandardFormat if it is an IPv6 address,
otherwise returns False otherwise returns False
""" """
if host == ('\x00' * 15) + '\x01': if host == (b'\x00' * 15) + b'\x01':
if not private: if not private:
logger.debug('Ignoring loopback address: %s', hostStandardFormat) logger.debug('Ignoring loopback address: %s', hostStandardFormat)
return False return False
@ -233,11 +233,19 @@ def checkIPv6Address(host, hostStandardFormat, private=False):
if not private: if not private:
logger.debug('Ignoring local address: %s', hostStandardFormat) logger.debug('Ignoring local address: %s', hostStandardFormat)
return hostStandardFormat if private else False return hostStandardFormat if private else False
if (ord(host.decode()[0]) & 0xfe) == 0xfc: try:
if not private: if (ord(host[0]) & 0xfe) == 0xfc:
logger.debug( if not private:
'Ignoring unique local address: %s', hostStandardFormat) logger.debug(
return hostStandardFormat if private else False 'Ignoring unique local address: %s', hostStandardFormat)
return hostStandardFormat if private else False
except TypeError:
if (ord(host.decode()[0]) & 0xfe) == 0xfc:
if not private:
logger.debug(
'Ignoring unique local address: %s', hostStandardFormat)
return hostStandardFormat if private else False
return False if private else hostStandardFormat return False if private else hostStandardFormat