From: Eric Leblond <eric@regit.org>
To: netfilter-devel@vger.kernel.org
Subject: Re: [nftables 3/3] mnl: improve select timeout logic
Date: Wed, 24 Jun 2015 11:31:16 +0200 [thread overview]
Message-ID: <1435138276.18335.10.camel@regit.org> (raw)
In-Reply-To: <1435132311-31452-4-git-send-email-eric@regit.org>
Hello,
Following live discussion with Pablo, please disregard this patch.
Sending a v2 in the following minutes.
BR,
On Wed, 2015-06-24 at 09:51 +0200, Eric Leblond wrote:
> This patch explicitely set timeout for select in mnl_batch_talk.
> Timeout used at the second call was the time spend on first select
> and this was not looking correct. Instead this patch set a short
> timeout as we are supposed to dequeue waiting kernel messages.
>
> Signed-off-by: Eric Leblond <eric@regit.org>
> ---
> src/mnl.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/src/mnl.c b/src/mnl.c
> index 76a9714..2da1074 100644
> --- a/src/mnl.c
> +++ b/src/mnl.c
> @@ -246,7 +246,7 @@ int mnl_batch_talk(struct mnl_socket *nl, struct
> list_head *err_list)
> char rcv_buf[MNL_SOCKET_BUFFER_SIZE];
> fd_set readfds;
> struct timeval tv = {
> - .tv_sec = 0,
> + .tv_sec = 10,
> .tv_usec = 0
> };
>
> @@ -274,6 +274,8 @@ int mnl_batch_talk(struct mnl_socket *nl, struct
> list_head *err_list)
> if (ret == -1)
> mnl_err_list_node_add(err_list, errno, nlh
> ->nlmsg_seq);
>
> + tv.tv_sec = 0;
> + tv.tv_usec = 1000;
> ret = select(fd+1, &readfds, NULL, NULL, &tv);
> if (ret == -1)
> return -1;
--
Eric Leblond <eric@regit.org>
Blog: https://home.regit.org/
prev parent reply other threads:[~2015-06-24 9:31 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-24 7:51 [nftables 0/3] misc fixes Eric Leblond
2015-06-24 7:51 ` [nftables 1/3] erec: fix buffer overflow Eric Leblond
2015-06-30 0:03 ` Pablo Neira Ayuso
2015-06-24 7:51 ` [nftables 2/3] erec: fix logic when reading from file Eric Leblond
2015-06-30 0:03 ` Pablo Neira Ayuso
2015-06-24 7:51 ` [nftables 3/3] mnl: improve select timeout logic Eric Leblond
2015-06-24 9:31 ` Eric Leblond [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1435138276.18335.10.camel@regit.org \
--to=eric@regit.org \
--cc=netfilter-devel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).