]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: connection: No longer export make_proxy_line_v1/v2 functions
authorChristopher Faulet <cfaulet@haproxy.com>
Fri, 22 Oct 2021 12:33:59 +0000 (14:33 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Wed, 27 Oct 2021 09:34:14 +0000 (11:34 +0200)
These functions are only used by the make_proxy_line() function. Thus, we
can turn them as static.

include/haproxy/connection.h
src/connection.c

index 7c970e2bdd9c7659d24b655cfce7d0a4c215b5f2..a140aa7baf2f5575e44d9b7a204a4d5fc9f0df30 100644 (file)
@@ -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);
 
index 24fa069e40950959475a9ead131a071f8625d595..bec639c8c5521ee1df1b8f615b2c6fda3e5914d3 100644 (file)
@@ -1560,24 +1560,6 @@ void list_mux_proto(FILE *out)
        }
 }
 
-/* Note: <remote> 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 <buf> for a maximum size of <buf_len> (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 <src> or <dst> 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: <remote> 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: <remote> 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,