tevt_loc_strm = 6,
};
-/* Types for termination event logs (4-bits) */
+/* Types for termination event logs (4-bits) per location */
+enum fd_term_event_type {
+ fd_tevt_type_shutw = 1,
+ fd_tevt_type_shutr = 2,
+ fd_tevt_type_rcv_err = 3,
+ fd_tevt_type_snd_err = 4,
+ /* unused: 5, 6 */
+ fd_tevt_type_connect_err = 7,
+ fd_tevt_type_intercepted = 8,
+};
+
+enum hs_term_event_type {
+ /* unused: 1, 2, 3 */
+ hs_tevt_type_snd_err = 4,
+ hs_tevt_type_truncated_shutr = 5,
+ hs_tevt_type_truncated_rcv_err = 6,
+};
+
+enum xprt_term_event_type {
+ xprt_tevt_type_shutw = 1,
+ xprt_tevt_type_shutr = 2,
+ xprt_tevt_type_rcv_err = 3,
+ xprt_tevt_type_snd_err = 4,
+};
+
+
enum term_event_type {
/* Events emitted by haproxy */
tevt_type_shutw = 1,
int xprt_add_hs(struct connection *conn);
void register_mux_proto(struct mux_proto_list *list);
-static inline void conn_report_term_evt(struct connection *conn, enum term_event_loc loc, enum term_event_type type);
+static inline void conn_report_term_evt(struct connection *conn, enum term_event_loc loc, unsigned char type);
extern struct idle_conns idle_conns[MAX_THREADS];
if (!(c->flags & CO_FL_SOCK_RD_SH) && clean)
shutdown(c->handle.fd, SHUT_WR);
}
- conn_report_term_evt(c, tevt_loc_fd, tevt_type_shutw);
+ conn_report_term_evt(c, tevt_loc_fd, fd_tevt_type_shutw);
}
static inline void conn_xprt_shutw(struct connection *c)
}
/* Report a connection event. <loc> may be "tevt_loc_fd", "tevt_loc_hs" or "tevt_loc_xprt" */
-static inline void conn_report_term_evt(struct connection *conn, enum term_event_loc loc, enum term_event_type type)
+static inline void conn_report_term_evt(struct connection *conn, enum term_event_loc loc, unsigned char type)
{
if (conn_is_back(conn))
loc |= 0x08;
goto fail;
recv_abort:
- conn_report_term_evt(conn, tevt_loc_hs, tevt_type_truncated_shutr);
+ conn_report_term_evt(conn, tevt_loc_hs, hs_tevt_type_truncated_shutr);
conn->err_code = CO_ER_PRX_ABORT;
conn->flags |= CO_FL_SOCK_RD_SH | CO_FL_SOCK_WR_SH;
goto fail;
fail:
if (!(conn->flags & CO_FL_SOCK_RD_SH))
- conn_report_term_evt(conn, tevt_loc_hs, tevt_type_truncated_rcv_err);
+ conn_report_term_evt(conn, tevt_loc_hs, hs_tevt_type_truncated_rcv_err);
conn->flags |= CO_FL_ERROR;
return 0;
}
out_error:
/* Write error on the file descriptor */
- conn_report_term_evt(conn, tevt_loc_hs, tevt_type_snd_err);
+ conn_report_term_evt(conn, tevt_loc_hs, hs_tevt_type_snd_err);
conn->flags |= CO_FL_ERROR;
return 0;
goto fail;
recv_abort:
- conn_report_term_evt(conn, tevt_loc_hs, tevt_type_truncated_shutr);
+ conn_report_term_evt(conn, tevt_loc_hs, hs_tevt_type_truncated_shutr);
conn->err_code = CO_ER_CIP_ABORT;
conn->flags |= CO_FL_SOCK_RD_SH | CO_FL_SOCK_WR_SH;
goto fail;
fail:
if (!(conn->flags & CO_FL_SOCK_RD_SH))
- conn_report_term_evt(conn, tevt_loc_hs, tevt_type_truncated_rcv_err);
+ conn_report_term_evt(conn, tevt_loc_hs, hs_tevt_type_truncated_rcv_err);
conn->flags |= CO_FL_ERROR;
return 0;
}
out_error:
/* Write error on the file descriptor */
- conn_report_term_evt(conn, tevt_loc_hs, tevt_type_snd_err);
+ conn_report_term_evt(conn, tevt_loc_hs, hs_tevt_type_snd_err);
conn->flags |= CO_FL_ERROR;
if (conn->err_code == CO_ER_NONE) {
conn->err_code = CO_ER_SOCKS4_SEND;
return 0;
recv_abort:
- conn_report_term_evt(conn, tevt_loc_hs, tevt_type_truncated_shutr);
+ conn_report_term_evt(conn, tevt_loc_hs, hs_tevt_type_truncated_shutr);
if (conn->err_code == CO_ER_NONE) {
conn->err_code = CO_ER_SOCKS4_ABORT;
}
fail:
if (!(conn->flags & CO_FL_SOCK_RD_SH))
- conn_report_term_evt(conn, tevt_loc_hs, tevt_type_truncated_rcv_err);
+ conn_report_term_evt(conn, tevt_loc_hs, hs_tevt_type_truncated_rcv_err);
conn->flags |= CO_FL_ERROR;
return 0;
}
/* report error on POLL_ERR before connection establishment */
if ((fdtab[conn->handle.fd].state & FD_POLL_ERR) && (conn->flags & CO_FL_WAIT_L4_CONN)) {
- conn_report_term_evt(conn, tevt_loc_fd, tevt_type_rcv_err);
+ conn_report_term_evt(conn, tevt_loc_fd, fd_tevt_type_rcv_err);
conn->flags |= CO_FL_ERROR | CO_FL_SOCK_RD_SH | CO_FL_SOCK_WR_SH;
conn_set_errcode(conn, CO_ER_POLLERR);
errno = 0; /* let the caller do a getsockopt() if it wants it */
continue;
}
/* here we have another error */
- conn_report_term_evt(conn, tevt_loc_fd, tevt_type_rcv_err);
+ conn_report_term_evt(conn, tevt_loc_fd, fd_tevt_type_rcv_err);
conn->flags |= CO_FL_ERROR;
conn_set_errno(conn, errno);
break;
return retval;
out_read0:
- conn_report_term_evt(conn, tevt_loc_fd, tevt_type_shutr);
+ conn_report_term_evt(conn, tevt_loc_fd, fd_tevt_type_shutr);
conn_sock_read0(conn);
conn->flags &= ~CO_FL_WAIT_L4_CONN;
goto leave;
if (conn->flags & CO_FL_SOCK_WR_SH) {
/* it's already closed */
- conn_report_term_evt(conn, tevt_loc_fd, tevt_type_snd_err);
+ conn_report_term_evt(conn, tevt_loc_fd, fd_tevt_type_snd_err);
conn->flags |= CO_FL_ERROR | CO_FL_SOCK_RD_SH;
errno = EPIPE;
conn_set_errno(conn, errno);
continue;
/* here we have another error */
- conn_report_term_evt(conn, tevt_loc_fd, tevt_type_snd_err);
+ conn_report_term_evt(conn, tevt_loc_fd, fd_tevt_type_snd_err);
conn->flags |= CO_FL_ERROR;
conn_set_errno(conn, errno);
break;
/* report error on POLL_ERR before connection establishment */
if ((fdtab[conn->handle.fd].state & FD_POLL_ERR) && (conn->flags & CO_FL_WAIT_L4_CONN)) {
- conn_report_term_evt(conn, tevt_loc_fd, tevt_type_rcv_err);
+ conn_report_term_evt(conn, tevt_loc_fd, fd_tevt_type_rcv_err);
conn->flags |= CO_FL_ERROR | CO_FL_SOCK_RD_SH | CO_FL_SOCK_WR_SH;
conn_set_errcode(conn, CO_ER_POLLERR);
goto leave;
break;
}
else if (errno != EINTR) {
- conn_report_term_evt(conn, tevt_loc_fd, tevt_type_rcv_err);
+ conn_report_term_evt(conn, tevt_loc_fd, fd_tevt_type_rcv_err);
conn->flags |= CO_FL_ERROR | CO_FL_SOCK_RD_SH | CO_FL_SOCK_WR_SH;
conn_set_errno(conn, errno);
break;
return done;
read0:
- conn_report_term_evt(conn, tevt_loc_fd, tevt_type_shutr);
+ conn_report_term_evt(conn, tevt_loc_fd, fd_tevt_type_shutr);
conn_sock_read0(conn);
conn->flags &= ~CO_FL_WAIT_L4_CONN;
* an error without checking.
*/
if (unlikely(!done && fdtab[conn->handle.fd].state & FD_POLL_ERR)) {
- conn_report_term_evt(conn, tevt_loc_fd, tevt_type_rcv_err);
+ conn_report_term_evt(conn, tevt_loc_fd, fd_tevt_type_rcv_err);
conn->flags |= CO_FL_ERROR | CO_FL_SOCK_RD_SH | CO_FL_SOCK_WR_SH;
conn_set_errcode(conn, CO_ER_POLLERR);
}
if (unlikely(fdtab[conn->handle.fd].state & FD_POLL_ERR)) {
/* an error was reported on the FD, we can't send anymore */
- conn_report_term_evt(conn, tevt_loc_fd, tevt_type_snd_err);
+ conn_report_term_evt(conn, tevt_loc_fd, fd_tevt_type_snd_err);
conn->flags |= CO_FL_ERROR | CO_FL_SOCK_WR_SH | CO_FL_SOCK_RD_SH;
conn_set_errcode(conn, CO_ER_POLLERR);
errno = EPIPE;
if (conn->flags & CO_FL_SOCK_WR_SH) {
/* it's already closed */
- conn_report_term_evt(conn, tevt_loc_fd, tevt_type_snd_err);
+ conn_report_term_evt(conn, tevt_loc_fd, fd_tevt_type_snd_err);
conn->flags |= CO_FL_ERROR | CO_FL_SOCK_RD_SH;
errno = EPIPE;
conn_set_errno(conn, errno);
break;
}
else if (errno != EINTR) {
- conn_report_term_evt(conn, tevt_loc_fd, tevt_type_snd_err);
+ conn_report_term_evt(conn, tevt_loc_fd, fd_tevt_type_snd_err);
conn->flags |= CO_FL_ERROR | CO_FL_SOCK_RD_SH | CO_FL_SOCK_WR_SH;
conn_set_errno(conn, errno);
break;
/* Write error on the file descriptor. Report it to the connection
* and disable polling on this FD.
*/
- conn_report_term_evt(conn, tevt_loc_fd, tevt_type_truncated_rcv_err);
+ conn_report_term_evt(conn, tevt_loc_fd, fd_tevt_type_connect_err);
conn->flags |= CO_FL_ERROR | CO_FL_SOCK_RD_SH | CO_FL_SOCK_WR_SH;
HA_ATOMIC_AND(&fdtab[fd].state, ~FD_LINGER_RISK);
fd_stop_both(fd);
/* Report an HS error only on SSL error */
if (!(conn->flags & (CO_FL_ERROR | CO_FL_SOCK_RD_SH | CO_FL_SOCK_WR_SH)))
- conn_report_term_evt(conn, tevt_loc_hs, tevt_type_truncated_rcv_err);
+ conn_report_term_evt(conn, tevt_loc_hs, hs_tevt_type_truncated_rcv_err);
/* Fail on all other handshake errors */
conn->flags |= CO_FL_ERROR;
ssl_sock_dump_errors(conn, NULL);
ERR_clear_error();
read0:
- conn_report_term_evt(conn, tevt_loc_xprt, tevt_type_shutr);
+ conn_report_term_evt(conn, tevt_loc_xprt, xprt_tevt_type_shutr);
conn_sock_read0(conn);
goto leave;
out_error:
- conn_report_term_evt(conn, tevt_loc_xprt, tevt_type_rcv_err);
+ conn_report_term_evt(conn, tevt_loc_xprt, xprt_tevt_type_rcv_err);
conn->flags |= CO_FL_ERROR;
/* Clear openssl global errors stack */
ssl_sock_dump_errors(conn, NULL);
ssl_sock_dump_errors(conn, NULL);
ERR_clear_error();
- conn_report_term_evt(conn, tevt_loc_xprt, tevt_type_snd_err);
+ conn_report_term_evt(conn, tevt_loc_xprt, xprt_tevt_type_snd_err);
conn->flags |= CO_FL_ERROR;
goto leave;
}
if (conn->flags & (CO_FL_WAIT_XPRT | CO_FL_SSL_WAIT_HS))
return;
- conn_report_term_evt(conn, tevt_loc_xprt, tevt_type_shutw);
+ conn_report_term_evt(conn, tevt_loc_xprt, xprt_tevt_type_shutw);
if (!clean)
/* don't sent notify on SSL_shutdown */
SSL_set_quiet_shutdown(ctx->ssl, 1);
}
end:
if (!result)
- conn_report_term_evt(conn, tevt_loc_fd, tevt_type_intercepted);
+ conn_report_term_evt(conn, tevt_loc_fd, fd_tevt_type_intercepted);
return result;
}