aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorRoi Dayan2020-08-03 10:33:04 +0300
committerPablo Neira Ayuso2020-08-03 12:36:47 +0200
commit73f9407b3eb893bc8a82293cc8d4dfa3db079c0b (patch)
tree9cd4ce4f0676761a264aadb7cc3ac232b8d74f9a /include
parent2ef740da4fef947fb4614808fb61ca8ccb313e0b (diff)
netfilter: conntrack: Move nf_ct_offload_timeout to header file
To be used by callers from other modules. [ Rename DAY to NF_CT_DAY to avoid possible symbol name pollution issue --Pablo ] Signed-off-by: Roi Dayan <roid@mellanox.com> Reviewed-by: Oz Shlomo <ozsh@mellanox.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'include')
-rw-r--r--include/net/netfilter/nf_conntrack.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/include/net/netfilter/nf_conntrack.h b/include/net/netfilter/nf_conntrack.h
index 90690e37a56f..c7bfddfc65b0 100644
--- a/include/net/netfilter/nf_conntrack.h
+++ b/include/net/netfilter/nf_conntrack.h
@@ -279,6 +279,18 @@ static inline bool nf_ct_should_gc(const struct nf_conn *ct)
!nf_ct_is_dying(ct);
}
+#define NF_CT_DAY (86400 * HZ)
+
+/* Set an arbitrary timeout large enough not to ever expire, this save
+ * us a check for the IPS_OFFLOAD_BIT from the packet path via
+ * nf_ct_is_expired().
+ */
+static inline void nf_ct_offload_timeout(struct nf_conn *ct)
+{
+ if (nf_ct_expires(ct) < NF_CT_DAY / 2)
+ ct->timeout = nfct_time_stamp + NF_CT_DAY;
+}
+
struct kernel_param;
int nf_conntrack_set_hashsize(const char *val, const struct kernel_param *kp);