]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: connection: don't use clear_addr() anymore, just release the address
authorWilly Tarreau <w@1wt.eu>
Thu, 18 Jul 2019 09:16:41 +0000 (11:16 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 19 Jul 2019 11:50:09 +0000 (13:50 +0200)
Now that we have dynamically allocated addresses, there's no need to
clear an address before reusing it, just release it. Note that this
is not equivalent to saying that an address is never zero, as shown in
assign_server_address() where an address 0.0.0.0 can still be assigned
to a connection for the time it takes to modify it.

src/backend.c

index dcf364201b64e929cb271996266e98024b53f581..a20150a3e8b3a3bfd604b6ba938343ba7713a1cc 100644 (file)
@@ -1054,8 +1054,7 @@ static void assign_tproxy_address(struct stream *s)
                if (cli_conn && conn_get_src(cli_conn))
                        *srv_conn->src = *cli_conn->src;
                else {
-                       /* FIXME WTA: the dynamic address may be released here */
-                       memset(srv_conn->src, 0, sizeof(*srv_conn->src));
+                       sockaddr_free(&srv_conn->src);
                }
                break;
        case CO_SRC_TPROXY_DYN:
@@ -1076,8 +1075,7 @@ static void assign_tproxy_address(struct stream *s)
                }
                break;
        default:
-               /* FIXME WTA: the dynamic address may be released here */
-               memset(srv_conn->src, 0, sizeof(*srv_conn->src));
+               sockaddr_free(&srv_conn->src);
        }
 #endif
 }