Add 32bit emulation for cmsg SO_TIMESTAMP
Subsystems (2)
PATCH 1/1 Add 32bit emulation for cmsg SO_TIMESTAMP
Some traceroute versions use the SO_TIMESTAMP cmsg for time measurement. This fixes them when running as 32bit on a 64bit x86-64 kernel.
-Andi
net/compat.c renamed from net/compat.c-o +11 -1
@@ -215,15 +215,25 @@int put_cmsg_compat (struct msghdr *kmsg,int level,int type,int len,void *data) { +struct compat_timeval ctv;struct compat_cmsghdr *cm = (struct compat_cmsghdr *) kmsg->msg_control;struct compat_cmsghdr cmhdr; -int cmlen =CMSG_COMPAT_LEN (len); +int cmlen;if (cm ==NULL || kmsg->msg_controllen <sizeof (*cm)) { kmsg->msg_flags |=MSG_CTRUNC ;return 0 ;/* XXX: return error? check spec. */ } +if (level ==SOL_SOCKET && type ==SO_TIMESTAMP ) { +struct timeval *tv = (struct timeval *)data; + ctv.tv_sec = tv->tv_sec; + ctv.tv_usec = tv->tv_usec; + data = &ctv; + len =sizeof (struct compat_timeval ); + } + + cmlen =CMSG_COMPAT_LEN (len);if (kmsg->msg_controllen < cmlen) { kmsg->msg_flags |=MSG_CTRUNC ; cmlen = kmsg->msg_controllen;
David S. Miller
AppliedQuoted 2 lines · On Wed, 7 Jan 2004 10:07:43 +0100 Andi Kleen <[email protected]> wrote:
Some traceroute versions use the
SO_TIMESTAMPcmsg for time measurement. This fixes them when running as 32bit on a 64bit x86-64 kernel.
Applied, thanks Andi.