You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@trafficserver.apache.org by GitBox <gi...@apache.org> on 2021/01/26 01:08:37 UTC

[GitHub] [trafficserver] masaori335 opened a new pull request #7445: Add Outbound PROXY Protocol (v1/v2) Support

masaori335 opened a new pull request #7445:
URL: https://github.com/apache/trafficserver/pull/7445


   Address #7444. AuTest is not included because it requires PROXY protocol support on the origin server side.
   
   ## New config
   - `proxy.config.http.proxy_protocol_out`
   
   | Value | Description |
   |----|----|
   |``-1`` | Disable (default) |
   |``0`` | Forward received PROXY protocol to the next hop |
   |``1`` | Send client information in PROXY protocol version 1 |
   |``2`` | Send client information in PROXY protocol version 2 |


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [trafficserver] masaori335 merged pull request #7445: Add PROXY Protocol Builder

Posted by GitBox <gi...@apache.org>.
masaori335 merged pull request #7445:
URL: https://github.com/apache/trafficserver/pull/7445


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [trafficserver] SolidWallOfCode commented on a change in pull request #7445: Add PROXY Protocol Builder

Posted by GitBox <gi...@apache.org>.
SolidWallOfCode commented on a change in pull request #7445:
URL: https://github.com/apache/trafficserver/pull/7445#discussion_r568170201



##########
File path: iocore/net/ProxyProtocol.cc
##########
@@ -302,6 +307,184 @@ proxy_protocol_v2_parse(ProxyProtocol *pp_info, const ts::TextView &msg)
   return 0;
 }
 
+size_t
+proxy_protocol_v1_build(uint8_t *buf, size_t max_buf_len, const ProxyProtocol &pp_info)
+{

Review comment:
       You should consider using `BufferWriter` here. I think it would noticeably simplify the code.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [trafficserver] zwoop commented on pull request #7445: Add PROXY Protocol Builder

Posted by GitBox <gi...@apache.org>.
zwoop commented on pull request #7445:
URL: https://github.com/apache/trafficserver/pull/7445#issuecomment-784377571


   Cherry-picked to v9.1.x branch.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [trafficserver] masaori335 commented on pull request #7445: Add PROXY Protocol Builder

Posted by GitBox <gi...@apache.org>.
masaori335 commented on pull request #7445:
URL: https://github.com/apache/trafficserver/pull/7445#issuecomment-772247186


   [approve ci autest]


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [trafficserver] masaori335 merged pull request #7445: Add PROXY Protocol Builder

Posted by GitBox <gi...@apache.org>.
masaori335 merged pull request #7445:
URL: https://github.com/apache/trafficserver/pull/7445


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [trafficserver] masaori335 commented on a change in pull request #7445: Add PROXY Protocol Builder

Posted by GitBox <gi...@apache.org>.
masaori335 commented on a change in pull request #7445:
URL: https://github.com/apache/trafficserver/pull/7445#discussion_r569157199



##########
File path: iocore/net/ProxyProtocol.cc
##########
@@ -302,6 +307,184 @@ proxy_protocol_v2_parse(ProxyProtocol *pp_info, const ts::TextView &msg)
   return 0;
 }
 
+size_t
+proxy_protocol_v1_build(uint8_t *buf, size_t max_buf_len, const ProxyProtocol &pp_info)
+{

Review comment:
       Replaced with `ts::FixedBufferWriter`. It made code simple.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [trafficserver] SolidWallOfCode commented on a change in pull request #7445: Add PROXY Protocol Builder

Posted by GitBox <gi...@apache.org>.
SolidWallOfCode commented on a change in pull request #7445:
URL: https://github.com/apache/trafficserver/pull/7445#discussion_r568167895



##########
File path: iocore/net/ProxyProtocol.cc
##########
@@ -55,7 +56,11 @@ constexpr uint8_t PPv2_PROTO_UNIX_DATAGRAM = 0x32;
 
 constexpr uint16_t PPv2_ADDR_LEN_INET  = 4 + 4 + 2 + 2;
 constexpr uint16_t PPv2_ADDR_LEN_INET6 = 16 + 16 + 2 + 2;
-// constexpr uint16_t PPv2_ADDR_LEN_UNIX  = 108 + 108;
+constexpr uint16_t PPv2_ADDR_LEN_UNIX  = 108 + 108;
+
+constexpr size_t TS_IPv4_LEN = sizeof(in_addr_t); ///< 4

Review comment:
       This should go in "ink_inet.h" next to `TS_IP6_SIZE`.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [trafficserver] SolidWallOfCode commented on a change in pull request #7445: Add PROXY Protocol Builder

Posted by GitBox <gi...@apache.org>.
SolidWallOfCode commented on a change in pull request #7445:
URL: https://github.com/apache/trafficserver/pull/7445#discussion_r568170583



##########
File path: iocore/net/ProxyProtocol.cc
##########
@@ -302,6 +307,184 @@ proxy_protocol_v2_parse(ProxyProtocol *pp_info, const ts::TextView &msg)
   return 0;
 }
 
+size_t
+proxy_protocol_v1_build(uint8_t *buf, size_t max_buf_len, const ProxyProtocol &pp_info)
+{
+  if (max_buf_len < PPv1_CONNECTION_HEADER_LEN_MAX) {
+    return 0;
+  }
+
+  size_t buf_len = 0;
+
+  // preface
+  memcpy(buf, PPv1_CONNECTION_PREFACE.data(), PPv1_CONNECTION_PREFACE.size());

Review comment:
       This becomes
   ```
   buf.write(PPv1_CONNECTION_PREFACE).write(' ');
   ```




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [trafficserver] masaori335 commented on pull request #7445: Add PROXY Protocol Builder

Posted by GitBox <gi...@apache.org>.
masaori335 commented on pull request #7445:
URL: https://github.com/apache/trafficserver/pull/7445#issuecomment-772247299


   [approve ci clang-analyzer]


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [trafficserver] masaori335 commented on a change in pull request #7445: Add PROXY Protocol Builder

Posted by GitBox <gi...@apache.org>.
masaori335 commented on a change in pull request #7445:
URL: https://github.com/apache/trafficserver/pull/7445#discussion_r569156702



##########
File path: iocore/net/ProxyProtocol.cc
##########
@@ -55,7 +56,11 @@ constexpr uint8_t PPv2_PROTO_UNIX_DATAGRAM = 0x32;
 
 constexpr uint16_t PPv2_ADDR_LEN_INET  = 4 + 4 + 2 + 2;
 constexpr uint16_t PPv2_ADDR_LEN_INET6 = 16 + 16 + 2 + 2;
-// constexpr uint16_t PPv2_ADDR_LEN_UNIX  = 108 + 108;
+constexpr uint16_t PPv2_ADDR_LEN_UNIX  = 108 + 108;
+
+constexpr size_t TS_IPv4_LEN = sizeof(in_addr_t); ///< 4

Review comment:
       Moved




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [trafficserver] masaori335 removed a comment on pull request #7445: Add PROXY Protocol Builder

Posted by GitBox <gi...@apache.org>.
masaori335 removed a comment on pull request #7445:
URL: https://github.com/apache/trafficserver/pull/7445#issuecomment-772247299






----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org