Source-Changes-HG archive

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

[src/trunk]: src/usr.sbin/traceroute Add sanity check for MTU size in fragmen...



details:   https://anonhg.NetBSD.org/src/rev/90db4c327345
branches:  trunk
changeset: 473717:90db4c327345
user:      is <is%NetBSD.org@localhost>
date:      Wed Jun 16 20:43:48 1999 +0000

description:
Add sanity check for MTU size in fragmentation required packets.

diffstat:

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

diffs (42 lines):

diff -r 2d2f76b1e023 -r 90db4c327345 usr.sbin/traceroute/traceroute.c
--- a/usr.sbin/traceroute/traceroute.c  Wed Jun 16 20:10:07 1999 +0000
+++ b/usr.sbin/traceroute/traceroute.c  Wed Jun 16 20:43:48 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: traceroute.c,v 1.34 1999/06/16 20:10:07 is Exp $       */
+/*     $NetBSD: traceroute.c,v 1.35 1999/06/16 20:43:48 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.34 1999/06/16 20:10:07 is Exp $");
+__RCSID("$NetBSD: traceroute.c,v 1.35 1999/06/16 20:43:48 is Exp $");
 #endif
 #endif
 
@@ -1478,7 +1478,7 @@
 {
         int i;
 
-        if (nextmtu > 0) {
+        if (nextmtu > 0 && nextmtu < packlen) {
                 Printf("\nfragmentation required and DF set, "
                     "next hop MTU = %d\n",
                         nextmtu);
@@ -1490,9 +1490,12 @@
                         }
                 }
         } else {
+                Printf("\nfragmentation required and DF set. ");
+               if (nextmtu)
+                       Printf("\nBogus next hop MTU = %d > last MTU = %d. ",
+                           nextmtu, packlen);
                 packlen = *mtuptr++;
-                Printf("\nfragmentation required and DF set, "
-                   "trying new MTU = %d\n", packlen);
+               Printf("Trying new MTU = %d\n", packlen);
         }
        outudp->uh_ulen =
            htons((u_short)(packlen - (sizeof(*outip) + optlen)));



Home | Main Index | Thread Index | Old Index