From 2152cb5b59409d5e4085b2e366c1d4ba7d780fa0 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Sun, 12 Nov 2006 23:50:48 +0100 Subject: [PATCH] [MEDIUM] import ip_tproxy.h from cttproxy The file "ip_tproxy.h" will be needed to build with cttproxy support. Let's include it to ease the build process. --- include/import/ip_tproxy.h | 77 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 include/import/ip_tproxy.h diff --git a/include/import/ip_tproxy.h b/include/import/ip_tproxy.h new file mode 100644 index 000000000..d33f14d73 --- /dev/null +++ b/include/import/ip_tproxy.h @@ -0,0 +1,77 @@ +/* + * Transparent proxy support for Linux/iptables + * + * Copyright (c) 2002-2004 BalaBit IT Ltd. + * Author: Balázs Scheidler + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + */ + +#ifndef _IP_TPROXY_H +#define _IP_TPROXY_H + +#ifdef __KERNEL__ +#include +#include +#else +#include +#ifndef IP_RECVORIGADDRS +#define IP_RECVORIGADDRS 11273 +#define IP_ORIGADDRS IP_RECVORIGADDRS +struct in_origaddrs { + struct in_addr ioa_srcaddr; + struct in_addr ioa_dstaddr; + unsigned short int ioa_srcport; + unsigned short int ioa_dstport; +}; +#endif +#endif + +/* + * used in setsockopt(SOL_IP, IP_TPROXY) should not collide + * with values in + */ + +#define IP_TPROXY 11274 + +/* tproxy operations */ +enum { + TPROXY_VERSION = 0, + TPROXY_ASSIGN, + TPROXY_UNASSIGN, + TPROXY_QUERY, + TPROXY_FLAGS, + TPROXY_ALLOC, + TPROXY_CONNECT +}; + +/* bitfields in IP_TPROXY_FLAGS */ +#define ITP_CONNECT 0x00000001 +#define ITP_LISTEN 0x00000002 +#define ITP_ESTABLISHED 0x00000004 + +#define ITP_ONCE 0x00010000 +#define ITP_MARK 0x00020000 +#define ITP_APPLIED 0x00040000 +#define ITP_UNIDIR 0x00080000 + +struct in_tproxy_addr{ + struct in_addr faddr; + u_int16_t fport; +}; + +struct in_tproxy { + /* fixed part, should not change between versions */ + u_int32_t op; + /* extensible part */ + union _in_args { + u_int32_t version; + struct in_tproxy_addr addr; + u_int32_t flags; + } v; +}; + +#endif