Linux-libre 5.3.12-gnu
[librecmc/linux-libre.git] / include / net / netfilter / nf_synproxy.h
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _NF_SYNPROXY_SHARED_H
3 #define _NF_SYNPROXY_SHARED_H
4
5 #include <linux/module.h>
6 #include <linux/skbuff.h>
7 #include <net/ip6_checksum.h>
8 #include <net/ip6_route.h>
9 #include <net/tcp.h>
10
11 #include <net/netfilter/nf_conntrack_seqadj.h>
12 #include <net/netfilter/nf_conntrack_synproxy.h>
13
14 void synproxy_send_client_synack(struct net *net, const struct sk_buff *skb,
15                                  const struct tcphdr *th,
16                                  const struct synproxy_options *opts);
17
18 bool synproxy_recv_client_ack(struct net *net,
19                               const struct sk_buff *skb,
20                               const struct tcphdr *th,
21                               struct synproxy_options *opts, u32 recv_seq);
22
23 unsigned int ipv4_synproxy_hook(void *priv, struct sk_buff *skb,
24                                 const struct nf_hook_state *nhs);
25 int nf_synproxy_ipv4_init(struct synproxy_net *snet, struct net *net);
26 void nf_synproxy_ipv4_fini(struct synproxy_net *snet, struct net *net);
27
28 #if IS_ENABLED(CONFIG_IPV6)
29 void synproxy_send_client_synack_ipv6(struct net *net,
30                                       const struct sk_buff *skb,
31                                       const struct tcphdr *th,
32                                       const struct synproxy_options *opts);
33
34 bool synproxy_recv_client_ack_ipv6(struct net *net, const struct sk_buff *skb,
35                                    const struct tcphdr *th,
36                                    struct synproxy_options *opts, u32 recv_seq);
37
38 unsigned int ipv6_synproxy_hook(void *priv, struct sk_buff *skb,
39                                 const struct nf_hook_state *nhs);
40 int nf_synproxy_ipv6_init(struct synproxy_net *snet, struct net *net);
41 void nf_synproxy_ipv6_fini(struct synproxy_net *snet, struct net *net);
42 #else
43 static inline int
44 nf_synproxy_ipv6_init(struct synproxy_net *snet, struct net *net) { return 0; }
45 static inline void
46 nf_synproxy_ipv6_fini(struct synproxy_net *snet, struct net *net) {};
47 #endif /* CONFIG_IPV6 */
48
49 #endif /* _NF_SYNPROXY_SHARED_H */