ipset timeout problem
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hello,
I am using ipset v. 6.2 on my Debian 6.0 64 bit box with kernel verison 2.6.37.2 #12. I used the command "ipset create test iptree --timeout 10800" for creating the set and add the ip addresses by using "ipset add test x.x.x.x". At beginning there seems no problem but after a while timeout values increases for ip addresses. Moreover I use a script to add those ip addresses to this set. The output of "ipset list test" is below:
Name: test
Type: hash:ip
Header: family inet hashsize 8192 maxelem 65536 timeout 10800 Size in memory: 733184
References: 3
Members:
82.192.209.168 timeout 14134968
208.64.3.39 timeout 14365461
208.64.174.47 timeout 14384661
82.192.190.201 timeout 14132269
82.192.9.77 timeout 8601380
82.192.27.13 timeout 12652080
82.192.3.140 timeout 12380980
208.64.124.180 timeout 14378563
208.64.50.80 timeout 14370262
82.192.83.196 timeout 13290880
188.132.196.169 timeout 39439453
82.192.42.169 timeout 12851080
208.64.104.203 timeout 6423
82.192.19.153 timeout 12571180
208.64.43.25 timeout 14369162
82.192.70.245 timeout 13141480
you can see the timeout values are much more higher than 10800 seconds but some of them are correct.
What does cause this problem?
Regards,
Lutfi
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iQEcBAEBAgAGBQJN0ipqAAoJEOASPA9veM4zHvUH/jnQ/8PV+GC8kZu7yHuWR5dS rz/iziJat1X1nE626JOJjI0nQuxAuOtbUwtOoslprgf0WZB0Sk04ewxL1DdmlerT hcGN7lVwGtOczrgRXS8i6DoSqH9KSzSyxqdnT1kuQ8VEI0CBfVeZh313kCk644sT 0G3gGPMjDtS1FY6brUAFZtFQq9GJjgVZcUiSQK+3xVQewUEKoLPoJfVyDnt+MBMz TPXhYKLQtRwLQN9efmNwlrNxJa1ux5VhmCxNPycWfog1Av6tUnBzxbNYzuYiob6h 9rUC7voMiBffNE26O1mf9mFGmyLSjPmPZ4Ca5T3vDFRcz36R5x8K4Cs0/VC+Xu0= =2LZD
-----END PGP SIGNATURE-----
Quoted 8 lines · Lutfi
I am using ipset v. 6.2 on my Debian 6.0 64 bit box with kernel verison 2.6.37.2 #12. I used the command "ipset create test iptree --timeout 10800" for creating the set and add the ip addresses by using "ipset add test x.x.x.x". At beginning there seems no problem but after a while timeout values increases for ip addresses. Moreover I use a script to add those ip addresses to this set. The output of "ipset list test" is below:
Quoted 7 lines
Name: test
Type: hash:ip
Header: family inet hashsize 8192 maxelem 65536 timeout 10800 Size in memory: 733184
References: 3
Members:
82.192.209.168 timeout 14134968
I have tried to reproduce it with ipset-6.5 and was unsuccessful. However, there are some problems with the timeout conversions in the kernel. Could you try the attached patch and report back whether it solves the issue?
Best regards,
Jozsef
-
E-mail : [email protected], [email protected] PGP key : http://www.kfki.hu/~kadlec/pgp_public_key.txt
Address : KFKI Research Institute for Particle and Nuclear Physics
H-1525 Budapest 114, POB. 49, Hungary
kernel/include/linux/netfilter/ipset/ip_set_timeout.h +10 -8
@@ -48,7 +48,7 @@ ip_set_timeout_test(unsigned long timeout) {return timeout !=IPSET_ELEM_UNSET && (timeout ==IPSET_ELEM_PERMANENT || -time_after (timeout, jiffies)); +time_is_after_jiffies (timeout)); } static inline bool
@@ -56,7 +56,7 @@ ip_set_timeout_expired(unsigned long timeout) {return timeout !=IPSET_ELEM_UNSET && timeout !=IPSET_ELEM_PERMANENT && -time_before (timeout, jiffies); +time_is_before_jiffies (timeout); } static inline unsigned long
@@ -67,7 +67,7 @@ ip_set_timeout_set(u32 timeout)if (!timeout)return IPSET_ELEM_PERMANENT ; - t = timeout *HZ + jiffies; + t =msecs_to_jiffies (timeout *1000 ) + jiffies;if (t ==IPSET_ELEM_UNSET || t ==IPSET_ELEM_PERMANENT )/* Bingo! */ t++;
@@ -78,7 +78,8 @@ ip_set_timeout_set(u32 timeout)static inline u32 ip_set_timeout_get (unsigned long timeout) { -return timeout ==IPSET_ELEM_PERMANENT ?0 : (timeout - jiffies)/HZ ; +return timeout ==IPSET_ELEM_PERMANENT ?0 : +jiffies_to_msecs (timeout - jiffies)/1000 ; }#else
@@ -92,14 +93,14 @@ static inline bool ip_set_timeout_test(unsigned long timeout) {return timeout ==IPSET_ELEM_PERMANENT || -time_after (timeout, jiffies); +time_is_after_jiffies (timeout); }static inline bool ip_set_timeout_expired (unsigned long timeout) {return timeout !=IPSET_ELEM_PERMANENT && -time_before (timeout, jiffies); +time_is_before_jiffies (timeout); } static inline unsigned long
@@ -110,7 +111,7 @@ ip_set_timeout_set(u32 timeout)if (!timeout)return IPSET_ELEM_PERMANENT ; - t = timeout *HZ + jiffies; + t =msecs_to_jiffies (timeout *1000 ) + jiffies;if (t ==IPSET_ELEM_PERMANENT )/* Bingo! :-) */ t++;
@@ -121,7 +122,8 @@ ip_set_timeout_set(u32 timeout)static inline u32 ip_set_timeout_get (unsigned long timeout) { -return timeout ==IPSET_ELEM_PERMANENT ?0 : (timeout - jiffies)/HZ ; +return timeout ==IPSET_ELEM_PERMANENT ?0 : +jiffies_to_msecs (timeout - jiffies)/1000 ; }#endif /* ! IP_SET_BITMAP_TIMEOUT */