Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1236183 > unrolled thread
| Started by | Arnd Bergmann <arnd@arndb.de> |
|---|---|
| First post | 2015-09-30 13:30 +0200 |
| Last post | 2015-10-02 23:30 +0200 |
| Articles | 3 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH 08/12] nfnetlink: use y2038 safe timestamp Arnd Bergmann <arnd@arndb.de> - 2015-09-30 13:30 +0200
Re: [PATCH 08/12] nfnetlink: use y2038 safe timestamp Pablo Neira Ayuso <pablo@netfilter.org> - 2015-10-02 14:50 +0200
Re: [PATCH 08/12] nfnetlink: use y2038 safe timestamp Arnd Bergmann <arnd@arndb.de> - 2015-10-02 23:30 +0200
| From | Arnd Bergmann <arnd@arndb.de> |
|---|---|
| Date | 2015-09-30 13:30 +0200 |
| Subject | [PATCH 08/12] nfnetlink: use y2038 safe timestamp |
| Message-ID | <qenKa-3xS-23@gated-at.bofh.it> |
The __build_packet_message function fills a nfulnl_msg_packet_timestamp
structure that uses 64-bit seconds and is therefore y2038 safe, but
it uses an intermediate 'struct timespec' which is not.
This trivially changes the code to use 'struct timespec64' instead,
to correct the result on 32-bit architectures.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Cc: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: Patrick McHardy <kaber@trash.net>
Cc: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Cc: netfilter-devel@vger.kernel.org
Cc: coreteam@netfilter.org
---
net/netfilter/nfnetlink_log.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/net/netfilter/nfnetlink_log.c b/net/netfilter/nfnetlink_log.c
index 4670821b569d..cc2300f4e177 100644
--- a/net/netfilter/nfnetlink_log.c
+++ b/net/netfilter/nfnetlink_log.c
@@ -538,9 +538,9 @@ __build_packet_message(struct nfnl_log_net *log,
if (skb->tstamp.tv64) {
struct nfulnl_msg_packet_timestamp ts;
- struct timeval tv = ktime_to_timeval(skb->tstamp);
- ts.sec = cpu_to_be64(tv.tv_sec);
- ts.usec = cpu_to_be64(tv.tv_usec);
+ struct timespec64 kts = ktime_to_timespec64(skb->tstamp);
+ ts.sec = cpu_to_be64(kts.tv_sec);
+ ts.usec = cpu_to_be64(kts.tv_nsec / NSEC_PER_USEC);
if (nla_put(inst->skb, NFULA_TIMESTAMP, sizeof(ts), &ts))
goto nla_put_failure;
--
2.1.0.rc2
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [next] | [standalone]
| From | Pablo Neira Ayuso <pablo@netfilter.org> |
|---|---|
| Date | 2015-10-02 14:50 +0200 |
| Message-ID | <qf7WG-3Cy-11@gated-at.bofh.it> |
| In reply to | #1236183 |
On Wed, Sep 30, 2015 at 01:26:38PM +0200, Arnd Bergmann wrote: > The __build_packet_message function fills a nfulnl_msg_packet_timestamp > structure that uses 64-bit seconds and is therefore y2038 safe, but > it uses an intermediate 'struct timespec' which is not. > > This trivially changes the code to use 'struct timespec64' instead, > to correct the result on 32-bit architectures. > > Signed-off-by: Arnd Bergmann <arnd@arndb.de> > Cc: Pablo Neira Ayuso <pablo@netfilter.org> > Cc: Patrick McHardy <kaber@trash.net> > Cc: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu> > Cc: netfilter-devel@vger.kernel.org > Cc: coreteam@netfilter.org Acked-by: Pablo Neira Ayuso <pablo@netfilter.org> BTW, I don't see the patch for nfnetlink_queue and I think I have seen it in the diffstat from your cover letter. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Arnd Bergmann <arnd@arndb.de> |
|---|---|
| Date | 2015-10-02 23:30 +0200 |
| Message-ID | <qfg3V-6Xd-15@gated-at.bofh.it> |
| In reply to | #1238168 |
On Friday 02 October 2015 14:53:55 Pablo Neira Ayuso wrote:
> On Wed, Sep 30, 2015 at 01:26:38PM +0200, Arnd Bergmann wrote:
> > The __build_packet_message function fills a nfulnl_msg_packet_timestamp
> > structure that uses 64-bit seconds and is therefore y2038 safe, but
> > it uses an intermediate 'struct timespec' which is not.
> >
> > This trivially changes the code to use 'struct timespec64' instead,
> > to correct the result on 32-bit architectures.
> >
> > Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> > Cc: Pablo Neira Ayuso <pablo@netfilter.org>
> > Cc: Patrick McHardy <kaber@trash.net>
> > Cc: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
> > Cc: netfilter-devel@vger.kernel.org
> > Cc: coreteam@netfilter.org
>
> Acked-by: Pablo Neira Ayuso <pablo@netfilter.org>
Thanks
> BTW, I don't see the patch for nfnetlink_queue and I think I have seen
> it in the diffstat from your cover letter.
My text must have been unclear. What I meant is that I have identified
that file as needing a patch (among 120 other files) but have not
written one.
This one is trivial, it just needs replacing this code
if (entskb->tstamp.tv64) {
struct nfqnl_msg_packet_timestamp ts;
struct timeval tv = ktime_to_timeval(entskb->tstamp);
ts.sec = cpu_to_be64(tv.tv_sec);
ts.usec = cpu_to_be64(tv.tv_usec);
if (nla_put(skb, NFQA_TIMESTAMP, sizeof(ts), &ts))
goto nla_put_failure;
}
with a version using ktime_to_timespec64. If you or someone else does
this, that makes one less file for me to track.
Arnd
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web