diff options
author | Oleksandr Tymoshenko <gonzo@bluezbox.com> | 2020-12-20 20:01:53 +0100 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2021-02-10 10:14:33 +0100 |
commit | dfcfd17f2818cf520ce6381aed9ec3d2fc12170d (patch) | |
tree | 761205d3bf6ffd297597820afb69cab02c6236f9 /include | |
parent | Remove unused 'peer_type' from SSL_SESSION (diff) | |
download | openssl-dfcfd17f2818cf520ce6381aed9ec3d2fc12170d.tar.xz openssl-dfcfd17f2818cf520ce6381aed9ec3d2fc12170d.zip |
Handle partial data re-sending on ktls/sendfile on FreeBSD
Add a handler for EBUSY sendfile error in addition to
EAGAIN. With EBUSY returned the data still can be partially
sent and user code has to be notified about it, otherwise it
may try to send data multiple times.
Reviewed-by: Ben Kaduk <kaduk@mit.edu>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/13716)
Diffstat (limited to 'include')
-rw-r--r-- | include/internal/ktls.h | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/include/internal/ktls.h b/include/internal/ktls.h index 135f953ca2..1f486e7b48 100644 --- a/include/internal/ktls.h +++ b/include/internal/ktls.h @@ -192,15 +192,12 @@ static ossl_inline int ktls_read_record(int fd, void *data, size_t length) static ossl_inline ossl_ssize_t ktls_sendfile(int s, int fd, off_t off, size_t size, int flags) { - off_t sbytes; + off_t sbytes = 0; int ret; ret = sendfile(fd, s, off, size, NULL, &sbytes, flags); - if (ret == -1) { - if (errno == EAGAIN && sbytes != 0) - return sbytes; - return -1; - } + if (ret == -1 && sbytes == 0) + return -1; return sbytes; } |