From 52304e802a8ca5414aee4e6153c98cffa674f1f8 Mon Sep 17 00:00:00 2001 From: Arnaud Ebalard <arno@natisbad.org> Date: Mon, 2 Nov 2009 21:07:38 +0100 Subject: [PATCH] in6_getscope(): Correct multicast case + ULA now considered global --- scapy/utils6.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/scapy/utils6.py b/scapy/utils6.py index 17c94b4c..61971d34 100644 --- a/scapy/utils6.py +++ b/scapy/utils6.py @@ -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: -- GitLab