blob: d33f14d730ed71369c619c63ee65bcd9d4e40ac9 [file] [log] [blame]
Willy Tarreau2152cb52006-11-12 23:50:48 +01001/*
2 * Transparent proxy support for Linux/iptables
3 *
4 * Copyright (c) 2002-2004 BalaBit IT Ltd.
5 * Author: Balázs Scheidler
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 *
11 */
12
13#ifndef _IP_TPROXY_H
14#define _IP_TPROXY_H
15
16#ifdef __KERNEL__
17#include <linux/types.h>
18#include <linux/in.h>
19#else
20#include <netinet/in.h>
21#ifndef IP_RECVORIGADDRS
22#define IP_RECVORIGADDRS 11273
23#define IP_ORIGADDRS IP_RECVORIGADDRS
24struct in_origaddrs {
25 struct in_addr ioa_srcaddr;
26 struct in_addr ioa_dstaddr;
27 unsigned short int ioa_srcport;
28 unsigned short int ioa_dstport;
29};
30#endif
31#endif
32
33/*
34 * used in setsockopt(SOL_IP, IP_TPROXY) should not collide
35 * with values in <linux/in.h>
36 */
37
38#define IP_TPROXY 11274
39
40/* tproxy operations */
41enum {
42 TPROXY_VERSION = 0,
43 TPROXY_ASSIGN,
44 TPROXY_UNASSIGN,
45 TPROXY_QUERY,
46 TPROXY_FLAGS,
47 TPROXY_ALLOC,
48 TPROXY_CONNECT
49};
50
51/* bitfields in IP_TPROXY_FLAGS */
52#define ITP_CONNECT 0x00000001
53#define ITP_LISTEN 0x00000002
54#define ITP_ESTABLISHED 0x00000004
55
56#define ITP_ONCE 0x00010000
57#define ITP_MARK 0x00020000
58#define ITP_APPLIED 0x00040000
59#define ITP_UNIDIR 0x00080000
60
61struct in_tproxy_addr{
62 struct in_addr faddr;
63 u_int16_t fport;
64};
65
66struct in_tproxy {
67 /* fixed part, should not change between versions */
68 u_int32_t op;
69 /* extensible part */
70 union _in_args {
71 u_int32_t version;
72 struct in_tproxy_addr addr;
73 u_int32_t flags;
74 } v;
75};
76
77#endif