NetBSD Problem Report #39157

From www@NetBSD.org  Wed Jul 16 20:43:09 2008
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by narn.NetBSD.org (Postfix) with ESMTP id 94E7763B9AA
	for <gnats-bugs@gnats.netbsd.org>; Wed, 16 Jul 2008 20:43:09 +0000 (UTC)
Message-Id: <20080716204309.2CABB63B89E@narn.NetBSD.org>
Date: Wed, 16 Jul 2008 20:43:09 +0000 (UTC)
From: mmayer@redback.com
Reply-To: mmayer@redback.com
To: gnats-bugs@NetBSD.org
Subject: traceroute not 64 bit aware (struct timeval issue)
X-Send-Pr-Version: www-1.0

>Number:         39157
>Category:       bin
>Synopsis:       traceroute not 64 bit aware (struct timeval issue)
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    bin-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Jul 16 20:45:00 +0000 2008
>Closed-Date:    Fri Oct 09 21:48:54 +0000 2009
>Last-Modified:  Fri Oct 09 21:48:54 +0000 2009
>Originator:     Markus Mayer
>Release:        NetBSD 4.0
>Organization:
Redback Networks Inc.
>Environment:
NetBSD mmayer-u5.van.redback.com 4.0 NetBSD 4.0 (GENERIC) #0: Sun Dec 16 02:17:35 PST 2007  builds@wb26:/home/builds/ab/netbsd-4-0-RELEASE/sparc64/200712160005Z-obj/home/builds/ab/netbsd-4-0-RELEASE/src/sys/arch/sparc64/compile/GENERIC sparc64

>Description:
Unlike ping, which declares struct tv32 and converts timestamps between struct tv32 and struct timeval, traceroute doesn't do this yet and directly uses struct timeval everywhere (including struct outdata).

On 64 bit systems, that leads to excessive packet length (52 bytes instead of 40 bytes) of traceroute packets.

Traceroute still seems to work with the 52 byte packets, but side effects cannot be ruled out.
>How-To-Repeat:
Run traceroute and look at the packet size (52 bytes instead of 40 bytes)

On NetBSD/64:

$ traceroute www.google.ca
traceroute: Warning: www.google.ca has multiple addresses; using 209.85.173.147
traceroute to www.l.google.com (209.85.173.147), 64 hops max, 52 byte packets

On Linux:

$ traceroute www.google.ca
traceroute: Warning: www.google.ca has multiple addresses; using 209.85.173.103
traceroute to mh-in-f103.google.com (209.85.173.103), 30 hops max, 40 byte packets

On Solaris:

$ traceroute www.google.ca
traceroute: Warning: www.l.google.com has multiple addresses; using 209.85.135.103
traceroute to www.l.google.com (209.85.135.103), 30 hops max, 40 byte packets

>Fix:
Introduce struct tv32 like it was done for ping. The excessive packet length comes from

struct outdata {
	u_char seq;		/* sequence number of this packet */
	u_char ttl;		/* ttl packet left with */
	struct timeval tv;	/* time packet left */
};

It should be

struct outdata {
	u_char seq;		/* sequence number of this packet */
	u_char ttl;		/* ttl packet left with */
	struct tv32 tv;		/* time packet left */
};

instead, struct tv32 being declared as (per ping)

struct tv32 {
	int32_t tv32_sec;
	int32_t tv32_usec;
};

>Release-Note:

>Audit-Trail:
From: Christos Zoulas <christos@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/39157 CVS commit: src/usr.sbin/traceroute
Date: Wed, 16 Jul 2008 21:34:17 +0000 (UTC)

 Module Name:	src
 Committed By:	christos
 Date:		Wed Jul 16 21:34:17 UTC 2008

 Modified Files:
 	src/usr.sbin/traceroute: traceroute.c

 Log Message:
 PR/39157: Markus Mayer: traceroute not 64 bit aware (struct timeval issue)


 To generate a diff of this commit:
 cvs rdiff -r1.71 -r1.72 src/usr.sbin/traceroute/traceroute.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: matthew green <mrg@eterna.com.au>
To: gnats-bugs@NetBSD.org
Cc: gnats-admin@netbsd.org, netbsd-bugs@netbsd.org
Subject: re: bin/39157: traceroute not 64 bit aware (struct timeval issue) 
Date: Thu, 17 Jul 2008 08:14:34 +1000

 seems that the bug is using structs to describe on-disk formats,
 instead of portable methods of fixed-size data access.


 .mrg.

From: Markus Mayer <mmayer@redback.com>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: bin/39157: traceroute not 64 bit aware (struct timeval issue)
Date: Thu, 17 Jul 2008 09:58:08 -0700

 gnats-admin@netbsd.org wrote:

 >> Category:       bin
 >> Responsible:    bin-bug-people
 >> Synopsis:       traceroute not 64 bit aware (struct timeval issue)
 >> Arrival-Date:   Wed Jul 16 20:45:00 +0000 2008
 > 

 I looked at the diff and I am wondering if it should be

      outsetup.tv.tv_sec  = htonl(tp->tv_sec);
      outsetup.tv.tv_usec  = htonl(tp->tv_usec);

 traceroute6 and ping are using htonl/ntohl.

 Regards,
 -Markus

 -- 
 Markus Mayer
 Redback Networks
 An Ericsson Company
 (778) 373-7251

State-Changed-From-To: open->closed
State-Changed-By: dsl@NetBSD.org
State-Changed-When: Fri, 09 Oct 2009 21:48:54 +0000
State-Changed-Why:
fixed ages ago.
ntohl() isn't needed because the values are only locally significant


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.