All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andi Kleen <ak@suse.de>
To: davem@redhat.com, netdev@oss.sgi.com
Subject: [PATCH] Add 32bit emulation for cmsg SO_TIMESTAMP
Date: Wed, 7 Jan 2004 10:07:43 +0100	[thread overview]
Message-ID: <20040107100743.1c0b18c2.ak@suse.de> (raw)


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;

             reply	other threads:[~2004-01-07  9:07 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-01-07  9:07 Andi Kleen [this message]
2004-01-07 20:12 ` [PATCH] Add 32bit emulation for cmsg SO_TIMESTAMP David S. Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040107100743.1c0b18c2.ak@suse.de \
    --to=ak@suse.de \
    --cc=davem@redhat.com \
    --cc=netdev@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.