MINOR: stream: Add pointer to front/back conn-streams into stream struct

frontend and backend conn-streams are now directly accesible from the
stream. This way, and with some other changes, it will be possible to remove
the stream-interfaces from the stream structure.
This commit is contained in:
Christopher Faulet 2021-12-22 14:22:03 +01:00
parent f835dea939
commit 95a61e8a0e
13 changed files with 85 additions and 74 deletions

View File

@ -139,7 +139,12 @@ static inline void cs_detach(struct conn_stream *cs)
appctx->applet->release(appctx);
appctx_free(appctx);
}
cs_init(cs);
/* Rest CS */
cs->flags = CS_FL_NONE;
cs->end = NULL;
cs->ctx = NULL;
cs->data_cb = NULL;
}
/* Release a conn_stream */

View File

@ -88,6 +88,7 @@
#define PCLI_F_PROMPT 0x10000
#define PCLI_F_PAYLOAD 0x20000
struct conn_stream;
struct hlua;
struct proxy;
struct pendconn;
@ -163,6 +164,9 @@ struct stream {
struct vars vars_txn; /* list of variables for the txn scope. */
struct vars vars_reqres; /* list of variables for the request and resp scope. */
struct conn_stream *csf; /* frontend conn-stream */
struct conn_stream *csb; /* backend conn-stream */
struct stream_interface si[2]; /* client and server stream interfaces */
struct strm_logs logs; /* logs for this stream */

View File

@ -1496,7 +1496,7 @@ int connect_server(struct stream *s)
if (avail >= 1) {
si_attach_conn(&s->si[1], srv_conn);
if (srv_conn->mux->attach(srv_conn, s->si[1].cs, s->sess) == -1) {
if (srv_conn->mux->attach(srv_conn, s->csb, s->sess) == -1) {
si_reset_endpoint(&s->si[1]);
srv_conn = NULL;
}
@ -1679,7 +1679,7 @@ int connect_server(struct stream *s)
if (init_mux) {
const struct mux_ops *alt_mux =
likely(!(s->flags & SF_WEBSOCKET)) ? NULL : srv_get_ws_proto(srv);
if (conn_install_mux_be(srv_conn, s->si[1].cs, s->sess, alt_mux) < 0) {
if (conn_install_mux_be(srv_conn, s->csb, s->sess, alt_mux) < 0) {
conn_full_close(srv_conn);
return SF_ERR_INTERNAL;
}
@ -1741,7 +1741,7 @@ int connect_server(struct stream *s)
* sockets, socket pairs, and occasionally TCP connections on the
* loopback on a heavily loaded system.
*/
if ((srv_conn->flags & CO_FL_ERROR || (s->si[1].cs)->flags & CS_FL_ERROR))
if ((srv_conn->flags & CO_FL_ERROR || s->csb->flags & CS_FL_ERROR))
s->si[1].flags |= SI_FL_ERR;
/* If we had early data, and the handshake ended, then
@ -1750,7 +1750,7 @@ int connect_server(struct stream *s)
* the handshake.
*/
if (!(srv_conn->flags & (CO_FL_WAIT_XPRT | CO_FL_EARLY_SSL_HS)))
(s->si[1].cs)->flags &= ~CS_FL_WAIT_FOR_HS;
s->csb->flags &= ~CS_FL_WAIT_FOR_HS;
if (!si_state_in(s->si[1].state, SI_SB_EST|SI_SB_DIS|SI_SB_CLO) &&
(srv_conn->flags & CO_FL_WAIT_XPRT) == 0) {
@ -1767,7 +1767,7 @@ int connect_server(struct stream *s)
* wake callback. Otherwise si_cs_recv()/si_cs_send() already take
* care of it.
*/
if (((s->si[1].cs)->flags & CS_FL_EOI) && !(si_ic(&s->si[1])->flags & CF_EOI))
if ((s->csb->flags & CS_FL_EOI) && !(si_ic(&s->si[1])->flags & CF_EOI))
si_ic(&s->si[1])->flags |= (CF_EOI|CF_READ_PARTIAL);
/* catch all sync connect while the mux is not already installed */
@ -2076,7 +2076,7 @@ void back_try_conn_req(struct stream *s)
*/
void back_handle_st_req(struct stream *s)
{
struct stream_interface *si = &s->si[1];
struct stream_interface *si = cs_si(s->csb);
if (si->state != SI_ST_REQ)
return;
@ -2085,7 +2085,7 @@ void back_handle_st_req(struct stream *s)
if (unlikely(obj_type(s->target) == OBJ_TYPE_APPLET)) {
/* the applet directly goes to the EST state */
struct appctx *appctx = cs_appctx(si->cs);
struct appctx *appctx = cs_appctx(s->csb);
if (!appctx || appctx->applet != __objt_applet(s->target))
appctx = si_register_handler(si, objt_applet(s->target));
@ -2211,7 +2211,7 @@ void back_handle_st_con(struct stream *s)
*/
void back_handle_st_cer(struct stream *s)
{
struct stream_interface *si = &s->si[1];
struct stream_interface *si = cs_si(s->csb);
DBG_TRACE_ENTER(STRM_EV_STRM_PROC|STRM_EV_SI_ST, s);
@ -2220,7 +2220,7 @@ void back_handle_st_cer(struct stream *s)
/* we probably have to release last stream from the server */
if (objt_server(s->target)) {
struct connection *conn = cs_conn(si->cs);
struct connection *conn = cs_conn(s->csb);
health_adjust(__objt_server(s->target), HANA_STATUS_L4_ERR);

View File

@ -2649,7 +2649,7 @@ smp_fetch_res_cache_name(const struct arg *args, struct sample *smp,
return 0;
/* Get appctx from the stream_interface. */
appctx = cs_appctx(smp->strm->si[1].cs);
appctx = cs_appctx(smp->strm->csb);
if (appctx && appctx->rule) {
cconf = appctx->rule->arg.act.p[0];
if (cconf) {

View File

@ -2018,7 +2018,7 @@ smp_fetch_fc_http_major(const struct arg *args, struct sample *smp, const char *
conn = (kw[0] == 'b') ? cs_conn(__objt_check(smp->sess->origin)->cs) : NULL;
else
conn = (kw[0] != 'b') ? objt_conn(smp->sess->origin) :
smp->strm ? cs_conn(smp->strm->si[1].cs) : NULL;
smp->strm ? cs_conn(smp->strm->csb) : NULL;
/* No connection or a connection with a RAW muxx */
if (!conn || (conn->mux && !(conn->mux->flags & MX_FL_HTX)))
@ -2115,7 +2115,7 @@ int smp_fetch_fc_err(const struct arg *args, struct sample *smp, const char *kw,
conn = (kw[0] == 'b') ? cs_conn(__objt_check(smp->sess->origin)->cs) : NULL;
else
conn = (kw[0] != 'b') ? objt_conn(smp->sess->origin) :
smp->strm ? cs_conn(smp->strm->si[1].cs) : NULL;
smp->strm ? cs_conn(smp->strm->csb) : NULL;
if (!conn)
return 0;
@ -2142,7 +2142,7 @@ int smp_fetch_fc_err_str(const struct arg *args, struct sample *smp, const char
conn = (kw[0] == 'b') ? cs_conn(__objt_check(smp->sess->origin)->cs) : NULL;
else
conn = (kw[0] != 'b') ? objt_conn(smp->sess->origin) :
smp->strm ? cs_conn(smp->strm->si[1].cs) : NULL;
smp->strm ? cs_conn(smp->strm->csb) : NULL;
if (!conn)
return 0;

View File

@ -105,7 +105,7 @@ int frontend_accept(struct stream *s)
int alpn_len;
/* try to report the ALPN value when available (also works for NPN) */
if (conn == cs_conn(s->si[0].cs)) {
if (conn == cs_conn(s->csf)) {
if (conn_get_alpn(conn, &alpn_str, &alpn_len) && alpn_str) {
int len = MIN(alpn_len, sizeof(alpn) - 1);
memcpy(alpn, alpn_str, len);

View File

@ -2617,7 +2617,7 @@ static int hlua_socket_getsockname(struct lua_State *L)
si = cs_si(appctx->owner);
s = si_strm(si);
conn = cs_conn(s->si[1].cs);
conn = cs_conn(s->csb);
if (!conn || !conn_get_src(conn)) {
xref_unlock(&socket->xref, peer);
lua_pushnil(L);
@ -2684,7 +2684,7 @@ __LJMP static int hlua_socket_connect_yield(struct lua_State *L, int status, lua
return 2;
}
appctx = cs_appctx(s->si[0].cs);
appctx = cs_appctx(s->csf);
/* Check for connection established. */
if (appctx->ctx.hlua_cosocket.connected) {

View File

@ -1325,7 +1325,7 @@ int http_wait_for_response(struct stream *s, struct channel *rep, int an_bit)
if (unlikely(htx_is_empty(htx) || htx->first == -1)) {
/* 1: have we encountered a read error ? */
if (rep->flags & CF_READ_ERROR) {
struct connection *conn = cs_conn(s->si[1].cs);
struct connection *conn = cs_conn(s->csb);
/* Perform a L7 retry because server refuses the early data. */
if ((si_b->flags & SI_FL_L7_RETRY) &&
@ -1656,7 +1656,7 @@ int http_wait_for_response(struct stream *s, struct channel *rep, int an_bit)
/* check for NTML authentication headers in 401 (WWW-Authenticate) and
* 407 (Proxy-Authenticate) responses and set the connection to private
*/
srv_conn = cs_conn(s->si[1].cs);
srv_conn = cs_conn(s->csb);
if (srv_conn) {
struct ist hdr;
struct http_hdr_ctx ctx;
@ -3873,7 +3873,6 @@ static int http_stats_check_uri(struct stream *s, struct http_txn *txn, struct p
static int http_handle_stats(struct stream *s, struct channel *req)
{
struct stats_admin_rule *stats_admin_rule;
struct stream_interface *si = &s->si[1];
struct session *sess = s->sess;
struct http_txn *txn = s->txn;
struct http_msg *msg = &txn->req;
@ -3883,7 +3882,7 @@ static int http_handle_stats(struct stream *s, struct channel *req)
struct htx *htx;
struct htx_sl *sl;
appctx = cs_appctx(si->cs);
appctx = cs_appctx(s->csb);
memset(&appctx->ctx.stats, 0, sizeof(appctx->ctx.stats));
appctx->st1 = appctx->st2 = 0;
appctx->ctx.stats.st_code = STAT_STATUS_INIT;
@ -5004,7 +5003,7 @@ static void http_debug_stline(const char *dir, struct stream *s, const struct ht
chunk_printf(&trash, "%08x:%s.%s[%04x:%04x]: ", s->uniq_id, s->be->id,
dir,
objt_conn(sess->origin) ? (unsigned short)__objt_conn(sess->origin)->handle.fd : -1,
cs_conn(s->si[1].cs) ? (unsigned short)(cs_conn(s->si[1].cs))->handle.fd : -1);
cs_conn(s->csb) ? (unsigned short)(cs_conn(s->csb))->handle.fd : -1);
max = HTX_SL_P1_LEN(sl);
UBOUND(max, trash.size - trash.data - 3);
@ -5035,7 +5034,7 @@ static void http_debug_hdr(const char *dir, struct stream *s, const struct ist n
chunk_printf(&trash, "%08x:%s.%s[%04x:%04x]: ", s->uniq_id, s->be->id,
dir,
objt_conn(sess->origin) ? (unsigned short)__objt_conn(sess->origin)->handle.fd : -1,
cs_conn(s->si[1].cs) ? (unsigned short)(cs_conn(s->si[1].cs))->handle.fd : -1);
cs_conn(s->csb) ? (unsigned short)(cs_conn(s->csb))->handle.fd : -1);
max = n.len;
UBOUND(max, trash.size - trash.data - 3);
@ -5091,7 +5090,7 @@ void http_txn_reset_res(struct http_txn *txn)
struct http_txn *http_create_txn(struct stream *s)
{
struct http_txn *txn;
struct conn_stream *cs = s->si[0].cs;
struct conn_stream *cs = s->csf;
txn = pool_alloc(pool_head_http_txn);
if (!txn)

View File

@ -1970,7 +1970,7 @@ int sess_build_logline(struct session *sess, struct stream *s, char *dst, size_t
if (likely(s)) {
be = s->be;
txn = s->txn;
be_conn = cs_conn(s->si[1].cs);
be_conn = cs_conn(s->csb);
status = (txn ? txn->status : 0);
s_flags = s->flags;
uniq_id = s->uniq_id;

View File

@ -529,7 +529,7 @@ smp_fetch_ssl_x_der(const struct arg *args, struct sample *smp, const char *kw,
SSL *ssl;
if (conn_server)
conn = smp->strm ? cs_conn(smp->strm->si[1].cs) : NULL;
conn = smp->strm ? cs_conn(smp->strm->csb) : NULL;
else
conn = objt_conn(smp->sess->origin);
@ -584,7 +584,7 @@ smp_fetch_ssl_x_chain_der(const struct arg *args, struct sample *smp, const char
int i;
if (conn_server)
conn = smp->strm ? cs_conn(smp->strm->si[1].cs) : NULL;
conn = smp->strm ? cs_conn(smp->strm->csb) : NULL;
else
conn = objt_conn(smp->sess->origin);
@ -647,7 +647,7 @@ smp_fetch_ssl_x_serial(const struct arg *args, struct sample *smp, const char *k
SSL *ssl;
if (conn_server)
conn = smp->strm ? cs_conn(smp->strm->si[1].cs) : NULL;
conn = smp->strm ? cs_conn(smp->strm->csb) : NULL;
else
conn = objt_conn(smp->sess->origin);
ssl = ssl_sock_get_ssl_object(conn);
@ -700,7 +700,7 @@ smp_fetch_ssl_x_sha1(const struct arg *args, struct sample *smp, const char *kw,
SSL *ssl;
if (conn_server)
conn = smp->strm ? cs_conn(smp->strm->si[1].cs) : NULL;
conn = smp->strm ? cs_conn(smp->strm->csb) : NULL;
else
conn = objt_conn(smp->sess->origin);
@ -751,7 +751,7 @@ smp_fetch_ssl_x_notafter(const struct arg *args, struct sample *smp, const char
SSL *ssl;
if (conn_server)
conn = smp->strm ? cs_conn(smp->strm->si[1].cs) : NULL;
conn = smp->strm ? cs_conn(smp->strm->csb) : NULL;
else
conn = objt_conn(smp->sess->origin);
@ -803,7 +803,7 @@ smp_fetch_ssl_x_i_dn(const struct arg *args, struct sample *smp, const char *kw,
SSL *ssl;
if (conn_server)
conn = smp->strm ? cs_conn(smp->strm->si[1].cs) : NULL;
conn = smp->strm ? cs_conn(smp->strm->csb) : NULL;
else
conn = objt_conn(smp->sess->origin);
@ -871,7 +871,7 @@ smp_fetch_ssl_x_notbefore(const struct arg *args, struct sample *smp, const char
SSL *ssl;
if (conn_server)
conn = smp->strm ? cs_conn(smp->strm->si[1].cs) : NULL;
conn = smp->strm ? cs_conn(smp->strm->csb) : NULL;
else
conn = objt_conn(smp->sess->origin);
@ -923,7 +923,7 @@ smp_fetch_ssl_x_s_dn(const struct arg *args, struct sample *smp, const char *kw,
SSL *ssl;
if (conn_server)
conn = smp->strm ? cs_conn(smp->strm->si[1].cs) : NULL;
conn = smp->strm ? cs_conn(smp->strm->csb) : NULL;
else
conn = objt_conn(smp->sess->origin);
@ -1020,7 +1020,7 @@ smp_fetch_ssl_x_version(const struct arg *args, struct sample *smp, const char *
SSL *ssl;
if (conn_server)
conn = smp->strm ? cs_conn(smp->strm->si[1].cs) : NULL;
conn = smp->strm ? cs_conn(smp->strm->csb) : NULL;
else
conn = objt_conn(smp->sess->origin);
ssl = ssl_sock_get_ssl_object(conn);
@ -1065,7 +1065,7 @@ smp_fetch_ssl_x_sig_alg(const struct arg *args, struct sample *smp, const char *
SSL *ssl;
if (conn_server)
conn = smp->strm ? cs_conn(smp->strm->si[1].cs) : NULL;
conn = smp->strm ? cs_conn(smp->strm->csb) : NULL;
else
conn = objt_conn(smp->sess->origin);
@ -1122,7 +1122,7 @@ smp_fetch_ssl_x_key_alg(const struct arg *args, struct sample *smp, const char *
SSL *ssl;
if (conn_server)
conn = smp->strm ? cs_conn(smp->strm->si[1].cs) : NULL;
conn = smp->strm ? cs_conn(smp->strm->csb) : NULL;
else
conn = objt_conn(smp->sess->origin);
ssl = ssl_sock_get_ssl_object(conn);
@ -1174,7 +1174,7 @@ smp_fetch_ssl_fc(const struct arg *args, struct sample *smp, const char *kw, voi
conn = (kw[4] == 'b') ? cs_conn(__objt_check(smp->sess->origin)->cs) : NULL;
else
conn = (kw[4] != 'b') ? objt_conn(smp->sess->origin) :
smp->strm ? cs_conn(smp->strm->si[1].cs) : NULL;
smp->strm ? cs_conn(smp->strm->csb) : NULL;
smp->data.type = SMP_T_BOOL;
smp->data.u.sint = (conn && conn->xprt == &ssl_sock);
@ -1211,7 +1211,7 @@ smp_fetch_ssl_fc_is_resumed(const struct arg *args, struct sample *smp, const ch
conn = (kw[4] == 'b') ? cs_conn(__objt_check(smp->sess->origin)->cs) : NULL;
else
conn = (kw[4] != 'b') ? objt_conn(smp->sess->origin) :
smp->strm ? cs_conn(smp->strm->si[1].cs) : NULL;
smp->strm ? cs_conn(smp->strm->csb) : NULL;
ssl = ssl_sock_get_ssl_object(conn);
@ -1234,7 +1234,7 @@ smp_fetch_ssl_fc_cipher(const struct arg *args, struct sample *smp, const char *
conn = (kw[4] == 'b') ? cs_conn(__objt_check(smp->sess->origin)->cs) : NULL;
else
conn = (kw[4] != 'b') ? objt_conn(smp->sess->origin) :
smp->strm ? cs_conn(smp->strm->si[1].cs) : NULL;
smp->strm ? cs_conn(smp->strm->csb) : NULL;
smp->flags = 0;
ssl = ssl_sock_get_ssl_object(conn);
@ -1268,7 +1268,7 @@ smp_fetch_ssl_fc_alg_keysize(const struct arg *args, struct sample *smp, const c
conn = (kw[4] == 'b') ? cs_conn(__objt_check(smp->sess->origin)->cs) : NULL;
else
conn = (kw[4] != 'b') ? objt_conn(smp->sess->origin) :
smp->strm ? cs_conn(smp->strm->si[1].cs) : NULL;
smp->strm ? cs_conn(smp->strm->csb) : NULL;
smp->flags = 0;
ssl = ssl_sock_get_ssl_object(conn);
@ -1299,7 +1299,7 @@ smp_fetch_ssl_fc_use_keysize(const struct arg *args, struct sample *smp, const c
conn = (kw[4] == 'b') ? cs_conn(__objt_check(smp->sess->origin)->cs) : NULL;
else
conn = (kw[4] != 'b') ? objt_conn(smp->sess->origin) :
smp->strm ? cs_conn(smp->strm->si[1].cs) : NULL;
smp->strm ? cs_conn(smp->strm->csb) : NULL;
smp->flags = 0;
ssl = ssl_sock_get_ssl_object(conn);
@ -1331,7 +1331,7 @@ smp_fetch_ssl_fc_npn(const struct arg *args, struct sample *smp, const char *kw,
conn = (kw[4] == 'b') ? cs_conn(__objt_check(smp->sess->origin)->cs) : NULL;
else
conn = (kw[4] != 'b') ? objt_conn(smp->sess->origin) :
smp->strm ? cs_conn(smp->strm->si[1].cs) : NULL;
smp->strm ? cs_conn(smp->strm->csb) : NULL;
ssl = ssl_sock_get_ssl_object(conn);
if (!ssl)
@ -1366,7 +1366,7 @@ smp_fetch_ssl_fc_alpn(const struct arg *args, struct sample *smp, const char *kw
conn = (kw[4] == 'b') ? cs_conn(__objt_check(smp->sess->origin)->cs) : NULL;
else
conn = (kw[4] != 'b') ? objt_conn(smp->sess->origin) :
smp->strm ? cs_conn(smp->strm->si[1].cs) : NULL;
smp->strm ? cs_conn(smp->strm->csb) : NULL;
ssl = ssl_sock_get_ssl_object(conn);
if (!ssl)
@ -1399,7 +1399,7 @@ smp_fetch_ssl_fc_protocol(const struct arg *args, struct sample *smp, const char
conn = (kw[4] == 'b') ? cs_conn(__objt_check(smp->sess->origin)->cs) : NULL;
else
conn = (kw[4] != 'b') ? objt_conn(smp->sess->origin) :
smp->strm ? cs_conn(smp->strm->si[1].cs) : NULL;
smp->strm ? cs_conn(smp->strm->csb) : NULL;
smp->flags = 0;
ssl = ssl_sock_get_ssl_object(conn);
@ -1437,7 +1437,7 @@ smp_fetch_ssl_fc_session_id(const struct arg *args, struct sample *smp, const ch
conn = (kw[4] == 'b') ? cs_conn(__objt_check(smp->sess->origin)->cs) : NULL;
else
conn = (kw[4] != 'b') ? objt_conn(smp->sess->origin) :
smp->strm ? cs_conn(smp->strm->si[1].cs) : NULL;
smp->strm ? cs_conn(smp->strm->csb) : NULL;
ssl = ssl_sock_get_ssl_object(conn);
if (!ssl)
@ -1469,7 +1469,7 @@ smp_fetch_ssl_fc_random(const struct arg *args, struct sample *smp, const char *
conn = (kw[4] == 'b') ? cs_conn(__objt_check(smp->sess->origin)->cs) : NULL;
else
conn = (kw[4] != 'b') ? objt_conn(smp->sess->origin) :
smp->strm ? cs_conn(smp->strm->si[1].cs) : NULL;
smp->strm ? cs_conn(smp->strm->csb) : NULL;
ssl = ssl_sock_get_ssl_object(conn);
if (!ssl)
@ -1506,7 +1506,7 @@ smp_fetch_ssl_fc_session_key(const struct arg *args, struct sample *smp, const c
conn = (kw[4] == 'b') ? cs_conn(__objt_check(smp->sess->origin)->cs) : NULL;
else
conn = (kw[4] != 'b') ? objt_conn(smp->sess->origin) :
smp->strm ? cs_conn(smp->strm->si[1].cs) : NULL;
smp->strm ? cs_conn(smp->strm->csb) : NULL;
ssl = ssl_sock_get_ssl_object(conn);
if (!ssl)
@ -1655,7 +1655,7 @@ smp_fetch_ssl_fc_err(const struct arg *args, struct sample *smp, const char *kw,
conn = (kw[4] == 'b') ? cs_conn(__objt_check(smp->sess->origin)->cs) : NULL;
else
conn = (kw[4] != 'b') ? objt_conn(smp->sess->origin) :
smp->strm ? cs_conn(smp->strm->si[1].cs) : NULL;
smp->strm ? cs_conn(smp->strm->csb) : NULL;
if (!conn || conn->xprt != &ssl_sock)
return 0;
@ -1708,7 +1708,7 @@ smp_fetch_ssl_fc_err_str(const struct arg *args, struct sample *smp, const char
conn = (kw[4] == 'b') ? cs_conn(__objt_check(smp->sess->origin)->cs) : NULL;
else
conn = (kw[4] != 'b') ? objt_conn(smp->sess->origin) :
smp->strm ? cs_conn(smp->strm->si[1].cs) : NULL;
smp->strm ? cs_conn(smp->strm->csb) : NULL;
if (!conn || conn->xprt != &ssl_sock)
return 0;
@ -1841,7 +1841,7 @@ static int smp_fetch_ssl_x_keylog(const struct arg *args, struct sample *smp, co
const char *sfx;
conn = (kw[4] != 'b') ? objt_conn(smp->sess->origin) :
smp->strm ? cs_conn(smp->strm->si[1].cs) : NULL;
smp->strm ? cs_conn(smp->strm->csb) : NULL;
if (!conn)
return 0;
@ -1938,7 +1938,7 @@ smp_fetch_ssl_fc_unique_id(const struct arg *args, struct sample *smp, const cha
conn = (kw[4] == 'b') ? cs_conn(__objt_check(smp->sess->origin)->cs) : NULL;
else
conn = (kw[4] != 'b') ? objt_conn(smp->sess->origin) :
smp->strm ? cs_conn(smp->strm->si[1].cs) : NULL;
smp->strm ? cs_conn(smp->strm->csb) : NULL;
smp->flags = 0;
ssl = ssl_sock_get_ssl_object(conn);

View File

@ -7735,7 +7735,7 @@ enum act_return ssl_action_wait_for_hs(struct act_rule *rule, struct proxy *px,
struct conn_stream *cs;
conn = objt_conn(sess->origin);
cs = s->si[0].cs;
cs = s->csf;
if (conn && cs) {
if (conn->flags & (CO_FL_EARLY_SSL_HS | CO_FL_SSL_WAIT_HS)) {

View File

@ -436,6 +436,8 @@ struct stream *stream_new(struct session *sess, struct conn_stream *cs, struct b
vars_init_head(&s->vars_txn, SCOPE_TXN);
vars_init_head(&s->vars_reqres, SCOPE_REQ);
s->csf = cs;
/* this part should be common with other protocols */
if (si_reset(&s->si[0]) < 0)
goto out_fail_alloc;
@ -474,9 +476,10 @@ struct stream *stream_new(struct session *sess, struct conn_stream *cs, struct b
if (likely(sess->fe->options2 & PR_O2_INDEPSTR))
s->si[1].flags |= SI_FL_INDEP_STR;
s->si[1].cs = cs_new(NULL, NULL, &s->obj_type, &s->si[1], NULL);
if (!s->si[1].cs)
s->csb = cs_new(NULL, NULL, &s->obj_type, &s->si[1], NULL);
if (!s->csb)
goto out_fail_alloc_cs;
s->si[1].cs = s->csb;
stream_init_srv_conn(s);
s->target = sess->listener ? sess->listener->default_target : NULL;
@ -721,7 +724,7 @@ static void stream_free(struct stream *s)
/* applets do not release session yet */
/* FIXME: Handle it in appctx_free ??? */
must_free_sess = objt_appctx(sess->origin) && sess->origin == s->si[0].cs->end;
must_free_sess = objt_appctx(sess->origin) && sess->origin == s->csf->end;
si_release_endpoint(&s->si[1]);
@ -873,8 +876,8 @@ int stream_set_timeout(struct stream *s, enum act_timeout_name name, int timeout
*/
static void back_establish(struct stream *s)
{
struct stream_interface *si = &s->si[1];
struct connection *conn = cs_conn(si->cs);
struct connection *conn = cs_conn(s->csb);
struct stream_interface *si = cs_si(s->csb);
struct channel *req = &s->req;
struct channel *rep = &s->res;
@ -997,12 +1000,12 @@ enum act_return process_use_service(struct act_rule *rule, struct proxy *px,
return ACT_RET_ERR;
/* Initialise the context. */
appctx = cs_appctx(s->si[1].cs);
appctx = cs_appctx(s->csb);
memset(&appctx->ctx, 0, sizeof(appctx->ctx));
appctx->rule = rule;
}
else
appctx = cs_appctx(s->si[1].cs);
appctx = cs_appctx(s->csb);
/* Stops the applet scheduling, in case of the init function miss
* some data.
@ -1475,7 +1478,7 @@ static int process_store_rules(struct stream *s, struct channel *rep, int an_bit
*/
int stream_set_http_mode(struct stream *s, const struct mux_proto_list *mux_proto)
{
struct conn_stream *cs = s->si[0].cs;
struct conn_stream *cs = s->csf;
struct connection *conn;
/* Already an HTTP stream */
@ -3190,7 +3193,7 @@ static int stats_dump_full_strm_to_buffer(struct stream_interface *si, struct st
else
chunk_appendf(&trash, " backend=<NONE> (id=-1 mode=-)");
conn = cs_conn(strm->si[1].cs);
conn = cs_conn(strm->csb);
switch (conn && conn_get_src(conn) ? addr_to_str(conn->src, pn, sizeof(pn)) : AF_UNSPEC) {
case AF_INET:
case AF_INET6:
@ -3257,8 +3260,8 @@ static int stats_dump_full_strm_to_buffer(struct stream_interface *si, struct st
&strm->si[0],
si_state_str(strm->si[0].state),
strm->si[0].flags,
obj_type_name(strm->si[0].cs->end),
obj_base_ptr(strm->si[0].cs->end),
obj_type_name(strm->csf->end),
obj_base_ptr(strm->csf->end),
strm->si[0].exp ?
tick_is_expired(strm->si[0].exp, now_ms) ? "<PAST>" :
human_time(TICKS_TO_MS(strm->si[0].exp - now_ms),
@ -3270,15 +3273,15 @@ static int stats_dump_full_strm_to_buffer(struct stream_interface *si, struct st
&strm->si[1],
si_state_str(strm->si[1].state),
strm->si[1].flags,
obj_type_name(strm->si[1].cs->end),
obj_base_ptr(strm->si[1].cs->end),
obj_type_name(strm->csb->end),
obj_base_ptr(strm->csb->end),
strm->si[1].exp ?
tick_is_expired(strm->si[1].exp, now_ms) ? "<PAST>" :
human_time(TICKS_TO_MS(strm->si[1].exp - now_ms),
TICKS_TO_MS(1000)) : "<NEVER>",
strm->si[1].err_type, strm->si[1].wait_event.events);
cs = strm->si[0].cs;
cs = strm->csf;
chunk_appendf(&trash, " cs=%p csf=0x%08x ctx=%p\n", cs, cs->flags, cs->ctx);
if ((conn = cs_conn(cs)) != NULL) {
@ -3314,7 +3317,7 @@ static int stats_dump_full_strm_to_buffer(struct stream_interface *si, struct st
(unsigned long long)tmpctx->t->cpu_time, (unsigned long long)tmpctx->t->lat_time);
}
cs = strm->si[1].cs;
cs = strm->csb;
chunk_appendf(&trash, " cs=%p csf=0x%08x ctx=%p\n", cs, cs->flags, cs->ctx);
if ((conn = cs_conn(cs)) != NULL) {
chunk_appendf(&trash,
@ -3648,7 +3651,7 @@ static int cli_io_handler_dump_sess(struct appctx *appctx)
human_time(TICKS_TO_MS(curr_strm->res.analyse_exp - now_ms),
TICKS_TO_MS(1000)) : "");
conn = cs_conn(curr_strm->si[0].cs);
conn = cs_conn(curr_strm->csf);
chunk_appendf(&trash,
" s0=[%d,%1xh,fd=%d,ex=%s]",
curr_strm->si[0].state,
@ -3658,7 +3661,7 @@ static int cli_io_handler_dump_sess(struct appctx *appctx)
human_time(TICKS_TO_MS(curr_strm->si[0].exp - now_ms),
TICKS_TO_MS(1000)) : "");
conn = cs_conn(curr_strm->si[1].cs);
conn = cs_conn(curr_strm->csb);
chunk_appendf(&trash,
" s1=[%d,%1xh,fd=%d,ex=%s]",
curr_strm->si[1].state,

View File

@ -54,7 +54,7 @@ smp_fetch_src(const struct arg *args, struct sample *smp, const char *kw, void *
if (kw[0] == 'b') { /* bc_src */
struct connection *conn = ((obj_type(smp->sess->origin) == OBJ_TYPE_CHECK)
? cs_conn(__objt_check(smp->sess->origin)->cs)
: (smp->strm ? cs_conn(smp->strm->si[1].cs): NULL));
: (smp->strm ? cs_conn(smp->strm->csb): NULL));
if (conn && conn_get_src(conn))
src = conn_src(conn);
}
@ -98,7 +98,7 @@ smp_fetch_sport(const struct arg *args, struct sample *smp, const char *kw, void
if (kw[0] == 'b') { /* bc_src_port */
struct connection *conn = ((obj_type(smp->sess->origin) == OBJ_TYPE_CHECK)
? cs_conn(__objt_check(smp->sess->origin)->cs)
: (smp->strm ? cs_conn(smp->strm->si[1].cs): NULL));
: (smp->strm ? cs_conn(smp->strm->csb): NULL));
if (conn && conn_get_src(conn))
src = conn_src(conn);
}
@ -133,7 +133,7 @@ smp_fetch_dst(const struct arg *args, struct sample *smp, const char *kw, void *
if (kw[0] == 'b') { /* bc_dst */
struct connection *conn = ((obj_type(smp->sess->origin) == OBJ_TYPE_CHECK)
? cs_conn(__objt_check(smp->sess->origin)->cs)
: (smp->strm ? cs_conn(smp->strm->si[1].cs): NULL));
: (smp->strm ? cs_conn(smp->strm->csb): NULL));
if (conn && conn_get_dst(conn))
dst = conn_dst(conn);
}
@ -229,7 +229,7 @@ smp_fetch_dport(const struct arg *args, struct sample *smp, const char *kw, void
if (kw[0] == 'b') { /* bc_dst_port */
struct connection *conn = ((obj_type(smp->sess->origin) == OBJ_TYPE_CHECK)
? cs_conn(__objt_check(smp->sess->origin)->cs)
: (smp->strm ? cs_conn(smp->strm->si[1].cs): NULL));
: (smp->strm ? cs_conn(smp->strm->csb): NULL));
if (conn && conn_get_dst(conn))
dst = conn_dst(conn);
}
@ -325,7 +325,7 @@ static inline int get_tcp_info(const struct arg *args, struct sample *smp,
/* get the object associated with the stream interface.The
* object can be other thing than a connection. For example,
* it be a appctx. */
conn = cs_conn(smp->strm->si[dir].cs);
conn = (dir == 0 ? cs_conn(smp->strm->csf) : cs_conn(smp->strm->csb));
if (!conn)
return 0;