Use CMSG_LEN() to compute ping SCM_TIMESTAMP cmsg_len.
Without this, cmsg_len size should be smaller than necessary on alpha. (Though, no obvious error was seen on ping time value on beast.)
This commit is contained in:
parent
5949020620
commit
6ecbec7768
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=58068
@ -649,7 +649,7 @@ main(argc, argv)
|
|||||||
#ifdef SO_TIMESTAMP
|
#ifdef SO_TIMESTAMP
|
||||||
if (cmsg->cmsg_level == SOL_SOCKET &&
|
if (cmsg->cmsg_level == SOL_SOCKET &&
|
||||||
cmsg->cmsg_type == SCM_TIMESTAMP &&
|
cmsg->cmsg_type == SCM_TIMESTAMP &&
|
||||||
cmsg->cmsg_len == (sizeof *cmsg + sizeof *t)) {
|
cmsg->cmsg_len == CMSG_LEN(sizeof *t)) {
|
||||||
/* Copy to avoid alignment problems: */
|
/* Copy to avoid alignment problems: */
|
||||||
memcpy(&now,CMSG_DATA(cmsg),sizeof(now));
|
memcpy(&now,CMSG_DATA(cmsg),sizeof(now));
|
||||||
t = &now;
|
t = &now;
|
||||||
|
Loading…
Reference in New Issue
Block a user