MINOR: tcp: replace various calls to conn_get_{from,to}_addr with conn_get_{src,dst}
These calls include the operation's status. When the check was already
present, it was merged with the call. when it was not present, it was
added.
diff --git a/src/proto_tcp.c b/src/proto_tcp.c
index a99febf..d999188 100644
--- a/src/proto_tcp.c
+++ b/src/proto_tcp.c
@@ -1172,7 +1172,7 @@
{
struct connection *cli_conn;
- if ((cli_conn = objt_conn(sess->origin)) && conn_ctrl_ready(cli_conn)) {
+ if ((cli_conn = objt_conn(sess->origin)) && conn_get_src(cli_conn)) {
struct sample *smp;
smp = sample_fetch_as_type(px, sess, s, SMP_OPT_DIR_REQ|SMP_OPT_FINAL, rule->arg.expr, SMP_T_ADDR);
@@ -1204,7 +1204,7 @@
{
struct connection *cli_conn;
- if ((cli_conn = objt_conn(sess->origin)) && conn_ctrl_ready(cli_conn)) {
+ if ((cli_conn = objt_conn(sess->origin)) && conn_get_dst(cli_conn)) {
struct sample *smp;
smp = sample_fetch_as_type(px, sess, s, SMP_OPT_DIR_REQ|SMP_OPT_FINAL, rule->arg.expr, SMP_T_ADDR);
@@ -1236,11 +1236,9 @@
{
struct connection *cli_conn;
- if ((cli_conn = objt_conn(sess->origin)) && conn_ctrl_ready(cli_conn)) {
+ if ((cli_conn = objt_conn(sess->origin)) && conn_get_src(cli_conn)) {
struct sample *smp;
- conn_get_from_addr(cli_conn);
-
smp = sample_fetch_as_type(px, sess, s, SMP_OPT_DIR_REQ|SMP_OPT_FINAL, rule->arg.expr, SMP_T_SINT);
if (smp) {
if (cli_conn->addr.from.ss_family == AF_INET6) {
@@ -1268,11 +1266,9 @@
{
struct connection *cli_conn;
- if ((cli_conn = objt_conn(sess->origin)) && conn_ctrl_ready(cli_conn)) {
+ if ((cli_conn = objt_conn(sess->origin)) && conn_get_dst(cli_conn)) {
struct sample *smp;
- conn_get_to_addr(cli_conn);
-
smp = sample_fetch_as_type(px, sess, s, SMP_OPT_DIR_REQ|SMP_OPT_FINAL, rule->arg.expr, SMP_T_SINT);
if (smp) {
if (cli_conn->addr.to.ss_family == AF_INET6) {
@@ -1425,6 +1421,9 @@
if (!cli_conn)
return 0;
+ if (!conn_get_src(cli_conn))
+ return 0;
+
switch (cli_conn->addr.from.ss_family) {
case AF_INET:
smp->data.u.ipv4 = ((struct sockaddr_in *)&cli_conn->addr.from)->sin_addr;
@@ -1451,6 +1450,9 @@
if (!cli_conn)
return 0;
+ if (!conn_get_src(cli_conn))
+ return 0;
+
smp->data.type = SMP_T_SINT;
if (!(smp->data.u.sint = get_host_port(&cli_conn->addr.from)))
return 0;
@@ -1468,7 +1470,8 @@
if (!cli_conn)
return 0;
- conn_get_to_addr(cli_conn);
+ if (!conn_get_dst(cli_conn))
+ return 0;
switch (cli_conn->addr.to.ss_family) {
case AF_INET:
@@ -1498,8 +1501,7 @@
if (!conn)
return 0;
- conn_get_to_addr(conn);
- if (!(conn->flags & CO_FL_ADDR_TO_SET))
+ if (!conn_get_dst(conn))
return 0;
smp->data.type = SMP_T_BOOL;
@@ -1519,8 +1521,7 @@
if (!conn)
return 0;
- conn_get_from_addr(conn);
- if (!(conn->flags & CO_FL_ADDR_FROM_SET))
+ if (!conn_get_src(conn))
return 0;
smp->data.type = SMP_T_BOOL;
@@ -1538,7 +1539,8 @@
if (!cli_conn)
return 0;
- conn_get_to_addr(cli_conn);
+ if (!conn_get_dst(cli_conn))
+ return 0;
smp->data.type = SMP_T_SINT;
if (!(smp->data.u.sint = get_host_port(&cli_conn->addr.to)))