Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.sbin/traceroute Don't forget to update the UDP length wh...



details:   https://anonhg.NetBSD.org/src/rev/7bfe0a47a62c
branches:  trunk
changeset: 473707:7bfe0a47a62c
user:      is <is%NetBSD.org@localhost>
date:      Wed Jun 16 13:52:58 1999 +0000

description:
Don't forget to update the UDP length when changing the packet length.
Reported by Johan Danielsson in PR 7781; the fix is an updated version
(by the same person) of the patch in the PR.

diffstat:

 usr.sbin/traceroute/traceroute.c |  10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diffs (45 lines):

diff -r ed638d1c3b83 -r 7bfe0a47a62c usr.sbin/traceroute/traceroute.c
--- a/usr.sbin/traceroute/traceroute.c  Wed Jun 16 13:26:16 1999 +0000
+++ b/usr.sbin/traceroute/traceroute.c  Wed Jun 16 13:52:58 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: traceroute.c,v 1.32 1999/06/16 13:26:16 is Exp $       */
+/*     $NetBSD: traceroute.c,v 1.33 1999/06/16 13:52:58 is Exp $       */
 
 /*
  * Copyright (c) 1988, 1989, 1991, 1994, 1995, 1996, 1997
@@ -29,7 +29,7 @@
 #else
 __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1991, 1994, 1995, 1996, 1997\n\
 The Regents of the University of California.  All rights reserved.\n");
-__RCSID("$NetBSD: traceroute.c,v 1.32 1999/06/16 13:26:16 is Exp $");
+__RCSID("$NetBSD: traceroute.c,v 1.33 1999/06/16 13:52:58 is Exp $");
 #endif
 #endif
 
@@ -1101,6 +1101,8 @@
 
                        if (errno == EMSGSIZE) {
                                packlen = *mtuptr++;
+               outudp->uh_ulen =
+                   htons((u_short)(packlen - (sizeof(*outip) + optlen)));
 #ifdef _NoLongerLooksUgly_
                                Printf("message too big, "
                                    "trying new MTU = %d\n", packlen);
@@ -1481,6 +1483,8 @@
 ",
                         nextmtu);
                 packlen = nextmtu;
+               outudp->uh_ulen =
+                   htons((u_short)(packlen - (sizeof(*outip) + optlen)));
                 for (i = 0; mtus[i] > 0; i++) {
                         if (mtus[i] < nextmtu) {
                                 mtuptr = &mtus[i];    /* next one to try */
@@ -1489,6 +1493,8 @@
                 }
         } else {
                 packlen = *mtuptr++;
+               outudp->uh_ulen =
+                   htons((u_short)(packlen - (sizeof(*outip) + optlen)));
                 Printf("fragmentation required and DF set, "
                    "trying new MTU = %d\n", packlen);
         }



Home | Main Index | Thread Index | Old Index