Skip to content

Commit 73f9407

Browse files
roidayanummakynes
authored andcommitted
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 <[email protected]> Reviewed-by: Oz Shlomo <[email protected]> Signed-off-by: Pablo Neira Ayuso <[email protected]>
1 parent 2ef740d commit 73f9407

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

include/net/netfilter/nf_conntrack.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,18 @@ static inline bool nf_ct_should_gc(const struct nf_conn *ct)
279279
!nf_ct_is_dying(ct);
280280
}
281281

282+
#define NF_CT_DAY (86400 * HZ)
283+
284+
/* Set an arbitrary timeout large enough not to ever expire, this save
285+
* us a check for the IPS_OFFLOAD_BIT from the packet path via
286+
* nf_ct_is_expired().
287+
*/
288+
static inline void nf_ct_offload_timeout(struct nf_conn *ct)
289+
{
290+
if (nf_ct_expires(ct) < NF_CT_DAY / 2)
291+
ct->timeout = nfct_time_stamp + NF_CT_DAY;
292+
}
293+
282294
struct kernel_param;
283295

284296
int nf_conntrack_set_hashsize(const char *val, const struct kernel_param *kp);

net/netfilter/nf_conntrack_core.c

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1344,18 +1344,6 @@ static bool gc_worker_can_early_drop(const struct nf_conn *ct)
13441344
return false;
13451345
}
13461346

1347-
#define DAY (86400 * HZ)
1348-
1349-
/* Set an arbitrary timeout large enough not to ever expire, this save
1350-
* us a check for the IPS_OFFLOAD_BIT from the packet path via
1351-
* nf_ct_is_expired().
1352-
*/
1353-
static void nf_ct_offload_timeout(struct nf_conn *ct)
1354-
{
1355-
if (nf_ct_expires(ct) < DAY / 2)
1356-
ct->timeout = nfct_time_stamp + DAY;
1357-
}
1358-
13591347
static void gc_worker(struct work_struct *work)
13601348
{
13611349
unsigned int min_interval = max(HZ / GC_MAX_BUCKETS_DIV, 1u);

0 commit comments

Comments
 (0)