1 #ifndef _NF_CONNTRACK_SYNPROXY_H
2 #define _NF_CONNTRACK_SYNPROXY_H
4 #include <net/netns/generic.h>
6 struct nf_conn_synproxy {
12 static inline struct nf_conn_synproxy *nfct_synproxy(const struct nf_conn *ct)
14 #if IS_ENABLED(CONFIG_NETFILTER_SYNPROXY)
15 return nf_ct_ext_find(ct, NF_CT_EXT_SYNPROXY);
21 static inline struct nf_conn_synproxy *nfct_synproxy_ext_add(struct nf_conn *ct)
23 #if IS_ENABLED(CONFIG_NETFILTER_SYNPROXY)
24 return nf_ct_ext_add(ct, NF_CT_EXT_SYNPROXY, GFP_ATOMIC);
30 static inline bool nf_ct_add_synproxy(struct nf_conn *ct,
31 const struct nf_conn *tmpl)
33 if (tmpl && nfct_synproxy(tmpl)) {
34 if (!nfct_seqadj_ext_add(ct))
37 if (!nfct_synproxy_ext_add(ct))
44 struct synproxy_stats {
45 unsigned int syn_received;
46 unsigned int cookie_invalid;
47 unsigned int cookie_valid;
48 unsigned int cookie_retrans;
49 unsigned int conn_reopened;
54 struct synproxy_stats __percpu *stats;
57 extern int synproxy_net_id;
58 static inline struct synproxy_net *synproxy_pernet(struct net *net)
60 return net_generic(net, synproxy_net_id);
63 struct synproxy_options {
72 struct xt_synproxy_info;
73 bool synproxy_parse_options(const struct sk_buff *skb, unsigned int doff,
74 const struct tcphdr *th,
75 struct synproxy_options *opts);
76 unsigned int synproxy_options_size(const struct synproxy_options *opts);
77 void synproxy_build_options(struct tcphdr *th,
78 const struct synproxy_options *opts);
80 void synproxy_init_timestamp_cookie(const struct xt_synproxy_info *info,
81 struct synproxy_options *opts);
82 void synproxy_check_timestamp_cookie(struct synproxy_options *opts);
84 unsigned int synproxy_tstamp_adjust(struct sk_buff *skb, unsigned int protoff,
85 struct tcphdr *th, struct nf_conn *ct,
86 enum ip_conntrack_info ctinfo,
87 const struct nf_conn_synproxy *synproxy);
89 #endif /* _NF_CONNTRACK_SYNPROXY_H */