From: Christopher Faulet Date: Mon, 20 Dec 2021 16:09:39 +0000 (+0100) Subject: MEDIUM: applet: Set the conn-stream as appctx owner instead of the stream-int X-Git-Tag: v2.6-dev2~47 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=86e1c3381bcead4a339f3b32234fbac61fafd6b5;p=thirdparty%2Fhaproxy.git MEDIUM: applet: Set the conn-stream as appctx owner instead of the stream-int Because appctx is now an endpoint of the conn-stream, there is no reason to still have the stream-interface as appctx owner. Thus, the conn-stream is now the appctx owner. --- diff --git a/addons/promex/service-prometheus.c b/addons/promex/service-prometheus.c index ef217007d2..5158d3233c 100644 --- a/addons/promex/service-prometheus.c +++ b/addons/promex/service-prometheus.c @@ -543,7 +543,7 @@ static int promex_dump_global_metrics(struct appctx *appctx, struct htx *htx) { static struct ist prefix = IST("haproxy_process_"); struct field val; - struct channel *chn = si_ic(appctx->owner); + struct channel *chn = si_ic(cs_si(appctx->owner)); struct ist out = ist2(trash.area, 0); size_t max = htx_get_max_blksz(htx, channel_htx_recv_max(chn, htx)); int ret = 1; @@ -594,7 +594,7 @@ static int promex_dump_front_metrics(struct appctx *appctx, struct htx *htx) static struct ist prefix = IST("haproxy_frontend_"); struct proxy *px; struct field val; - struct channel *chn = si_ic(appctx->owner); + struct channel *chn = si_ic(cs_si(appctx->owner)); struct ist out = ist2(trash.area, 0); size_t max = htx_get_max_blksz(htx, channel_htx_recv_max(chn, htx)); struct field *stats = stat_l[STATS_DOMAIN_PROXY]; @@ -694,7 +694,7 @@ static int promex_dump_listener_metrics(struct appctx *appctx, struct htx *htx) static struct ist prefix = IST("haproxy_listener_"); struct proxy *px; struct field val; - struct channel *chn = si_ic(appctx->owner); + struct channel *chn = si_ic(cs_si(appctx->owner)); struct ist out = ist2(trash.area, 0); size_t max = htx_get_max_blksz(htx, channel_htx_recv_max(chn, htx)); struct field *stats = stat_l[STATS_DOMAIN_PROXY]; @@ -785,7 +785,7 @@ static int promex_dump_back_metrics(struct appctx *appctx, struct htx *htx) struct proxy *px; struct server *sv; struct field val; - struct channel *chn = si_ic(appctx->owner); + struct channel *chn = si_ic(cs_si(appctx->owner)); struct ist out = ist2(trash.area, 0); size_t max = htx_get_max_blksz(htx, channel_htx_recv_max(chn, htx)); struct field *stats = stat_l[STATS_DOMAIN_PROXY]; @@ -938,7 +938,7 @@ static int promex_dump_srv_metrics(struct appctx *appctx, struct htx *htx) struct proxy *px; struct server *sv; struct field val; - struct channel *chn = si_ic(appctx->owner); + struct channel *chn = si_ic(cs_si(appctx->owner)); struct ist out = ist2(trash.area, 0); size_t max = htx_get_max_blksz(htx, channel_htx_recv_max(chn, htx)); struct field *stats = stat_l[STATS_DOMAIN_PROXY]; @@ -1107,7 +1107,7 @@ static int promex_dump_sticktable_metrics(struct appctx *appctx, struct htx *htx { static struct ist prefix = IST("haproxy_sticktable_"); struct field val; - struct channel *chn = si_ic(appctx->owner); + struct channel *chn = si_ic(cs_si(appctx->owner)); struct ist out = ist2(trash.area, 0); size_t max = htx_get_max_blksz(htx, channel_htx_recv_max(chn, htx)); int ret = 1; @@ -1427,7 +1427,7 @@ static int promex_parse_uri(struct appctx *appctx, struct stream_interface *si) * full. */ static int promex_send_headers(struct appctx *appctx, struct stream_interface *si, struct htx *htx) { - struct channel *chn = si_ic(appctx->owner); + struct channel *chn = si_ic(cs_si(appctx->owner)); struct htx_sl *sl; unsigned int flags; @@ -1463,7 +1463,7 @@ static int promex_appctx_init(struct appctx *appctx, struct proxy *px, struct st /* The main I/O handler for the promex applet. */ static void promex_appctx_handle_io(struct appctx *appctx) { - struct stream_interface *si = appctx->owner; + struct stream_interface *si = cs_si(appctx->owner); struct stream *s = si_strm(si); struct channel *req = si_oc(si); struct channel *res = si_ic(si); diff --git a/include/haproxy/applet-t.h b/include/haproxy/applet-t.h index faa399ed5d..da8dfc87d8 100644 --- a/include/haproxy/applet-t.h +++ b/include/haproxy/applet-t.h @@ -58,7 +58,7 @@ struct appctx { struct buffer *chunk; /* used to store unfinished commands */ unsigned int st2; /* output state for stats, unused by peers */ struct applet *applet; /* applet this context refers to */ - void *owner; /* pointer to upper layer's entity (eg: stream interface) */ + void *owner; /* pointer to upper layer's entity (eg: conn_stream) */ struct act_rule *rule; /* rule associated with the applet. */ int (*io_handler)(struct appctx *appctx); /* used within the cli_io_handler when st0 = CLI_ST_CALLBACK */ void (*io_release)(struct appctx *appctx); /* used within the cli_io_handler when st0 = CLI_ST_CALLBACK, diff --git a/include/haproxy/conn_stream.h b/include/haproxy/conn_stream.h index 723265a596..c7f736d2e4 100644 --- a/include/haproxy/conn_stream.h +++ b/include/haproxy/conn_stream.h @@ -86,6 +86,11 @@ static inline struct appctx *cs_appctx(const struct conn_stream *cs) return (cs ? objt_appctx(cs->end) : NULL); } +static inline struct stream_interface *cs_si(const struct conn_stream *cs) +{ + return ((cs_conn(cs) || cs_appctx(cs)) ? cs->data : NULL); +} + /* Attaches a conn_stream to a data layer and sets the relevant callbacks */ static inline void cs_attach(struct conn_stream *cs, void *data, const struct data_cb *data_cb) { diff --git a/include/haproxy/stream_interface.h b/include/haproxy/stream_interface.h index 81089660d5..314f54c5a0 100644 --- a/include/haproxy/stream_interface.h +++ b/include/haproxy/stream_interface.h @@ -193,7 +193,7 @@ static inline void si_attach_cs(struct stream_interface *si, struct conn_stream struct appctx *appctx = cs_appctx(cs); si->ops = &si_applet_ops; - appctx->owner = si; + appctx->owner = cs; cs_attach(cs, si, NULL); } else { @@ -221,7 +221,7 @@ static inline void si_attach_appctx(struct stream_interface *si, struct appctx * { si_reset_endpoint(si); cs_init(si->cs, &appctx->obj_type); - appctx->owner = si; + appctx->owner = si->cs; si_attach_cs(si, si->cs); } diff --git a/src/activity.c b/src/activity.c index aab0b3c2b9..7386247d9c 100644 --- a/src/activity.c +++ b/src/activity.c @@ -610,7 +610,7 @@ static int cli_io_handler_show_profiling(struct appctx *appctx) unsigned long long tot_alloc_calls, tot_free_calls; unsigned long long tot_alloc_bytes, tot_free_bytes; #endif - struct stream_interface *si = appctx->owner; + struct stream_interface *si = cs_si(appctx->owner); struct buffer *name_buffer = get_trash_chunk(); const char *str; int max_lines; @@ -837,7 +837,7 @@ static int cli_parse_show_profiling(char **args, char *payload, struct appctx *a static int cli_io_handler_show_tasks(struct appctx *appctx) { struct sched_activity tmp_activity[256] __attribute__((aligned(64))); - struct stream_interface *si = appctx->owner; + struct stream_interface *si = cs_si(appctx->owner); struct buffer *name_buffer = get_trash_chunk(); struct sched_activity *entry; const struct tasklet *tl; diff --git a/src/applet.c b/src/applet.c index 7d1ec289b0..ff7381da2d 100644 --- a/src/applet.c +++ b/src/applet.c @@ -35,7 +35,7 @@ DECLARE_POOL(pool_head_appctx, "appctx", sizeof(struct appctx)); int appctx_buf_available(void *arg) { struct appctx *appctx = arg; - struct stream_interface *si = appctx->owner; + struct stream_interface *si = cs_si(appctx->owner); /* allocation requested ? */ if (!(si->flags & SI_FL_RXBLK_BUFF)) @@ -61,7 +61,7 @@ int appctx_buf_available(void *arg) struct task *task_run_applet(struct task *t, void *context, unsigned int state) { struct appctx *app = context; - struct stream_interface *si = app->owner; + struct stream_interface *si; unsigned int rate; size_t count; @@ -70,6 +70,8 @@ struct task *task_run_applet(struct task *t, void *context, unsigned int state) return NULL; } + si = cs_si(app->owner); + /* We always pretend the applet can't get and doesn't want to * put, it's up to it to change this if needed. This ensures * that one applet which ignores any event will not spin. @@ -112,4 +114,3 @@ struct task *task_run_applet(struct task *t, void *context, unsigned int state) channel_release_buffer(si_ic(si), &app->buffer_wait); return t; } - diff --git a/src/cache.c b/src/cache.c index d73696912e..ac4c6827f1 100644 --- a/src/cache.c +++ b/src/cache.c @@ -1272,7 +1272,7 @@ static unsigned int htx_cache_dump_blk(struct appctx *appctx, struct htx *htx, e unsigned int max, total; uint32_t blksz; - max = htx_get_max_blksz(htx, channel_htx_recv_max(si_ic(appctx->owner), htx)); + max = htx_get_max_blksz(htx, channel_htx_recv_max(si_ic(cs_si(appctx->owner)), htx)); if (!max) return 0; blksz = ((type == HTX_BLK_HDR || type == HTX_BLK_TLR) @@ -1315,7 +1315,7 @@ static unsigned int htx_cache_dump_data_blk(struct appctx *appctx, struct htx *h unsigned int max, total, rem_data; uint32_t blksz; - max = htx_get_max_blksz(htx, channel_htx_recv_max(si_ic(appctx->owner), htx)); + max = htx_get_max_blksz(htx, channel_htx_recv_max(si_ic(cs_si(appctx->owner)), htx)); if (!max) return 0; @@ -1429,7 +1429,7 @@ static void http_cache_io_handler(struct appctx *appctx) { struct cache_entry *cache_ptr = appctx->ctx.cache.entry; struct shared_block *first = block_ptr(cache_ptr); - struct stream_interface *si = appctx->owner; + struct stream_interface *si = cs_si(appctx->owner); struct channel *req = si_oc(si); struct channel *res = si_ic(si); struct htx *req_htx, *res_htx; @@ -2563,7 +2563,7 @@ static int cli_parse_show_cache(char **args, char *payload, struct appctx *appct static int cli_io_handler_show_cache(struct appctx *appctx) { struct cache* cache = appctx->ctx.cli.p0; - struct stream_interface *si = appctx->owner; + struct stream_interface *si = cs_si(appctx->owner); if (cache == NULL) { cache = LIST_ELEM((caches).n, typeof(struct cache *), list); diff --git a/src/cli.c b/src/cli.c index c8891129e7..b3a5fffb6e 100644 --- a/src/cli.c +++ b/src/cli.c @@ -669,7 +669,7 @@ static int cli_get_severity_output(struct appctx *appctx) { if (appctx->cli_severity_output) return appctx->cli_severity_output; - return strm_li(si_strm(appctx->owner))->bind_conf->severity_output; + return strm_li(si_strm(cs_si(appctx->owner)))->bind_conf->severity_output; } /* Processes the CLI interpreter on the stats socket. This function is called @@ -837,7 +837,7 @@ static int cli_output_msg(struct channel *chn, const char *msg, int severity, in */ static void cli_io_handler(struct appctx *appctx) { - struct stream_interface *si = appctx->owner; + struct stream_interface *si = cs_si(appctx->owner); struct channel *req = si_oc(si); struct channel *res = si_ic(si); struct bind_conf *bind_conf = strm_li(si_strm(si))->bind_conf; @@ -1160,7 +1160,7 @@ static void cli_release_handler(struct appctx *appctx) */ static int cli_io_handler_show_env(struct appctx *appctx) { - struct stream_interface *si = appctx->owner; + struct stream_interface *si = cs_si(appctx->owner); char **var = appctx->ctx.cli.p0; if (unlikely(si_ic(si)->flags & (CF_WRITE_ERROR|CF_SHUTW))) @@ -1195,7 +1195,7 @@ static int cli_io_handler_show_env(struct appctx *appctx) */ static int cli_io_handler_show_fd(struct appctx *appctx) { - struct stream_interface *si = appctx->owner; + struct stream_interface *si = cs_si(appctx->owner); int fd = appctx->ctx.cli.i0; int ret = 1; @@ -1394,7 +1394,7 @@ static int cli_io_handler_show_fd(struct appctx *appctx) */ static int cli_io_handler_show_activity(struct appctx *appctx) { - struct stream_interface *si = appctx->owner; + struct stream_interface *si = cs_si(appctx->owner); int thr; if (unlikely(si_ic(si)->flags & (CF_WRITE_ERROR|CF_SHUTW))) @@ -1497,7 +1497,7 @@ static int cli_io_handler_show_activity(struct appctx *appctx) static int cli_io_handler_show_cli_sock(struct appctx *appctx) { struct bind_conf *bind_conf; - struct stream_interface *si = appctx->owner; + struct stream_interface *si = cs_si(appctx->owner); chunk_reset(&trash); @@ -1634,7 +1634,7 @@ static int cli_parse_show_fd(char **args, char *payload, struct appctx *appctx, /* parse a "set timeout" CLI request. It always returns 1. */ static int cli_parse_set_timeout(char **args, char *payload, struct appctx *appctx, void *private) { - struct stream_interface *si = appctx->owner; + struct stream_interface *si = cs_si(appctx->owner); struct stream *s = si_strm(si); if (strcmp(args[2], "cli") == 0) { @@ -1918,7 +1918,7 @@ static int _getsocks(char **args, char *payload, struct appctx *appctx, void *pr char *cmsgbuf = NULL; unsigned char *tmpbuf = NULL; struct cmsghdr *cmsg; - struct stream_interface *si = appctx->owner; + struct stream_interface *si = cs_si(appctx->owner); struct stream *s = si_strm(si); struct connection *remote = cs_conn(si_opposite(si)->cs); struct msghdr msghdr; diff --git a/src/debug.c b/src/debug.c index 1a69697e7f..0d4a3f3038 100644 --- a/src/debug.c +++ b/src/debug.c @@ -249,7 +249,7 @@ void ha_task_dump(struct buffer *buf, const struct task *task, const char *pfx) if (task->process == process_stream && task->context) s = (struct stream *)task->context; else if (task->process == task_run_applet && task->context) - s = si_strm(((struct appctx *)task->context)->owner); + s = si_strm(cs_si(((struct appctx *)task->context)->owner)); else if (task->process == si_cs_io_cb && task->context) s = si_strm((struct stream_interface *)task->context); @@ -288,7 +288,7 @@ void ha_task_dump(struct buffer *buf, const struct task *task, const char *pfx) */ static int cli_io_handler_show_threads(struct appctx *appctx) { - struct stream_interface *si = appctx->owner; + struct stream_interface *si = cs_si(appctx->owner); int thr; if (unlikely(si_ic(si)->flags & (CF_WRITE_ERROR|CF_SHUTW))) @@ -632,7 +632,7 @@ static int debug_parse_cli_write(char **args, char *payload, struct appctx *appc */ static int debug_parse_cli_stream(char **args, char *payload, struct appctx *appctx, void *private) { - struct stream *s = si_strm(appctx->owner); + struct stream *s = si_strm(cs_si(appctx->owner)); int arg; void *ptr; int size; @@ -1182,7 +1182,7 @@ static int debug_parse_cli_memstats(char **args, char *payload, struct appctx *a */ static int debug_iohandler_memstats(struct appctx *appctx) { - struct stream_interface *si = appctx->owner; + struct stream_interface *si = cs_si(appctx->owner); struct mem_stats *ptr = appctx->ctx.cli.p0; int ret = 1; diff --git a/src/dns.c b/src/dns.c index 2caa5ad27b..719aed6f0a 100644 --- a/src/dns.c +++ b/src/dns.c @@ -407,7 +407,7 @@ out: */ static void dns_session_io_handler(struct appctx *appctx) { - struct stream_interface *si = appctx->owner; + struct stream_interface *si = cs_si(appctx->owner); struct dns_session *ds = appctx->ctx.sft.ptr; struct ring *ring = &ds->ring; struct buffer *buf = &ring->buf; diff --git a/src/flt_spoe.c b/src/flt_spoe.c index 8b2de432c6..a12d75daab 100644 --- a/src/flt_spoe.c +++ b/src/flt_spoe.c @@ -1135,7 +1135,7 @@ spoe_handle_healthcheck_response(char *frame, size_t size, char *err, int errlen static int spoe_send_frame(struct appctx *appctx, char *buf, size_t framesz) { - struct stream_interface *si = appctx->owner; + struct stream_interface *si = cs_si(appctx->owner); int ret; uint32_t netint; @@ -1161,7 +1161,7 @@ spoe_send_frame(struct appctx *appctx, char *buf, size_t framesz) static int spoe_recv_frame(struct appctx *appctx, char *buf, size_t framesz) { - struct stream_interface *si = appctx->owner; + struct stream_interface *si = cs_si(appctx->owner); int ret; uint32_t netint; @@ -1190,8 +1190,8 @@ spoe_recv_frame(struct appctx *appctx, char *buf, size_t framesz) static int spoe_wakeup_appctx(struct appctx *appctx) { - si_want_get(appctx->owner); - si_rx_endp_more(appctx->owner); + si_want_get(cs_si(appctx->owner)); + si_rx_endp_more(cs_si(appctx->owner)); appctx_wakeup(appctx); return 1; } @@ -1217,7 +1217,7 @@ spoe_process_appctx(struct task * task, void *context, unsigned int state) static void spoe_release_appctx(struct appctx *appctx) { - struct stream_interface *si = appctx->owner; + struct stream_interface *si = cs_si(appctx->owner); struct spoe_appctx *spoe_appctx = SPOE_APPCTX(appctx); struct spoe_agent *agent; struct spoe_context *ctx, *back; @@ -1337,7 +1337,7 @@ spoe_release_appctx(struct appctx *appctx) static int spoe_handle_connect_appctx(struct appctx *appctx) { - struct stream_interface *si = appctx->owner; + struct stream_interface *si = cs_si(appctx->owner); struct spoe_agent *agent = SPOE_APPCTX(appctx)->agent; char *frame, *buf; int ret; @@ -1403,7 +1403,7 @@ spoe_handle_connect_appctx(struct appctx *appctx) static int spoe_handle_connecting_appctx(struct appctx *appctx) { - struct stream_interface *si = appctx->owner; + struct stream_interface *si = cs_si(appctx->owner); struct spoe_agent *agent = SPOE_APPCTX(appctx)->agent; char *frame; int ret; @@ -1648,7 +1648,7 @@ spoe_handle_receiving_frame_appctx(struct appctx *appctx, int *skip) /* Do not forget to remove processed frame from the output buffer */ if (trash.data) - co_skip(si_oc(appctx->owner), trash.data); + co_skip(si_oc(cs_si(appctx->owner)), trash.data); end: return ret; } @@ -1656,7 +1656,7 @@ spoe_handle_receiving_frame_appctx(struct appctx *appctx, int *skip) static int spoe_handle_processing_appctx(struct appctx *appctx) { - struct stream_interface *si = appctx->owner; + struct stream_interface *si = cs_si(appctx->owner); struct server *srv = objt_server(si_strm(si)->target); struct spoe_agent *agent = SPOE_APPCTX(appctx)->agent; int ret, skip_sending = 0, skip_receiving = 0, active_s = 0, active_r = 0, close_asap = 0; @@ -1779,7 +1779,7 @@ spoe_handle_processing_appctx(struct appctx *appctx) static int spoe_handle_disconnect_appctx(struct appctx *appctx) { - struct stream_interface *si = appctx->owner; + struct stream_interface *si = cs_si(appctx->owner); struct spoe_agent *agent = SPOE_APPCTX(appctx)->agent; char *frame, *buf; int ret; @@ -1832,7 +1832,7 @@ spoe_handle_disconnect_appctx(struct appctx *appctx) static int spoe_handle_disconnecting_appctx(struct appctx *appctx) { - struct stream_interface *si = appctx->owner; + struct stream_interface *si = cs_si(appctx->owner); char *frame; int ret; @@ -1883,7 +1883,7 @@ spoe_handle_disconnecting_appctx(struct appctx *appctx) next: /* Do not forget to remove processed frame from the output buffer */ if (trash.data) - co_skip(si_oc(appctx->owner), trash.data); + co_skip(si_oc(cs_si(appctx->owner)), trash.data); return 0; stop: @@ -1897,7 +1897,7 @@ spoe_handle_disconnecting_appctx(struct appctx *appctx) static void spoe_handle_appctx(struct appctx *appctx) { - struct stream_interface *si = appctx->owner; + struct stream_interface *si = cs_si(appctx->owner); struct spoe_agent *agent; if (SPOE_APPCTX(appctx) == NULL) diff --git a/src/hlua.c b/src/hlua.c index c61e666678..35ed2e5bb6 100644 --- a/src/hlua.c +++ b/src/hlua.c @@ -1905,7 +1905,7 @@ __LJMP static struct hlua_socket *hlua_checksocket(lua_State *L, int ud) */ static void hlua_socket_handler(struct appctx *appctx) { - struct stream_interface *si = appctx->owner; + struct stream_interface *si = cs_si(appctx->owner); if (appctx->ctx.hlua_cosocket.die) { si_shutw(si); @@ -2101,7 +2101,7 @@ __LJMP static int hlua_socket_receive_yield(struct lua_State *L, int status, lua if (!peer) goto no_peer; appctx = container_of(peer, struct appctx, ctx.hlua_cosocket.xref); - si = appctx->owner; + si = cs_si(appctx->owner); s = si_strm(si); oc = &s->res; @@ -2340,7 +2340,7 @@ static int hlua_socket_write_yield(struct lua_State *L,int status, lua_KContext return 1; } appctx = container_of(peer, struct appctx, ctx.hlua_cosocket.xref); - si = appctx->owner; + si = cs_si(appctx->owner); s = si_strm(si); /* Check for connection close. */ @@ -2573,7 +2573,7 @@ __LJMP static int hlua_socket_getpeername(struct lua_State *L) return 1; } appctx = container_of(peer, struct appctx, ctx.hlua_cosocket.xref); - si = appctx->owner; + si = cs_si(appctx->owner); dst = si_dst(si_opposite(si)); if (!dst) { xref_unlock(&socket->xref, peer); @@ -2614,7 +2614,7 @@ static int hlua_socket_getsockname(struct lua_State *L) return 1; } appctx = container_of(peer, struct appctx, ctx.hlua_cosocket.xref); - si = appctx->owner; + si = cs_si(appctx->owner); s = si_strm(si); conn = cs_conn(s->si[1].cs); @@ -2665,7 +2665,7 @@ __LJMP static int hlua_socket_connect_yield(struct lua_State *L, int status, lua return 2; } appctx = container_of(peer, struct appctx, ctx.hlua_cosocket.xref); - si = appctx->owner; + si = cs_si(appctx->owner); s = si_strm(si); /* Check if we run on the same thread than the xreator thread. @@ -2777,7 +2777,7 @@ __LJMP static int hlua_socket_connect(struct lua_State *L) } appctx = container_of(peer, struct appctx, ctx.hlua_cosocket.xref); - si = appctx->owner; + si = cs_si(appctx->owner); s = si_strm(si); if (!sockaddr_alloc(&si_opposite(si)->dst, addr, sizeof(*addr))) { @@ -2833,7 +2833,7 @@ __LJMP static int hlua_socket_connect_ssl(struct lua_State *L) return 1; } appctx = container_of(peer, struct appctx, ctx.hlua_cosocket.xref); - si = appctx->owner; + si = cs_si(appctx->owner); s = si_strm(si); s->target = &socket_ssl->obj_type; @@ -2889,7 +2889,7 @@ __LJMP static int hlua_socket_settimeout(struct lua_State *L) return 0; } appctx = container_of(peer, struct appctx, ctx.hlua_cosocket.xref); - si = appctx->owner; + si = cs_si(appctx->owner); s = si_strm(si); s->sess->fe->timeout.connect = tmout; @@ -4269,7 +4269,7 @@ __LJMP static struct hlua_appctx *hlua_checkapplet_tcp(lua_State *L, int ud) static int hlua_applet_tcp_new(lua_State *L, struct appctx *ctx) { struct hlua_appctx *luactx; - struct stream_interface *si = ctx->owner; + struct stream_interface *si = cs_si(ctx->owner); struct stream *s = si_strm(si); struct proxy *p = s->be; @@ -4450,7 +4450,7 @@ __LJMP static int hlua_applet_tcp_get_priv(lua_State *L) __LJMP static int hlua_applet_tcp_getline_yield(lua_State *L, int status, lua_KContext ctx) { struct hlua_appctx *luactx = MAY_LJMP(hlua_checkapplet_tcp(L, 1)); - struct stream_interface *si = luactx->appctx->owner; + struct stream_interface *si = cs_si(luactx->appctx->owner); int ret; const char *blk1; size_t len1; @@ -4504,7 +4504,7 @@ __LJMP static int hlua_applet_tcp_getline(lua_State *L) __LJMP static int hlua_applet_tcp_recv_yield(lua_State *L, int status, lua_KContext ctx) { struct hlua_appctx *luactx = MAY_LJMP(hlua_checkapplet_tcp(L, 1)); - struct stream_interface *si = luactx->appctx->owner; + struct stream_interface *si = cs_si(luactx->appctx->owner); size_t len = MAY_LJMP(luaL_checkinteger(L, 2)); int ret; const char *blk1; @@ -4612,7 +4612,7 @@ __LJMP static int hlua_applet_tcp_send_yield(lua_State *L, int status, lua_KCont struct hlua_appctx *luactx = MAY_LJMP(hlua_checkapplet_tcp(L, 1)); const char *str = MAY_LJMP(luaL_checklstring(L, 2, &len)); int l = MAY_LJMP(luaL_checkinteger(L, 3)); - struct stream_interface *si = luactx->appctx->owner; + struct stream_interface *si = cs_si(luactx->appctx->owner); struct channel *chn = si_ic(si); int max; @@ -4675,7 +4675,7 @@ static int hlua_applet_http_new(lua_State *L, struct appctx *ctx) { struct hlua_appctx *luactx; struct hlua_txn htxn; - struct stream_interface *si = ctx->owner; + struct stream_interface *si = cs_si(ctx->owner); struct stream *s = si_strm(si); struct proxy *px = s->be; struct htx *htx; @@ -4937,7 +4937,7 @@ __LJMP static int hlua_applet_http_get_priv(lua_State *L) __LJMP static int hlua_applet_http_getline_yield(lua_State *L, int status, lua_KContext ctx) { struct hlua_appctx *luactx = MAY_LJMP(hlua_checkapplet_http(L, 1)); - struct stream_interface *si = luactx->appctx->owner; + struct stream_interface *si = cs_si(luactx->appctx->owner); struct channel *req = si_oc(si); struct htx *htx; struct htx_blk *blk; @@ -5032,7 +5032,7 @@ __LJMP static int hlua_applet_http_getline(lua_State *L) __LJMP static int hlua_applet_http_recv_yield(lua_State *L, int status, lua_KContext ctx) { struct hlua_appctx *luactx = MAY_LJMP(hlua_checkapplet_http(L, 1)); - struct stream_interface *si = luactx->appctx->owner; + struct stream_interface *si = cs_si(luactx->appctx->owner); struct channel *req = si_oc(si); struct htx *htx; struct htx_blk *blk; @@ -5141,7 +5141,7 @@ __LJMP static int hlua_applet_http_recv(lua_State *L) __LJMP static int hlua_applet_http_send_yield(lua_State *L, int status, lua_KContext ctx) { struct hlua_appctx *luactx = MAY_LJMP(hlua_checkapplet_http(L, 1)); - struct stream_interface *si = luactx->appctx->owner; + struct stream_interface *si = cs_si(luactx->appctx->owner); struct channel *res = si_ic(si); struct htx *htx = htx_from_buf(&res->buf); const char *data; @@ -5275,7 +5275,7 @@ __LJMP static int hlua_applet_http_status(lua_State *L) __LJMP static int hlua_applet_http_send_response(lua_State *L) { struct hlua_appctx *luactx = MAY_LJMP(hlua_checkapplet_http(L, 1)); - struct stream_interface *si = luactx->appctx->owner; + struct stream_interface *si = cs_si(luactx->appctx->owner); struct channel *res = si_ic(si); struct htx *htx; struct htx_sl *sl; @@ -5474,7 +5474,7 @@ __LJMP static int hlua_applet_http_send_response(lua_State *L) __LJMP static int hlua_applet_http_start_response_yield(lua_State *L, int status, lua_KContext ctx) { struct hlua_appctx *luactx = MAY_LJMP(hlua_checkapplet_http(L, 1)); - struct stream_interface *si = luactx->appctx->owner; + struct stream_interface *si = cs_si(luactx->appctx->owner); struct channel *res = si_ic(si); if (co_data(res)) { @@ -9182,7 +9182,7 @@ struct task *hlua_applet_wakeup(struct task *t, void *context, unsigned int stat static int hlua_applet_tcp_init(struct appctx *ctx, struct proxy *px, struct stream *strm) { - struct stream_interface *si = ctx->owner; + struct stream_interface *si = cs_si(ctx->owner); struct hlua *hlua; struct task *task; char **arg; @@ -9278,7 +9278,7 @@ static int hlua_applet_tcp_init(struct appctx *ctx, struct proxy *px, struct str void hlua_applet_tcp_fct(struct appctx *ctx) { - struct stream_interface *si = ctx->owner; + struct stream_interface *si = cs_si(ctx->owner); struct stream *strm = si_strm(si); struct channel *res = si_ic(si); struct act_rule *rule = ctx->rule; @@ -9369,7 +9369,7 @@ static void hlua_applet_tcp_release(struct appctx *ctx) */ static int hlua_applet_http_init(struct appctx *ctx, struct proxy *px, struct stream *strm) { - struct stream_interface *si = ctx->owner; + struct stream_interface *si = cs_si(ctx->owner); struct http_txn *txn; struct hlua *hlua; char **arg; @@ -9470,7 +9470,7 @@ static int hlua_applet_http_init(struct appctx *ctx, struct proxy *px, struct st void hlua_applet_http_fct(struct appctx *ctx) { - struct stream_interface *si = ctx->owner; + struct stream_interface *si = cs_si(ctx->owner); struct stream *strm = si_strm(si); struct channel *req = si_oc(si); struct channel *res = si_ic(si); @@ -10089,7 +10089,7 @@ static int hlua_cli_io_handler_fct(struct appctx *appctx) struct hlua_function *fcn; hlua = appctx->ctx.hlua_cli.hlua; - si = appctx->owner; + si = cs_si(appctx->owner); fcn = appctx->ctx.hlua_cli.fcn; /* If the stream is disconnect or closed, ldo nothing. */ diff --git a/src/http_client.c b/src/http_client.c index 64e5190bec..0149eeb885 100644 --- a/src/http_client.c +++ b/src/http_client.c @@ -165,7 +165,7 @@ err: */ static int hc_cli_io_handler(struct appctx *appctx) { - struct stream_interface *si = appctx->owner; + struct stream_interface *si = cs_si(appctx->owner); struct buffer *trash = alloc_trash_chunk(); struct httpclient *hc = appctx->ctx.cli.p0; struct http_hdr *hdrs, *hdr; @@ -639,7 +639,7 @@ err: static void httpclient_applet_io_handler(struct appctx *appctx) { struct httpclient *hc = appctx->ctx.httpclient.ptr; - struct stream_interface *si = appctx->owner; + struct stream_interface *si = cs_si(appctx->owner); struct stream *s = si_strm(si); struct channel *req = &s->req; struct channel *res = &s->res; diff --git a/src/log.c b/src/log.c index 0213435c23..dbcffc6b51 100644 --- a/src/log.c +++ b/src/log.c @@ -3550,7 +3550,7 @@ out: static void syslog_io_handler(struct appctx *appctx) { static THREAD_LOCAL struct ist metadata[LOG_META_FIELDS]; - struct stream_interface *si = appctx->owner; + struct stream_interface *si = cs_si(appctx->owner); struct stream *s = si_strm(si); struct proxy *frontend = strm_fe(s); struct listener *l = strm_li(s); diff --git a/src/map.c b/src/map.c index 00297022da..870d92410a 100644 --- a/src/map.c +++ b/src/map.c @@ -323,7 +323,7 @@ struct pattern_expr *pat_expr_get_next(struct pattern_expr *getnext, struct list /* expects the current generation ID in appctx->cli.cli.i0 */ static int cli_io_handler_pat_list(struct appctx *appctx) { - struct stream_interface *si = appctx->owner; + struct stream_interface *si = cs_si(appctx->owner); struct pat_ref_elt *elt; if (unlikely(si_ic(si)->flags & (CF_WRITE_ERROR|CF_SHUTW))) { @@ -406,7 +406,7 @@ static int cli_io_handler_pat_list(struct appctx *appctx) static int cli_io_handler_pats_list(struct appctx *appctx) { - struct stream_interface *si = appctx->owner; + struct stream_interface *si = cs_si(appctx->owner); switch (appctx->st2) { case STAT_ST_INIT: @@ -468,7 +468,7 @@ static int cli_io_handler_pats_list(struct appctx *appctx) static int cli_io_handler_map_lookup(struct appctx *appctx) { - struct stream_interface *si = appctx->owner; + struct stream_interface *si = cs_si(appctx->owner); struct sample sample; struct pattern *pat; int match_method; @@ -993,7 +993,7 @@ static int cli_parse_del_map(char **args, char *payload, struct appctx *appctx, */ static int cli_io_handler_clear_map(struct appctx *appctx) { - struct stream_interface *si = appctx->owner; + struct stream_interface *si = cs_si(appctx->owner); int finished; HA_SPIN_LOCK(PATREF_LOCK, &appctx->ctx.map.ref->lock); diff --git a/src/mworker.c b/src/mworker.c index 5d30b18519..e690f8b7da 100644 --- a/src/mworker.c +++ b/src/mworker.c @@ -509,7 +509,7 @@ void mworker_cleanup_proc() /* Displays workers and processes */ static int cli_io_handler_show_proc(struct appctx *appctx) { - struct stream_interface *si = appctx->owner; + struct stream_interface *si = cs_si(appctx->owner); struct mworker_proc *child; int old = 0; int up = now.tv_sec - proc_self->timestamp; diff --git a/src/peers.c b/src/peers.c index df3fd9eb6c..1b80452739 100644 --- a/src/peers.c +++ b/src/peers.c @@ -446,7 +446,7 @@ static void peers_trace(enum trace_level level, uint64_t mask, if (peer->appctx) { struct stream_interface *si; - si = peer->appctx->owner; + si = cs_si(peer->appctx->owner); if (si) { struct stream *s = si_strm(si); @@ -1049,7 +1049,7 @@ void __peer_session_deinit(struct peer *peer) if (!peer->appctx) return; - si = peer->appctx->owner; + si = cs_si(peer->appctx->owner); if (!si) return; @@ -1149,7 +1149,7 @@ static int peer_get_version(const char *str, static inline int peer_getline(struct appctx *appctx) { int n; - struct stream_interface *si = appctx->owner; + struct stream_interface *si = cs_si(appctx->owner); n = co_getline(si_oc(si), trash.area, trash.size); if (!n) @@ -1182,7 +1182,7 @@ static inline int peer_send_msg(struct appctx *appctx, struct peer_prep_params *params) { int ret, msglen; - struct stream_interface *si = appctx->owner; + struct stream_interface *si = cs_si(appctx->owner); msglen = peer_prepare_msg(trash.area, trash.size, params); if (!msglen) { @@ -1662,7 +1662,7 @@ static inline int peer_send_teach_stage2_msgs(struct appctx *appctx, struct peer static int peer_treat_updatemsg(struct appctx *appctx, struct peer *p, int updt, int exp, char **msg_cur, char *msg_end, int msg_len, int totl) { - struct stream_interface *si = appctx->owner; + struct stream_interface *si = cs_si(appctx->owner); struct shared_table *st = p->remote_table; struct stksess *ts, *newts; uint32_t update; @@ -2114,7 +2114,7 @@ static inline int peer_treat_switchmsg(struct appctx *appctx, struct peer *p, static inline int peer_treat_definemsg(struct appctx *appctx, struct peer *p, char **msg_cur, char *msg_end, int totl) { - struct stream_interface *si = appctx->owner; + struct stream_interface *si = cs_si(appctx->owner); int table_id_len; struct shared_table *st; int table_type; @@ -2313,7 +2313,7 @@ static inline int peer_recv_msg(struct appctx *appctx, char *msg_head, size_t ms uint32_t *msg_len, int *totl) { int reql; - struct stream_interface *si = appctx->owner; + struct stream_interface *si = cs_si(appctx->owner); char *cur; reql = co_getblk(si_oc(si), msg_head, 2 * sizeof(char), *totl); @@ -2385,7 +2385,7 @@ static inline int peer_recv_msg(struct appctx *appctx, char *msg_head, size_t ms static inline int peer_treat_awaited_msg(struct appctx *appctx, struct peer *peer, unsigned char *msg_head, char **msg_cur, char *msg_end, int msg_len, int totl) { - struct stream_interface *si = appctx->owner; + struct stream_interface *si = cs_si(appctx->owner); struct stream *s = si_strm(si); struct peers *peers = strm_fe(s)->parent; @@ -2673,7 +2673,7 @@ static inline int peer_getline_last(struct appctx *appctx, struct peer **curpeer char *p; int reql; struct peer *peer; - struct stream_interface *si = appctx->owner; + struct stream_interface *si = cs_si(appctx->owner); struct stream *s = si_strm(si); struct peers *peers = strm_fe(s)->parent; @@ -2834,7 +2834,7 @@ static inline void init_connected_peer(struct peer *peer, struct peers *peers) */ static void peer_io_handler(struct appctx *appctx) { - struct stream_interface *si = appctx->owner; + struct stream_interface *si = cs_si(appctx->owner); struct stream *s = si_strm(si); struct peers *curpeers = strm_fe(s)->parent; struct peer *curpeer = NULL; @@ -3829,7 +3829,7 @@ static int peers_dump_peer(struct buffer *msg, struct stream_interface *si, stru chunk_appendf(&trash, " appctx:%p st0=%d st1=%d task_calls=%u", appctx, appctx->st0, appctx->st1, appctx->t ? appctx->t->calls : 0); - peer_si = peer->appctx->owner; + peer_si = cs_si(peer->appctx->owner); if (!peer_si) goto table_info; @@ -3952,7 +3952,7 @@ static int cli_io_handler_show_peers(struct appctx *appctx) { int show_all; int ret = 0, first_peers = 1; - struct stream_interface *si = appctx->owner; + struct stream_interface *si = cs_si(appctx->owner); thread_isolate(); diff --git a/src/pool.c b/src/pool.c index 0e33cd353f..45c05fa454 100644 --- a/src/pool.c +++ b/src/pool.c @@ -995,7 +995,7 @@ int pool_parse_debugging(const char *str, char **err) */ static int cli_io_handler_dump_pools(struct appctx *appctx) { - struct stream_interface *si = appctx->owner; + struct stream_interface *si = cs_si(appctx->owner); dump_pools_to_trash(); if (ci_putchk(si_ic(si), &trash) == -1) { diff --git a/src/proxy.c b/src/proxy.c index a97b3cd80e..a130e00f89 100644 --- a/src/proxy.c +++ b/src/proxy.c @@ -2689,7 +2689,7 @@ static int dump_servers_state(struct stream_interface *si) */ static int cli_io_handler_servers_state(struct appctx *appctx) { - struct stream_interface *si = appctx->owner; + struct stream_interface *si = cs_si(appctx->owner); struct proxy *curproxy; chunk_reset(&trash); @@ -2736,7 +2736,7 @@ static int cli_io_handler_servers_state(struct appctx *appctx) */ static int cli_io_handler_show_backend(struct appctx *appctx) { - struct stream_interface *si = appctx->owner; + struct stream_interface *si = cs_si(appctx->owner); struct proxy *curproxy; chunk_reset(&trash); @@ -3039,7 +3039,7 @@ static int cli_parse_show_errors(char **args, char *payload, struct appctx *appc */ static int cli_io_handler_show_errors(struct appctx *appctx) { - struct stream_interface *si = appctx->owner; + struct stream_interface *si = cs_si(appctx->owner); extern const char *monthname[12]; if (unlikely(si_ic(si)->flags & (CF_WRITE_ERROR|CF_SHUTW))) diff --git a/src/resolvers.c b/src/resolvers.c index 43e755b2c9..dff09fe6e3 100644 --- a/src/resolvers.c +++ b/src/resolvers.c @@ -2745,7 +2745,7 @@ static int cli_parse_stat_resolvers(char **args, char *payload, struct appctx *a */ static int cli_io_handler_dump_resolvers_to_buffer(struct appctx *appctx) { - struct stream_interface *si = appctx->owner; + struct stream_interface *si = cs_si(appctx->owner); struct resolvers *resolvers; struct dns_nameserver *ns; diff --git a/src/ring.c b/src/ring.c index 4f1bca270e..e5d4fb53c0 100644 --- a/src/ring.c +++ b/src/ring.c @@ -276,7 +276,7 @@ int ring_attach_cli(struct ring *ring, struct appctx *appctx) */ int cli_io_handler_show_ring(struct appctx *appctx) { - struct stream_interface *si = appctx->owner; + struct stream_interface *si = cs_si(appctx->owner); struct ring *ring = appctx->ctx.cli.p0; struct buffer *buf = &ring->buf; size_t ofs = appctx->ctx.cli.o0; diff --git a/src/server.c b/src/server.c index d165f50b93..6e1e2f1fe2 100644 --- a/src/server.c +++ b/src/server.c @@ -4314,7 +4314,7 @@ static int cli_parse_set_server(char **args, char *payload, struct appctx *appct static int cli_parse_get_weight(char **args, char *payload, struct appctx *appctx, void *private) { - struct stream_interface *si = appctx->owner; + struct stream_interface *si = cs_si(appctx->owner); struct proxy *px; struct server *sv; char *line; diff --git a/src/ssl_ckch.c b/src/ssl_ckch.c index 24e3130943..08472c68f1 100644 --- a/src/ssl_ckch.c +++ b/src/ssl_ckch.c @@ -1159,7 +1159,7 @@ static int cli_io_handler_show_cert(struct appctx *appctx) { struct buffer *trash = alloc_trash_chunk(); struct ebmb_node *node; - struct stream_interface *si = appctx->owner; + struct stream_interface *si = cs_si(appctx->owner); struct ckch_store *ckchs; if (trash == NULL) @@ -1558,7 +1558,7 @@ static int ckch_store_show_ocsp_certid(struct ckch_store *ckch_store, struct buf /* IO handler of the details "show ssl cert " */ static int cli_io_handler_show_cert_detail(struct appctx *appctx) { - struct stream_interface *si = appctx->owner; + struct stream_interface *si = cs_si(appctx->owner); struct ckch_store *ckchs = appctx->ctx.cli.p0; struct buffer *out = alloc_trash_chunk(); int retval = 0; @@ -1606,7 +1606,7 @@ yield: static int cli_io_handler_show_cert_ocsp_detail(struct appctx *appctx) { #if ((defined SSL_CTRL_SET_TLSEXT_STATUS_REQ_CB && !defined OPENSSL_NO_OCSP) && !defined OPENSSL_IS_BORINGSSL) - struct stream_interface *si = appctx->owner; + struct stream_interface *si = cs_si(appctx->owner); struct ckch_store *ckchs = appctx->ctx.cli.p0; struct buffer *out = alloc_trash_chunk(); int from_transaction = appctx->ctx.cli.i0; @@ -1837,7 +1837,7 @@ static void __ckch_inst_free_locked(struct ckch_inst *ckchi) */ static int cli_io_handler_commit_cert(struct appctx *appctx) { - struct stream_interface *si = appctx->owner; + struct stream_interface *si = cs_si(appctx->owner); int y = 0; char *err = NULL; struct ckch_store *old_ckchs, *new_ckchs = NULL; @@ -2603,7 +2603,7 @@ static inline int __create_new_instance(struct appctx *appctx, struct ckch_inst */ static int cli_io_handler_commit_cafile_crlfile(struct appctx *appctx) { - struct stream_interface *si = appctx->owner; + struct stream_interface *si = cs_si(appctx->owner); int y = 0; char *err = NULL; struct cafile_entry *old_cafile_entry = NULL, *new_cafile_entry = NULL; @@ -2827,7 +2827,7 @@ static void cli_release_commit_cafile(struct appctx *appctx) /* IO handler of details "show ssl ca-file " */ static int cli_io_handler_show_cafile_detail(struct appctx *appctx) { - struct stream_interface *si = appctx->owner; + struct stream_interface *si = cs_si(appctx->owner); struct cafile_entry *cafile_entry = appctx->ctx.cli.p0; struct buffer *out = alloc_trash_chunk(); int i; @@ -2980,7 +2980,7 @@ static int cli_io_handler_show_cafile(struct appctx *appctx) { struct buffer *trash = alloc_trash_chunk(); struct ebmb_node *node; - struct stream_interface *si = appctx->owner; + struct stream_interface *si = cs_si(appctx->owner); struct cafile_entry *cafile_entry; if (trash == NULL) @@ -3486,7 +3486,7 @@ end: /* IO handler of details "show ssl crl-file " */ static int cli_io_handler_show_crlfile_detail(struct appctx *appctx) { - struct stream_interface *si = appctx->owner; + struct stream_interface *si = cs_si(appctx->owner); struct cafile_entry *cafile_entry = appctx->ctx.cli.p0; struct buffer *out = alloc_trash_chunk(); int i; @@ -3616,7 +3616,7 @@ static int cli_io_handler_show_crlfile(struct appctx *appctx) { struct buffer *trash = alloc_trash_chunk(); struct ebmb_node *node; - struct stream_interface *si = appctx->owner; + struct stream_interface *si = cs_si(appctx->owner); struct cafile_entry *cafile_entry; if (trash == NULL) diff --git a/src/ssl_crtlist.c b/src/ssl_crtlist.c index 93168e3c7f..c1675fe822 100644 --- a/src/ssl_crtlist.c +++ b/src/ssl_crtlist.c @@ -887,7 +887,7 @@ static void dump_crtlist_filters(struct buffer *buf, struct crtlist_entry *entry static int cli_io_handler_dump_crtlist(struct appctx *appctx) { struct buffer *trash = alloc_trash_chunk(); - struct stream_interface *si = appctx->owner; + struct stream_interface *si = cs_si(appctx->owner); struct ebmb_node *lnode; if (trash == NULL) @@ -918,7 +918,7 @@ static int cli_io_handler_dump_crtlist_entries(struct appctx *appctx) { struct buffer *trash = alloc_trash_chunk(); struct crtlist *crtlist; - struct stream_interface *si = appctx->owner; + struct stream_interface *si = cs_si(appctx->owner); struct crtlist_entry *entry; if (trash == NULL) @@ -1041,7 +1041,7 @@ static void cli_release_add_crtlist(struct appctx *appctx) static int cli_io_handler_add_crtlist(struct appctx *appctx) { struct bind_conf_list *bind_conf_node; - struct stream_interface *si = appctx->owner; + struct stream_interface *si = cs_si(appctx->owner); struct crtlist *crtlist = appctx->ctx.cli.p0; struct crtlist_entry *entry = appctx->ctx.cli.p1; struct ckch_store *store = entry->node.key; diff --git a/src/ssl_sock.c b/src/ssl_sock.c index b79fc71d41..7f30b8f203 100644 --- a/src/ssl_sock.c +++ b/src/ssl_sock.c @@ -7195,7 +7195,7 @@ static inline int cli_io_handler_tlskeys_entries(struct appctx *appctx) { */ static int cli_io_handler_tlskeys_files(struct appctx *appctx) { - struct stream_interface *si = appctx->owner; + struct stream_interface *si = cs_si(appctx->owner); switch (appctx->st2) { case STAT_ST_INIT: @@ -7471,7 +7471,7 @@ static int cli_io_handler_show_ocspresponse(struct appctx *appctx) struct buffer *trash = alloc_trash_chunk(); struct buffer *tmp = NULL; struct ebmb_node *node; - struct stream_interface *si = appctx->owner; + struct stream_interface *si = cs_si(appctx->owner); struct certificate_ocsp *ocsp = NULL; BIO *bio = NULL; int write = -1; @@ -7658,7 +7658,7 @@ static int cli_io_handler_show_ocspresponse_detail(struct appctx *appctx) { struct buffer *trash = alloc_trash_chunk(); struct certificate_ocsp *ocsp = NULL; - struct stream_interface *si = appctx->owner; + struct stream_interface *si = cs_si(appctx->owner); ocsp = appctx->ctx.cli.p0; diff --git a/src/stats.c b/src/stats.c index 1600ef4c83..bffd3e395e 100644 --- a/src/stats.c +++ b/src/stats.c @@ -4262,7 +4262,7 @@ full: */ static void http_stats_io_handler(struct appctx *appctx) { - struct stream_interface *si = appctx->owner; + struct stream_interface *si = cs_si(appctx->owner); struct stream *s = si_strm(si); struct channel *req = si_oc(si); struct channel *res = si_ic(si); @@ -4911,7 +4911,7 @@ static int cli_parse_show_stat(char **args, char *payload, struct appctx *appctx appctx->ctx.stats.scope_len = 0; appctx->ctx.stats.flags = STAT_SHNODE | STAT_SHDESC; - if ((strm_li(si_strm(appctx->owner))->bind_conf->level & ACCESS_LVL_MASK) >= ACCESS_LVL_OPER) + if ((strm_li(si_strm(cs_si(appctx->owner)))->bind_conf->level & ACCESS_LVL_MASK) >= ACCESS_LVL_OPER) appctx->ctx.stats.flags |= STAT_SHLGNDS; /* proxy is the default domain */ @@ -4967,7 +4967,7 @@ static int cli_parse_show_stat(char **args, char *payload, struct appctx *appctx static int cli_io_handler_dump_info(struct appctx *appctx) { - return stats_dump_info_to_buffer(appctx->owner); + return stats_dump_info_to_buffer(cs_si(appctx->owner)); } /* This I/O handler runs as an applet embedded in a stream interface. It is @@ -4975,12 +4975,12 @@ static int cli_io_handler_dump_info(struct appctx *appctx) */ static int cli_io_handler_dump_stat(struct appctx *appctx) { - return stats_dump_stat_to_buffer(appctx->owner, NULL, NULL); + return stats_dump_stat_to_buffer(cs_si(appctx->owner), NULL, NULL); } static int cli_io_handler_dump_json_schema(struct appctx *appctx) { - return stats_dump_json_schema_to_buffer(appctx->owner); + return stats_dump_json_schema_to_buffer(cs_si(appctx->owner)); } int stats_allocate_proxy_counters_internal(struct extra_counters **counters, diff --git a/src/stick_table.c b/src/stick_table.c index 331ee19a03..667123c1c7 100644 --- a/src/stick_table.c +++ b/src/stick_table.c @@ -4391,7 +4391,7 @@ static int table_dump_entry_to_buffer(struct buffer *msg, */ static int table_process_entry_per_key(struct appctx *appctx, char **args) { - struct stream_interface *si = appctx->owner; + struct stream_interface *si = cs_si(appctx->owner); struct stktable *t = appctx->ctx.table.target; struct stksess *ts; uint32_t uint32_key; @@ -4646,7 +4646,7 @@ err_args: */ static int cli_io_handler_table(struct appctx *appctx) { - struct stream_interface *si = appctx->owner; + struct stream_interface *si = cs_si(appctx->owner); struct stream *s = si_strm(si); struct ebmb_node *eb; int skip_entry; diff --git a/src/stream.c b/src/stream.c index 622d6b82f5..dd6ae6f8af 100644 --- a/src/stream.c +++ b/src/stream.c @@ -2789,7 +2789,7 @@ void stream_dump_and_crash(enum obj_type *obj, int rate) if (!appctx) return; ptr = appctx; - s = si_strm(appctx->owner); + s = si_strm(cs_si(appctx->owner)); if (!s) return; } @@ -3476,7 +3476,7 @@ static int cli_parse_show_sess(char **args, char *payload, struct appctx *appctx /* let's set our own stream's epoch to the current one and increment * it so that we know which streams were already there before us. */ - si_strm(appctx->owner)->stream_epoch = _HA_ATOMIC_FETCH_ADD(&stream_epoch, 1); + si_strm(cs_si(appctx->owner))->stream_epoch = _HA_ATOMIC_FETCH_ADD(&stream_epoch, 1); return 0; } @@ -3487,7 +3487,7 @@ static int cli_parse_show_sess(char **args, char *payload, struct appctx *appctx */ static int cli_io_handler_dump_sess(struct appctx *appctx) { - struct stream_interface *si = appctx->owner; + struct stream_interface *si = cs_si(appctx->owner); struct connection *conn; thread_isolate(); @@ -3539,7 +3539,7 @@ static int cli_io_handler_dump_sess(struct appctx *appctx) else { /* check if we've found a stream created after issuing the "show sess" */ curr_strm = LIST_ELEM(appctx->ctx.sess.bref.ref, struct stream *, list); - if ((int)(curr_strm->stream_epoch - si_strm(appctx->owner)->stream_epoch) > 0) + if ((int)(curr_strm->stream_epoch - si_strm(cs_si(appctx->owner))->stream_epoch) > 0) done = 1; }