]> git.proxmox.com Git - ovs.git/blame - datapath/linux/compat/include/net/netfilter/nf_conntrack_core.h
compat: Remove unused function
[ovs.git] / datapath / linux / compat / include / net / netfilter / nf_conntrack_core.h
CommitLineData
057772cf
JS
1#ifndef _NF_CONNTRACK_CORE_WRAPPER_H
2#define _NF_CONNTRACK_CORE_WRAPPER_H
3
4#include_next <net/netfilter/nf_conntrack_core.h>
5
6#ifndef HAVE_NF_CT_TMPL_ALLOC_TAKES_STRUCT_ZONE
7
8#include <net/netfilter/nf_conntrack_zones.h>
9
10#define nf_ct_tmpl_alloc rpl_nf_ct_tmpl_alloc
11/* Released via destroy_conntrack() */
12static inline struct nf_conn *
13nf_ct_tmpl_alloc(struct net *net, const struct nf_conntrack_zone *zone,
14 gfp_t flags)
15{
16 struct nf_conn *tmpl;
17
18 tmpl = kzalloc(sizeof(*tmpl), flags);
19 if (tmpl == NULL)
20 return NULL;
21
22 tmpl->status = IPS_TEMPLATE;
23 write_pnet(&tmpl->ct_net, net);
24
25 if (nf_ct_zone_add(tmpl, flags, zone) < 0)
26 goto out_free;
27
28 atomic_set(&tmpl->ct_general.use, 0);
29
30 return tmpl;
31out_free:
32 kfree(tmpl);
33 return NULL;
34}
35
36static void rpl_nf_ct_tmpl_free(struct nf_conn *tmpl)
37{
38 nf_ct_ext_destroy(tmpl);
39 nf_ct_ext_free(tmpl);
40 kfree(tmpl);
41}
42#define nf_ct_tmpl_free rpl_nf_ct_tmpl_free
0d330e42
JR
43
44static inline struct nf_conntrack_tuple_hash *
45rpl_nf_conntrack_find_get(struct net *net,
46 const struct nf_conntrack_zone *zone,
47 const struct nf_conntrack_tuple *tuple)
48{
49 return nf_conntrack_find_get(net, zone->id, tuple);
50}
51#define nf_conntrack_find_get rpl_nf_conntrack_find_get
52#endif /* HAVE_NF_CT_TMPL_ALLOC_TAKES_STRUCT_ZONE */
53
54#ifndef HAVE_NF_CT_GET_TUPLEPR_TAKES_STRUCT_NET
55static inline bool rpl_nf_ct_get_tuple(const struct sk_buff *skb,
56 unsigned int nhoff,
57 unsigned int dataoff, u_int16_t l3num,
58 u_int8_t protonum,
59 struct net *net,
60 struct nf_conntrack_tuple *tuple,
61 const struct nf_conntrack_l3proto *l3proto,
62 const struct nf_conntrack_l4proto *l4proto)
63{
64 return nf_ct_get_tuple(skb, nhoff, dataoff, l3num, protonum, tuple,
65 l3proto, l4proto);
66}
67#define nf_ct_get_tuple rpl_nf_ct_get_tuple
68#endif /* HAVE_NF_CT_GET_TUPLEPR_TAKES_STRUCT_NET */
69
6d9b6937
JR
70#ifdef HAVE_NF_CONN_TIMER
71
72#ifndef HAVE_NF_CT_DELETE
73#include <net/netfilter/nf_conntrack_timestamp.h>
74#endif
75
76static inline bool rpl_nf_ct_delete(struct nf_conn *ct, u32 portid, int report)
77{
78 if (del_timer(&ct->timeout))
79#ifdef HAVE_NF_CT_DELETE
80 return nf_ct_delete(ct, portid, report);
81#else
82 {
83 struct nf_conn_tstamp *tstamp;
84
85 tstamp = nf_conn_tstamp_find(ct);
86 if (tstamp && tstamp->stop == 0)
87 tstamp->stop = ktime_to_ns(ktime_get_real());
88
89 if (!test_bit(IPS_DYING_BIT, &ct->status) &&
90 unlikely(nf_conntrack_event(IPCT_DESTROY, ct) < 0)) {
91 /* destroy event was not delivered */
92 nf_ct_delete_from_lists(ct);
93 nf_ct_dying_timeout(ct);
94 return false;
95 }
96 set_bit(IPS_DYING_BIT, &ct->status);
97 nf_ct_delete_from_lists(ct);
98 nf_ct_put(ct);
99 return true;
100 }
101#endif
102 return false;
103}
104#define nf_ct_delete rpl_nf_ct_delete
105#endif /* HAVE_NF_CONN_TIMER */
106
057772cf 107#endif /* _NF_CONNTRACK_CORE_WRAPPER_H */