Print EtherTalk packets correctly; closes PR 649.

Document `-T' option in manual page.

Submitted by:	Toshihiro Kanda <candy@fct.kgc.co.jp> (first fix only)
This commit is contained in:
Garrett Wollman 1995-09-22 17:24:51 +00:00
parent fcc3b6999e
commit ce8bb77296
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=10955
2 changed files with 23 additions and 8 deletions

View File

@ -22,7 +22,7 @@
*/
#ifndef lint
static char rcsid[] =
"@(#)$Header: print-atalk.c,v 1.36 94/06/20 19:44:34 leres Exp $ (LBL)";
"@(#)$Header: /home/ncvs/src/usr.sbin/tcpdump/tcpdump/print-atalk.c,v 1.2 1995/03/08 12:52:25 olah Exp $ (LBL)";
#endif
#include <sys/param.h>
@ -100,9 +100,16 @@ atalk_print(register const u_char *bp, int length)
register const struct atShortDDP *sdp;
u_short snet;
#if 0
lp = (struct LAP *)bp;
bp += sizeof(*lp);
length -= sizeof(*lp);
#else
{
static struct LAP lp_ = {0, 0, lapDDP};
lp = &lp_;
}
#endif
switch (lp->type) {
case lapShortDDP:
@ -532,7 +539,7 @@ ataddr_string(u_short atnet, u_char athost)
if (tp2->addr == i) {
tp->addr = (atnet << 8) | athost;
tp->nxt = (struct hnamemem *)calloc(1, sizeof(*tp));
(void)sprintf(nambuf, "%s.%d", tp2->name, athost);
(void)sprintf(nambuf, "%s.%02x", tp2->name, athost);
tp->name = savestr(nambuf);
return (tp->name);
}
@ -540,10 +547,10 @@ ataddr_string(u_short atnet, u_char athost)
tp->addr = (atnet << 8) | athost;
tp->nxt = (struct hnamemem *)calloc(1, sizeof(*tp));
if (athost != 255)
(void)sprintf(nambuf, "%d.%d.%d",
(void)sprintf(nambuf, "%02x.%02x.%02x",
atnet >> 8, atnet & 0xff, athost);
else
(void)sprintf(nambuf, "%d.%d", atnet >> 8, atnet & 0xff);
(void)sprintf(nambuf, "%02x.%02x", atnet >> 8, atnet & 0xff);
i = strlen(nambuf) + 1;
tp->name = strcpy(malloc((u_int) i), nambuf);
@ -564,8 +571,8 @@ ddpskt_string(register int skt)
static char buf[8];
if (nflag) {
(void)sprintf(buf, "%d", skt);
(void)sprintf(buf, "%02x", skt);
return (buf);
}
return (tok2str(skt2str, "%d", skt));
return (tok2str(skt2str, "%02x", skt));
}

View File

@ -1,4 +1,4 @@
.\" @(#) $Header: tcpdump.1,v 1.45 94/06/20 18:54:27 leres Exp $ (LBL)
.\" @(#) $Id: /home/ncvs/src/usr.sbin/tcpdump/tcpdump/tcpdump.1,v 1.3 1995/03/08 12:52:47 olah Exp $ (LBL)
.\"
.\" Copyright (c) 1987, 1988, 1989, 1990, 1991, 1992, 1994
.\" The Regents of the University of California. All rights reserved.
@ -20,7 +20,7 @@
.\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
.\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
.\"
.TH TCPDUMP 1 "20 Jun 1994"
.TH TCPDUMP 1 "22 Sept 1995"
.SH NAME
tcpdump \- dump traffic on a network
.SH SYNOPSIS
@ -34,6 +34,9 @@ tcpdump \- dump traffic on a network
] [
.B \-F
.I file
] [
.B \-T
.I type
]
.br
.ti +8
@ -155,6 +158,11 @@ Print absolute, rather than relative, TCP sequence numbers.
.B \-tt
Print an unformatted timestamp on each dump line.
.TP
.B \-T
Print unrecognized UDP packets as if they were type
.IR type .
Valid types are `vat', `wb', `rpc', and `rtp'.
.TP
.B \-v
(Slightly more) verbose output. For example, the time to live
and type of service information in an IP packet is printed.