summaryrefslogtreecommitdiffstats
path: root/kernel/include/linux/netfilter/ipset/ip_set_timeout.h
diff options
context:
space:
mode:
authorJozsef Kadlecsik <kadlec@blackhole.kfki.hu>2018-05-31 18:45:21 +0200
committerJozsef Kadlecsik <kadlec@blackhole.kfki.hu>2018-06-01 13:22:41 +0200
commit8b140bd12daffd6b3c6e50af9c55f8a601900664 (patch)
treecc701a5e9b24b5a1ed389c489aced05d8f1a88f3 /kernel/include/linux/netfilter/ipset/ip_set_timeout.h
parent5f9b3901a058c8a530d3831027a21c5497a07807 (diff)
List timing out entries with "timeout 1" instead of zero timeout value
When listing sets with timeout support, there's a probability that just timing out entries with "0" timeout value is listed/saved. However when restoring the saved list, the zero timeout value means permanent elelements. The new behaviour is that timing out entries are listed with "timeout 1" instead of zero. Fixes bugzilla #1258.
Diffstat (limited to 'kernel/include/linux/netfilter/ipset/ip_set_timeout.h')
-rw-r--r--kernel/include/linux/netfilter/ipset/ip_set_timeout.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/kernel/include/linux/netfilter/ipset/ip_set_timeout.h b/kernel/include/linux/netfilter/ipset/ip_set_timeout.h
index bfb3531..7ad8ddf 100644
--- a/kernel/include/linux/netfilter/ipset/ip_set_timeout.h
+++ b/kernel/include/linux/netfilter/ipset/ip_set_timeout.h
@@ -65,8 +65,14 @@ ip_set_timeout_set(unsigned long *timeout, u32 value)
static inline u32
ip_set_timeout_get(const unsigned long *timeout)
{
- return *timeout == IPSET_ELEM_PERMANENT ? 0 :
- jiffies_to_msecs(*timeout - jiffies)/MSEC_PER_SEC;
+ u32 t;
+
+ if (*timeout == IPSET_ELEM_PERMANENT)
+ return 0;
+
+ t = jiffies_to_msecs(*timeout - jiffies)/MSEC_PER_SEC;
+ /* Zero value in userspace means no timeout */
+ return t == 0 ? 1 : t;
}
#endif /* __KERNEL__ */