From: Patrick McHardy <kaber@trash.net>
To: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: Netfilter Development Mailinglist <netfilter-devel@vger.kernel.org>
Subject: netfilter: nf_conntrack: fix lifetime display for disabled connections
Date: Wed, 19 Jan 2011 19:13:00 +0100 [thread overview]
Message-ID: <4D3729AC.1090702@trash.net> (raw)
[-- Attachment #1: Type: text/plain, Size: 0 bytes --]
[-- Attachment #2: x --]
[-- Type: text/plain, Size: 1936 bytes --]
commit f5c88f56b35599ab9ff2d3398e0153e4cd4a4c82
Author: Patrick McHardy <kaber@trash.net>
Date: Wed Jan 19 19:10:49 2011 +0100
netfilter: nf_conntrack: fix lifetime display for disabled connections
When no tstamp extension exists, ct_delta_time() returns -1, which is
then assigned to an u64 and tested for negative values to decide
whether to display the lifetime. This obviously doesn't work, use
a s64 and merge the two minor functions into one.
Signed-off-by: Patrick McHardy <kaber@trash.net>
diff --git a/net/netfilter/nf_conntrack_standalone.c b/net/netfilter/nf_conntrack_standalone.c
index 69107fd..0ae1428 100644
--- a/net/netfilter/nf_conntrack_standalone.c
+++ b/net/netfilter/nf_conntrack_standalone.c
@@ -141,29 +141,24 @@ static inline int ct_show_secctx(struct seq_file *s, const struct nf_conn *ct)
#endif
#ifdef CONFIG_NF_CONNTRACK_TIMESTAMP
-static u_int64_t ct_delta_time(u_int64_t time_now, const struct nf_conn *ct)
+static int ct_show_delta_time(struct seq_file *s, const struct nf_conn *ct)
{
+ struct ct_iter_state *st = s->private;
struct nf_conn_tstamp *tstamp;
+ s64 delta_time;
tstamp = nf_conn_tstamp_find(ct);
if (tstamp) {
- u_int64_t delta_time = time_now - tstamp->start;
- return delta_time > 0 ? div_s64(delta_time, NSEC_PER_SEC) : 0;
+ delta_time = st->time_now - tstamp->start;
+ if (delta_time > 0)
+ delta_time = div_s64(delta_time, NSEC_PER_SEC);
+ else
+ delta_time = 0;
+
+ return seq_printf(s, "delta-time=%llu ",
+ (unsigned long long)delta_time);
}
- return -1;
-}
-
-static int ct_show_delta_time(struct seq_file *s, const struct nf_conn *ct)
-{
- struct ct_iter_state *st = s->private;
- u_int64_t delta_time;
-
- delta_time = ct_delta_time(st->time_now, ct);
- if (delta_time < 0)
- return 0;
-
- return seq_printf(s, "delta-time=%llu ",
- (unsigned long long)delta_time);
+ return 0;
}
#else
static inline int
next reply other threads:[~2011-01-19 18:13 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-01-19 18:13 Patrick McHardy [this message]
2011-01-19 18:18 ` netfilter: nf_conntrack: fix lifetime display for disabled connections 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=4D3729AC.1090702@trash.net \
--to=kaber@trash.net \
--cc=netfilter-devel@vger.kernel.org \
--cc=pablo@netfilter.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.