]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
[MINOR] add new tproxy flags for dynamic source address binding
authorWilly Tarreau <w@1wt.eu>
Mon, 7 Sep 2009 09:51:47 +0000 (11:51 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 30 Mar 2010 07:59:44 +0000 (09:59 +0200)
This patch adds a new TPROXY bind type, TPROXY_DYN, to indicate to the
TCP connect function that we want to bind to the address passed in
argument.

include/types/proxy.h
include/types/server.h
src/proto_tcp.c

index 13b5f2a52178c76052c91be0bcbf52dd72c3e2f7..cc2311781ef7a620bb26d352c79cc1276db843e0 100644 (file)
 #define PR_O_ABRT_CLOSE 0x00800000      /* immediately abort request when client closes */
 
 /* TPXY: exclusive values */
-#define PR_O_TPXY_ADDR  0x02000000     /* bind to this non-local address when connect()ing */
-#define PR_O_TPXY_CIP  0x04000000      /* bind to the client's IP address when connect()ing */
-#define PR_O_TPXY_CLI  0x06000000      /* bind to the client's IP+port when connect()ing */
-#define PR_O_TPXY_MASK 0x06000000      /* bind to a non-local address when connect()ing */
+#define PR_O_TPXY_ADDR  0x01000000     /* bind to this non-local address when connect()ing */
+#define PR_O_TPXY_CIP   0x02000000     /* bind to the client's IP address when connect()ing */
+#define PR_O_TPXY_CLI   0x03000000     /* bind to the client's IP+port when connect()ing */
+#define PR_O_TPXY_DYN   0x04000000     /* bind to a dynamically computed non-local address */
+#define PR_O_TPXY_MASK  0x07000000     /* bind to a non-local address when connect()ing */
 
 #define PR_O_SERVER_CLO 0x08000000     /* option http-server-close */
 #define PR_O_CONTSTATS 0x10000000      /* continous counters */
index ac94460dc5a86d8bc6a66f3ddae791c767bfaed5..bf3d6b01e926b899fdb9f985b7ce53a7fd84f6f3 100644 (file)
@@ -51,7 +51,8 @@
 #define SRV_TPROXY_ADDR        0x0100  /* bind to this non-local address to reach this server */
 #define SRV_TPROXY_CIP 0x0200  /* bind to the client's IP address to reach this server */
 #define SRV_TPROXY_CLI 0x0300  /* bind to the client's IP+port to reach this server */
-#define SRV_TPROXY_MASK        0x0300  /* bind to a non-local address to reach this server */
+#define SRV_TPROXY_DYN 0x0400  /* bind to a dynamically computed non-local address */
+#define SRV_TPROXY_MASK        0x0700  /* bind to a non-local address to reach this server */
 
 /* function which act on servers need to return various errors */
 #define SRV_STATUS_OK       0   /* everything is OK. */
index 50ab08170f29f46f6c0e8daa66950d8f789dca69..6494db7a55245ea42aa37d955492cbf60689308e 100644 (file)
@@ -254,6 +254,7 @@ int tcpv4_connect_server(struct stream_interface *si,
                        flags = 3;
                        break;
                case SRV_TPROXY_CIP:
+               case SRV_TPROXY_DYN:
                        flags = 1;
                        break;
                }
@@ -326,6 +327,7 @@ int tcpv4_connect_server(struct stream_interface *si,
                        flags = 3;
                        break;
                case PR_O_TPXY_CIP:
+               case PR_O_TPXY_DYN:
                        flags = 1;
                        break;
                }