From: Pablo Neira Ayuso <pablo@netfilter.org>
To: dmitry pervushin <dmitry.pervushin@linaro.org>
Cc: netfilter-devel@vger.kernel.org, linux-kernel@vger.kernel.org,
patches@linaro.org, dmitry pervushin <dpervushin@gmail.com>,
Ashish Sharma <ashishsharma@google.com>,
JP Abgrall <jpa@google.com>, John Stultz <john.stultz@linaro.org>
Subject: Re: [PATCH 1/2] netfilter: idletimers - fix the case of already expired timer
Date: Fri, 26 Apr 2013 03:24:38 +0200 [thread overview]
Message-ID: <20130426012438.GA4486@localhost> (raw)
In-Reply-To: <1366537994-19511-2-git-send-email-dmitry.pervushin@linaro.org>
Hi,
Same thing with this patch:
https://patchwork.kernel.org/patch/2333841/
Regards.
On Sun, Apr 21, 2013 at 11:53:13AM +0200, dmitry pervushin wrote:
> From: dmitry pervushin <dpervushin@gmail.com>
>
> Fix the case in which timer has expired and we refresh it without
> sending the notification
>
> Signed-off-by: Ashish Sharma <ashishsharma@google.com>
> Signed-off-by: JP Abgrall <jpa@google.com>
> Signed-off-by: John Stultz <john.stultz@linaro.org>
> Signed-off-by: dmitry pervushin <dmitry.pervushin@linaro.org>
> ---
> net/netfilter/xt_IDLETIMER.c | 18 ++++++++++++++++--
> 1 file changed, 16 insertions(+), 2 deletions(-)
>
> diff --git a/net/netfilter/xt_IDLETIMER.c b/net/netfilter/xt_IDLETIMER.c
> index f407ebc1..3540c04 100644
> --- a/net/netfilter/xt_IDLETIMER.c
> +++ b/net/netfilter/xt_IDLETIMER.c
> @@ -168,14 +168,22 @@ static unsigned int idletimer_tg_target(struct sk_buff *skb,
> const struct xt_action_param *par)
> {
> const struct idletimer_tg_info *info = par->targinfo;
> + unsigned long now = jiffies;
>
> pr_debug("resetting timer %s, timeout period %u\n",
> info->label, info->timeout);
>
> BUG_ON(!info->timer);
>
> + if (time_before(info->timer->timer.expires, now)) {
> + schedule_work(&info->timer->work);
> + pr_debug("Starting timer %s (Expired, Jiffies): %lu, %lu\n",
> + info->label, info->timer->timer.expires, now);
> + }
> +
> + /* TODO: Avoid modifying timers on each packet */
> mod_timer(&info->timer->timer,
> - msecs_to_jiffies(info->timeout * 1000) + jiffies);
> + msecs_to_jiffies(info->timeout * 1000) + now);
>
> return XT_CONTINUE;
> }
> @@ -184,6 +192,7 @@ static int idletimer_tg_checkentry(const struct xt_tgchk_param *par)
> {
> struct idletimer_tg_info *info = par->targinfo;
> int ret;
> + unsigned long now = jiffies;
>
> pr_debug("checkentry targinfo%s\n", info->label);
>
> @@ -204,8 +213,13 @@ static int idletimer_tg_checkentry(const struct xt_tgchk_param *par)
> info->timer = __idletimer_tg_find_by_label(info->label);
> if (info->timer) {
> info->timer->refcnt++;
> + if (time_before(info->timer->timer.expires, now)) {
> + schedule_work(&info->timer->work);
> + pr_debug("Starting Checkentry timer (Expired, Jiffies): %lu, %lu\n",
> + info->timer->timer.expires, now);
> + }
> mod_timer(&info->timer->timer,
> - msecs_to_jiffies(info->timeout * 1000) + jiffies);
> + msecs_to_jiffies(info->timeout * 1000) + now);
>
> pr_debug("increased refcnt of timer %s to %u\n",
> info->label, info->timer->refcnt);
> --
> 1.7.10.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2013-04-26 1:24 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-21 9:53 [PATCH 0/2] netfilter: idletimers dmitry pervushin
2013-04-21 9:53 ` [PATCH 1/2] netfilter: idletimers - fix the case of already expired timer dmitry pervushin
2013-04-26 1:24 ` Pablo Neira Ayuso [this message]
2013-04-21 9:53 ` [PATCH 2/2] netfilter: idletimers - add send_nl_msg field dmitry pervushin
2013-04-26 1:22 ` Pablo Neira Ayuso
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=20130426012438.GA4486@localhost \
--to=pablo@netfilter.org \
--cc=ashishsharma@google.com \
--cc=dmitry.pervushin@linaro.org \
--cc=dpervushin@gmail.com \
--cc=john.stultz@linaro.org \
--cc=jpa@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netfilter-devel@vger.kernel.org \
--cc=patches@linaro.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).