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

DTLSHandshake 'fragment_offset' field initialized incorrectly #137

Open
4Kp3n opened this issue Aug 1, 2018 · 2 comments
Open

DTLSHandshake 'fragment_offset' field initialized incorrectly #137

4Kp3n opened this issue Aug 1, 2018 · 2 comments

Comments

@4Kp3n
Copy link

4Kp3n commented Aug 1, 2018

Hi,

I'm having some trouble sending DTLS messages.
I created some very basic DTLSClientHello like so:

p = DTLSRecord(version=version)/DTLSHandshake()/DTLSClientHello(cipher_suites=cipher)

and send it via a UDP socket to the DTLS server:

s.sendto(bytes(p), (ip, port))

However examining the Wireshark trace and the output of p.show2() shows, that the fragment_offset field of the DTLSHandshake layer get's initialized to x = len(pkt.payload) in the i2m function.
This is not right as the RFC states:

fragment_offset (the number of bytes
contained in previous fragments)

and no previous fragments have been sent.

Any help appreciated.

Cheers Skllrn

@tintinweb
Copy link
Owner

Hi @skllrn,

thanks for raising this issue.
I haven't yet looked into this but would you be able to provide a PR fixing this?

cheers,
tin

@4Kp3n
Copy link
Author

4Kp3n commented Aug 23, 2018

Hey @tintinweb,

thanks for the reply.

In order to calculate the fragment_offset one would have to inspect the package, determine if the payload is bigger than the networks MTU and split the payload accordingly onto multiple DTLSRecords.

It would be neccessary to make sendall in TLSSocket do these splits and calculate the three affected fields

length
fragment_length
fragment_offset

of the DTLSHandshake object accordingly.
The recvall function in contrast should detect the fragments, buffer them and reasemble when all fragements are received.

Not sure I can do it without guidance but I'll have a try.

Cheers,
skllrn

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