Skip to content

Conversation

@zhouronghua
Copy link

@zhouronghua zhouronghua commented Apr 15, 2021

another version to solve the difference betwwen python2 and python3
decode first when get the packet

# be UDP (0x11)
# for python3 it's bytes, need to decode to str first
if type(pkt) is bytes:
pkt = pkt.decode(errors='ignore')
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My point is that I think this should happen in DHCPServer.serve_forever() (line 251):

import six
...
pkt = DhcpPacket(six.ensure_str(data))
self.handle_dhcp_request(pkt)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how about this:
zhouronghua#1 (comment)

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. Can you get this into this PR? Don't forget to add six to the requirements.txt file.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. Can you get this into this PR? Don't forget to add six to the requirements.txt file.

sorry, it doesn't work, the content of the data have changed, i prefer to drop this PR, and adapt ord only

@zhouronghua zhouronghua requested a review from mpetazzoni April 19, 2021 01:32
add ord adapter for python2 and python3
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

Successfully merging this pull request may close these issues.

2 participants