mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-04-17 20:45:40 +00:00
MEDIUM: session: use the pointer to the origin instead of s->si[0].end
When s->si[0].end was dereferenced as a connection or anything in order to retrieve information about the originating session, we'll now use sess->origin instead so that when we have to chain multiple streams in HTTP/2, we'll keep accessing the same origin.
This commit is contained in:
parent
40606ab976
commit
9ad7bd48d2
@ -607,7 +607,7 @@ int assign_server(struct stream *s)
|
||||
|
||||
switch (s->be->lbprm.algo & BE_LB_PARM) {
|
||||
case BE_LB_HASH_SRC:
|
||||
conn = objt_conn(s->si[0].end);
|
||||
conn = objt_conn(strm_sess(s)->origin);
|
||||
if (conn && conn->addr.from.ss_family == AF_INET) {
|
||||
srv = get_server_sh(s->be,
|
||||
(void *)&((struct sockaddr_in *)&conn->addr.from)->sin_addr,
|
||||
@ -746,7 +746,7 @@ int assign_server(struct stream *s)
|
||||
*/
|
||||
int assign_server_address(struct stream *s)
|
||||
{
|
||||
struct connection *cli_conn = objt_conn(s->si[0].end);
|
||||
struct connection *cli_conn = objt_conn(strm_sess(s)->origin);
|
||||
struct connection *srv_conn = objt_conn(s->si[1].end);
|
||||
|
||||
#ifdef DEBUG_FULL
|
||||
@ -966,7 +966,7 @@ static void assign_tproxy_address(struct stream *s)
|
||||
case CO_SRC_TPROXY_CLI:
|
||||
case CO_SRC_TPROXY_CIP:
|
||||
/* FIXME: what can we do if the client connects in IPv6 or unix socket ? */
|
||||
cli_conn = objt_conn(s->si[0].end);
|
||||
cli_conn = objt_conn(strm_sess(s)->origin);
|
||||
if (cli_conn)
|
||||
srv_conn->addr.from = cli_conn->addr.from;
|
||||
else
|
||||
@ -1074,7 +1074,7 @@ int connect_server(struct stream *s)
|
||||
srv_conn->send_proxy_ofs = 0;
|
||||
if (objt_server(s->target) && objt_server(s->target)->pp_opts) {
|
||||
srv_conn->send_proxy_ofs = 1; /* must compute size */
|
||||
cli_conn = objt_conn(s->si[0].end);
|
||||
cli_conn = objt_conn(strm_sess(s)->origin);
|
||||
if (cli_conn)
|
||||
conn_get_to_addr(cli_conn);
|
||||
}
|
||||
|
@ -5022,7 +5022,7 @@ static int stats_dump_full_sess_to_buffer(struct stream_interface *si, struct st
|
||||
sess->uniq_id,
|
||||
strm_sess(sess)->listener && strm_sess(sess)->listener->proto->name ? strm_sess(sess)->listener->proto->name : "?");
|
||||
|
||||
conn = objt_conn(sess->si[0].end);
|
||||
conn = objt_conn(strm_sess(sess)->origin);
|
||||
switch (conn ? addr_to_str(&conn->addr.from, pn, sizeof(pn)) : AF_UNSPEC) {
|
||||
case AF_INET:
|
||||
case AF_INET6:
|
||||
@ -5604,7 +5604,7 @@ static int stats_dump_sess_to_buffer(struct stream_interface *si)
|
||||
strm_sess(curr_sess)->listener->proto->name);
|
||||
|
||||
|
||||
conn = objt_conn(curr_sess->si[0].end);
|
||||
conn = objt_conn(strm_sess(curr_sess)->origin);
|
||||
switch (conn ? addr_to_str(&conn->addr.from, pn, sizeof(pn)) : AF_UNSPEC) {
|
||||
case AF_INET:
|
||||
case AF_INET6:
|
||||
|
@ -55,7 +55,7 @@
|
||||
int frontend_accept(struct stream *s)
|
||||
{
|
||||
struct session *sess = s->sess;
|
||||
struct connection *conn = __objt_conn(s->si[0].end);
|
||||
struct connection *conn = __objt_conn(sess->origin);
|
||||
struct listener *l = sess->listener;
|
||||
struct proxy *fe = sess->fe;
|
||||
|
||||
|
@ -3505,7 +3505,7 @@ __LJMP static int hlua_txn_set_tos(lua_State *L)
|
||||
htxn = MAY_LJMP(hlua_checktxn(L, 1));
|
||||
tos = MAY_LJMP(luaL_checkinteger(L, 2));
|
||||
|
||||
if ((cli_conn = objt_conn(htxn->s->si[0].end)) && conn_ctrl_ready(cli_conn))
|
||||
if ((cli_conn = objt_conn(htxn->s->sess->origin)) && conn_ctrl_ready(cli_conn))
|
||||
inet_set_tos(cli_conn->t.sock.fd, cli_conn->addr.from, tos);
|
||||
|
||||
return 0;
|
||||
@ -3522,7 +3522,7 @@ __LJMP static int hlua_txn_set_mark(lua_State *L)
|
||||
htxn = MAY_LJMP(hlua_checktxn(L, 1));
|
||||
mark = MAY_LJMP(luaL_checkinteger(L, 2));
|
||||
|
||||
if ((cli_conn = objt_conn(htxn->s->si[0].end)) && conn_ctrl_ready(cli_conn))
|
||||
if ((cli_conn = objt_conn(htxn->s->sess->origin)) && conn_ctrl_ready(cli_conn))
|
||||
setsockopt(cli_conn->t.sock.fd, SOL_SOCKET, SO_MARK, &mark, sizeof(mark));
|
||||
#endif
|
||||
return 0;
|
||||
|
12
src/log.c
12
src/log.c
@ -986,7 +986,7 @@ int build_logline(struct stream *s, char *dst, size_t maxsize, struct list *list
|
||||
break;
|
||||
|
||||
case LOG_FMT_CLIENTIP: // %ci
|
||||
conn = objt_conn(s->si[0].end);
|
||||
conn = objt_conn(sess->origin);
|
||||
if (conn)
|
||||
ret = lf_ip(tmplog, (struct sockaddr *)&conn->addr.from, dst + maxsize - tmplog, tmp);
|
||||
else
|
||||
@ -998,7 +998,7 @@ int build_logline(struct stream *s, char *dst, size_t maxsize, struct list *list
|
||||
break;
|
||||
|
||||
case LOG_FMT_CLIENTPORT: // %cp
|
||||
conn = objt_conn(s->si[0].end);
|
||||
conn = objt_conn(sess->origin);
|
||||
if (conn) {
|
||||
if (conn->addr.from.ss_family == AF_UNIX) {
|
||||
ret = ltoa_o(sess->listener->luid, tmplog, dst + maxsize - tmplog);
|
||||
@ -1017,7 +1017,7 @@ int build_logline(struct stream *s, char *dst, size_t maxsize, struct list *list
|
||||
break;
|
||||
|
||||
case LOG_FMT_FRONTENDIP: // %fi
|
||||
conn = objt_conn(s->si[0].end);
|
||||
conn = objt_conn(sess->origin);
|
||||
if (conn) {
|
||||
conn_get_to_addr(conn);
|
||||
ret = lf_ip(tmplog, (struct sockaddr *)&conn->addr.to, dst + maxsize - tmplog, tmp);
|
||||
@ -1032,7 +1032,7 @@ int build_logline(struct stream *s, char *dst, size_t maxsize, struct list *list
|
||||
break;
|
||||
|
||||
case LOG_FMT_FRONTENDPORT: // %fp
|
||||
conn = objt_conn(s->si[0].end);
|
||||
conn = objt_conn(sess->origin);
|
||||
if (conn) {
|
||||
conn_get_to_addr(conn);
|
||||
if (conn->addr.to.ss_family == AF_UNIX)
|
||||
@ -1193,7 +1193,7 @@ int build_logline(struct stream *s, char *dst, size_t maxsize, struct list *list
|
||||
#ifdef USE_OPENSSL
|
||||
case LOG_FMT_SSL_CIPHER: // %sslc
|
||||
src = NULL;
|
||||
conn = objt_conn(s->si[0].end);
|
||||
conn = objt_conn(sess->origin);
|
||||
if (conn) {
|
||||
if (sess->listener->xprt == &ssl_sock)
|
||||
src = ssl_sock_get_cipher_name(conn);
|
||||
@ -1207,7 +1207,7 @@ int build_logline(struct stream *s, char *dst, size_t maxsize, struct list *list
|
||||
|
||||
case LOG_FMT_SSL_VERSION: // %sslv
|
||||
src = NULL;
|
||||
conn = objt_conn(s->si[0].end);
|
||||
conn = objt_conn(sess->origin);
|
||||
if (conn) {
|
||||
if (sess->listener->xprt == &ssl_sock)
|
||||
src = ssl_sock_get_proto_version(conn);
|
||||
|
@ -2772,12 +2772,13 @@ int http_wait_for_request(struct stream *s, struct channel *req, int an_bit)
|
||||
req->flags |= CF_READ_DONTWAIT; /* try to get back here ASAP */
|
||||
s->res.flags &= ~CF_EXPECT_MORE; /* speed up sending a previous response */
|
||||
#ifdef TCP_QUICKACK
|
||||
if (sess->listener->options & LI_O_NOQUICKACK && req->buf->i && objt_conn(s->si[0].end) && conn_ctrl_ready(__objt_conn(s->si[0].end))) {
|
||||
if (sess->listener->options & LI_O_NOQUICKACK && req->buf->i &&
|
||||
objt_conn(sess->origin) && conn_ctrl_ready(__objt_conn(sess->origin))) {
|
||||
/* We need more data, we have to re-enable quick-ack in case we
|
||||
* previously disabled it, otherwise we might cause the client
|
||||
* to delay next data.
|
||||
*/
|
||||
setsockopt(__objt_conn(s->si[0].end)->t.sock.fd, IPPROTO_TCP, TCP_QUICKACK, &one, sizeof(one));
|
||||
setsockopt(__objt_conn(sess->origin)->t.sock.fd, IPPROTO_TCP, TCP_QUICKACK, &one, sizeof(one));
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -3325,6 +3326,7 @@ static int http_transform_header(struct stream* s, struct http_msg *msg,
|
||||
enum rule_result
|
||||
http_req_get_intercept_rule(struct proxy *px, struct list *rules, struct stream *s, struct http_txn *txn)
|
||||
{
|
||||
struct session *sess = strm_sess(s);
|
||||
struct connection *cli_conn;
|
||||
struct http_req_rule *rule;
|
||||
struct hdr_ctx ctx;
|
||||
@ -3400,13 +3402,13 @@ resume_execution:
|
||||
break;
|
||||
|
||||
case HTTP_REQ_ACT_SET_TOS:
|
||||
if ((cli_conn = objt_conn(s->si[0].end)) && conn_ctrl_ready(cli_conn))
|
||||
if ((cli_conn = objt_conn(sess->origin)) && conn_ctrl_ready(cli_conn))
|
||||
inet_set_tos(cli_conn->t.sock.fd, cli_conn->addr.from, rule->arg.tos);
|
||||
break;
|
||||
|
||||
case HTTP_REQ_ACT_SET_MARK:
|
||||
#ifdef SO_MARK
|
||||
if ((cli_conn = objt_conn(s->si[0].end)) && conn_ctrl_ready(cli_conn))
|
||||
if ((cli_conn = objt_conn(sess->origin)) && conn_ctrl_ready(cli_conn))
|
||||
setsockopt(cli_conn->t.sock.fd, SOL_SOCKET, SO_MARK, &rule->arg.mark, sizeof(rule->arg.mark));
|
||||
#endif
|
||||
break;
|
||||
@ -3577,7 +3579,7 @@ resume_execution:
|
||||
t->data_arg[STKTABLE_DT_HTTP_REQ_RATE].u, 1);
|
||||
|
||||
stkctr_set_flags(&s->stkctr[http_req_trk_idx(rule->action)], STKCTR_TRACK_CONTENT);
|
||||
if (strm_sess(s)->fe != s->be)
|
||||
if (sess->fe != s->be)
|
||||
stkctr_set_flags(&s->stkctr[http_req_trk_idx(rule->action)], STKCTR_TRACK_BACKEND);
|
||||
}
|
||||
}
|
||||
@ -3600,6 +3602,7 @@ resume_execution:
|
||||
static enum rule_result
|
||||
http_res_get_intercept_rule(struct proxy *px, struct list *rules, struct stream *s, struct http_txn *txn)
|
||||
{
|
||||
struct session *sess = strm_sess(s);
|
||||
struct connection *cli_conn;
|
||||
struct http_res_rule *rule;
|
||||
struct hdr_ctx ctx;
|
||||
@ -3647,13 +3650,13 @@ resume_execution:
|
||||
break;
|
||||
|
||||
case HTTP_RES_ACT_SET_TOS:
|
||||
if ((cli_conn = objt_conn(s->si[0].end)) && conn_ctrl_ready(cli_conn))
|
||||
if ((cli_conn = objt_conn(sess->origin)) && conn_ctrl_ready(cli_conn))
|
||||
inet_set_tos(cli_conn->t.sock.fd, cli_conn->addr.from, rule->arg.tos);
|
||||
break;
|
||||
|
||||
case HTTP_RES_ACT_SET_MARK:
|
||||
#ifdef SO_MARK
|
||||
if ((cli_conn = objt_conn(s->si[0].end)) && conn_ctrl_ready(cli_conn))
|
||||
if ((cli_conn = objt_conn(sess->origin)) && conn_ctrl_ready(cli_conn))
|
||||
setsockopt(cli_conn->t.sock.fd, SOL_SOCKET, SO_MARK, &rule->arg.mark, sizeof(rule->arg.mark));
|
||||
#endif
|
||||
break;
|
||||
@ -8589,6 +8592,7 @@ void http_capture_bad_message(struct error_snapshot *es, struct stream *s,
|
||||
struct http_msg *msg,
|
||||
enum ht_state state, struct proxy *other_end)
|
||||
{
|
||||
struct session *sess = strm_sess(s);
|
||||
struct channel *chn = msg->chn;
|
||||
int len1, len2;
|
||||
|
||||
@ -8610,8 +8614,8 @@ void http_capture_bad_message(struct error_snapshot *es, struct stream *s,
|
||||
es->sid = s->uniq_id;
|
||||
es->srv = objt_server(s->target);
|
||||
es->oe = other_end;
|
||||
if (objt_conn(s->si[0].end))
|
||||
es->src = __objt_conn(s->si[0].end)->addr.from;
|
||||
if (objt_conn(sess->origin))
|
||||
es->src = __objt_conn(sess->origin)->addr.from;
|
||||
else
|
||||
memset(&es->src, 0, sizeof(es->src));
|
||||
|
||||
@ -8765,10 +8769,12 @@ unsigned int http_get_fhdr(const struct http_msg *msg, const char *hname, int hl
|
||||
*/
|
||||
void debug_hdr(const char *dir, struct stream *s, const char *start, const char *end)
|
||||
{
|
||||
struct session *sess = strm_sess(s);
|
||||
int max;
|
||||
|
||||
chunk_printf(&trash, "%08x:%s.%s[%04x:%04x]: ", s->uniq_id, s->be->id,
|
||||
dir,
|
||||
objt_conn(s->si[0].end) ? (unsigned short)objt_conn(s->si[0].end)->t.sock.fd : -1,
|
||||
objt_conn(sess->origin) ? (unsigned short)objt_conn(sess->origin)->t.sock.fd : -1,
|
||||
objt_conn(s->si[1].end) ? (unsigned short)objt_conn(s->si[1].end)->t.sock.fd : -1);
|
||||
|
||||
for (max = 0; start + max < end; max++)
|
||||
@ -10585,7 +10591,8 @@ smp_fetch_base32_src(struct proxy *px, struct stream *l4, void *l7, unsigned int
|
||||
const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||
{
|
||||
struct chunk *temp;
|
||||
struct connection *cli_conn = objt_conn(l4->si[0].end);
|
||||
struct session *sess = strm_sess(l4);
|
||||
struct connection *cli_conn = objt_conn(sess->origin);
|
||||
|
||||
if (!cli_conn)
|
||||
return 0;
|
||||
@ -11374,7 +11381,8 @@ smp_fetch_url32_src(struct proxy *px, struct stream *l4, void *l7, unsigned int
|
||||
const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||
{
|
||||
struct chunk *temp;
|
||||
struct connection *cli_conn = objt_conn(l4->si[0].end);
|
||||
struct session *sess = strm_sess(l4);
|
||||
struct connection *cli_conn = objt_conn(sess->origin);
|
||||
|
||||
if (!smp_fetch_url32(px, l4, l7, opt, args, smp, kw, private))
|
||||
return 0;
|
||||
|
@ -1366,7 +1366,7 @@ int tcp_exec_req_rules(struct stream *s)
|
||||
struct tcp_rule *rule;
|
||||
struct stksess *ts;
|
||||
struct stktable *t = NULL;
|
||||
struct connection *conn = objt_conn(s->si[0].end);
|
||||
struct connection *conn = objt_conn(sess->origin);
|
||||
int result = 1;
|
||||
enum acl_test_res ret;
|
||||
|
||||
@ -1968,7 +1968,8 @@ static int
|
||||
smp_fetch_src(struct proxy *px, struct stream *l4, void *l7, unsigned int opt,
|
||||
const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||
{
|
||||
struct connection *cli_conn = objt_conn(l4->si[0].end);
|
||||
struct session *sess = strm_sess(l4);
|
||||
struct connection *cli_conn = objt_conn(sess->origin);
|
||||
|
||||
if (!cli_conn)
|
||||
return 0;
|
||||
@ -1995,7 +1996,8 @@ static int
|
||||
smp_fetch_sport(struct proxy *px, struct stream *l4, void *l7, unsigned int opt,
|
||||
const struct arg *args, struct sample *smp, const char *k, void *private)
|
||||
{
|
||||
struct connection *cli_conn = objt_conn(l4->si[0].end);
|
||||
struct session *sess = strm_sess(l4);
|
||||
struct connection *cli_conn = objt_conn(sess->origin);
|
||||
|
||||
if (!cli_conn)
|
||||
return 0;
|
||||
@ -2013,7 +2015,8 @@ static int
|
||||
smp_fetch_dst(struct proxy *px, struct stream *l4, void *l7, unsigned int opt,
|
||||
const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||
{
|
||||
struct connection *cli_conn = objt_conn(l4->si[0].end);
|
||||
struct session *sess = strm_sess(l4);
|
||||
struct connection *cli_conn = objt_conn(sess->origin);
|
||||
|
||||
if (!cli_conn)
|
||||
return 0;
|
||||
@ -2042,7 +2045,8 @@ static int
|
||||
smp_fetch_dport(struct proxy *px, struct stream *l4, void *l7, unsigned int opt,
|
||||
const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||
{
|
||||
struct connection *cli_conn = objt_conn(l4->si[0].end);
|
||||
struct session *sess = strm_sess(l4);
|
||||
struct connection *cli_conn = objt_conn(sess->origin);
|
||||
|
||||
if (!cli_conn)
|
||||
return 0;
|
||||
|
@ -77,6 +77,7 @@
|
||||
#include <proto/proxy.h>
|
||||
#include <proto/shctx.h>
|
||||
#include <proto/ssl_sock.h>
|
||||
#include <proto/stream.h>
|
||||
#include <proto/task.h>
|
||||
|
||||
/* Warning, these are bits, not integers! */
|
||||
@ -3087,11 +3088,12 @@ smp_fetch_ssl_fc_has_crt(struct proxy *px, struct stream *l4, void *l7, unsigned
|
||||
const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||
{
|
||||
struct connection *conn;
|
||||
struct session *sess = l4->sess;
|
||||
|
||||
if (!l4)
|
||||
return 0;
|
||||
|
||||
conn = objt_conn(l4->si[0].end);
|
||||
conn = objt_conn(sess->origin);
|
||||
if (!conn || conn->xprt != &ssl_sock)
|
||||
return 0;
|
||||
|
||||
@ -3119,12 +3121,13 @@ smp_fetch_ssl_x_der(struct proxy *px, struct stream *l4, void *l7, unsigned int
|
||||
X509 *crt = NULL;
|
||||
int ret = 0;
|
||||
struct chunk *smp_trash;
|
||||
struct session *sess = strm_sess(l4);
|
||||
struct connection *conn;
|
||||
|
||||
if (!l4)
|
||||
return 0;
|
||||
|
||||
conn = objt_conn(l4->si[0].end);
|
||||
conn = objt_conn(sess->origin);
|
||||
if (!conn || conn->xprt != &ssl_sock)
|
||||
return 0;
|
||||
|
||||
@ -3167,12 +3170,13 @@ smp_fetch_ssl_x_serial(struct proxy *px, struct stream *l4, void *l7, unsigned i
|
||||
X509 *crt = NULL;
|
||||
int ret = 0;
|
||||
struct chunk *smp_trash;
|
||||
struct session *sess = strm_sess(l4);
|
||||
struct connection *conn;
|
||||
|
||||
if (!l4)
|
||||
return 0;
|
||||
|
||||
conn = objt_conn(l4->si[0].end);
|
||||
conn = objt_conn(sess->origin);
|
||||
if (!conn || conn->xprt != &ssl_sock)
|
||||
return 0;
|
||||
|
||||
@ -3216,12 +3220,13 @@ smp_fetch_ssl_x_sha1(struct proxy *px, struct stream *l4, void *l7, unsigned int
|
||||
const EVP_MD *digest;
|
||||
int ret = 0;
|
||||
struct chunk *smp_trash;
|
||||
struct session *sess = strm_sess(l4);
|
||||
struct connection *conn;
|
||||
|
||||
if (!l4)
|
||||
return 0;
|
||||
|
||||
conn = objt_conn(l4->si[0].end);
|
||||
conn = objt_conn(sess->origin);
|
||||
if (!conn || conn->xprt != &ssl_sock)
|
||||
return 0;
|
||||
|
||||
@ -3263,12 +3268,13 @@ smp_fetch_ssl_x_notafter(struct proxy *px, struct stream *l4, void *l7, unsigned
|
||||
X509 *crt = NULL;
|
||||
int ret = 0;
|
||||
struct chunk *smp_trash;
|
||||
struct session *sess = strm_sess(l4);
|
||||
struct connection *conn;
|
||||
|
||||
if (!l4)
|
||||
return 0;
|
||||
|
||||
conn = objt_conn(l4->si[0].end);
|
||||
conn = objt_conn(sess->origin);
|
||||
if (!conn || conn->xprt != &ssl_sock)
|
||||
return 0;
|
||||
|
||||
@ -3311,12 +3317,13 @@ smp_fetch_ssl_x_i_dn(struct proxy *px, struct stream *l4, void *l7, unsigned int
|
||||
X509_NAME *name;
|
||||
int ret = 0;
|
||||
struct chunk *smp_trash;
|
||||
struct session *sess = strm_sess(l4);
|
||||
struct connection *conn;
|
||||
|
||||
if (!l4)
|
||||
return 0;
|
||||
|
||||
conn = objt_conn(l4->si[0].end);
|
||||
conn = objt_conn(sess->origin);
|
||||
if (!conn || conn->xprt != &ssl_sock)
|
||||
return 0;
|
||||
|
||||
@ -3373,12 +3380,13 @@ smp_fetch_ssl_x_notbefore(struct proxy *px, struct stream *l4, void *l7, unsigne
|
||||
X509 *crt = NULL;
|
||||
int ret = 0;
|
||||
struct chunk *smp_trash;
|
||||
struct session *sess = strm_sess(l4);
|
||||
struct connection *conn;
|
||||
|
||||
if (!l4)
|
||||
return 0;
|
||||
|
||||
conn = objt_conn(l4->si[0].end);
|
||||
conn = objt_conn(sess->origin);
|
||||
if (!conn || conn->xprt != &ssl_sock)
|
||||
return 0;
|
||||
|
||||
@ -3421,12 +3429,13 @@ smp_fetch_ssl_x_s_dn(struct proxy *px, struct stream *l4, void *l7, unsigned int
|
||||
X509_NAME *name;
|
||||
int ret = 0;
|
||||
struct chunk *smp_trash;
|
||||
struct session *sess = strm_sess(l4);
|
||||
struct connection *conn;
|
||||
|
||||
if (!l4)
|
||||
return 0;
|
||||
|
||||
conn = objt_conn(l4->si[0].end);
|
||||
conn = objt_conn(sess->origin);
|
||||
if (!conn || conn->xprt != &ssl_sock)
|
||||
return 0;
|
||||
|
||||
@ -3477,12 +3486,13 @@ smp_fetch_ssl_c_used(struct proxy *px, struct stream *l4, void *l7, unsigned int
|
||||
const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||
{
|
||||
X509 *crt;
|
||||
struct session *sess = strm_sess(l4);
|
||||
struct connection *conn;
|
||||
|
||||
if (!l4)
|
||||
return 0;
|
||||
|
||||
conn = objt_conn(l4->si[0].end);
|
||||
conn = objt_conn(sess->origin);
|
||||
if (!conn || conn->xprt != &ssl_sock)
|
||||
return 0;
|
||||
|
||||
@ -3512,12 +3522,13 @@ smp_fetch_ssl_x_version(struct proxy *px, struct stream *l4, void *l7, unsigned
|
||||
{
|
||||
int cert_peer = (kw[4] == 'c') ? 1 : 0;
|
||||
X509 *crt;
|
||||
struct session *sess = strm_sess(l4);
|
||||
struct connection *conn;
|
||||
|
||||
if (!l4)
|
||||
return 0;
|
||||
|
||||
conn = objt_conn(l4->si[0].end);
|
||||
conn = objt_conn(sess->origin);
|
||||
if (!conn || conn->xprt != &ssl_sock)
|
||||
return 0;
|
||||
|
||||
@ -3553,12 +3564,13 @@ smp_fetch_ssl_x_sig_alg(struct proxy *px, struct stream *l4, void *l7, unsigned
|
||||
int cert_peer = (kw[4] == 'c') ? 1 : 0;
|
||||
X509 *crt;
|
||||
int nid;
|
||||
struct session *sess = strm_sess(l4);
|
||||
struct connection *conn;
|
||||
|
||||
if (!l4)
|
||||
return 0;
|
||||
|
||||
conn = objt_conn(l4->si[0].end);
|
||||
conn = objt_conn(sess->origin);
|
||||
if (!conn || conn->xprt != &ssl_sock)
|
||||
return 0;
|
||||
|
||||
@ -3605,12 +3617,13 @@ smp_fetch_ssl_x_key_alg(struct proxy *px, struct stream *l4, void *l7, unsigned
|
||||
int cert_peer = (kw[4] == 'c') ? 1 : 0;
|
||||
X509 *crt;
|
||||
int nid;
|
||||
struct session *sess = strm_sess(l4);
|
||||
struct connection *conn;
|
||||
|
||||
if (!l4)
|
||||
return 0;
|
||||
|
||||
conn = objt_conn(l4->si[0].end);
|
||||
conn = objt_conn(sess->origin);
|
||||
if (!conn || conn->xprt != &ssl_sock)
|
||||
return 0;
|
||||
|
||||
@ -3667,7 +3680,8 @@ smp_fetch_ssl_fc_has_sni(struct proxy *px, struct stream *l4, void *l7, unsigned
|
||||
const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||
{
|
||||
#ifdef SSL_CTRL_SET_TLSEXT_HOSTNAME
|
||||
struct connection *conn = objt_conn(l4->si[0].end);
|
||||
struct session *sess = strm_sess(l4);
|
||||
struct connection *conn = objt_conn(sess->origin);
|
||||
|
||||
smp->type = SMP_T_BOOL;
|
||||
smp->data.uint = (conn && conn->xprt == &ssl_sock) &&
|
||||
@ -3774,6 +3788,7 @@ smp_fetch_ssl_fc_npn(struct proxy *px, struct stream *l4, void *l7, unsigned int
|
||||
const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||
{
|
||||
struct connection *conn;
|
||||
struct session *sess = strm_sess(l4);
|
||||
|
||||
smp->flags = SMP_F_CONST;
|
||||
smp->type = SMP_T_STR;
|
||||
@ -3781,7 +3796,7 @@ smp_fetch_ssl_fc_npn(struct proxy *px, struct stream *l4, void *l7, unsigned int
|
||||
if (!l4)
|
||||
return 0;
|
||||
|
||||
conn = objt_conn(l4->si[0].end);
|
||||
conn = objt_conn(sess->origin);
|
||||
if (!conn || !conn->xprt_ctx || conn->xprt != &ssl_sock)
|
||||
return 0;
|
||||
|
||||
@ -3802,6 +3817,7 @@ smp_fetch_ssl_fc_alpn(struct proxy *px, struct stream *l4, void *l7, unsigned in
|
||||
const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||
{
|
||||
struct connection *conn;
|
||||
struct session *sess = strm_sess(l4);
|
||||
|
||||
smp->flags = SMP_F_CONST;
|
||||
smp->type = SMP_T_STR;
|
||||
@ -3809,7 +3825,7 @@ smp_fetch_ssl_fc_alpn(struct proxy *px, struct stream *l4, void *l7, unsigned in
|
||||
if (!l4)
|
||||
return 0;
|
||||
|
||||
conn = objt_conn(l4->si[0].end);
|
||||
conn = objt_conn(sess->origin);
|
||||
if (!conn || !conn->xprt_ctx || conn->xprt != &ssl_sock)
|
||||
return 0;
|
||||
|
||||
@ -3898,6 +3914,7 @@ smp_fetch_ssl_fc_sni(struct proxy *px, struct stream *l4, void *l7, unsigned int
|
||||
{
|
||||
#ifdef SSL_CTRL_SET_TLSEXT_HOSTNAME
|
||||
struct connection *conn;
|
||||
struct session *sess = strm_sess(l4);
|
||||
|
||||
smp->flags = SMP_F_CONST;
|
||||
smp->type = SMP_T_STR;
|
||||
@ -3905,7 +3922,7 @@ smp_fetch_ssl_fc_sni(struct proxy *px, struct stream *l4, void *l7, unsigned int
|
||||
if (!l4)
|
||||
return 0;
|
||||
|
||||
conn = objt_conn(l4->si[0].end);
|
||||
conn = objt_conn(sess->origin);
|
||||
if (!conn || !conn->xprt_ctx || conn->xprt != &ssl_sock)
|
||||
return 0;
|
||||
|
||||
@ -3968,12 +3985,13 @@ static int
|
||||
smp_fetch_ssl_c_ca_err(struct proxy *px, struct stream *l4, void *l7, unsigned int opt,
|
||||
const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||
{
|
||||
struct session *sess = strm_sess(l4);
|
||||
struct connection *conn;
|
||||
|
||||
if (!l4)
|
||||
return 0;
|
||||
|
||||
conn = objt_conn(l4->si[0].end);
|
||||
conn = objt_conn(sess->origin);
|
||||
if (!conn || conn->xprt != &ssl_sock)
|
||||
return 0;
|
||||
|
||||
@ -3994,12 +4012,13 @@ static int
|
||||
smp_fetch_ssl_c_ca_err_depth(struct proxy *px, struct stream *l4, void *l7, unsigned int opt,
|
||||
const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||
{
|
||||
struct session *sess = strm_sess(l4);
|
||||
struct connection *conn;
|
||||
|
||||
if (!l4)
|
||||
return 0;
|
||||
|
||||
conn = objt_conn(l4->si[0].end);
|
||||
conn = objt_conn(sess->origin);
|
||||
if (!conn || conn->xprt != &ssl_sock)
|
||||
return 0;
|
||||
|
||||
@ -4020,12 +4039,13 @@ static int
|
||||
smp_fetch_ssl_c_err(struct proxy *px, struct stream *l4, void *l7, unsigned int opt,
|
||||
const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||
{
|
||||
struct session *sess = strm_sess(l4);
|
||||
struct connection *conn;
|
||||
|
||||
if (!l4)
|
||||
return 0;
|
||||
|
||||
conn = objt_conn(l4->si[0].end);
|
||||
conn = objt_conn(sess->origin);
|
||||
if (!conn || conn->xprt != &ssl_sock)
|
||||
return 0;
|
||||
|
||||
@ -4046,12 +4066,13 @@ static int
|
||||
smp_fetch_ssl_c_verify(struct proxy *px, struct stream *l4, void *l7, unsigned int opt,
|
||||
const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||
{
|
||||
struct session *sess = strm_sess(l4);
|
||||
struct connection *conn;
|
||||
|
||||
if (!l4)
|
||||
return 0;
|
||||
|
||||
conn = objt_conn(l4->si[0].end);
|
||||
conn = objt_conn(sess->origin);
|
||||
if (!conn || conn->xprt != &ssl_sock)
|
||||
return 0;
|
||||
|
||||
|
11
src/stream.c
11
src/stream.c
@ -592,9 +592,10 @@ int stream_complete(struct stream *s)
|
||||
static void stream_free(struct stream *s)
|
||||
{
|
||||
struct http_txn *txn = &s->txn;
|
||||
struct proxy *fe = strm_sess(s)->fe;
|
||||
struct session *sess = strm_sess(s);
|
||||
struct proxy *fe = sess->fe;
|
||||
struct bref *bref, *back;
|
||||
struct connection *cli_conn = objt_conn(s->si[0].end);
|
||||
struct connection *cli_conn = objt_conn(sess->origin);
|
||||
int i;
|
||||
|
||||
if (s->pend_pos)
|
||||
@ -2910,6 +2911,7 @@ void stream_shutdown(struct stream *stream, int why)
|
||||
struct stkctr *
|
||||
smp_fetch_sc_stkctr(struct stream *l4, const struct arg *args, const char *kw)
|
||||
{
|
||||
struct session *sess = strm_sess(l4);
|
||||
static struct stkctr stkctr;
|
||||
struct stksess *stksess;
|
||||
unsigned int num = kw[2] - '0';
|
||||
@ -2923,7 +2925,7 @@ smp_fetch_sc_stkctr(struct stream *l4, const struct arg *args, const char *kw)
|
||||
}
|
||||
else if (num > 9) { /* src_* variant, args[0] = table */
|
||||
struct stktable_key *key;
|
||||
struct connection *conn = objt_conn(l4->si[0].end);
|
||||
struct connection *conn = objt_conn(sess->origin);
|
||||
|
||||
if (!conn)
|
||||
return NULL;
|
||||
@ -3144,7 +3146,8 @@ static int
|
||||
smp_fetch_src_updt_conn_cnt(struct proxy *px, struct stream *l4, void *l7, unsigned int opt,
|
||||
const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||
{
|
||||
struct connection *conn = objt_conn(l4->si[0].end);
|
||||
struct session *sess = strm_sess(l4);
|
||||
struct connection *conn = objt_conn(sess->origin);
|
||||
struct stksess *ts;
|
||||
struct stktable_key *key;
|
||||
void *ptr;
|
||||
|
Loading…
Reference in New Issue
Block a user