diff options
author | KOVACS Krisztian <hidden@sch.bme.hu> | 2008-10-08 05:35:12 -0400 |
---|---|---|
committer | Patrick McHardy <kaber@trash.net> | 2008-10-08 05:35:12 -0400 |
commit | 9ad2d745a23853927a19789b034d9eb2e62d78ee (patch) | |
tree | 6ae36961fcd9c8273f2868d3ca16d9d5f8a8ba5e /include/net | |
parent | 73e4022f78acdbe420e8c24a7afbd90f4c8f5077 (diff) |
netfilter: iptables tproxy core
The iptables tproxy core is a module that contains the common routines used by
various tproxy related modules (TPROXY target and socket match)
Signed-off-by: KOVACS Krisztian <hidden@sch.bme.hu>
Signed-off-by: Patrick McHardy <kaber@trash.net>
Diffstat (limited to 'include/net')
-rw-r--r-- | include/net/netfilter/nf_tproxy_core.h | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/include/net/netfilter/nf_tproxy_core.h b/include/net/netfilter/nf_tproxy_core.h new file mode 100644 index 000000000000..208b46f4d6d2 --- /dev/null +++ b/include/net/netfilter/nf_tproxy_core.h | |||
@@ -0,0 +1,32 @@ | |||
1 | #ifndef _NF_TPROXY_CORE_H | ||
2 | #define _NF_TPROXY_CORE_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | #include <linux/in.h> | ||
6 | #include <linux/skbuff.h> | ||
7 | #include <net/sock.h> | ||
8 | #include <net/inet_sock.h> | ||
9 | #include <net/tcp.h> | ||
10 | |||
11 | /* look up and get a reference to a matching socket */ | ||
12 | extern struct sock * | ||
13 | nf_tproxy_get_sock_v4(struct net *net, const u8 protocol, | ||
14 | const __be32 saddr, const __be32 daddr, | ||
15 | const __be16 sport, const __be16 dport, | ||
16 | const struct net_device *in, bool listening); | ||
17 | |||
18 | static inline void | ||
19 | nf_tproxy_put_sock(struct sock *sk) | ||
20 | { | ||
21 | /* TIME_WAIT inet sockets have to be handled differently */ | ||
22 | if ((sk->sk_protocol == IPPROTO_TCP) && (sk->sk_state == TCP_TIME_WAIT)) | ||
23 | inet_twsk_put(inet_twsk(sk)); | ||
24 | else | ||
25 | sock_put(sk); | ||
26 | } | ||
27 | |||
28 | /* assign a socket to the skb -- consumes sk */ | ||
29 | int | ||
30 | nf_tproxy_assign_sock(struct sk_buff *skb, struct sock *sk); | ||
31 | |||
32 | #endif | ||