[MINOR] add new tproxy flags for dynamic source address binding

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.
This commit is contained in:
Willy Tarreau 2009-09-07 11:51:47 +02:00
parent d54bbdce87
commit 090466c91a
3 changed files with 9 additions and 5 deletions

View File

@ -96,10 +96,11 @@
#define PR_O_ABRT_CLOSE 0x00800000 /* immediately abort request when client closes */ #define PR_O_ABRT_CLOSE 0x00800000 /* immediately abort request when client closes */
/* TPXY: exclusive values */ /* TPXY: exclusive values */
#define PR_O_TPXY_ADDR 0x02000000 /* bind to this 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 0x04000000 /* bind to the client's IP 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 0x06000000 /* bind to the client's IP+port when connect()ing */ #define PR_O_TPXY_CLI 0x03000000 /* 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_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_SERVER_CLO 0x08000000 /* option http-server-close */
#define PR_O_CONTSTATS 0x10000000 /* continous counters */ #define PR_O_CONTSTATS 0x10000000 /* continous counters */

View File

@ -51,7 +51,8 @@
#define SRV_TPROXY_ADDR 0x0100 /* bind to this non-local address to reach this server */ #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_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_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 */ /* function which act on servers need to return various errors */
#define SRV_STATUS_OK 0 /* everything is OK. */ #define SRV_STATUS_OK 0 /* everything is OK. */

View File

@ -254,6 +254,7 @@ int tcpv4_connect_server(struct stream_interface *si,
flags = 3; flags = 3;
break; break;
case SRV_TPROXY_CIP: case SRV_TPROXY_CIP:
case SRV_TPROXY_DYN:
flags = 1; flags = 1;
break; break;
} }
@ -326,6 +327,7 @@ int tcpv4_connect_server(struct stream_interface *si,
flags = 3; flags = 3;
break; break;
case PR_O_TPXY_CIP: case PR_O_TPXY_CIP:
case PR_O_TPXY_DYN:
flags = 1; flags = 1;
break; break;
} }