From ce7501de79b035a03c52aa47c671aac2fcdfd631 Mon Sep 17 00:00:00 2001 From: Alexander Stephan Date: Sat, 28 Oct 2023 20:57:07 +0200 Subject: [PATCH] MINOR: connection: Send out generic, user-defined server TLVs To follow-up the implementation of the new set-proxy-v2-tlv-fmt keyword in the server, the connection is updated to use the previously allocated TLVs. If no value was specified, we send out an empty TLV. As the feature is fully working with this commit, documentation and a test for the server and default-server are added as well. --- doc/configuration.txt | 16 ++++ .../proxy_protocol_send_generic.vtc | 74 +++++++++++++++++++ src/connection.c | 36 ++++++++- 3 files changed, 124 insertions(+), 2 deletions(-) create mode 100644 reg-tests/connection/proxy_protocol_send_generic.vtc diff --git a/doc/configuration.txt b/doc/configuration.txt index 8d2fdde21e..e7678a29a7 100644 --- a/doc/configuration.txt +++ b/doc/configuration.txt @@ -16742,6 +16742,22 @@ send-proxy-v2 of this version of the protocol. See also the "no-send-proxy-v2" option of this section and send-proxy" option of the "bind" keyword. +set-proxy-v2-tlv-fmt() + The "set-proxy-v2-tlv-fmt" parameter is used to send arbitrary PROXY protocol + version 2 TLVs. For the type () range of the defined TLV type please refer + to section 2.2.8. of the proxy protocol specification. However, the value can + be chosen freely as long as it does not exceed the maximum length of 65,535 + bytes. It can also be used for forwarding TLVs by using the fetch "fc_pp_tlv" + to retrieve a received TLV from the frontend. It may be used as a server or + a default-server option. It must be used in combination with send-proxy-v2 + such that PPv2 TLVs are actually sent out. + + Example: + server srv1 192.168.1.1:80 send-proxy-v2 set-proxy-v2-tlv-fmt(0x20) %[fc_pp_tlv(0x20)] + + In this case, we fetch the TLV with the type 0x20 as a string and set as the value + of a newly created TLV that also has the type 0x20. + proxy-v2-options