version 1.102.6.3, 2013/06/23 06:28:52 |
version 1.102.6.4, 2014/08/20 00:02:27 |
Line 1011 pr_pack(u_char *buf, |
|
Line 1011 pr_pack(u_char *buf, |
|
icp = (struct icmp *)(buf + hlen); |
icp = (struct icmp *)(buf + hlen); |
if (icp->icmp_type == ICMP_ECHOREPLY |
if (icp->icmp_type == ICMP_ECHOREPLY |
&& icp->icmp_id == ident) { |
&& icp->icmp_id == ident) { |
struct timespec tv; |
|
|
|
if (icp->icmp_seq == htons((u_int16_t)(ntransmitted-1))) |
if (icp->icmp_seq == htons((u_int16_t)(ntransmitted-1))) |
lastrcvd = 1; |
lastrcvd = 1; |
Line 1019 pr_pack(u_char *buf, |
|
Line 1018 pr_pack(u_char *buf, |
|
if (first_rx.tv_sec == 0) |
if (first_rx.tv_sec == 0) |
first_rx = last_rx; |
first_rx = last_rx; |
nreceived++; |
nreceived++; |
if (pingflags & F_TIMING) { |
if (pingflags & (F_TIMING|F_TIMING64)) { |
struct tv32 tv32; |
struct timespec tv; |
|
|
(void) memcpy(&tv32, icp->icmp_data, sizeof(tv32)); |
if (pingflags & F_TIMING) { |
tv.tv_sec = (uint32_t)ntohl(tv32.tv32_sec); |
struct tv32 tv32; |
tv.tv_nsec = ntohl(tv32.tv32_usec) * 1000; |
|
} else if (pingflags & F_TIMING64) |
(void)memcpy(&tv32, icp->icmp_data, sizeof(tv32)); |
(void) memcpy(&tv, icp->icmp_data, sizeof(tv)); |
tv.tv_sec = (uint32_t)ntohl(tv32.tv32_sec); |
|
tv.tv_nsec = ntohl(tv32.tv32_usec) * 1000; |
|
} else if (pingflags & F_TIMING64) |
|
(void)memcpy(&tv, icp->icmp_data, sizeof(tv)); |
|
else |
|
memset(&tv, 0, sizeof(tv)); /* XXX: gcc */ |
|
|
if (pingflags & (F_TIMING|F_TIMING64)) { |
|
triptime = diffsec(&last_rx, &tv); |
triptime = diffsec(&last_rx, &tv); |
tsum += triptime; |
tsum += triptime; |
tsumsq += triptime * triptime; |
tsumsq += triptime * triptime; |