MINOR: log: use conn->{src,dst} instead of conn->addr.{from,to}
This is used to retrieve the addresses to be logged (client, frontend,
backend, server). In all places the validity check was already performed.
diff --git a/src/log.c b/src/log.c
index ff637dd..ed45a73 100644
--- a/src/log.c
+++ b/src/log.c
@@ -2022,7 +2022,7 @@
case LOG_FMT_CLIENTIP: // %ci
conn = objt_conn(sess->origin);
if (conn && conn_get_src(conn))
- ret = lf_ip(tmplog, (struct sockaddr *)&conn->addr.from, dst + maxsize - tmplog, tmp);
+ ret = lf_ip(tmplog, (struct sockaddr *)conn->src, dst + maxsize - tmplog, tmp);
else
ret = lf_text_len(tmplog, NULL, 0, dst + maxsize - tmplog, tmp);
if (ret == NULL)
@@ -2034,10 +2034,10 @@
case LOG_FMT_CLIENTPORT: // %cp
conn = objt_conn(sess->origin);
if (conn && conn_get_src(conn)) {
- if (conn->addr.from.ss_family == AF_UNIX) {
+ if (conn->src->ss_family == AF_UNIX) {
ret = ltoa_o(sess->listener->luid, tmplog, dst + maxsize - tmplog);
} else {
- ret = lf_port(tmplog, (struct sockaddr *)&conn->addr.from,
+ ret = lf_port(tmplog, (struct sockaddr *)conn->src,
dst + maxsize - tmplog, tmp);
}
}
@@ -2053,7 +2053,7 @@
case LOG_FMT_FRONTENDIP: // %fi
conn = objt_conn(sess->origin);
if (conn && conn_get_dst(conn)) {
- ret = lf_ip(tmplog, (struct sockaddr *)&conn->addr.to, dst + maxsize - tmplog, tmp);
+ ret = lf_ip(tmplog, (struct sockaddr *)conn->dst, dst + maxsize - tmplog, tmp);
}
else
ret = lf_text_len(tmplog, NULL, 0, dst + maxsize - tmplog, tmp);
@@ -2067,10 +2067,10 @@
case LOG_FMT_FRONTENDPORT: // %fp
conn = objt_conn(sess->origin);
if (conn && conn_get_dst(conn)) {
- if (conn->addr.to.ss_family == AF_UNIX)
+ if (conn->dst->ss_family == AF_UNIX)
ret = ltoa_o(sess->listener->luid, tmplog, dst + maxsize - tmplog);
else
- ret = lf_port(tmplog, (struct sockaddr *)&conn->addr.to, dst + maxsize - tmplog, tmp);
+ ret = lf_port(tmplog, (struct sockaddr *)conn->dst, dst + maxsize - tmplog, tmp);
}
else
ret = lf_text_len(tmplog, NULL, 0, dst + maxsize - tmplog, tmp);
@@ -2083,7 +2083,7 @@
case LOG_FMT_BACKENDIP: // %bi
if (be_conn && conn_get_src(be_conn))
- ret = lf_ip(tmplog, (const struct sockaddr *)&be_conn->addr.from, dst + maxsize - tmplog, tmp);
+ ret = lf_ip(tmplog, (const struct sockaddr *)be_conn->src, dst + maxsize - tmplog, tmp);
else
ret = lf_text_len(tmplog, NULL, 0, dst + maxsize - tmplog, tmp);
@@ -2095,7 +2095,7 @@
case LOG_FMT_BACKENDPORT: // %bp
if (be_conn && conn_get_src(be_conn))
- ret = lf_port(tmplog, (struct sockaddr *)&be_conn->addr.from, dst + maxsize - tmplog, tmp);
+ ret = lf_port(tmplog, (struct sockaddr *)be_conn->src, dst + maxsize - tmplog, tmp);
else
ret = lf_text_len(tmplog, NULL, 0, dst + maxsize - tmplog, tmp);
@@ -2107,7 +2107,7 @@
case LOG_FMT_SERVERIP: // %si
if (be_conn && conn_get_dst(be_conn))
- ret = lf_ip(tmplog, (struct sockaddr *)&be_conn->addr.to, dst + maxsize - tmplog, tmp);
+ ret = lf_ip(tmplog, (struct sockaddr *)be_conn->dst, dst + maxsize - tmplog, tmp);
else
ret = lf_text_len(tmplog, NULL, 0, dst + maxsize - tmplog, tmp);
@@ -2119,7 +2119,7 @@
case LOG_FMT_SERVERPORT: // %sp
if (be_conn && conn_get_dst(be_conn))
- ret = lf_port(tmplog, (struct sockaddr *)&be_conn->addr.to, dst + maxsize - tmplog, tmp);
+ ret = lf_port(tmplog, (struct sockaddr *)be_conn->dst, dst + maxsize - tmplog, tmp);
else
ret = lf_text_len(tmplog, NULL, 0, dst + maxsize - tmplog, tmp);