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

Patch 2 #35

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Patch 2 #35

wants to merge 3 commits into from

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

@@ -171,6 +171,9 @@ def __init__(self, pkt):

# Strip off the ethernet frame and check the IP packet type. It should
# 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