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

IPv4 Packet Creation failed : TypeError: object of type 'NoneType' has no len() #49

Open
sunilkr opened this issue Jul 16, 2018 · 1 comment

Comments

@sunilkr
Copy link

sunilkr commented Jul 16, 2018

While crafting IPv4 packet, following exception was raise.
Code:

        pkt = ip.IP(src_s='127.0.0.1', dst_s='127.0.0.2', tos=0, id=12, off=1024, ttl=64)
        pkt.flags = ip.IP_DF|ip.IP_MF
        pkt.body_bytes = b'12345678'
        raw = pkt.bin()

TraceBack:

Traceback (most recent call last):
  File "/home/user/code/py3/project/unittests/test_ip.py", line 57, in test_match_unicast_true
    raw = pkt.bin()
  File "/home/user/.local/lib/python3.6/site-packages/pypacker/pypacker.py", line 820, in bin
    layer._update_fields()
  File "/home/user/.local/lib/python3.6/site-packages/pypacker/layer3/ip.py", line 229, in _update_fields
    self.sum = in_cksum(self._pack_header())
  File "/home/user/.local/lib/python3.6/site-packages/pypacker/checksum.py", line 49, in in_cksum
    return in_cksum_done(in_cksum_add(0, buf))
  File "/home/user/.local/lib/python3.6/site-packages/pypacker/checksum.py", line 23, in in_cksum_add
    n = len(buf)
TypeError: object of type 'NoneType' has no len()

Something I did wrong, or its some corner case. Hoe to access error object from pypacker.PyPacket

@mike01
Copy link
Owner

mike01 commented Jul 16, 2018

Thanks, fixed in gitlab repo at https://gitlab.com/mike01/pypacker

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

2 participants