Skip to content
Snippets Groups Projects
Commit 52304e80 authored by Arnaud Ebalard's avatar Arnaud Ebalard
Browse files

in6_getscope(): Correct multicast case + ULA now considered global

parent 0190c6f5
No related branches found
No related tags found
No related merge requests found
......@@ -682,19 +682,27 @@ def in6_isaddrllallservers(str):
return (inet_pton(socket.AF_INET6, "ff02::2") ==
inet_pton(socket.AF_INET6, str))
def in6_getscope(addr):
"""
Returns the scope of the address.
"""
if in6_isgladdr(addr):
if in6_isgladdr(addr) or in6_isuladdr(addr):
scope = IPV6_ADDR_GLOBAL
elif in6_islladdr(addr):
scope = IPV6_ADDR_LINKLOCAL
elif in6_issladdr(addr):
scope = IPV6_ADDR_SITELOCAL
elif in6_ismaddr(addr):
scope = IPV6_ADDR_MULTICAST
if in6_ismgladdr(addr):
scope = IPV6_ADDR_GLOBAL
elif in6_ismlladdr(addr):
scope = IPV6_ADDR_LINKLOCAL
elif in6_ismsladdr(addr):
scope = IPV6_ADDR_SITELOCAL
elif in6_ismnladdr(addr):
scope = IPV6_ADDR_LOOPBACK
else:
scope = -1
elif addr == '::1':
scope = IPV6_ADDR_LOOPBACK
else:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment