Changeset View
Changeset View
Standalone View
Standalone View
sbin/ping6/ping6.c
Show First 20 Lines • Show All 1,373 Lines • ▼ Show 20 Lines | if (options & F_FQDN) { | ||||
icp->icmp6_code = 0; | icp->icmp6_code = 0; | ||||
icp->icmp6_id = htons(ident); | icp->icmp6_id = htons(ident); | ||||
icp->icmp6_seq = ntohs(seq); | icp->icmp6_seq = ntohs(seq); | ||||
if (timing) { | if (timing) { | ||||
struct timeval tv; | struct timeval tv; | ||||
struct tv32 *tv32; | struct tv32 *tv32; | ||||
(void)gettimeofday(&tv, NULL); | (void)gettimeofday(&tv, NULL); | ||||
tv32 = (struct tv32 *)&outpack[ICMP6ECHOLEN]; | tv32 = (struct tv32 *)&outpack[ICMP6ECHOLEN]; | ||||
tv32->tv32_sec = htonl(tv.tv_sec); | /* | ||||
tv32->tv32_usec = htonl(tv.tv_usec); | * The time values saved in a packet are | ||||
* truncated down to 32 bits. | |||||
asomers: Yeah they're truncated. That much is clear from the cast. But why? | |||||
jansucanUnsubmitted Done Inline ActionsPlease, tell me what's the correct comment. Or should remove it? jansucan: Please, tell me what's the correct comment. Or should remove it? | |||||
*/ | |||||
tv32->tv32_sec = (uint32_t)htonl(tv.tv_sec); | |||||
tv32->tv32_usec = (uint32_t)htonl(tv.tv_usec); | |||||
} | } | ||||
cc = ICMP6ECHOLEN + datalen; | cc = ICMP6ECHOLEN + datalen; | ||||
} | } | ||||
#ifdef DIAGNOSTIC | #ifdef DIAGNOSTIC | ||||
if (pingerlen() != cc) | if (pingerlen() != cc) | ||||
errx(1, "internal error; length mismatch"); | errx(1, "internal error; length mismatch"); | ||||
#endif | #endif | ||||
▲ Show 20 Lines • Show All 1,429 Lines • Show Last 20 Lines |
Yeah they're truncated. That much is clear from the cast. But why?