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

tls_sendmsg should send partial data for TCP #29

Closed
djwatson opened this issue May 10, 2016 · 6 comments
Closed

tls_sendmsg should send partial data for TCP #29

djwatson opened this issue May 10, 2016 · 6 comments

Comments

@djwatson
Copy link
Member

Currently tls_sendmsg does a size check:

if (size > KTLS_MAX_PAYLOAD_SIZE) { ret = -E2BIG; goto send_end; }

For tcp, we should be sending KTLS_MAX_PAYLOAD_SIZE bytes, and returning the number of bytes sent, or providing a socket buffer somehow.

I think this is probably OK for UDP/DTLS though.

The man page says it should be EMSGSIZE:

If the message is too long to pass atomically through the underlying protocol, the error EMSGSIZE is returned, and the message is not transmitted.

@fridex
Copy link
Member

fridex commented May 11, 2016

For tcp, we should be sending KTLS_MAX_PAYLOAD_SIZE bytes, and returning the number of bytes sent

Sounds reasonable to transparently assemble records from kvec (simply by iterating over scatter/gather array passed) so user space does not have to care about it. I don't like the buffer approach, is it really needed here?

Nevertheless, I would consider to send payload based on MTU set by setsockopt(2) (which is KTLS_MAX_PAYLOAD_SIZE by default) for both, TLS and DTLS (for DTLS limit what can be sent).

The man page says it should be EMSGSIZE:

Return values have to be reviewed. To be honest, I did not give any special care to return values at all (https://github.com/fridex/af_ktls/issues/3).

@lancerchao
Copy link
Contributor

OpenSSL[1] segments data into record buffers if size overflows.

[1] https://www.ibm.com/support/knowledgecenter/ssw_i5_54/apis/sslwrite.htm

@djwatson
Copy link
Member Author

fixed by #62

@lancerchao
Copy link
Contributor

Why is this closed? #62 fixes recv partial data. It hasn't changed send.

@fridex
Copy link
Member

fridex commented Jul 28, 2016

Reopening...

@djwatson
Copy link
Member Author

implemented in #84

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

No branches or pull requests

3 participants