CLEANUP: stconn: rename cs{,_get}_{src,dst} to sc_*
The following functions were renamed: cs_src() -> sc_src() cs_dst() -> sc_dst() cs_get_src() -> sc_get_src() cs_get_dst() -> sc_get_dst()
This commit is contained in:
parent
19c65a9ded
commit
d68ff018c5
@ -169,7 +169,7 @@ static inline int cs_alloc_ibuf(struct stconn *cs, struct buffer_wait *wait)
|
||||
* the session for frontend CS and the server connection for the backend CS. It
|
||||
* returns a const address on success or NULL on failure.
|
||||
*/
|
||||
static inline const struct sockaddr_storage *cs_src(const struct stconn *cs)
|
||||
static inline const struct sockaddr_storage *sc_src(const struct stconn *cs)
|
||||
{
|
||||
if (cs->src)
|
||||
return cs->src;
|
||||
@ -189,7 +189,7 @@ static inline const struct sockaddr_storage *cs_src(const struct stconn *cs)
|
||||
* on the session for frontend CS and the server connection for the backend
|
||||
* CS. It returns a const address on success or NULL on failure.
|
||||
*/
|
||||
static inline const struct sockaddr_storage *cs_dst(const struct stconn *cs)
|
||||
static inline const struct sockaddr_storage *sc_dst(const struct stconn *cs)
|
||||
{
|
||||
if (cs->dst)
|
||||
return cs->dst;
|
||||
@ -210,7 +210,7 @@ static inline const struct sockaddr_storage *cs_dst(const struct stconn *cs)
|
||||
* source address is copied from the session one for frontend CS and the server
|
||||
* connection for the backend CS.
|
||||
*/
|
||||
static inline int cs_get_src(struct stconn *cs)
|
||||
static inline int sc_get_src(struct stconn *cs)
|
||||
{
|
||||
const struct sockaddr_storage *src = NULL;
|
||||
|
||||
@ -240,7 +240,7 @@ static inline int cs_get_src(struct stconn *cs)
|
||||
* stream connector destination address is copied from the session one for frontend
|
||||
* CS and the server connection for the backend CS.
|
||||
*/
|
||||
static inline int cs_get_dst(struct stconn *cs)
|
||||
static inline int sc_get_dst(struct stconn *cs)
|
||||
{
|
||||
const struct sockaddr_storage *dst = NULL;
|
||||
|
||||
|
@ -733,7 +733,7 @@ int assign_server(struct stream *s)
|
||||
const struct sockaddr_storage *src;
|
||||
|
||||
case BE_LB_HASH_SRC:
|
||||
src = cs_src(s->scf);
|
||||
src = sc_src(s->scf);
|
||||
if (src && src->ss_family == AF_INET) {
|
||||
srv = get_server_sh(s->be,
|
||||
(void *)&((struct sockaddr_in *)src)->sin_addr,
|
||||
@ -894,7 +894,7 @@ static int alloc_dst_address(struct sockaddr_storage **ss,
|
||||
* locally on multiple addresses at once. Nothing is done
|
||||
* for AF_UNIX addresses.
|
||||
*/
|
||||
dst = cs_dst(s->scf);
|
||||
dst = sc_dst(s->scf);
|
||||
if (dst && dst->ss_family == AF_INET) {
|
||||
((struct sockaddr_in *)*ss)->sin_family = AF_INET;
|
||||
((struct sockaddr_in *)*ss)->sin_addr =
|
||||
@ -911,7 +911,7 @@ static int alloc_dst_address(struct sockaddr_storage **ss,
|
||||
if ((srv->flags & SRV_F_MAPPORTS)) {
|
||||
int base_port;
|
||||
|
||||
dst = cs_dst(s->scf);
|
||||
dst = sc_dst(s->scf);
|
||||
if (dst) {
|
||||
/* First, retrieve the port from the incoming connection */
|
||||
base_port = get_host_port(dst);
|
||||
@ -934,7 +934,7 @@ static int alloc_dst_address(struct sockaddr_storage **ss,
|
||||
return SRV_STATUS_INTERNAL;
|
||||
|
||||
/* in transparent mode, use the original dest addr if no dispatch specified */
|
||||
dst = cs_dst(s->scf);
|
||||
dst = sc_dst(s->scf);
|
||||
if (dst && (dst->ss_family == AF_INET || dst->ss_family == AF_INET6))
|
||||
**ss = *dst;
|
||||
}
|
||||
@ -1111,7 +1111,7 @@ static int alloc_bind_address(struct sockaddr_storage **ss,
|
||||
case CO_SRC_TPROXY_CLI:
|
||||
case CO_SRC_TPROXY_CIP:
|
||||
/* FIXME: what can we do if the client connects in IPv6 or unix socket ? */
|
||||
addr = cs_src(s->scf);
|
||||
addr = sc_src(s->scf);
|
||||
if (!addr)
|
||||
return SRV_STATUS_INTERNAL;
|
||||
|
||||
|
@ -1826,8 +1826,8 @@ static int make_proxy_line_v2(char *buf, int buf_len, struct server *srv, struct
|
||||
memcpy(hdr->sig, pp2_signature, PP2_SIGNATURE_LEN);
|
||||
|
||||
if (strm) {
|
||||
src = cs_src(strm->scf);
|
||||
dst = cs_dst(strm->scf);
|
||||
src = sc_src(strm->scf);
|
||||
dst = sc_dst(strm->scf);
|
||||
}
|
||||
else if (remote && conn_get_src(remote) && conn_get_dst(remote)) {
|
||||
src = conn_src(remote);
|
||||
@ -2025,8 +2025,8 @@ int make_proxy_line(char *buf, int buf_len, struct server *srv, struct connectio
|
||||
const struct sockaddr_storage *dst = NULL;
|
||||
|
||||
if (strm) {
|
||||
src = cs_src(strm->scf);
|
||||
dst = cs_dst(strm->scf);
|
||||
src = sc_src(strm->scf);
|
||||
dst = sc_dst(strm->scf);
|
||||
}
|
||||
else if (remote && conn_get_src(remote) && conn_get_dst(remote)) {
|
||||
src = conn_src(remote);
|
||||
|
@ -62,7 +62,7 @@ int frontend_accept(struct stream *s)
|
||||
s->do_log(s);
|
||||
}
|
||||
else if (conn) {
|
||||
src = cs_src(s->scf);
|
||||
src = sc_src(s->scf);
|
||||
if (!src)
|
||||
send_log(fe, LOG_INFO, "Connect from unknown source to listener %d (%s/%s)\n",
|
||||
l->luid, fe->id, (fe->mode == PR_MODE_HTTP) ? "HTTP" : "TCP");
|
||||
@ -73,7 +73,7 @@ int frontend_accept(struct stream *s)
|
||||
switch (addr_to_str(src, pn, sizeof(pn))) {
|
||||
case AF_INET:
|
||||
case AF_INET6:
|
||||
dst = cs_dst(s->scf);
|
||||
dst = sc_dst(s->scf);
|
||||
if (dst) {
|
||||
addr_to_str(dst, sn, sizeof(sn));
|
||||
port = get_host_port(dst);
|
||||
@ -113,7 +113,7 @@ int frontend_accept(struct stream *s)
|
||||
}
|
||||
}
|
||||
|
||||
src = cs_src(s->scf);
|
||||
src = sc_src(s->scf);
|
||||
if (!src) {
|
||||
chunk_printf(&trash, "%08x:%s.accept(%04x)=%04x from [listener:%d] ALPN=%s\n",
|
||||
s->uniq_id, fe->id, (unsigned short)l->rx.fd, (unsigned short)conn->handle.fd,
|
||||
|
@ -2636,7 +2636,7 @@ __LJMP static int hlua_socket_getpeername(struct lua_State *L)
|
||||
|
||||
appctx = container_of(peer, struct hlua_csk_ctx, xref)->appctx;
|
||||
cs = appctx_cs(appctx);
|
||||
dst = cs_dst(cs_opposite(cs));
|
||||
dst = sc_dst(cs_opposite(cs));
|
||||
if (!dst) {
|
||||
xref_unlock(&socket->xref, peer);
|
||||
lua_pushnil(L);
|
||||
|
@ -662,7 +662,7 @@ int http_process_request(struct stream *s, struct channel *req, int an_bit)
|
||||
* asks for it.
|
||||
*/
|
||||
if ((sess->fe->options | s->be->options) & PR_O_FWDFOR) {
|
||||
const struct sockaddr_storage *src = cs_src(s->scf);
|
||||
const struct sockaddr_storage *src = sc_src(s->scf);
|
||||
struct http_hdr_ctx ctx = { .blk = NULL };
|
||||
struct ist hdr = isttest(s->be->fwdfor_hdr_name) ? s->be->fwdfor_hdr_name : sess->fe->fwdfor_hdr_name;
|
||||
|
||||
@ -719,7 +719,7 @@ int http_process_request(struct stream *s, struct channel *req, int an_bit)
|
||||
* asks for it.
|
||||
*/
|
||||
if ((sess->fe->options | s->be->options) & PR_O_ORGTO) {
|
||||
const struct sockaddr_storage *dst = cs_dst(s->scf);
|
||||
const struct sockaddr_storage *dst = sc_dst(s->scf);
|
||||
struct ist hdr = isttest(s->be->orgto_hdr_name) ? s->be->orgto_hdr_name : sess->fe->orgto_hdr_name;
|
||||
|
||||
if (dst && dst->ss_family == AF_INET) {
|
||||
|
@ -1186,7 +1186,7 @@ static int smp_fetch_base32(const struct arg *args, struct sample *smp, const ch
|
||||
*/
|
||||
static int smp_fetch_base32_src(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||
{
|
||||
const struct sockaddr_storage *src = (smp->strm ? cs_src(smp->strm->scf) : NULL);
|
||||
const struct sockaddr_storage *src = (smp->strm ? sc_src(smp->strm->scf) : NULL);
|
||||
struct buffer *temp;
|
||||
|
||||
if (!src)
|
||||
@ -2053,7 +2053,7 @@ static int smp_fetch_url32(const struct arg *args, struct sample *smp, const cha
|
||||
*/
|
||||
static int smp_fetch_url32_src(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||
{
|
||||
const struct sockaddr_storage *src = (smp->strm ? cs_src(smp->strm->scf) : NULL);
|
||||
const struct sockaddr_storage *src = (smp->strm ? sc_src(smp->strm->scf) : NULL);
|
||||
struct buffer *temp;
|
||||
|
||||
if (!src)
|
||||
|
@ -2114,7 +2114,7 @@ int sess_build_logline(struct session *sess, struct stream *s, char *dst, size_t
|
||||
break;
|
||||
|
||||
case LOG_FMT_CLIENTIP: // %ci
|
||||
addr = (s ? cs_src(s->scf) : sess_src(sess));
|
||||
addr = (s ? sc_src(s->scf) : sess_src(sess));
|
||||
if (addr)
|
||||
ret = lf_ip(tmplog, (struct sockaddr *)addr, dst + maxsize - tmplog, tmp);
|
||||
else
|
||||
@ -2127,7 +2127,7 @@ int sess_build_logline(struct session *sess, struct stream *s, char *dst, size_t
|
||||
break;
|
||||
|
||||
case LOG_FMT_CLIENTPORT: // %cp
|
||||
addr = (s ? cs_src(s->scf) : sess_src(sess));
|
||||
addr = (s ? sc_src(s->scf) : sess_src(sess));
|
||||
if (addr) {
|
||||
/* sess->listener is always defined when the session's owner is an inbound connections */
|
||||
if (addr->ss_family == AF_UNIX)
|
||||
@ -2145,7 +2145,7 @@ int sess_build_logline(struct session *sess, struct stream *s, char *dst, size_t
|
||||
break;
|
||||
|
||||
case LOG_FMT_FRONTENDIP: // %fi
|
||||
addr = (s ? cs_dst(s->scf) : sess_dst(sess));
|
||||
addr = (s ? sc_dst(s->scf) : sess_dst(sess));
|
||||
if (addr)
|
||||
ret = lf_ip(tmplog, (struct sockaddr *)addr, dst + maxsize - tmplog, tmp);
|
||||
else
|
||||
@ -2158,7 +2158,7 @@ int sess_build_logline(struct session *sess, struct stream *s, char *dst, size_t
|
||||
break;
|
||||
|
||||
case LOG_FMT_FRONTENDPORT: // %fp
|
||||
addr = (s ? cs_dst(s->scf) : sess_dst(sess));
|
||||
addr = (s ? sc_dst(s->scf) : sess_dst(sess));
|
||||
if (addr) {
|
||||
/* sess->listener is always defined when the session's owner is an inbound connections */
|
||||
if (addr->ss_family == AF_UNIX)
|
||||
|
@ -1236,8 +1236,8 @@ static int fcgi_set_default_param(struct fcgi_conn *fconn, struct fcgi_strm *fst
|
||||
struct fcgi_strm_params *params)
|
||||
{
|
||||
struct connection *cli_conn = objt_conn(fstrm->sess->origin);
|
||||
const struct sockaddr_storage *src = (sc_check(fcgi_strm_sc(fstrm)) ? conn_src(fconn->conn) : cs_src(cs_opposite(fcgi_strm_sc(fstrm))));
|
||||
const struct sockaddr_storage *dst = (sc_check(fcgi_strm_sc(fstrm)) ? conn_dst(fconn->conn) : cs_dst(cs_opposite(fcgi_strm_sc(fstrm))));
|
||||
const struct sockaddr_storage *src = (sc_check(fcgi_strm_sc(fstrm)) ? conn_src(fconn->conn) : sc_src(cs_opposite(fcgi_strm_sc(fstrm))));
|
||||
const struct sockaddr_storage *dst = (sc_check(fcgi_strm_sc(fstrm)) ? conn_dst(fconn->conn) : sc_dst(cs_opposite(fcgi_strm_sc(fstrm))));
|
||||
struct ist p;
|
||||
|
||||
if (!sl)
|
||||
|
@ -67,7 +67,7 @@ static enum act_return tcp_action_req_set_src(struct act_rule *rule, struct prox
|
||||
|
||||
case ACT_F_TCP_REQ_CNT:
|
||||
case ACT_F_HTTP_REQ:
|
||||
if (!cs_get_src(s->scf))
|
||||
if (!sc_get_src(s->scf))
|
||||
goto end;
|
||||
src = s->scf->src;
|
||||
break;
|
||||
@ -123,7 +123,7 @@ static enum act_return tcp_action_req_set_dst(struct act_rule *rule, struct prox
|
||||
|
||||
case ACT_F_TCP_REQ_CNT:
|
||||
case ACT_F_HTTP_REQ:
|
||||
if (!cs_get_dst(s->scf))
|
||||
if (!sc_get_dst(s->scf))
|
||||
goto end;
|
||||
dst = s->scf->dst;
|
||||
break;
|
||||
@ -180,7 +180,7 @@ static enum act_return tcp_action_req_set_src_port(struct act_rule *rule, struct
|
||||
|
||||
case ACT_F_TCP_REQ_CNT:
|
||||
case ACT_F_HTTP_REQ:
|
||||
if (!cs_get_src(s->scf))
|
||||
if (!sc_get_src(s->scf))
|
||||
goto end;
|
||||
src = s->scf->src;
|
||||
break;
|
||||
@ -235,7 +235,7 @@ static enum act_return tcp_action_req_set_dst_port(struct act_rule *rule, struct
|
||||
|
||||
case ACT_F_TCP_REQ_CNT:
|
||||
case ACT_F_HTTP_REQ:
|
||||
if (!cs_get_dst(s->scf))
|
||||
if (!sc_get_dst(s->scf))
|
||||
goto end;
|
||||
dst = s->scf->dst;
|
||||
break;
|
||||
|
@ -64,7 +64,7 @@ smp_fetch_src(const struct arg *args, struct sample *smp, const char *kw, void *
|
||||
src = conn_src(conn);
|
||||
}
|
||||
else /* src */
|
||||
src = (smp->strm ? cs_src(smp->strm->scf) : sess_src(smp->sess));
|
||||
src = (smp->strm ? sc_src(smp->strm->scf) : sess_src(smp->sess));
|
||||
|
||||
if (!src)
|
||||
return 0;
|
||||
@ -108,7 +108,7 @@ smp_fetch_sport(const struct arg *args, struct sample *smp, const char *kw, void
|
||||
src = conn_src(conn);
|
||||
}
|
||||
else /* src_port */
|
||||
src = (smp->strm ? cs_src(smp->strm->scf) : sess_src(smp->sess));
|
||||
src = (smp->strm ? sc_src(smp->strm->scf) : sess_src(smp->sess));
|
||||
|
||||
if (!src)
|
||||
return 0;
|
||||
@ -143,7 +143,7 @@ smp_fetch_dst(const struct arg *args, struct sample *smp, const char *kw, void *
|
||||
dst = conn_dst(conn);
|
||||
}
|
||||
else /* dst */
|
||||
dst = (smp->strm ? cs_dst(smp->strm->scf) : sess_dst(smp->sess));
|
||||
dst = (smp->strm ? sc_dst(smp->strm->scf) : sess_dst(smp->sess));
|
||||
|
||||
if (!dst)
|
||||
return 0;
|
||||
@ -180,7 +180,7 @@ int smp_fetch_dst_is_local(const struct arg *args, struct sample *smp, const cha
|
||||
dst = conn_dst(conn);
|
||||
}
|
||||
else /* dst_is_local */
|
||||
dst = (smp->strm ? cs_dst(smp->strm->scf) : sess_dst(smp->sess));
|
||||
dst = (smp->strm ? sc_dst(smp->strm->scf) : sess_dst(smp->sess));
|
||||
|
||||
if (!dst)
|
||||
return 0;
|
||||
@ -206,7 +206,7 @@ int smp_fetch_src_is_local(const struct arg *args, struct sample *smp, const cha
|
||||
src = conn_src(conn);
|
||||
}
|
||||
else /* src_is_local */
|
||||
src = (smp->strm ? cs_src(smp->strm->scf) : sess_src(smp->sess));
|
||||
src = (smp->strm ? sc_src(smp->strm->scf) : sess_src(smp->sess));
|
||||
|
||||
if (!src)
|
||||
return 0;
|
||||
@ -239,7 +239,7 @@ smp_fetch_dport(const struct arg *args, struct sample *smp, const char *kw, void
|
||||
dst = conn_dst(conn);
|
||||
}
|
||||
else /* dst_port */
|
||||
dst = (smp->strm ? cs_dst(smp->strm->scf) : sess_dst(smp->sess));
|
||||
dst = (smp->strm ? sc_dst(smp->strm->scf) : sess_dst(smp->sess));
|
||||
|
||||
if (!dst)
|
||||
return 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user