Mein Fehler!
Die Zeile
if delta > 8:
muss raus, war leider noch drin, hatte zum debug eingebaut und unvollständig wieder raus genommen.
if delta > 8:
print ("is_similar",c,delta,a,b)
So sollte es sein:
root@yildun:/opt/ffmap-backend# diff -u nodedb.py-ffmuc-original nodedb.py-so-geht-es
--- nodedb.py-ffmuc-original 2015-02-25 21:25:07.698098999 +0100
+++ nodedb.py-so-geht-es 2015-02-27 08:38:21.396502999 +0100
@@ -85,7 +85,7 @@
try:
if 'neighbor' in x:
try:
- node = self.maybe_node_by_mac((x['neighbor']))
+ node = self.maybe_node_by_mac((x['neighbor'], ))
except:
continue
@@ -373,8 +373,12 @@
delta = 0
if len(c) > 0:
- delta = sum(abs(i[0] -i[1]) for i in c)
-
+ delta = 0
+ for i in c:
+ ddd = abs(i[0] -i[1])
+ if ddd > 128:
+ ddd = abs(ddd - 256)
+ delta = delta + ddd
# These addresses look pretty similar!
return delta < 8
@@ -393,7 +397,7 @@
x = list(mac_a)
x[5] += 1
- x[5] %= 255
+ x[5] %= 256
if mac_b == x:
return True
@@ -402,21 +406,21 @@
return True
x[3] += 1
- x[3] %= 255
+ x[3] %= 256
if mac_b == x:
return True
x = list(mac_a)
x[0] |= 2
x[5] += 2
- x[5] %= 255
+ x[5] %= 256
if mac_b == x:
return True
x = list(mac_a)
x[0] |= 2
x[3] += 1
- x[3] %= 255
+ x[3] %= 256
if mac_b == x:
return True
Servus
Christian