mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-20 21:31:28 +02:00
MEDIUM: splice: Don't consider EINVAL to be a fatal error
Don't consider that EINVAL is a fatal error, when calling splice(). When doing splicing from a kTLS socket, splice() will set errno to EINVAL if the next record to be read is not an application data record. This is not a fatal error, it just means we have to use recvmsg() to read it, and potentially we can then resume using splicing. It is unfortunate that EINVAL was used for that case, but we should never get any other case of receiving EINVAL from splice(), so it should be safe to treat it as non-fatal.
This commit is contained in:
parent
ed7d20afc8
commit
755436920d
@ -123,8 +123,20 @@ int raw_sock_to_pipe(struct connection *conn, void *xprt_ctx, struct pipe *pipe,
|
|||||||
/* splice not supported on this end, disable it.
|
/* splice not supported on this end, disable it.
|
||||||
* We can safely return -1 since there is no
|
* We can safely return -1 since there is no
|
||||||
* chance that any data has been piped yet.
|
* chance that any data has been piped yet.
|
||||||
|
* EINVAL, however, is a bit special.
|
||||||
|
* If we're trying to splice from a KTLS
|
||||||
|
* socket, the kernel may return EINVAL
|
||||||
|
* to signal that the current TLS record
|
||||||
|
* is not application data, and that we
|
||||||
|
* have to call recvmsg() to get it.
|
||||||
|
* This is not really an error, and doesn't
|
||||||
|
* mean we won't be able to splice later.
|
||||||
|
* Choosing EINVAL there is a bit unfortunate,
|
||||||
|
* because it can mean many things, but we
|
||||||
|
* should not get it for any other reason.
|
||||||
*/
|
*/
|
||||||
retval = -1;
|
if (errno != EINVAL)
|
||||||
|
retval = -1;
|
||||||
goto leave;
|
goto leave;
|
||||||
}
|
}
|
||||||
else if (errno == EINTR) {
|
else if (errno == EINTR) {
|
||||||
@ -132,9 +144,11 @@ int raw_sock_to_pipe(struct connection *conn, void *xprt_ctx, struct pipe *pipe,
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
/* here we have another error */
|
/* here we have another error */
|
||||||
conn_report_term_evt(conn, tevt_loc_fd, fd_tevt_type_rcv_err);
|
if (errno != EINVAL) {
|
||||||
conn->flags |= CO_FL_ERROR;
|
conn_report_term_evt(conn, tevt_loc_fd, fd_tevt_type_rcv_err);
|
||||||
conn_set_errno(conn, errno);
|
conn->flags |= CO_FL_ERROR;
|
||||||
|
conn_set_errno(conn, errno);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
} /* ret <= 0 */
|
} /* ret <= 0 */
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user