]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/dde/linux26/contrib/include/net/netfilter/nf_tproxy_core.h
Inital import
[l4.git] / l4 / pkg / dde / linux26 / contrib / include / net / netfilter / nf_tproxy_core.h
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