aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJozsef Kadlecsik <kadlec@blackhole.kfki.hu>2011-05-24 04:20:17 -0400
committerPablo Neira Ayuso <pablo@netfilter.org>2011-05-26 13:07:32 -0400
commit249ddc79a38a8918ad53ac22606ca8af694344a5 (patch)
tree41d253f884f7da6e18300b8b3056c45c020e9953
parent71338aa7d050c86d8765cd36e46be514fb0ebbce (diff)
netfilter: ipset: Use proper timeout value to jiffies conversion
Signed-off-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
-rw-r--r--include/linux/netfilter/ipset/ip_set_timeout.h18
1 files changed, 10 insertions, 8 deletions
diff --git a/include/linux/netfilter/ipset/ip_set_timeout.h b/include/linux/netfilter/ipset/ip_set_timeout.h
index 9f30c5f2ec1..bcdd40ad39e 100644
--- a/include/linux/netfilter/ipset/ip_set_timeout.h
+++ b/include/linux/netfilter/ipset/ip_set_timeout.h
@@ -45,7 +45,7 @@ ip_set_timeout_test(unsigned long timeout)
45{ 45{
46 return timeout != IPSET_ELEM_UNSET && 46 return timeout != IPSET_ELEM_UNSET &&
47 (timeout == IPSET_ELEM_PERMANENT || 47 (timeout == IPSET_ELEM_PERMANENT ||
48 time_after(timeout, jiffies)); 48 time_is_after_jiffies(timeout));
49} 49}
50 50
51static inline bool 51static inline bool
@@ -53,7 +53,7 @@ ip_set_timeout_expired(unsigned long timeout)
53{ 53{
54 return timeout != IPSET_ELEM_UNSET && 54 return timeout != IPSET_ELEM_UNSET &&
55 timeout != IPSET_ELEM_PERMANENT && 55 timeout != IPSET_ELEM_PERMANENT &&
56 time_before(timeout, jiffies); 56 time_is_before_jiffies(timeout);
57} 57}
58 58
59static inline unsigned long 59static inline unsigned long
@@ -64,7 +64,7 @@ ip_set_timeout_set(u32 timeout)
64 if (!timeout) 64 if (!timeout)
65 return IPSET_ELEM_PERMANENT; 65 return IPSET_ELEM_PERMANENT;
66 66
67 t = timeout * HZ + jiffies; 67 t = msecs_to_jiffies(timeout * 1000) + jiffies;
68 if (t == IPSET_ELEM_UNSET || t == IPSET_ELEM_PERMANENT) 68 if (t == IPSET_ELEM_UNSET || t == IPSET_ELEM_PERMANENT)
69 /* Bingo! */ 69 /* Bingo! */
70 t++; 70 t++;
@@ -75,7 +75,8 @@ ip_set_timeout_set(u32 timeout)
75static inline u32 75static inline u32
76ip_set_timeout_get(unsigned long timeout) 76ip_set_timeout_get(unsigned long timeout)
77{ 77{
78 return timeout == IPSET_ELEM_PERMANENT ? 0 : (timeout - jiffies)/HZ; 78 return timeout == IPSET_ELEM_PERMANENT ? 0 :
79 jiffies_to_msecs(timeout - jiffies)/1000;
79} 80}
80 81
81#else 82#else
@@ -89,14 +90,14 @@ static inline bool
89ip_set_timeout_test(unsigned long timeout) 90ip_set_timeout_test(unsigned long timeout)
90{ 91{
91 return timeout == IPSET_ELEM_PERMANENT || 92 return timeout == IPSET_ELEM_PERMANENT ||
92 time_after(timeout, jiffies); 93 time_is_after_jiffies(timeout);
93} 94}
94 95
95static inline bool 96static inline bool
96ip_set_timeout_expired(unsigned long timeout) 97ip_set_timeout_expired(unsigned long timeout)
97{ 98{
98 return timeout != IPSET_ELEM_PERMANENT && 99 return timeout != IPSET_ELEM_PERMANENT &&
99 time_before(timeout, jiffies); 100 time_is_before_jiffies(timeout);
100} 101}
101 102
102static inline unsigned long 103static inline unsigned long
@@ -107,7 +108,7 @@ ip_set_timeout_set(u32 timeout)
107 if (!timeout) 108 if (!timeout)
108 return IPSET_ELEM_PERMANENT; 109 return IPSET_ELEM_PERMANENT;
109 110
110 t = timeout * HZ + jiffies; 111 t = msecs_to_jiffies(timeout * 1000) + jiffies;
111 if (t == IPSET_ELEM_PERMANENT) 112 if (t == IPSET_ELEM_PERMANENT)
112 /* Bingo! :-) */ 113 /* Bingo! :-) */
113 t++; 114 t++;
@@ -118,7 +119,8 @@ ip_set_timeout_set(u32 timeout)
118static inline u32 119static inline u32
119ip_set_timeout_get(unsigned long timeout) 120ip_set_timeout_get(unsigned long timeout)
120{ 121{
121 return timeout == IPSET_ELEM_PERMANENT ? 0 : (timeout - jiffies)/HZ; 122 return timeout == IPSET_ELEM_PERMANENT ? 0 :
123 jiffies_to_msecs(timeout - jiffies)/1000;
122} 124}
123#endif /* ! IP_SET_BITMAP_TIMEOUT */ 125#endif /* ! IP_SET_BITMAP_TIMEOUT */
124 126