From: Christopher Faulet Date: Fri, 22 Oct 2021 12:33:59 +0000 (+0200) Subject: CLEANUP: connection: No longer export make_proxy_line_v1/v2 functions X-Git-Tag: v2.5-dev12~60 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4bfce397b80234a129862197daf1e7ed5de11c16;p=thirdparty%2Fhaproxy.git CLEANUP: connection: No longer export make_proxy_line_v1/v2 functions These functions are only used by the make_proxy_line() function. Thus, we can turn them as static. --- diff --git a/include/haproxy/connection.h b/include/haproxy/connection.h index 7c970e2bdd..a140aa7baf 100644 --- a/include/haproxy/connection.h +++ b/include/haproxy/connection.h @@ -51,8 +51,6 @@ extern struct mux_stopping_data mux_stopping_data[MAX_THREADS]; /* receive a PROXY protocol header over a connection */ int conn_recv_proxy(struct connection *conn, int flag); int make_proxy_line(char *buf, int buf_len, struct server *srv, struct connection *remote, struct stream *strm); -int make_proxy_line_v1(char *buf, int buf_len, struct sockaddr_storage *src, struct sockaddr_storage *dst); -int make_proxy_line_v2(char *buf, int buf_len, struct server *srv, struct connection *remote, struct stream *strm); int conn_append_debug_info(struct buffer *buf, const struct connection *conn, const char *pfx); diff --git a/src/connection.c b/src/connection.c index 24fa069e40..bec639c8c5 100644 --- a/src/connection.c +++ b/src/connection.c @@ -1560,24 +1560,6 @@ void list_mux_proto(FILE *out) } } -/* Note: is explicitly allowed to be NULL */ -int make_proxy_line(char *buf, int buf_len, struct server *srv, struct connection *remote, struct stream *strm) -{ - int ret = 0; - - if (srv && (srv->pp_opts & SRV_PP_V2)) { - ret = make_proxy_line_v2(buf, buf_len, srv, remote, strm); - } - else { - if (remote && conn_get_src(remote) && conn_get_dst(remote)) - ret = make_proxy_line_v1(buf, buf_len, remote->src, remote->dst); - else - ret = make_proxy_line_v1(buf, buf_len, NULL, NULL); - } - - return ret; -} - /* Makes a PROXY protocol line from the two addresses. The output is sent to * buffer for a maximum size of (including the trailing zero). * It returns the number of bytes composing this line (including the trailing @@ -1585,7 +1567,7 @@ int make_proxy_line(char *buf, int buf_len, struct server *srv, struct connectio * TCP6 and "UNKNOWN" formats. If any of or is null, UNKNOWN is * emitted as well. */ -int make_proxy_line_v1(char *buf, int buf_len, struct sockaddr_storage *src, struct sockaddr_storage *dst) +static int make_proxy_line_v1(char *buf, int buf_len, struct sockaddr_storage *src, struct sockaddr_storage *dst) { int ret = 0; char * protocol; @@ -1673,7 +1655,7 @@ static int make_tlv(char *dest, int dest_len, char type, uint16_t length, const } /* Note: is explicitly allowed to be NULL */ -int make_proxy_line_v2(char *buf, int buf_len, struct server *srv, struct connection *remote, struct stream *strm) +static int make_proxy_line_v2(char *buf, int buf_len, struct server *srv, struct connection *remote, struct stream *strm) { const char pp2_signature[] = PP2_SIGNATURE; void *tlv_crc32c_p = NULL; @@ -1872,6 +1854,24 @@ int make_proxy_line_v2(char *buf, int buf_len, struct server *srv, struct connec return ret; } +/* Note: is explicitly allowed to be NULL */ +int make_proxy_line(char *buf, int buf_len, struct server *srv, struct connection *remote, struct stream *strm) +{ + int ret = 0; + + if (srv && (srv->pp_opts & SRV_PP_V2)) { + ret = make_proxy_line_v2(buf, buf_len, srv, remote, strm); + } + else { + if (remote && conn_get_src(remote) && conn_get_dst(remote)) + ret = make_proxy_line_v1(buf, buf_len, remote->src, remote->dst); + else + ret = make_proxy_line_v1(buf, buf_len, NULL, NULL); + } + + return ret; +} + /* returns 0 on success */ static int cfg_parse_pp2_never_send_local(char **args, int section_type, struct proxy *curpx, const struct proxy *defpx, const char *file, int line,