NetBSD Problem Report #45257
From tsutsui@ceres.dti.ne.jp Mon Aug 15 07:50:13 2011
Return-Path: <tsutsui@ceres.dti.ne.jp>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
by www.NetBSD.org (Postfix) with ESMTP id EAA7463B89A
for <gnats-bugs@gnats.NetBSD.org>; Mon, 15 Aug 2011 07:50:12 +0000 (UTC)
Message-Id: <201108150750.p7F7o8YI017764@mirage.localdomain>
Date: Mon, 15 Aug 2011 16:50:08 +0900 (JST)
From: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
Reply-To: tsutsui@ceres.dti.ne.jp
To: gnats-bugs@gnats.NetBSD.org
Cc: tsutsui@ceres.dti.ne.jp
Subject: ping(8) prints bogus round-trip times after Year 2038
X-Send-Pr-Version: 3.95
>Number: 45257
>Category: bin
>Synopsis: ping(8) prints bogus round-trip times after Year 2038
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: christos
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Mon Aug 15 07:55:00 +0000 2011
>Closed-Date: Tue Aug 23 17:36:13 +0000 2011
>Last-Modified: Sat Sep 10 20:05:02 +0000 2011
>Originator: Izumi Tsutsui
>Release: NetBSD 5.99.55
>Organization:
>Environment:
System: NetBSD 5.99.55 (GENERIC) #246: Tue Aug 9 00:26:31 JST 2011
Architecture: m68k
Machine: hp300
but affects all ports
>Description:
ping(8) prints wrong round-trip times after year 2038
even after 64 bit time_t changes.
On BE machines it occurs after year 2038,
and on LE machines after year ~2106.
>How-To-Repeat:
# uname -prs
NetBSD 5.99.55 m68k
# date
Mon Aug 15 16:26:40 JST 2011
# ping -n -c 1 192.168.20.1
PING 192.168.20.1 (192.168.20.1): 56 data bytes
64 bytes from 192.168.20.1: icmp_seq=0 ttl=255 time=4.292 ms
----192.168.20.1 PING Statistics----
1 packets transmitted, 1 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 4.292/4.292/4.292/0.000 ms
#
# date 203908151627.00
Mon Aug 15 16:27:00 JST 2039
# ping -n -c 1 192.168.20.1
PING 192.168.20.1 (192.168.20.1): 56 data bytes
64 bytes from 192.168.20.1: icmp_seq=0 ttl=255 time=4294967296004.156 ms
----192.168.20.1 PING Statistics----
1 packets transmitted, 1 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 999999999000.000/4294967296004.156/4294967296004.156/0.000 ms
#
# rdate 192.168.20.1
Mon Aug 15 16:27:03 2011
# ping -n -c 1 192.168.20.1
PING 192.168.20.1 (192.168.20.1): 56 data bytes
64 bytes from 192.168.20.1: icmp_seq=0 ttl=255 time=3.288 ms
----192.168.20.1 PING Statistics----
1 packets transmitted, 1 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 3.288/3.288/3.288/0.000 ms
#
>Fix:
The problem is that ping(8) uses 32bit values (as struct tv32)
to send F_TIMING info, but ntohl() and diffsec() don't
handle signedness and width properly:
http://nxr.NetBSD.org/xref/src/sbin/ping/ping.c#993
---
if (pingflags & F_TIMING) {
struct timeval tv;
struct tv32 tv32;
(void) memcpy(&tv32, icp->icmp_data, sizeof(tv32));
tv.tv_sec = ntohl(tv32.tv32_sec);
tv.tv_usec = ntohl(tv32.tv32_usec);
triptime = diffsec(&last_rx, &tv);
---
Note ntohl() and htonl() is no-op on BE machines
and both tv32_sec and tv.tv_sec are signed,
while on LE machines ntohl() implicitly casts its arg to unsigned.
Ryo Shimizu (ryo@) has a patch for this problem.
---
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: bin-bug-people->ryo
Responsible-Changed-By: ryo@NetBSD.org
Responsible-Changed-When: Mon, 15 Aug 2011 08:04:20 +0000
Responsible-Changed-Why:
mine
From: Ryo SHIMIZU <ryo@nerv.org>
To: gnats-bugs@NetBSD.org
Cc: gnats-admin@netbsd.org, netbsd-bugs@netbsd.org
Subject: Re: bin/45257: ping(8) prints bogus round-trip times after Year 2038
Date: Mon, 15 Aug 2011 17:07:18 +0900
>Fix:
Is this patch ok?
Index: ping.c
===================================================================
RCS file: /cvsroot/src/sbin/ping/ping.c,v
retrieving revision 1.94
diff -a -u -r1.94 ping.c
--- ping.c 9 Aug 2011 12:55:19 -0000 1.94
+++ ping.c 15 Aug 2011 07:26:19 -0000
@@ -137,8 +137,8 @@
#define TST(seq) (A(seq) & B(seq))
struct tv32 {
- int32_t tv32_sec;
- int32_t tv32_usec;
+ uint32_t tv32_sec;
+ uint32_t tv32_usec;
};
@@ -213,6 +213,7 @@
static void fill(void);
static void rnd_fill(void);
static double diffsec(struct timeval *, struct timeval *);
+static double diffsec_tv32(struct timeval *, struct tv32 *);
static void timevaladd(struct timeval *, struct timeval *);
static void sec_to_timeval(const double, struct timeval *);
static double timeval_to_sec(const struct timeval *);
@@ -859,7 +860,7 @@
opack_icmp.icmp_type = ICMP_ECHO;
opack_icmp.icmp_id = ident;
- tv32.tv32_sec = htonl(now.tv_sec);
+ tv32.tv32_sec = htonl((uint32_t)now.tv_sec);
tv32.tv32_usec = htonl(now.tv_usec);
if (pingflags & F_TIMING)
(void) memcpy(&opack_icmp.icmp_data[0], &tv32, sizeof(tv32));
@@ -991,13 +992,13 @@
first_rx = last_rx;
nreceived++;
if (pingflags & F_TIMING) {
- struct timeval tv;
struct tv32 tv32;
(void) memcpy(&tv32, icp->icmp_data, sizeof(tv32));
- tv.tv_sec = ntohl(tv32.tv32_sec);
- tv.tv_usec = ntohl(tv32.tv32_usec);
- triptime = diffsec(&last_rx, &tv);
+ NTOHL(tv32.tv32_sec);
+ NTOHL(tv32.tv32_usec);
+
+ triptime = diffsec_tv32(&last_rx, &tv32);
tsum += triptime;
tsumsq += triptime * triptime;
if (triptime < tmin)
@@ -1246,6 +1247,13 @@
+ (timenow->tv_usec - then->tv_usec)/1000000.0);
}
+static double
+diffsec_tv32(struct timeval *timenow, struct tv32 *then)
+{
+ return (((timenow->tv_sec & 0xffffffff) - then->tv32_sec)) * 1.0 +
+ (timenow->tv_usec - then->tv32_usec) / 1000000.0;
+}
+
static void
timevaladd(struct timeval *t1,
I have tested as below;
myhost# cat t.c
#include <stdio.h>
#include <time.h>
int
main(int argc, char *argv[])
{
time_t t;
time(&t);
printf("time_t = %llu = 0x%llx\n", t, t);
return 0;
}
* FYI: 2106-02-07 15:28 JST is 0xfffffff0 in unixtime.
myhost# date
Mon Aug 15 16:56:06 JST 2011
myhost# date 210602071528
Sun Feb 7 15:28:00 JST 2106
myhost# ./a.out
time_t = 4294967281 = 0xfffffff1
myhost# ping localhost
PING localhost (127.0.0.1): 56 data bytes
64 bytes from 127.0.0.1: icmp_seq=0 ttl=255 time=0.022 ms
64 bytes from 127.0.0.1: icmp_seq=1 ttl=255 time=0.026 ms
64 bytes from 127.0.0.1: icmp_seq=2 ttl=255 time=0.026 ms
64 bytes from 127.0.0.1: icmp_seq=3 ttl=255 time=0.028 ms
64 bytes from 127.0.0.1: icmp_seq=4 ttl=255 time=0.046 ms
64 bytes from 127.0.0.1: icmp_seq=5 ttl=255 time=0.030 ms
64 bytes from 127.0.0.1: icmp_seq=6 ttl=255 time=0.026 ms
64 bytes from 127.0.0.1: icmp_seq=7 ttl=255 time=0.025 ms
64 bytes from 127.0.0.1: icmp_seq=8 ttl=255 time=0.026 ms
64 bytes from 127.0.0.1: icmp_seq=9 ttl=255 time=0.025 ms
64 bytes from 127.0.0.1: icmp_seq=10 ttl=255 time=0.024 ms
64 bytes from 127.0.0.1: icmp_seq=11 ttl=255 time=0.025 ms
64 bytes from 127.0.0.1: icmp_seq=12 ttl=255 time=0.028 ms
64 bytes from 127.0.0.1: icmp_seq=13 ttl=255 time=0.041 ms
64 bytes from 127.0.0.1: icmp_seq=14 ttl=255 time=0.026 ms
64 bytes from 127.0.0.1: icmp_seq=15 ttl=255 time=0.048 ms
64 bytes from 127.0.0.1: icmp_seq=16 ttl=255 time=0.028 ms
64 bytes from 127.0.0.1: icmp_seq=17 ttl=255 time=0.026 ms
64 bytes from 127.0.0.1: icmp_seq=18 ttl=255 time=0.028 ms
64 bytes from 127.0.0.1: icmp_seq=19 ttl=255 time=0.025 ms
64 bytes from 127.0.0.1: icmp_seq=20 ttl=255 time=0.025 ms
64 bytes from 127.0.0.1: icmp_seq=21 ttl=255 time=0.027 ms
64 bytes from 127.0.0.1: icmp_seq=22 ttl=255 time=0.029 ms
^C
----localhost PING Statistics----
23 packets transmitted, 23 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 0.022/0.029/0.048/0.007 ms
myhost# ./a.out
time_t = 4294967305 = 0x100000009
--
ryo shimizu
From: Ryo Shimizu <ryo@nerv.org>
To: gnats-bugs@NetBSD.org
Cc: gnats-admin@netbsd.org, netbsd-bugs@netbsd.org, david@l8s.co.uk,
tsutsui@ceres.dti.ne.jp, ryo@netbsd.org
Subject: Re: bin/45257: ping(8) prints bogus round-trip times after Year 2038
Date: Thu, 18 Aug 2011 19:46:40 +0900
>Fix:
pointed out from dsl@ about the seconds wrap case,
and reviewed by tsutsui@.
Index: ping.c
===================================================================
RCS file: /cvsroot/src/sbin/ping/ping.c,v
retrieving revision 1.94
diff -a -u -r1.94 ping.c
--- ping.c 9 Aug 2011 12:55:19 -0000 1.94
+++ ping.c 18 Aug 2011 10:41:23 -0000
@@ -137,7 +137,7 @@
#define TST(seq) (A(seq) & B(seq))
struct tv32 {
- int32_t tv32_sec;
+ uint32_t tv32_sec;
int32_t tv32_usec;
};
@@ -213,6 +213,7 @@
static void fill(void);
static void rnd_fill(void);
static double diffsec(struct timeval *, struct timeval *);
+static double diffsec_tv32(struct timeval *, struct tv32 *);
static void timevaladd(struct timeval *, struct timeval *);
static void sec_to_timeval(const double, struct timeval *);
static double timeval_to_sec(const struct timeval *);
@@ -859,7 +860,7 @@
opack_icmp.icmp_type = ICMP_ECHO;
opack_icmp.icmp_id = ident;
- tv32.tv32_sec = htonl(now.tv_sec);
+ tv32.tv32_sec = htonl((uint32_t)now.tv_sec);
tv32.tv32_usec = htonl(now.tv_usec);
if (pingflags & F_TIMING)
(void) memcpy(&opack_icmp.icmp_data[0], &tv32, sizeof(tv32));
@@ -991,13 +992,12 @@
first_rx = last_rx;
nreceived++;
if (pingflags & F_TIMING) {
- struct timeval tv;
struct tv32 tv32;
(void) memcpy(&tv32, icp->icmp_data, sizeof(tv32));
- tv.tv_sec = ntohl(tv32.tv32_sec);
- tv.tv_usec = ntohl(tv32.tv32_usec);
- triptime = diffsec(&last_rx, &tv);
+ NTOHL(tv32.tv32_sec);
+ NTOHL(tv32.tv32_usec);
+ triptime = diffsec_tv32(&last_rx, &tv32);
tsum += triptime;
tsumsq += triptime * triptime;
if (triptime < tmin)
@@ -1246,6 +1246,14 @@
+ (timenow->tv_usec - then->tv_usec)/1000000.0);
}
+static double
+diffsec_tv32(struct timeval *timenow, struct tv32 *then)
+{
+ /* consider 32bit seconds wrap */
+ return ((uint32_t)timenow->tv_sec - then->tv32_sec) * 1.0 +
+ (timenow->tv_usec - then->tv32_usec) / 1000000.0;
+}
+
static void
timevaladd(struct timeval *t1,
--
ryo shimizu
From: christos@zoulas.com (Christos Zoulas)
To: Ryo Shimizu <ryo@nerv.org>, gnats-bugs@NetBSD.org
Cc: gnats-admin@netbsd.org, netbsd-bugs@netbsd.org, david@l8s.co.uk,
tsutsui@ceres.dti.ne.jp, ryo@netbsd.org
Subject: Re: bin/45257: ping(8) prints bogus round-trip times after Year 2038
Date: Thu, 18 Aug 2011 07:12:13 -0400
On Aug 18, 7:46pm, ryo@nerv.org (Ryo Shimizu) wrote:
-- Subject: Re: bin/45257: ping(8) prints bogus round-trip times after Year 2
|
| >Fix:
| pointed out from dsl@ about the seconds wrap case,
| and reviewed by tsutsui@.
Why all the complexity? All you should need is to cast to unsigned when
assigning.
christos
Index: ping.c
===================================================================
RCS file: /cvsroot/src/sbin/ping/ping.c,v
retrieving revision 1.93
diff -u -u -r1.93 ping.c
--- ping.c 11 Mar 2011 09:59:56 -0000 1.93
+++ ping.c 18 Aug 2011 11:10:30 -0000
@@ -137,7 +137,7 @@
#define TST(seq) (A(seq) & B(seq))
struct tv32 {
- int32_t tv32_sec;
+ uint32_t tv32_sec;
int32_t tv32_usec;
};
@@ -859,7 +859,7 @@
opack_icmp.icmp_type = ICMP_ECHO;
opack_icmp.icmp_id = ident;
- tv32.tv32_sec = htonl(now.tv_sec);
+ tv32.tv32_sec = (uint32_t)htonl(now.tv_sec);
tv32.tv32_usec = htonl(now.tv_usec);
if (pingflags & F_TIMING)
(void) memcpy(&opack_icmp.icmp_data[0], &tv32, sizeof(tv32));
@@ -995,7 +995,7 @@
struct tv32 tv32;
(void) memcpy(&tv32, icp->icmp_data, sizeof(tv32));
- tv.tv_sec = ntohl(tv32.tv32_sec);
+ tv.tv_sec = (uint32_t)ntohl(tv32.tv32_sec);
tv.tv_usec = ntohl(tv32.tv32_usec);
triptime = diffsec(&last_rx, &tv);
tsum += triptime;
From: Ryo Shimizu <ryo@nerv.org>
To: christos@zoulas.com (Christos Zoulas)
Cc: gnats-bugs@NetBSD.org, gnats-admin@netbsd.org, netbsd-bugs@netbsd.org,
david@l8s.co.uk, tsutsui@ceres.dti.ne.jp
Subject: Re: bin/45257: ping(8) prints bogus round-trip times after Year 2038
Date: Fri, 19 Aug 2011 02:17:59 +0900
>Why all the complexity? All you should need is to cast to unsigned when
>assigning.
No. it is not enough.
>@@ -995,7 +995,7 @@
> struct tv32 tv32;
>
> (void) memcpy(&tv32, icp->icmp_data, sizeof(tv32));
>- tv.tv_sec = ntohl(tv32.tv32_sec);
>+ tv.tv_sec = (uint32_t)ntohl(tv32.tv32_sec);
> tv.tv_usec = ntohl(tv32.tv32_usec);
> triptime = diffsec(&last_rx, &tv);
> tsum += triptime;
In case of last_rx.tv_sec is over 0x100000000,
diffsec(&last_rx, &tv) returns big value.
e.g.) last_rx.tv_sec = 0x100000005, tv.tv_sec = 0x00000004, result is 0x100000001.
# date 210602070628.13 # unixtime 0xfffffffd
Sun Feb 7 06:28:13 UTC 2106
# ping localhost
PING localhost (127.0.0.1): 56 data bytes
64 bytes from 127.0.0.1: icmp_seq=0 ttl=255 time=0.019 ms
64 bytes from 127.0.0.1: icmp_seq=1 ttl=255 time=0.026 ms
64 bytes from 127.0.0.1: icmp_seq=2 ttl=255 time=4294967296000.025 ms
64 bytes from 127.0.0.1: icmp_seq=3 ttl=255 time=4294967296000.024 ms
64 bytes from 127.0.0.1: icmp_seq=4 ttl=255 time=4294967296000.027 ms
64 bytes from 127.0.0.1: icmp_seq=5 ttl=255 time=4294967296000.026 ms
^C
----localhost PING Statistics----
6 packets transmitted, 6 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 0.019/2863311530666.691/4294967296000.027/2217911574655.135 ms
--
ryo shimizu
From: David Laight <david@l8s.co.uk>
To: gnats-bugs@NetBSD.org
Cc:
Subject: Re: bin/45257: ping(8) prints bogus round-trip times after Year 2038
Date: Thu, 18 Aug 2011 20:47:14 +0100
On Thu, Aug 18, 2011 at 06:30:05PM +0000, Ryo Shimizu wrote:
>
> >Why all the complexity? All you should need is to cast to unsigned when
> >assigning.
>
> No. it is not enough.
Change diffsec() to do:
return ((uint32_t)(timenow->tv_sec - then->tv_sec)*1.0
+ (timenow->tv_usec - then->tv_usec)/1000000.0);
David
--
David Laight: david@l8s.co.uk
From: "Christos Zoulas" <christos@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/45257 CVS commit: src/sbin/ping
Date: Fri, 19 Aug 2011 04:35:40 -0400
Module Name: src
Committed By: christos
Date: Fri Aug 19 08:35:40 UTC 2011
Modified Files:
src/sbin/ping: ping.c
Log Message:
PR/45257: Ryo Shimizu: ping(8) prints bogus round-trip times after Year 2038
Clamp all time computations to 32 bits; idea from dsl@
To generate a diff of this commit:
cvs rdiff -u -r1.94 -r1.95 src/sbin/ping/ping.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
From: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
To: gnats-bugs@NetBSD.org
Cc: christos@NetBSD.org, tsutsui@ceres.dti.ne.jp
Subject: Re: PR/45257 CVS commit: src/sbin/ping
Date: Sat, 20 Aug 2011 23:23:40 +0900
> Modified Files:
> src/sbin/ping: ping.c
>
> Log Message:
> PR/45257: Ryo Shimizu: ping(8) prints bogus round-trip times after Year 2038
> Clamp all time computations to 32 bits; idea from dsl@
This doesn't work (at least on i386):
# ping -n -c 1 192.168.20.13
PING 192.168.20.13 (192.168.20.13): 56 data bytes
ping: poll: Invalid argument
#
Removing (uint32_t) cast from diffsec() makes it work again,
so probably we have to check all callers of diffsec().
---
Izumi Tsutsui
From: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
To: gnats-bugs@NetBSD.org
Cc: christos@NetBSD.org, tsutsui@ceres.dti.ne.jp
Subject: Re: PR/45257 CVS commit: src/sbin/ping
Date: Sat, 20 Aug 2011 23:43:28 +0900
> Removing (uint32_t) cast from diffsec() makes it work again,
> so probably we have to check all callers of diffsec().
At least doit() expects diffsec() could return negative value
(to check "expired").
Probably we need an independent diffsec function for round-trip time
which is the only user of 32bit tv_sec and will never be negative?
---
Izumi Tsutsui
From: Ryo Shimizu <ryo@nerv.org>
To: gnats-bugs@NetBSD.org
Cc: christos@NetBSD.org, tsutsui@ceres.dti.ne.jp
Subject: Re: PR/45257 CVS commit: src/sbin/ping
Date: Sun, 21 Aug 2011 02:09:55 +0900
I tested latest ping.c (rev1.96), it works after y2106,
but doesn't work after y2038.
# date
Sat Aug 20 17:09:09 UTC 2011
# ping localhost
PING localhost (127.0.0.1): 56 data bytes
64 bytes from 127.0.0.1: icmp_seq=0 ttl=255 time=0.020 ms
64 bytes from 127.0.0.1: icmp_seq=1 ttl=255 time=0.027 ms
^C
----localhost PING Statistics----
2 packets transmitted, 2 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 0.020/0.024/0.027/0.005 ms
# date 203801190314.08
Tue Jan 19 03:14:08 UTC 2038
# ping localhost
PING localhost (127.0.0.1): 56 data bytes
ping: poll: Invalid argument
# date 210602070628.16
Sun Feb 7 06:28:16 UTC 2106
# ping localhost
PING localhost (127.0.0.1): 56 data bytes
64 bytes from 127.0.0.1: icmp_seq=0 ttl=255 time=0.021 ms
64 bytes from 127.0.0.1: icmp_seq=1 ttl=255 time=0.030 ms
64 bytes from 127.0.0.1: icmp_seq=2 ttl=255 time=0.027 ms
^C
----localhost PING Statistics----
3 packets transmitted, 3 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 0.021/0.026/0.030/0.005 ms
--
ryo shimizu
From: christos@zoulas.com (Christos Zoulas)
To: Ryo Shimizu <ryo@nerv.org>, gnats-bugs@NetBSD.org
Cc: tsutsui@ceres.dti.ne.jp
Subject: Re: PR/45257 CVS commit: src/sbin/ping
Date: Sun, 21 Aug 2011 01:59:24 -0400
On Aug 21, 2:09am, ryo@nerv.org (Ryo Shimizu) wrote:
-- Subject: Re: PR/45257 CVS commit: src/sbin/ping
|
| but doesn't work after y2038.
[8:57am] 2541# date 203801190314.08
Jan 19 03:14:08 date: date set by christos
Tue Jan 19 03:14:08 EET 2038
[3:14am] 2542#ping localhost
PING localhost (127.0.0.1): 56 data bytes
64 bytes from 127.0.0.1: icmp_seq=0 ttl=255 time=0.129 ms
64 bytes from 127.0.0.1: icmp_seq=1 ttl=255 time=0.167 ms
^C
----localhost PING Statistics----
2 packets transmitted, 2 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 0.129/0.148/0.167/0.027 ms
[3:14am] 2543#obj.amd64/ping localhost
PING localhost (127.0.0.1): 56 data bytes
64 bytes from 127.0.0.1: icmp_seq=0 ttl=255 time=0.133 ms
64 bytes from 127.0.0.1: icmp_seq=1 ttl=255 time=0.169 ms
64 bytes from 127.0.0.1: icmp_seq=2 ttl=255 time=0.152 ms
64 bytes from 127.0.0.1: icmp_seq=3 ttl=255 time=0.204 ms
64 bytes from 127.0.0.1: icmp_seq=4 ttl=255 time=0.157 ms
64 bytes from 127.0.0.1: icmp_seq=5 ttl=255 time=0.150 ms
64 bytes from 127.0.0.1: icmp_seq=6 ttl=255 time=0.150 ms
Seems to work here.
christos
From: Ryo Shimizu <ryo@nerv.org>
To: christos@zoulas.com (Christos Zoulas)
Cc: gnats-bugs@NetBSD.org, tsutsui@ceres.dti.ne.jp, ryo@nerv.org
Subject: Re: PR/45257 CVS commit: src/sbin/ping
Date: Sun, 21 Aug 2011 15:25:39 +0900
>[8:57am] 2541# date 203801190314.08
>Jan 19 03:14:08 date: date set by christos
>Tue Jan 19 03:14:08 EET 2038
date 203801190314.08 on *EET* is 2147476448 = 0x7fffe3e0 in time_t.
Please test "env TZ=UTC date 203801190314.08" again.
--
ryo shimizu
Responsible-Changed-From-To: ryo->christos
Responsible-Changed-By: ryo@NetBSD.org
Responsible-Changed-When: Tue, 23 Aug 2011 17:36:13 +0000
Responsible-Changed-Why:
fixed src/sbin/ping.c r1.95-r1.97 by christos@
State-Changed-From-To: open->closed
State-Changed-By: ryo@NetBSD.org
State-Changed-When: Tue, 23 Aug 2011 17:36:13 +0000
State-Changed-Why:
fixed
From: Robert Elz <kre@munnari.OZ.AU>
To: gnats-bugs@NetBSD.org
Cc:
Subject: Re: bin/45257: ping(8) prints bogus round-trip times after Year 2038
Date: Sun, 11 Sep 2011 01:06:19 +0700
Date: Thu, 18 Aug 2011 19:50:04 +0000 (UTC)
From: David Laight <david@l8s.co.uk>
Message-ID: <20110818195004.56F0E63C0E2@www.NetBSD.org>
| Change diffsec() to do:
| return ((uint32_t)(timenow->tv_sec - then->tv_sec)*1.0
| + (timenow->tv_usec - then->tv_usec)/1000000.0);
Sorry, I know I'm a lot behind in my list reading, but what's this fetish
with 32 bit time_t's in ping on a system which (necessarily for the reported
problem) must have 64 bit time_t's ?
Why not just change ping to send 64 bit times (seconds) (plus microseconds or
whatever is in the other 32 bits)?
There's no standards issue, no compatibility issue, no reason at all that
I can see (unless you really care about an extra 4 bytes of min packet size,
which would usually make no difference to the IPv4 ping because of the
padding it defaults to send).
kre
ps: Does this issue also apply to ping6 ?
From: "Christos Zoulas" <christos@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/45257 CVS commit: src/sbin/ping
Date: Sat, 10 Sep 2011 16:04:28 -0400
Module Name: src
Committed By: christos
Date: Sat Sep 10 20:04:28 UTC 2011
Modified Files:
src/sbin/ping: ping.8 ping.c
Log Message:
PR/45257: Instead of passing a 32bit sec and 32 bit usec timestamp in little
endian format by default, pass a struct timespec in native host format. Add
-C flag to produce a compatible timestamp like before.
To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/sbin/ping/ping.8
cvs rdiff -u -r1.98 -r1.99 src/sbin/ping/ping.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.