1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _NF_CONNTRACK_SYNPROXY_H
3 #define _NF_CONNTRACK_SYNPROXY_H
5 #include <net/netfilter/nf_conntrack_seqadj.h>
6 #include <net/netns/generic.h>
8 struct nf_conn_synproxy {
14 static inline struct nf_conn_synproxy *nfct_synproxy(const struct nf_conn *ct)
16 #if IS_ENABLED(CONFIG_NETFILTER_SYNPROXY)
17 return nf_ct_ext_find(ct, NF_CT_EXT_SYNPROXY);
23 static inline struct nf_conn_synproxy *nfct_synproxy_ext_add(struct nf_conn *ct)
25 #if IS_ENABLED(CONFIG_NETFILTER_SYNPROXY)
26 return nf_ct_ext_add(ct, NF_CT_EXT_SYNPROXY, GFP_ATOMIC);
32 static inline bool nf_ct_add_synproxy(struct nf_conn *ct,
33 const struct nf_conn *tmpl)
35 #if IS_ENABLED(CONFIG_NETFILTER_SYNPROXY)
36 if (tmpl && nfct_synproxy(tmpl)) {
37 if (!nfct_seqadj_ext_add(ct))
40 if (!nfct_synproxy_ext_add(ct))
48 #endif /* _NF_CONNTRACK_SYNPROXY_H */