From 9d4a1202b725494f121c1e79e8b4ad24ad37546e Mon Sep 17 00:00:00 2001
From: Guillaume Valadon <guillaume@valadon.net>
Date: Wed, 24 Jul 2013 18:55:37 +0200
Subject: [PATCH] Issue #892: in6_isanycast inconsistent

---
 scapy/utils6.py | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/scapy/utils6.py b/scapy/utils6.py
index 9d12081f..1353cae0 100644
--- a/scapy/utils6.py
+++ b/scapy/utils6.py
@@ -535,9 +535,10 @@ def in6_iseui64(x):
 def in6_isanycast(x): # RFC 2526
     if in6_iseui64(x):
         s = '::fdff:ffff:ffff:ff80'
-        x = in6_and(x, inet_pton(socket.AF_INET6, '::ffff:ffff:ffff:ff80'))
-        x = in6_and(x, inet_pton(socket.AF_INET6, s)) 
-        return x == inet_pton(socket.AF_INET6, s)
+        packed_x = inet_pton(socket.AF_INET6, x)
+        packed_s = inet_pton(socket.AF_INET6, s)
+        x_and_s = in6_and(packed_x, packed_s) 
+        return x_and_s == packed_s
     else:
         # not EUI-64 
         #|              n bits             |    121-n bits    |   7 bits   |
-- 
GitLab