From owner-freebsd-bugs@FreeBSD.ORG Thu Apr 17 04:40:17 2003 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 6EBE337B401 for ; Thu, 17 Apr 2003 04:40:17 -0700 (PDT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id A3A0F43FBD for ; Thu, 17 Apr 2003 04:40:15 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.9/8.12.9) with ESMTP id h3HBeFUp025256 for ; Thu, 17 Apr 2003 04:40:15 -0700 (PDT) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.9/8.12.9/Submit) id h3HBeFZx025255; Thu, 17 Apr 2003 04:40:15 -0700 (PDT) Resent-Date: Thu, 17 Apr 2003 04:40:15 -0700 (PDT) Resent-Message-Id: <200304171140.h3HBeFZx025255@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Rene de Vries Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id C3BEB37B401 for ; Thu, 17 Apr 2003 04:34:17 -0700 (PDT) Received: from bastix.tunix.nl (bastix.tunix.nl [193.79.201.39]) by mx1.FreeBSD.org (Postfix) with ESMTP id 45B0C43FA3 for ; Thu, 17 Apr 2003 04:34:16 -0700 (PDT) (envelope-from rene@tunix.nl) Received: (from root@localhost) by bastix.tunix.nl (8.9.3c/8.6.12) id NAA60385 for ; Thu, 17 Apr 2003 13:34:32 +0200 (CEST) Received: by bastix.tunix.nl (TUNIX txp2/smap) for id sma060071; Thu, 17 Apr 03 13:33:21 +0200 Received: from upsilix.tunix.nl (upsilix.tunix.nl [172.16.2.22]) by fix.tunix.nl (8.10.2+Sun/8.10.2) with ESMTP id h3HBX4902702 for ; Thu, 17 Apr 2003 13:33:04 +0200 (MEST) Received: from upsilix.tunix.nl (localhost.tunix.nl [127.0.0.1]) by upsilix.tunix.nl (8.12.6/8.12.6) with ESMTP id h3HBX0c5053460 for ; Thu, 17 Apr 2003 13:33:00 +0200 (CEST) (envelope-from rene@upsilix.tunix.nl) Received: (from rene@localhost) by upsilix.tunix.nl (8.12.6/8.12.6/Submit) id h3HBX0gN053459; Thu, 17 Apr 2003 13:33:00 +0200 (CEST) (envelope-from rene) Message-Id: <200304171133.h3HBX0gN053459@upsilix.tunix.nl> Date: Thu, 17 Apr 2003 13:33:00 +0200 (CEST) From: Rene de Vries To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Subject: bin/51091: [FEATURE] Add -A (print ASCII) flag to tcpdump X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Rene de Vries List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Apr 2003 11:40:17 -0000 >Number: 51091 >Category: bin >Synopsis: [FEATURE] Add -A (print ASCII) flag to tcpdump >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Thu Apr 17 04:40:15 PDT 2003 >Closed-Date: >Last-Modified: >Originator: Rene de Vries >Release: FreeBSD 4.7-RELEASE-p3 i386 / FreeBSD 5.0-20030401 i386 >Organization: Tunix Internet Security & Training >Environment: >Description: Print the payload of TCP packets in human-readable (ASCII) format. This can be usefull when debugging readable protocols (like SMTP, HTTP, etc). >How-To-Repeat: >Fix: See Also: https://sourceforge.net/tracker/index.php?func=detail&aid=723026&group_id=53066&atid=469575 Files: src/contrib/tcpdump/interface.h src/contrib/tcpdump/print-tcp.c src/contrib/tcpdump/tcpdump.1 src/contrib/tcpdump/tcpdump.c Author: Edwin H. Kremer Diff against FreeBSD 5 (current as of 01 Apr 2003): Index: contrib/tcpdump/interface.h =================================================================== RCS file: /home/fbsd-cvsrepo/src/contrib/tcpdump/interface.h,v retrieving revision 1.8 diff -u -r1.8 interface.h --- contrib/tcpdump/interface.h 2 Mar 2003 08:25:48 -0000 1.8 +++ contrib/tcpdump/interface.h 1 Apr 2003 11:36:54 -0000 @@ -67,6 +67,7 @@ }; extern int aflag; /* translate network and broadcast addresses */ +extern int Aflag; /* ASCII print of the payload of TCP packets */ extern int dflag; /* print filter code */ extern int eflag; /* print ethernet header */ extern int fflag; /* don't translate "foreign" IP address */ Index: contrib/tcpdump/print-tcp.c =================================================================== RCS file: /home/fbsd-cvsrepo/src/contrib/tcpdump/print-tcp.c,v retrieving revision 1.1.1.6 diff -u -r1.1.1.6 print-tcp.c --- contrib/tcpdump/print-tcp.c 21 Jun 2002 00:43:23 -0000 1.1.1.6 +++ contrib/tcpdump/print-tcp.c 1 Apr 2003 11:36:54 -0000 @@ -614,6 +614,16 @@ ns_print(bp + 2, length - 2); } else if (sport == MSDP_PORT || dport == MSDP_PORT) { msdp_print(bp, length); + } else if ( Aflag ) { + int c; + putchar(' '); putchar('['); putchar(' '); + /* avoid reading beyond the snapped number of bytes */ + while ( length-- > 0 && bp <= snapend ) { + c = *bp++; + safeputchar(c); + } + putchar(' '); + putchar(']'); } } return; Index: contrib/tcpdump/tcpdump.1 =================================================================== RCS file: /home/fbsd-cvsrepo/src/contrib/tcpdump/tcpdump.1,v retrieving revision 1.12 diff -u -r1.12 tcpdump.1 --- contrib/tcpdump/tcpdump.1 26 Jan 2003 01:23:26 -0000 1.12 +++ contrib/tcpdump/tcpdump.1 1 Apr 2003 11:36:54 -0000 @@ -192,6 +192,9 @@ .B \-a Attempt to convert network and broadcast addresses to names. .TP +.B \-A +Print the payload of TCP packets in human-readable (ASCII) format. +.TP .B \-c Exit after receiving \fIcount\fP packets. .TP Index: contrib/tcpdump/tcpdump.c =================================================================== RCS file: /home/fbsd-cvsrepo/src/contrib/tcpdump/tcpdump.c,v retrieving revision 1.7 diff -u -r1.7 tcpdump.c --- contrib/tcpdump/tcpdump.c 26 Jan 2003 01:23:26 -0000 1.7 +++ contrib/tcpdump/tcpdump.c 1 Apr 2003 11:36:54 -0000 @@ -68,6 +68,7 @@ #include "gmt2local.h" int aflag; /* translate network and broadcast addresses */ +int Aflag; /* ASCII print of the payload of TCP packets */ int dflag; /* print filter code */ int eflag; /* print ethernet header */ int fflag; /* don't translate "foreign" IP address */ @@ -313,13 +314,17 @@ opterr = 0; while ( - (op = getopt(argc, argv, "ac:C:deE:fF:i:lLm:nNOpqr:Rs:StT:uvw:xXy:Y")) != -1) + (op = getopt(argc, argv, "aAc:C:deE:fF:i:lLm:nNOpqr:Rs:StT:uvw:xXy:Y")) != -1) switch (op) { case 'a': ++aflag; break; + case 'A': + ++Aflag; + break; + case 'c': cnt = atoi(optarg); if (cnt <= 0) @@ -762,7 +767,7 @@ (void)fprintf(stderr, "%s version %s\n", program_name, version); (void)fprintf(stderr, "libpcap version %s\n", pcap_version); (void)fprintf(stderr, -"Usage: %s [-adeflLnNOpqRStuvxX] [ -c count ] [ -C file_size ]\n", program_name); +"Usage: %s [-aAdeflLnNOpqRStuvxX] [ -c count ] [ -C file_size ]\n", program_name); (void)fprintf(stderr, "\t\t[ -F file ] [ -i interface ] [ -r file ] [ -s snaplen ]\n"); (void)fprintf(stderr, >Release-Note: >Audit-Trail: >Unformatted: