Commit 58aafc2a authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Allocate client IP/port string from sess->ws

parent 6a92b339
...@@ -772,8 +772,8 @@ struct sess { ...@@ -772,8 +772,8 @@ struct sess {
struct suckaddr *local_addr; struct suckaddr *local_addr;
/* formatted ascii client address */ /* formatted ascii client address */
char addr[ADDR_BUFSIZE]; char *client_addr_str;
char port[PORT_BUFSIZE]; char *client_port_str;
struct acct acct_ses; struct acct acct_ses;
......
...@@ -348,7 +348,8 @@ pan_sess(const struct sess *sp) ...@@ -348,7 +348,8 @@ pan_sess(const struct sess *sp)
VSB_printf(pan_vsp, " sp = %p {\n", sp); VSB_printf(pan_vsp, " sp = %p {\n", sp);
VSB_printf(pan_vsp, " fd = %d, vxid = %u,\n", VSB_printf(pan_vsp, " fd = %d, vxid = %u,\n",
sp->fd, sp->vxid & VSL_IDENTMASK); sp->fd, sp->vxid & VSL_IDENTMASK);
VSB_printf(pan_vsp, " client = %s %s,\n", sp->addr, sp->port); VSB_printf(pan_vsp, " client = %s %s,\n", sp->client_addr_str,
sp->client_port_str);
switch (sp->sess_step) { switch (sp->sess_step) {
#define SESS_STEP(l, u) case S_STP_##u: stp = "S_STP_" #u; break; #define SESS_STEP(l, u) case S_STP_##u: stp = "S_STP_" #u; break;
#include "tbl/steps.h" #include "tbl/steps.h"
......
...@@ -674,7 +674,8 @@ cnt_recv(struct worker *wrk, struct req *req) ...@@ -674,7 +674,8 @@ cnt_recv(struct worker *wrk, struct req *req)
AZ(req->obj); AZ(req->obj);
AZ(req->objcore); AZ(req->objcore);
VSLb(req->vsl, SLT_ReqStart, "%s %s", req->sp->addr, req->sp->port); VSLb(req->vsl, SLT_ReqStart, "%s %s",
req->sp->client_addr_str, req->sp->client_port_str);
if (req->err_code) { if (req->err_code) {
req->req_step = R_STP_ERROR; req->req_step = R_STP_ERROR;
......
...@@ -192,12 +192,14 @@ ses_vsl_socket(struct sess *sp, const char *lsockname) ...@@ -192,12 +192,14 @@ ses_vsl_socket(struct sess *sp, const char *lsockname)
AN(VSA_Build(sp->local_addr, &ss, sl)); AN(VSA_Build(sp->local_addr, &ss, sl));
assert(VSA_Sane(sp->local_addr)); assert(VSA_Sane(sp->local_addr));
VTCP_name(sp->remote_addr, VTCP_name(sp->remote_addr, laddr, sizeof laddr, lport, sizeof lport);
sp->addr, sizeof sp->addr, sp->port, sizeof sp->port); sp->client_addr_str = WS_Copy(sp->ws, laddr, -1);
sp->client_port_str = WS_Copy(sp->ws, lport, -1);
VTCP_name(sp->local_addr, laddr, sizeof laddr, lport, sizeof lport); VTCP_name(sp->local_addr, laddr, sizeof laddr, lport, sizeof lport);
VSL(SLT_Begin, sp->vxid, "sess"); VSL(SLT_Begin, sp->vxid, "sess");
VSL(SLT_SessOpen, sp->vxid, "%s %s %s %s %s %.6f %d", VSL(SLT_SessOpen, sp->vxid, "%s %s %s %s %s %.6f %d",
sp->addr, sp->port, lsockname, laddr, lport, sp->t_open, sp->fd); sp->client_addr_str, sp->client_port_str, lsockname, laddr, lport,
sp->t_open, sp->fd);
} }
/*-------------------------------------------------------------------- /*--------------------------------------------------------------------
......
...@@ -199,7 +199,7 @@ VRT_r_client_identity(const struct vrt_ctx *ctx) ...@@ -199,7 +199,7 @@ VRT_r_client_identity(const struct vrt_ctx *ctx)
if (ctx->req->client_identity != NULL) if (ctx->req->client_identity != NULL)
return (ctx->req->client_identity); return (ctx->req->client_identity);
else else
return (ctx->req->sp->addr); return (ctx->req->sp->client_addr_str);
} }
void void
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment