* [PATCH 1/1] ipset: fix timeout data type size
@ 2013-10-31 4:34 Nikolay Martynov
2013-11-08 5:31 ` Nikolay Martynov
2013-11-11 20:51 ` Jozsef Kadlecsik
0 siblings, 2 replies; 3+ messages in thread
From: Nikolay Martynov @ 2013-10-31 4:34 UTC (permalink / raw)
To: kadlec; +Cc: Nikolay Martynov, netfilter-devel
Currently it is impossible to set timeout on some architectures
(MIPS ar71xx at least) because timeout is parsed into long long data
type but used as uint32 without proper conversion. This patch fixes
this issue. Tested on ar71xx router.
Signed-off-by: Nikolay Martynov <mar.kolya@gmail.com>
---
lib/parse.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/lib/parse.c b/lib/parse.c
index 8ea8542..440ef8f 100644
--- a/lib/parse.c
+++ b/lib/parse.c
@@ -1292,15 +1292,20 @@ ipset_parse_timeout(struct ipset_session *session,
enum ipset_opt opt, const char *str)
{
int err;
- unsigned long long num = 0;
+ unsigned long long llnum = 0;
+ uint32_t num = 0;
assert(session);
assert(opt == IPSET_OPT_TIMEOUT);
assert(str);
- err = string_to_number_ll(session, str, 0, UINT_MAX/1000, &num);
- if (err == 0)
+ err = string_to_number_ll(session, str, 0, UINT_MAX/1000, &llnum);
+ if (err == 0) {
+ /* Timeout is expected to be 32bits wide, so we have
+ to convert it here */
+ num = llnum;
return ipset_session_data_set(session, opt, &num);
+ }
return err;
}
--
Thanks.
Nikolay.
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 1/1] ipset: fix timeout data type size
2013-10-31 4:34 [PATCH 1/1] ipset: fix timeout data type size Nikolay Martynov
@ 2013-11-08 5:31 ` Nikolay Martynov
2013-11-11 20:51 ` Jozsef Kadlecsik
1 sibling, 0 replies; 3+ messages in thread
From: Nikolay Martynov @ 2013-11-08 5:31 UTC (permalink / raw)
To: kadlec; +Cc: netfilter-devel
Hi.
I've sent this patch for ipset some time ago. It fixes a bug that
surfaces itself on some platforms (notably on mips routers running
openwrt). Unfortunately I have not seen any feedback/response to this
patch. Is something wrong with the proposed fix or with patch itself?
Could you please let me know.
Thanks!
2013/10/31 Nikolay Martynov <mar.kolya@gmail.com>:
> Currently it is impossible to set timeout on some architectures
> (MIPS ar71xx at least) because timeout is parsed into long long data
> type but used as uint32 without proper conversion. This patch fixes
> this issue. Tested on ar71xx router.
>
> Signed-off-by: Nikolay Martynov <mar.kolya@gmail.com>
> ---
> lib/parse.c | 11 ++++++++---
> 1 file changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/lib/parse.c b/lib/parse.c
> index 8ea8542..440ef8f 100644
> --- a/lib/parse.c
> +++ b/lib/parse.c
> @@ -1292,15 +1292,20 @@ ipset_parse_timeout(struct ipset_session *session,
> enum ipset_opt opt, const char *str)
> {
> int err;
> - unsigned long long num = 0;
> + unsigned long long llnum = 0;
> + uint32_t num = 0;
>
> assert(session);
> assert(opt == IPSET_OPT_TIMEOUT);
> assert(str);
>
> - err = string_to_number_ll(session, str, 0, UINT_MAX/1000, &num);
> - if (err == 0)
> + err = string_to_number_ll(session, str, 0, UINT_MAX/1000, &llnum);
> + if (err == 0) {
> + /* Timeout is expected to be 32bits wide, so we have
> + to convert it here */
> + num = llnum;
> return ipset_session_data_set(session, opt, &num);
> + }
>
> return err;
> }
> --
> Thanks.
> Nikolay.
>
--
Martynov Nikolay.
Email: mar.kolya@gmail.com
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 1/1] ipset: fix timeout data type size
2013-10-31 4:34 [PATCH 1/1] ipset: fix timeout data type size Nikolay Martynov
2013-11-08 5:31 ` Nikolay Martynov
@ 2013-11-11 20:51 ` Jozsef Kadlecsik
1 sibling, 0 replies; 3+ messages in thread
From: Jozsef Kadlecsik @ 2013-11-11 20:51 UTC (permalink / raw)
To: Nikolay Martynov; +Cc: netfilter-devel
On Thu, 31 Oct 2013, Nikolay Martynov wrote:
> Currently it is impossible to set timeout on some architectures
> (MIPS ar71xx at least) because timeout is parsed into long long data
> type but used as uint32 without proper conversion. This patch fixes
> this issue. Tested on ar71xx router.
Patch is applied, thanks!
Best regards,
Jozsef
-
E-mail : kadlec@blackhole.kfki.hu, kadlecsik.jozsef@wigner.mta.hu
PGP key : http://www.kfki.hu/~kadlec/pgp_public_key.txt
Address : Wigner Research Centre for Physics, Hungarian Academy of Sciences
H-1525 Budapest 114, POB. 49, Hungary
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-11-11 20:51 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-31 4:34 [PATCH 1/1] ipset: fix timeout data type size Nikolay Martynov
2013-11-08 5:31 ` Nikolay Martynov
2013-11-11 20:51 ` Jozsef Kadlecsik
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).