netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Add 32bit emulation for cmsg SO_TIMESTAMP
@ 2004-01-07  9:07 Andi Kleen
  2004-01-07 20:12 ` David S. Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Andi Kleen @ 2004-01-07  9:07 UTC (permalink / raw)
  To: davem, netdev


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

--- linux-2.6.1rc2-amd64/net/compat.c-o	2003-11-23 19:46:36.000000000 -0800
+++ linux-2.6.1rc2-amd64/net/compat.c	2004-01-07 00:21:43.741256711 -0800
@@ -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;

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Add 32bit emulation for cmsg SO_TIMESTAMP
  2004-01-07  9:07 [PATCH] Add 32bit emulation for cmsg SO_TIMESTAMP Andi Kleen
@ 2004-01-07 20:12 ` David S. Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David S. Miller @ 2004-01-07 20:12 UTC (permalink / raw)
  To: Andi Kleen; +Cc: netdev

On Wed, 7 Jan 2004 10:07:43 +0100
Andi Kleen <ak@suse.de> wrote:

> Some traceroute versions use the SO_TIMESTAMP cmsg for time measurement.
> This fixes them when running as 32bit on a 64bit x86-64 kernel.

Applied, thanks Andi.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-01-07 20:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-01-07  9:07 [PATCH] Add 32bit emulation for cmsg SO_TIMESTAMP Andi Kleen
2004-01-07 20:12 ` David S. Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).