Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug in python3 version of model_11 #56

Open
Heiner92 opened this issue May 30, 2018 · 0 comments
Open

Bug in python3 version of model_11 #56

Heiner92 opened this issue May 30, 2018 · 0 comments

Comments

@Heiner92
Copy link

I found a bug the python 3 branch for model_11

The parsing of the MAC address should be different in py3.
In Python 3 the sock.recvfrom(...) call returns bytes while Python 2.7 recvfrom returns a string.
I couldn't find the line of code where sock.recvfrom(...) is called but this can be fixed in another way:

The function data_to_eui48 in core/util.py needs to be changed:

def data_to_eui48(data):
    return '%02X:%02X:%02X:%02X:%02X:%02X' % (ord(data[2]), ord(data[3]), ord(data[4]), ord(data[5]), ord(data[6]), ord(data[7]))

data is no longer of type str but of type bytes.

Therefore the line

data=data.decode('utf-8','backslashreplace') 

needs to be added.

A cleaner fix would be to search for all calls of sock.recvfrom(...) and change its output

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant