Giter Site home page Giter Site logo

the-tcpdump-group / tcpdump Goto Github PK

View Code? Open in Web Editor NEW
2.5K 134.0 823.0 29.49 MB

the TCPdump network dissector

Home Page: https://www.tcpdump.org/

License: Other

Shell 1.31% C 93.35% Awk 0.11% Perl 0.71% Makefile 0.37% GDB 0.02% M4 0.67% CMake 1.71% Roff 1.76%
pcap pcapng packet-capture sniffer tcpdump libpcap berkeley-packet-filter bsd-packet-filter bpf auditing

tcpdump's Introduction

TCPDUMP 4.x.y by The Tcpdump Group

To report a security issue please send an e-mail to [email protected].

To report bugs and other problems, contribute patches, request a feature, provide generic feedback etc please see the guidelines for contributing in the tcpdump source tree root.

Anonymous Git is available via

https://github.com/the-tcpdump-group/tcpdump.git

This directory contains source code for tcpdump, a tool for network monitoring and data acquisition.

Over the past few years, tcpdump has been steadily improved by the excellent contributions from the Internet community (just browse through the change log). We are grateful for all the input.

Supported platforms

In many operating systems tcpdump is available as a native package or port, which simplifies installation of updates and long-term maintenance. However, the native packages are sometimes a few versions behind and to try a more recent snapshot it will take to compile tcpdump from the source code.

tcpdump compiles and works on at least the following platforms:

  • AIX
  • DragonFly BSD
  • FreeBSD
  • Haiku
  • HP-UX 11i
  • illumos (OmniOS, OpenIndiana)
  • GNU/Hurd
  • GNU/Linux
  • {Mac} OS X / macOS
  • NetBSD
  • OpenBSD
  • Solaris
  • Windows (requires WinPcap or Npcap, and Visual Studio with CMake)

In the past tcpdump certainly or likely worked on the following platforms:

  • 4.3BSD
  • BSD/386, later BSD/OS
  • DEC OSF/1, later Digital UNIX, later Tru64 UNIX
  • DOS
  • IRIX
  • LynxOS
  • SINIX
  • SunOS
  • Ultrix
  • UnixWare

Dependency on libpcap

tcpdump uses libpcap, a system-independent interface for user-level packet capture. Before building tcpdump, you must first retrieve and build libpcap.

Once libpcap is built (either install it or make sure it's in ../libpcap), you can build tcpdump using the procedure in the installation notes.

Origins of tcpdump

The program is loosely based on SMI's "etherfind" although none of the etherfind code remains. It was originally written by Van Jacobson as part of an ongoing research project to investigate and improve TCP and Internet gateway performance. The parts of the program originally taken from Sun's etherfind were later re-written by Steven McCanne of LBL. To insure that there would be no vestige of proprietary code in tcpdump, Steve wrote these pieces from the specification given by the manual entry, with no access to the source of tcpdump or etherfind.

formerly from	Lawrence Berkeley National Laboratory
		Network Research Group <[email protected]>
		ftp://ftp.ee.lbl.gov/old/tcpdump.tar.Z (3.4)

See also

Richard Stevens gives an excellent treatment of the Internet protocols in his book "TCP/IP Illustrated, Volume 1". If you want to learn more about tcpdump and how to interpret its output, pick up this book.

Another tool that tcpdump users might find useful is tcpslice. It is a program that can be used to extract portions of tcpdump binary trace files.

The original LBL README by Steve McCanne, Craig Leres and Van Jacobson

This directory also contains some short awk programs intended as
examples of ways to reduce tcpdump data when you're tracking
particular network problems:

send-ack.awk
	Simplifies the tcpdump trace for an ftp (or other unidirectional
	tcp transfer).  Since we assume that one host only sends and
	the other only acks, all address information is left off and
	we just note if the packet is a "send" or an "ack".

	There is one output line per line of the original trace.
	Field 1 is the packet time in decimal seconds, relative
	to the start of the conversation.  Field 2 is delta-time
	from last packet.  Field 3 is packet type/direction.
	"Send" means data going from sender to receiver, "ack"
	means an ack going from the receiver to the sender.  A
	preceding "*" indicates that the data is a retransmission.
	A preceding "-" indicates a hole in the sequence space
	(i.e., missing packet(s)), a "#" means an odd-size (not max
	seg size) packet.  Field 4 has the packet flags
	(same format as raw trace).  Field 5 is the sequence
	number (start seq. num for sender, next expected seq number
	for acks).  The number in parens following an ack is
	the delta-time from the first send of the packet to the
	ack.  A number in parens following a send is the
	delta-time from the first send of the packet to the
	current send (on duplicate packets only).  Duplicate
	sends or acks have a number in square brackets showing
	the number of duplicates so far.

	Here is a short sample from near the start of an ftp:
		3.00    0.20   send . 512
		3.20    0.20    ack . 1024  (0.20)
		3.20    0.00   send P 1024
		3.40    0.20    ack . 1536  (0.20)
		3.80    0.40 * send . 0  (3.80) [2]
		3.82    0.02 *  ack . 1536  (0.62) [2]
	Three seconds into the conversation, bytes 512 through 1023
	were sent.  200ms later they were acked.  Shortly thereafter
	bytes 1024-1535 were sent and again acked after 200ms.
	Then, for no apparent reason, 0-511 is retransmitted, 3.8
	seconds after its initial send (the round trip time for this
	ftp was 1sec, +-500ms).  Since the receiver is expecting
	1536, 1536 is re-acked when 0 arrives.

packetdat.awk
	Computes chunk summary data for an ftp (or similar
	unidirectional tcp transfer). [A "chunk" refers to
	a chunk of the sequence space -- essentially the packet
	sequence number divided by the max segment size.]

	A summary line is printed showing the number of chunks,
	the number of packets it took to send that many chunks
	(if there are no lost or duplicated packets, the number
	of packets should equal the number of chunks) and the
	number of acks.

	Following the summary line is one line of information
	per chunk.  The line contains eight fields:
	   1 - the chunk number
	   2 - the start sequence number for this chunk
	   3 - time of first send
	   4 - time of last send
	   5 - time of first ack
	   6 - time of last ack
	   7 - number of times chunk was sent
	   8 - number of times chunk was acked
	(all times are in decimal seconds, relative to the start
	of the conversation.)

	As an example, here is the first part of the output for
	an ftp trace:

	# 134 chunks.  536 packets sent.  508 acks.
	1       1       0.00    5.80    0.20    0.20    4       1
	2       513     0.28    6.20    0.40    0.40    4       1
	3       1025    1.16    6.32    1.20    1.20    4       1
	4       1561    1.86    15.00   2.00    2.00    6       1
	5       2049    2.16    15.44   2.20    2.20    5       1
	6       2585    2.64    16.44   2.80    2.80    5       1
	7       3073    3.00    16.66   3.20    3.20    4       1
	8       3609    3.20    17.24   3.40    5.82    4       11
	9       4097    6.02    6.58    6.20    6.80    2       5

	This says that 134 chunks were transferred (about 70K
	since the average packet size was 512 bytes).  It took
	536 packets to transfer the data (i.e., on the average
	each chunk was transmitted four times).  Looking at,
	say, chunk 4, we see it represents the 512 bytes of
	sequence space from 1561 to 2048.  It was first sent
	1.86 seconds into the conversation.  It was last
	sent 15 seconds into the conversation and was sent
	a total of 6 times (i.e., it was retransmitted every
	2 seconds on the average).  It was acked once, 140ms
	after it first arrived.

stime.awk
atime.awk
	Output one line per send or ack, respectively, in the form
		<time> <seq. number>
	where <time> is the time in seconds since the start of the
	transfer and <seq. number> is the sequence number being sent
	or acked.  I typically plot this data looking for suspicious
	patterns.


The problem I was looking at was the bulk-data-transfer
throughput of medium delay network paths (1-6 sec.  round trip
time) under typical DARPA Internet conditions.  The trace of the
ftp transfer of a large file was used as the raw data source.
The method was:

  - On a local host (but not the Sun running tcpdump), connect to
    the remote ftp.

  - On the monitor Sun, start the trace going.  E.g.,
      tcpdump host local-host and remote-host and port ftp-data >tracefile

  - On local, do either a get or put of a large file (~500KB),
    preferably to the null device (to minimize effects like
    closing the receive window while waiting for a disk write).

  - When transfer is finished, stop tcpdump.  Use awk to make up
    two files of summary data (maxsize is the maximum packet size,
    tracedata is the file of tcpdump tracedata):
      awk -f send-ack.awk packetsize=avgsize tracedata >sa
      awk -f packetdat.awk packetsize=avgsize tracedata >pd

  - While the summary data files are printing, take a look at
    how the transfer behaved:
      awk -f stime.awk tracedata | xgraph
    (90% of what you learn seems to happen in this step).

  - Do all of the above steps several times, both directions,
    at different times of day, with different protocol
    implementations on the other end.

  - Using one of the Unix data analysis packages (in my case,
    S and Gary Perlman's Unix|Stat), spend a few months staring
    at the data.

  - Change something in the local protocol implementation and
    redo the steps above.

  - Once a week, tell your funding agent that you're discovering
    wonderful things and you'll write up that research report
    "real soon now".

tcpdump's People

Contributors

acodingfreak avatar brooksdavis avatar ckishimo avatar davecronin avatar dogbert2 avatar fenner avatar ffatghub avatar fxlb avatar guyharris avatar gvanem avatar gvarenni avatar hannesgredler avatar herwinw avatar infrastation avatar jhsmt avatar job avatar kivinen avatar krajaratnam avatar longinus00 avatar lumag avatar mcr avatar mister-x- avatar mlichvar avatar msabramo avatar msekletar avatar rfrancoise avatar sgeto avatar tejblum avatar ton31337 avatar wxsbsd avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tcpdump's Issues

can not compile on Darwin

Converted from SourceForge issue 704421, submitted by nobody

diff -u -d -b -w -u -r1.35 print-esp.c
--- print-esp.c 13 Mar 2003 07:40:48 -0000 1.35
+++ print-esp.c 16 Mar 2003 09:17:11 -0000
@@ -116,7 +116,7 @@
struct sa_list {
struct sa_list *next;
struct sockaddr_storage daddr;

  • uint32_t spi;
  • u_int32_t spi;
    struct esp_algorithm xform;
    char secret[256]; /
    is that big enough for all secrets? */
    int secretlen;

3.7.1: memory leak: getname()

Converted from SourceForge issue 604464, submitted by nobody

hi,

while observing millions of mostly broken udp, tcp and
icmp payloads inside mostly broken ipv4 packets,
tcpdump-3.7.1 kept allocating more and more memory
until it had occupied a huge 244MB memory space.

my analysis is that there is some memory forgotten to
free in case of broken packets.

libpcap version 0.7.

regards,
-tom

&quot;outgoing&quot; not supported for PPP

Converted from SourceForge issue 682893, submitted by nobody

From the tcpdump man pages:

For
`null' link layers (i.e. point to
point pro-
tocols such as slip) the inbound
and out-
bound qualifiers can be used to
specify a
desired direction.

I believe PPP support for inbound and outbound
qualifiers should be implemented in tcpdump. As of
tcpdump 3.7.1 using inbound or outbound results this
error message and tcpdump exits:

~# tcpdump -i ppp0 'outbound'
tcpdump: inbound/outbound
not supported on linktype 113

SLIP is little used these days but PPP is wide-spread and,
IMHO, these qualitfiers should be included for PPP.

Clifford Kite <[email protected]>

print-sctp.c compile errors - I have solution.

Converted from SourceForge issue 822833, submitted by antis0c

Recently on my AMD64 box, glibc seems to include an
enum for IPPROTO_SCTP in netinet/in.h out of the box.
However due to the order of the includes with tcpdump,
sctpContants.h is included before netinet/in.h.

The relavent part of in.h is as follows:

enum {
.. various protocols ..
IPPROTO_SCTP = 132,

define IPPROTO_SCTP IPPROTO_SCTP

.. more protocols ..
};

However, since sctpConstants.h is included before
netinet.h/in.h it defines IPPROTO_SCTP as 132, so when
run through CPP we get:

132 = 132,

instead of IPPROTO_SCTP = 132,

Causing a syntax error in netinet/in.h, which then
causes IPPROTO_SCTP to not be defined correctly when
the next line is:

define IPPROTO_SCTP IPPROTO_SCTP.

Thus we get an undefined error in print-sctp.c for
IPPROTO_SCTP.

Simply changing the order of the includeded headers so
that netinet/in.h comes before sctpConstants.h fixes
this problem.

Feel free to email me about this, [email protected].

Thanks.

print-mobility.c bugs

Converted from SourceForge issue 907958, submitted by brianhaley

I noticed while looking at the Mobile IPv6 decodes in
print-mobility.c that there are a number of cases where
structure elements are printed as signed integers
instead of unsigned. For example:

printf(" seq#=%d", EXTRACT_16BITS(&mh->ip6m_data16[0]));

This should be %u. I counted 7 in total.

Also, should all the local variables be unsigned as
well (mhlen, hlen, etc)? That would be a few more
%d->%u changes too.

I also found a lot of old mobility code in
print-ip6opts.c - BU, BA, BR, ALTCOA, UI and AUTH can
all be removed, they're superceded by print-mobility.c
as of the latest version of the draft (24).

Let me know if I can be of any more help with Mobile
IPv6 decodes or questions.

Thanks,

-Brian

Filtering problems in token-ring

Converted from SourceForge issue 574488, submitted by nobody

Trying to dump with a filer like
tcpdump -X -i tr0 -n -s 4056 ip host xxx.xxx.xxx.xxx
I do not dump anything.
The reason seems to be the fact that the host I'm
trying to trace (and which is connecting to the host
i'm running tcpdump on ) is on a remote eth networkm
while i'm on a token ring one.

the output i get if I dump without filters is:

07:05:00.975449 rt = 610:11:ff00 (1500) stfsrv01.http >
stftk06.49454: S 1959913187:1959913187(0) ack 101 win
12048 <mss 4016> (DF)
0x0000 aaaa 0300 0000 0800 4500 002c 0000 4000
........E..,..@.
0x0010 4006 efd3 8493 a160 8494 a070 0050 c12e
@.........p.P.. 0x0020 74d1 e6e3 0000 0065 6012 2f10 f678 0000 t......e./..x..
0x0030 0204 0fb0
....
07:05:01.033334 0:3:91:0:71:48 sap 90 >
0:40:aa:7d:bb:4b ip-sap I (s=0,r=8,P) len=56
0x0000 0690 0011 ff00 aaaa 0300 0000 0800 4500
..............E.
0x0010 0028 00c8 0000 3a06 3510 8494 a070 8493
.(....:.5....p..
0x0020 a160 c12e 0050 0000 0065 74d1 e6e4 5010
.`...P...et...P.
0x0030 060c 4136 0000 0000 0000 0000
..A6........

In other words, those frames coming from eth make
tcpdump unable to read layer 3 headers ( i may assume
because of the rt value, don't know...).
Note that the previous dump was about a
SYN-ACK ->
ACK <-
between the same two machines.

Emanuele "SKULL" Balla
[email protected]

[patch] if construct terminated by semi-colon

Converted from SourceForge issue 913191, submitted by maneo

In the tcpdump source code distribution which ships
with FreeBSD 5-CURRENT, in print-lwres.c a misplaced
semi-colon terminates an ``if'' construct causing
the printf() statement to execute regardless of the
outcome of the condition.

I have attached the patch.

NFS offsets printed in hex for v3, decimal for v2

Converted from SourceForge issue 774176, submitted by nobody

In the NFS packet printer, the file offset is printed
in hex
for v3 packets, and decimal for v2 packets. There
might
also be other fields that are this way, but this is the
one
that jumped out at me.

To make matters more interesting, there doesn't seem to
be any way to distinguish the protocol version (v2 or
v3)
except by looking at the file offset and seeing whether
it
begins with 0x or something else.

I ran nfsdump with

-vv -s400 port 2049

Compile failure on Solaris 8.

Converted from SourceForge issue 601639, submitted by nobody

I get a very strange error when attempting to compile
tcpdump v3.7. I can't quite get a handle on what's
happening here, though it certainly has something to do
with macros, it's just not yielding easily to my
analysis. So here's the scoop:

Configure completes:
loading cache ./config.cache
checking host system type... sparc-sun-solaris2.8
checking for gcc... (cached) gcc
checking whether the C compiler (gcc ) works... yes
checking whether the C compiler (gcc ) is a
cross-compiler... no
checking whether we are using GNU C... (cached) yes
checking whether gcc accepts -g... (cached) yes
checking gcc version... (cached) 3
checking for inline... (cached) inline
checking for attribute... (cached) yes
checking how to run the C preprocessor... (cached) gcc
-E
checking for fcntl.h... (cached) yes
checking for rpc/rpcent.h... (cached) yes
checking for netinet/if_ether.h... (cached) yes
checking whether time.h and sys/time.h may both be
included... (cached) yes
checking for smi.h... (cached) no
checking for smiInit in -lsmi... (cached) no
checking whether to enable the possibly-buggy SMB
printer... yes
configure: warning: The SMB printer may have
exploitable buffer overflows!!!
checking whether to enable ipv6... no
checking for inet_ntop... yes
checking for inet_pton... yes
checking for inet_aton... yes
checking if sockaddr struct has sa_len member...
(cached) no
checking size of char... (cached) 1
checking size of short... (cached) 2
checking size of int... (cached) 4
checking size of long... (cached) 4
checking for addrinfo... (cached) yes
checking for NI_MAXSERV... (cached) yes
checking for NI_NAMEREQD... (cached) yes
checking for sockaddr_storage... (cached) yes
checking for INADDRSZ... (cached) no
checking for IN6ADDRSZ... (cached) no
checking for RES_USE_INET6... (cached) yes
checking for res_state_ext... (cached) no
checking for nsort in res_state... (cached) no
checking for vfprintf... (cached) yes
checking for strcasecmp... (cached) yes
checking for strlcat... (cached) yes
checking for strlcpy... (cached) yes
checking for strdup... (cached) yes
checking for ether_ntohost... (cached) no
checking for setlinebuf... (cached) yes
checking for vsnprintf... (cached) yes
checking for snprintf... (cached) yes
checking return type of signal handlers... (cached)
void
checking for sigset... (cached) yes
checking for dnet_htoa in -ldnet... (cached) no
checking for main in -lrpc... (cached) no
checking for library containing getrpcbynumber...
(cached) -lnsl
checking for library containing gethostbyname...
(cached) none required
checking for library containing socket... (cached)
-lsocket
checking for library containing putmsg... (cached) none
required
checking for local pcap library...
../libpcap-0.6.2/libpcap.a
checking for bpf_dump... (cached) yes
checking for u_int8_t using gcc... (cached) no
checking for int16_t using gcc... (cached) yes
checking for u_int16_t using gcc... (cached) no
checking for int32_t using gcc... (cached) yes
checking for u_int32_t using gcc... (cached) no
checking if sockaddr struct has sa_len member...
(cached) no
checking if unaligned accesses fail... (cached) yes
checking for h_errno... (cached) yes
checking for SSLeay... /usr
checking for des_cbc_encrypt in -lcrypto... (cached)
yes
checking for cast.h... (cached) no
checking for rc5.h... (cached) no
checking for a BSD compatible install... ./install-sh
-c
creating ./config.status
creating Makefile
creating config.h
config.h is unchanged

And almost everything makes correctly, except for
util.c. I'm going to cut out the errors and warnings I
got here.
gcc -O2 -DHAVE_CONFIG_H -I. -I../libpcap-0.6.2
-I./missing -I/usr/include -c ./
addrtoname.c
addrtoname.c: In function getname': addrtoname.c:210: warning: assignment makes pointer from integer without a cast addrtoname.c:221: warning: assignment makes pointer from integer without a cast addrtoname.c: In functionetheraddr_string':
addrtoname.c:470: warning: assignment makes pointer
from integer without a cast
addrtoname.c: In function etherproto_string': addrtoname.c:526: warning: assignment makes pointer from integer without a cast addrtoname.c: In functionprotoid_string':
addrtoname.c:553: warning: assignment makes pointer
from integer without a cast
addrtoname.c: In function llcsap_string': addrtoname.c:572: warning: assignment makes pointer from integer without a cast addrtoname.c: In functiontcpport_string':
addrtoname.c:616: warning: assignment makes pointer
from integer without a cast
addrtoname.c: In function udpport_string': addrtoname.c:635: warning: assignment makes pointer from integer without a cast addrtoname.c: In functioninit_servarray':
addrtoname.c:661: warning: assignment makes pointer
from integer without a cast
addrtoname.c:663: warning: assignment makes pointer
from integer without a cast
addrtoname.c: In function init_protoidarray': addrtoname.c:725: warning: assignment makes pointer from integer without a cast addrtoname.c: In functioninit_etherarray':
addrtoname.c:776: warning: assignment makes pointer
from integer without a cast

gcc -O2 -DHAVE_CONFIG_H -I. -I../libpcap-0.6.2
-I./missing -I/usr/include -c ./
print-atalk.c
print-atalk.c: In function `ataddr_string':
print-atalk.c:578: warning: assignment makes pointer
from integer without a cast
print-atalk.c:595: warning: assignment makes pointer
from integer without a cast
print-atalk.c:607: warning: assignment makes pointer
from integer without a cast

gcc -O2 -DHAVE_CONFIG_H -I. -I../libpcap-0.6.2
-I./missing -I/usr/include -c ./
print-nfs.c
print-nfs.c: In function nfs_printfh': print-nfs.c:761: warning: passing arg 6 ofParse_fh'
from incompatible pointer
type

gcc -O2 -DHAVE_CONFIG_H -I. -I../libpcap-0.6.2
-I./missing -I/usr/include -c ./
setsignal.c
setsignal.c: In function setsignal': setsignal.c:72: warning: return makes pointer from integer without a cast gcc -O2 -DHAVE_CONFIG_H -I. -I../libpcap-0.6.2 -I./missing -I/usr/include -c ./ tcpdump.c gcc -O2 -DHAVE_CONFIG_H -I. -I../libpcap-0.6.2 -I./missing -I/usr/include -c ./ util.c util.c: In functionerror':
util.c:251: __builtin_va_alist' undeclared (first use in this function) util.c:251: (Each undeclared identifier is reported only once util.c:251: for each function it appears in.) util.c: In functionwarning':
util.c:270: `__builtin_va_alist' undeclared (first use
in this function)
gmake: *** [util.o] Error 1

As for `__builtin_va_alist', I can't find it anywhere.
I can't grep out "alist" anywhere. And I can't grep
"builtin" anywhere. This indicates to me that there's
probably some strange stuff happening with macros and
text substitutions. If I were getting any traction on
it at all, I'd probably attempt to fix it.

Seg. Fault on smb decode

Converted from SourceForge issue 600346, submitted by nobody

I found a case where bad data being sent by a Win2k
server causes a segment fault in Windump.

The fix was in smbutil.c, function fdata1 in the case
for 'T' (time decoding). I solved the problem by catching
the null value returned by localtime. See below.

case 'T':
  {

time_t t;
struct tm* lt; <<<<------- new code
int x = IVAL(buf,0);
switch (atoi(fmt+1)) {
case 1:
if (x==0 || x==-1 || x==0xFFFFFFFF)
t = 0;
else
t = make_unix_date(buf);
buf+=4;
break;
case 2:
if (x==0 || x==-1 || x==0xFFFFFFFF)
t = 0;
else
t = make_unix_date2(buf);
buf+=4;
break;
case 3:
t = interpret_long_date(buf);
buf+=8;
break;
}

lt = t ? localtime(&t) : NULL; // catch bogus
time here <<<< ----- new code here
printf("%s", lt ? asctime(lt) : "NULL\n"); <<---
changed code
fmt++; while (isdigit(*fmt)) fmt++;
break;
}

Problem compiling tcpdump 3.8.1

Converted from SourceForge issue 886075, submitted by pierre42

gmake

gcc -O2 -s -O3 -march=i686 -DHAVE_CONFIG_H
-D_U_="attribute((unused))" -I. -I./missing
-I/usr/include -L/usr/lib -o tcpdump addrtoname.o
gmpls.o gmt2local.o machdep.o parsenfsfh.o
print-802_11.o print-ah.o print-arcnet.o print-aodv.o
print-arp.o print-ascii.o print-atalk.o print-atm.o
print-beep.o print-bfd.o print-bgp.o print-bootp.o
print-cdp.o print-chdlc.o print-cip.o print-cnfp.o
print-decnet.o print-domain.o print-dvmrp.o print-enc.o
print-egp.o print-esp.o print-ether.o print-fddi.o
print-fr.o print-gre.o print-hsrp.o print-icmp.o
print-igmp.o print-igrp.o print-ip.o print-ipcomp.o
print-ipfc.o print-ipx.o print-isakmp.o print-isoclns.o
print-krb.o print-l2tp.o print-lane.o print-ldp.o
print-llc.o print-lwres.o print-mobile.o print-mpls.o
print-msdp.o print-nfs.o print-ntp.o print-null.o
print-ospf.o print-pflog.o print-pim.o print-ppp.o
print-pppoe.o print-pptp.o print-radius.o print-raw.o
print-rip.o print-rsvp.o print-rx.o print-sctp.o
print-sl.o print-sll.o print-snmp.o print-stp.o
print-sunatm.o print-sunrpc.o print-tcp.o
print-telnet.o print-tftp.o print-timed.o print-token.o
print-udp.o print-vjc.o print-vrrp.o print-wb.o
print-zephyr.o setsignal.o tcpdump.o util.o version.o
print-ip6.o print-ip6opts.o print-mobility.o
print-ripng.o print-icmp6.o print-frag6.o print-rt6.o
print-ospf6.o print-dhcp6.o print-smb.o smbutil.o
strlcat.o strlcpy.o -lpcap -ldnet
tcpdump.o(.text+0x3d2): In function main': : undefined reference topcap_debug'
collect2: ld returned 1 exit status
gmake: *** [tcpdump] Error 1

snmp trap decoding bug

Converted from SourceForge issue 915936, submitted by kin1

Specific trap is always displayed as "[specific-trap(xx)!
=0]". even if generic trap is enterprise-specific.
I think GT_ENTERPRISE in print-snmp.c should be 6, not
7. I checked ver 3.8.1.

BSD/OS support for extra things

Converted from SourceForge issue 697571, submitted by cross

There has been support added by BSDi engineering to the
tcpdump they ship. That is version 3.4a6, I think.
(Very old)

I wanted to get a newer tcpdump installed. I am trying
to port over the additions they've made that aren't
superceeded by tcpdump 3.7.1. Two notable examples are:

DLT_8021Q - 802.1q VLAN tagged ethernet packets
ATM ARP code

There are a few other things that I think might be
superceeded, but I can't tell easily.

Who should I work with to get changes incorporated,
assuming you're interested in having them?

(This effects libpcap too, but I didn't open a separate
bug there)

Build problem if PWD != srcdir

Converted from SourceForge issue 697610, submitted by cross

When tcpdump'd configure script looks for a local
libpcap, it looks in "..". It should look in
"${srcdir}/..", so that if you're running it as part of
a larger make, it will look in the parent of the
tcpdump source code rather than the parent of the shell
that invoked make.

print-domain.c message header bitflag error

Converted from SourceForge issue 807330, submitted by syberpunk

The test for DNS message dnssec bit flags in the query
and response are backwards. The CD bit has meaning in
a query, and the AD bit has meaning in a response.

Below is a diff of the fix (very minor):

530c530

< DNS_CD(np)? "%" : "");

> DNS_AD(np) ? "$" : "");
593c593

< DNS_AD(np) ? "$" : "");

> DNS_CD(np)? "%" : "");

tcpdump manpage

Converted from SourceForge issue 677812, submitted by saltyhacker

The tcpdump manpage says:
We see that this octet contains 2 bytes

instead I believe it should say:
We see that this octet contains 2 bits

Below is the context taken directly from the manpage
output of 'man tcpdump'
...
Let's have a closer look at octet no. 13:

                   |               |
                   |---------------|
                   |   |U|A|P|R|S|F|
                   |---------------|
                   |7   5   3     0|

   We see that this octet contains 2 bytes from the 

reserved field. According to RFC 793 this
field is reserved for future use and must be 0. The
remaining 6 bits are the TCP control bits
we are interested in. We have numbered the bits in
this octet from 0 to 7, right to left, so
the PSH bit is bit number 3, while the URG bit is
number 5.
...

print-nfs prints beyond end of string

Converted from SourceForge issue 592852, submitted by nobody

Version 3.7.1
Machine: i686
Os: Linux 2.2.16-22enterprise
Command: tcpdump -tuNl -s 200 port nfsd
Problem: segmentation faults
The last packet printed in a sample execution is:
silver.482673452 > marble.nfs: 124 lookup fh
Unknown/CABAEBFE85A6370002000000110800001108000002000000EAF25E5A00000000
"^@ssh^@^@^@M-_M-FM-zM-vM-^GM-'jM-zM-&M-%M-`^O^@M-hM-^WM-^/M-xM-^MM-p/NM-V4M-kO^@x^WM-a^@^@^Q^@^@^@PORT
nfsd^@^@^@^Y^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^Y^@^@^@x^O^U^H^@^

... and a lot of more garbage, until it crashes.

The actual last packet printed actually varies from an
execution to
another, but the problem is always the same: when
printing some nfs
lookup request packets, the string printing loop goes
past the end of the string representing the filename,
until it hits a memory location out of the process image.

I had a look at the source code: I think the problem
happens in
fn_printn() called from parsefn() in print-nfs.c. I
changed the call
to
fn_printn(cp, len, snaplen);
and it does not segfault anymore, but all the printed
filenames in
lookup requests are empty.

Ruggero
[email protected]

installation problem

Converted from SourceForge issue 668951, submitted by nobody

having downloaded 3.7.1, untaring
and runing configure, with no errors,
make returned:

gcc -O2 -DHAVE_CONFIG_H -I. -I./missing -I/usr/include
-c ./addrtoname.c
./addrtoname.c:50:18: pcap.h: No such file or directory
./addrtoname.c:51:25: pcap-namedb.h: No such file or
directory
In file included from ./addrtoname.c:58:
interface.h:184:18: pcap.h: No such file or directory
make: *** [addrtoname.o] Error 1

Eviatar Tron
[email protected]

print-mobility.c bugs

Converted from SourceForge issue 907927, submitted by brianhaley

I noticed while looking at the Mobile IPv6 decodes in
print-mobility.c that there are a number of cases where
structure elements are printed as signed integers
instead of unsigned. For example:

printf(" seq#=%d", EXTRACT_16BITS(&mh->ip6m_data16[0]));

This should be %u. I counted 7 in total.

Also, should all the local variables be unsigned as
well (mhlen, hlen, etc)? That would be a few more
%d->%u changes too.

I also found a lot of old mobility code in
print-ip6opts.c - BU, BA, BR, ALTCOA, UI and AUTH can
all be removed, they're superceded by print-mobility.c
as of the latest version of the draft (24).

Let me know if I can be of any more help with Mobile
IPv6 decodes or questions.

Thanks,

-Brian

Bug with stdout buffer (win32)

Converted from SourceForge issue 819223, submitted by niwostufe0

-- mail i've sended to windump developer --
Hi there,

i found an Bug in windump's stdout buffer settings.
I want grep the output from windump with an perl script
and only can read
in
~4kb Blocks steps :-(

I take a look in the windump source and found the
problem:

in tcpdump.c line 373:
setvbuf(stdout, NULL, _IOLBF, 0);

the doc say that the value 0 isn't allowed here ;-)
~ cutted doc ~
size
Buffer size in bytes. Allowable range: 2 < size < 32768.
Internally, the
value supplied for size is rounded down to the nearest
multiple of 2.
~ end cutted doc ~

i have patched the line to
setvbuf(stdout, NULL, _IONBF, 0);

_IONBF -no bufferring

it work fine.

sorry for my english ;-)
greeting from germany

Joachim

-- end mail i've sended to windump developer --

Hi, the windump people tell me that this Problem is in the
tcpdump source, so i post it here.
I don't know if this Problem only is on Win32 Plattform, i
don't have to docs of "setvbuf" for *nix.

greeting from Germany
Joachim

ISAKMP printer fails

Converted from SourceForge issue 610455, submitted by nobody

Some of the ISAKMP packets causes Bus Error on Solaris
unless you specify the -q switch to turn of the
analysis. In the attached dumpfile I collected some
packets from our traces, which cause this problem.

cheers,
Tamas

<[email protected]>

Compile error 3.7.2, 3.7.1, (and so on?)

Converted from SourceForge issue 739058, submitted by nobody

When compiling print-sctp.c, a parse error is generated
at line 84 of /usr/include/netinet/in.h.

Cause:

The cause is that IPPROTO_SCTP is defined in both
sctpConstants.h and in <netinet/in.h>, but
sctpConstants.h is included first in print-sctp.c which
defeats an #ifdef guard around the IPPROTO_SCTP
definition in sctpConstants.h.

Presumed Solution:

Recording the includes so that <netinet/in.h> is read
first allows its IPPROTO_SCTP value to be used, and
allows the #ifdef guard around the constant in
sctpConstants.h to work as (presumably) intended.

Richard Huddleston
[email protected]

RH Linux 9, 2.4 kernel, server install, Intel P4

3.8.1 won't build if HAVE_LIBCRYPTO && !HAVE_OPENSSL_EVP_H

Converted from SourceForge issue 892966, submitted by vda

print-esp.c:

ifdef HAVE_LIBCRYPTO

ifdef HAVE_OPENSSL_EVP_H

include <openssl/evp.h>

endif

endif

# ifdef HAVE_LIBCRYPTO

struct sa_list {
struct sa_list *next;
struct sockaddr_storage daddr;
u_int32_t spi;
const EVP_CIPHER *evp;
^^^^^^^^^^^^^^^^^^^^^

This blews up if I HAVE_LIBCRYPTO
but !HAVE_OPENSSL_EVP_H

segfault in arp printing code

Converted from SourceForge issue 603312, submitted by warchild314

When tcpdump attempts to print an arp packet (arp
reply, rarp request/reply only, it seems) whose
supposed hardware address length is 0, linkaddr_string
improperly malloc's 0*3 and causes a segfault.

There are two solutions that I can think of. First,
have a sanity check in addrtoname.c's linkaddr_string
that handles the special case when it receives a
hardware address length of 0. I'm not entirely sure
what this special case would do, but returning
abnormally might be ok. Second may be to sanity check
len before ever passing it to linkaddr_string, but that
could get real ugly.

I stumbled upon this bug while trying to debug an
application of my own that crafts arp packets. I
accidentally had the hardware address lenght of the arp
packet set to 0 and my tcpdump session segfaulted.
Repeating this in gdb led me to linkaddr_string and the
malloc mixup. If you need it,
http://spoofed.org/files/arp-tk.c . Change line 321
(the call to libnet_build_arp()) to use a hardware
address length of 0 instead of 6, recompile, and the
fire up tcpdump. You should be able to get a segfault
with 'arp-tk -i eth0 -v -o rrep -D 1:2:3:4:5:6 -S
1:2:3:4:5:6', where eth0 is my default interface and
the two ethernet addresses are just picked at random.

not all packets to assigned TCP ports are that protocol

Converted from SourceForge issue 781153, submitted by fenner

From FreeBSD PR 34269:

tcpdump -v parses TCP packets that are part of a valid HTTP
request/response
exchange in the format of an NFS packet. This has caused
"false alarms" about
security of networks here. Note the improperly-parsed
packets in the
example of the output below:

tcpdump -nv port 2049

08:30:34.545243 216.106.74.90.2049 > 208.48.65.12.80: S
[tcp sum ok] 6953841:6953841(0) win 8192 <mss
536,nop,nop,sackOK> (DF) (ttl 112, id 64830, len 48)
08:30:34.546152 208.48.65.12.80 > 216.106.74.90.2049: S
[tcp sum ok] 1333449278:1333449278(0) ack 6953842 win
8767 <mss 1380> (ttl 254, id 0, len 44)
08:30:34.948079 216.106.74.90.2049 > 208.48.65.12.80: .
[tcp sum ok] ack 1 win 8576 (DF) (ttl 112, id 1343, len 40)
08:30:34.964025 216.106.74.90.2049 >
208.48.65.12.796226405: reply ERR 396 (DF) (ttl 112, id
1599, len 436)
08:30:34.965233 208.48.65.12.80 > 216.106.74.90.2049: .
[tcp sum ok] ack 397 win 32836 (ttl 64, id 14650, len 40)
08:30:35.017109 208.48.65.12.791752241 >
216.106.74.90.2049: 247 proc-542008692 (ttl 64, id 14651,
len 287)
08:30:35.017900 208.48.65.12.976170870 >
216.106.74.90.2049: 63 proc-1831826803 (ttl 64, id 14652,
len 103)
08:30:35.018116 208.48.65.12.80 > 216.106.74.90.2049: F
[tcp sum ok] 311:311(0) ack 397 win 33232 (ttl 63, id
14653, len 40)
08:30:35.540344 216.106.74.90.2049 > 208.48.65.12.80: .
[tcp sum ok] ack 311 win 8266 (DF) (ttl 112, id 4927, len
40)
08:30:35.554091 216.106.74.90.2049 > 208.48.65.12.80: .
[tcp sum ok] ack 312 win 8266 (DF) (ttl 112, id 5439, len
40)
08:30:35.554363 216.106.74.90.2049 > 208.48.65.12.80: F
[tcp sum ok] 397:397(0) ack 312 win 8266 (DF) (ttl 112, id
5695, len 40)
08:30:35.554863 208.48.65.12.80 > 216.106.74.90.2049: .
[tcp sum ok] ack 398 win 33232 (ttl 64, id 14654, len 40)

At this location, this only seems to occur for return packets
to port 2049 on a remote system.
This may occur under other conditions as well, not seen
here.

libpcap crashes ip-stack on wlan

Converted from SourceForge issue 649597, submitted by besh23

i've detected problems with libpcap on wlan environment.
the situation is this: if there is a wep64 encrypted wlan
(ap, win-xp client, linux client) the network is running
fine. when the linux client is put into promiscuous mode
the connection breakes. the win-xp client connection is
still working, so i assume that linux gets problems with
the ip-stack.
this bug doesn't affect if there is no win-xp client. the
linux client is debian unstable x86 w/ latest libpcap and
the shmoo patched orinoco drivers (monitor mode
enabled, but doesn't matter in ap mode). all wlan cards
are orinoco silver (enterasys networks).

has someone else detected such problems with
libpcap? this happens when i use iptraf, tcpdump or
echolot.

feel free to contact me if i shall provide additional
information.

Document ethernet padding with -x

Converted from SourceForge issue 559168, submitted by nobody

While playing around with both tcpdump 3.7.1 and tcpdump 3.6
I belive I have found a bug with the representation of Ethernet
trailer information within an IP packet information.

I have sent an ICMP Timestamp request to a destination host
and with the reply I saw wierd padding at the end of the packet:

13:16:23.010811 10.50.1.63 > 10.50.1.211: icmp: time stamp
query id 40973 seq 0 (ttl 255, id 13170, len 40)
4500 0028 3372 0000 ff01 70ed 0a32 013f
0a32 01d3 0d00 226f a00d 0000 02a2 2de1
0000 0000 0000 0000 0000 0000 0000
13:16:23.011395 10.50.1.211 > 10.50.1.63: icmp: time stamp
reply id 40973 seq 0 : org 0x2a22de1 recv 0x2a6c8c9 xmit
0x2a6c8c9 (DF) (ttl 255, id 42448, len 40)
4500 0028 a5d0 4000 ff01 be8e 0a32 01d3
0a32 013f 0e00 8a8f a00d 0000 02a2 2de1
02a6 c8c9 02a6 c8c9 5555 5555 5555

As you can see there are 6 bytes added at the end of the ICMP
Timestamp reply, just after the transmit timestamp information
(5555 5555 5555).

You can also see the same thing with the ICMP Timestamp
request I have sent. In this case the padded trailer was 0000
0000 0000.

Using ethereal (which also display this at the end of the IP
packet...) I was able to track the padded information to be the
Ethernet Trailer.

Thank you
Ofir Arkin
[email protected]

Broken Cisco NetFlow Decode

Converted from SourceForge issue 649659, submitted by nobody

The record structure for Cisco NetFlow packets is the wrong size; therefore, every record after the first in a packet will not print correctly. The solution is to remove the last variable (peer_nexthop) which is not common to all versions.

[mds] cvs diff print-cnfp.c 
Index: print-cnfp.c
===================================================================
RCS file: /tcpdump/master/tcpdump/print-cnfp.c,v
retrieving revision 1.12
diff -r1.12 print-cnfp.c
77d76
< struct in_addrpeer_nexthop;/* v6: IP address of the nexthop within the peer (FIB)*/
[mds]

tcpdump manpage has incomplete docs on TCP headers

Converted from SourceForge issue 753399, submitted by arach

I got this reported to us and I think it belongs upstream.

reporter:[email protected]
http://bugs.gentoo.org/show_bug.cgi?id=21312
Regards,
[email protected]


There are two TCP headers, ECN Echo and ECN Cwnd
Reduced, that tcpdump
recognizes and outputs the existence of, but aren't
listed in the manpage. The
relevant section of tcpdump.1, near the top of the TCP
Packets section, line 743:

   Flags  are some combination of S (SYN), F (FIN),

P (PUSH) or R (RST) or
a single `.' (no flags). Data-seqno describes
the portion of sequence

The part of print-tcp.c that produces the header flag
output, inside the
function tcp_print, line 274:

if ((flags = tp->th_flags) &
(TH_SYN|TH_FIN|TH_RST|TH_PUSH|
TH_ECNECHO|TH_CWR)) {
if (flags & TH_SYN)
putchar('S');
if (flags & TH_FIN)
putchar('F');
if (flags & TH_RST)
putchar('R');
if (flags & TH_PUSH)
putchar('P');
if (flags & TH_CWR)
putchar('W');/* congestion _W_indow reduced (ECN) /
if (flags & TH_ECNECHO)
putchar('E');/
ecn _E_cho sent (ECN) */
} else
putchar('.');

W and E are not documented in the manpage.

Reproducible: Always
Steps to Reproduce:
1.Run tcpdump
2.Receive a packet with the W or E header flags set
3.Wonder what W and E mean, as they aren't in the manpage.

compilation problem on redhat7.2

Converted from SourceForge issue 640412, submitted by nfudd

On redhat7.2, compilation fails because the pcap
headers are in
/usr/include/pcap.

Adding '-I/usr/include/pcap' into the Makefile fixes
the problem.
Adding it to the configure program would be a good idea.

man page - repetitions

Converted from SourceForge issue 678506, submitted by nobody

On the man page, atleast as posted on the web it
states:

"The following TCP flags field values are
available: tcp-fin, tcp-syn, tcp-rst, tcp-
push, tcp-push, tcp-ack, tcp-urg."

As you can see, "tcp-push" is repeated twice. It should
really state:

"The following TCP flags field values are
available: tcp-fin, tcp-syn, tcp-rst, tcp-
push, tcp-ack, tcp-urg."

print-nfs.c bug

Converted from SourceForge issue 761585, submitted by wtloren

There are bugs in print-nfs.c that were fixed in cvs
version 1.96 (see below) but are still present in the
latest release version, tcpdump-3.7.2

1.96 Mon Aug 26 9:36:20 2002 by guy
Diffs to 1.95

Fixes for:

parsefattr misuses nfsv2 version members for v3.
print_int64 prints at least 9 digits unnecessarily.
-u flag doesn't always suppress decoding handles.

from Takashi Yamamoto <[email protected]>.

Loren Brookes

doubled attributes in radius packet (print-radius.c)

Converted from SourceForge issue 818521, submitted by bibergan

in print-radius.c
While printing radius packet, doubled packets doesn't
show.
In the folowing dump bytes 5a and 5b mean second
(broken) empty attribute User-Name, but in parsed
string it was not shown.

12:47:12.124731 somehost1.com.radacct >
somehost2.com.radacct: rad-account-re
q 86 [id 17] Attr[ NAS_ipaddr{localhost} NAS_port{1}
Acct_session_id{02} Acct_s
tatus{#257} User{[email protected]} User
Proxy_state{........�b.........} ]
0x0000 4500 0072 d638 0000 4011 dd40 c313
ddea E..r.8..@..@....
0x0010 c383 6280 0715 0715 005e fa23 0411
0056 ..b......^.#...V
0x0020 060b 2706 3e86 cea7 ab95 91ab e0a7
d0db ..'.>...........
0x0030 0406 7f00 0001 0506 0000 0001 2c04
3032 ............,.02
0x0040 2806 0000 0001 0114 6e6f 626f 6479
4073 (.......nobody@s
0x0050 6f6d 6568 6f73 742e 7275 0102 2116
eadd omehost.ru..!...
0x0060 13c3 1100 0000 8062 83c3 0100 007f
1d00 .......b........

wrong BGP header length handling

Converted from SourceForge issue 744517, submitted by nobody

if a malicious user forge a BGP packet with length
field < 19 tcpdump behaves strangely, as follows:

  • SeXmAcHiNe:/home/mydecay# tcpdump -i eth0 -vv >
    tcpdump-log &
  • [1] 12549
  • tcpdump: listening on eth0
  • SeXmAcHiNe:/home/mydecay# ./bgpfuck-safe 62.40.96.125
  • SeXmAcHiNe:/home/mydecay# vi tcpdump-log #
    (slight output follows)
  • 21:39:54.813582 SeXmAcHiNe.male.bgp >
    uk.se1.se.geant.net.bgp: S [tcp sum ok]
    1236353731:1236353731(0) win 5840 (DF) (ttl 64, id
    44695, len 60)
  • 21:39:54.928438 uk.se1.se.geant.net.bgp >
    SeXmAcHiNe.male.bgp: S [tcp sum ok]
    1685809323:1685809323(0) ack 1236353732 win 16500 (ttl
    53, id 63544, len 60)
  • 21:39:54.928499 SeXmAcHiNe.male.bgp >
    uk.se1.se.geant.net.bgp: . [tcp sum ok] 1:1(0) ack 1
    win 5840 (DF) (ttl 64, id 44696, len 52)
  • 21:39:54.928547 SeXmAcHiNe.male.bgp >
    uk.se1.se.geant.net.bgp: P 1:45(44) ack 1 win 5840
    <nop,nop,timestamp 2747488 471312052>: BGP (#0)
  •      (#0)
    
  •      (#0)
    
  •      (#0)
    
  •      (#0)
    
  •      (#0)
    
  •      (#0)
    
  •      (#0)
    
  •      (#0)
    
  •      (#0)
    
  •      (#0)
    
  •      (#0)
    
  •      (#0)
    
  •      (#0)
    
  •      (#0)
    
  •      (#0)
    
  •      (#0)
    
  •      (#0)
    
  •      (#0)
    
  •      (#0)
    
  •      (#0)
    
  •      [...]
    
  • ... and so on ad-libitum
    *
  •                          Michele &quot;mydecay&quot; Marchetto
    
    */

a proof of concepts is attached:

patch has been sent to authors

unintended (?) semi-colon in lwres_print

Converted from SourceForge issue 621590, submitted by nobody

file: print-lwres.c
cvs revision: 1.5
function: lwres_print
case statement: LWRES_OPCODE_GETRDATABYNAME

                   if (ntohs(grbn-&gt;rdclass) != C_IN);
                            printf(&quot; %s&quot;,

tok2str(ns_class2str, "Class%d",
ntohs(grbn->rdclass)));

it appears as though the semi-colon at the end of the
"if" was mistakenly added resulting in the "printf"
always being performed.

-C Option for v3.7.2 requires pcap write directory

Converted from SourceForge issue 766143, submitted by hsiehjt

The -C option is a great addition; makes my life much
easier! Thanks for the great work!

I am not sure if the issue reported below is intended
behavior or a bug. The man pages do not provide any
guidance in this area.

Using the following versions on Red Hat Linux 9:

tcpdump version 3.7.2
libpcap version 0.7.2

When writing to file with the -C option, the destination
directory must permit write access to the pcap user.
Otherwise tcpdump exits with a permission denied error
message.

I noticed tcpdump runs under the UID of pcap even
when launched as root (see ps -ef printout below):

pcap 4766 4341 0 13:05 pts/2 00:00:00
tcpdump -C 1 -w test.libp -i eth2

Here is a listing of the resulting capture files:

-rw-r--r-- 1 root root 1000034 Jul 4 13:11
test.libp
-rw-r--r-- 1 pcap pcap 356424 Jul 4 13:13
test.libp2

Please note the first file is owned by root while the
second one is owned by pcap.

3.8.1: configure fails to detect openssl/evp.h

Converted from SourceForge issue 892961, submitted by vda

On my system configure says

checking for openssl/evp.h... no

but

ls -l /usr/include/openssl/evp.h

-rw-r--r-- 1 root root 27263 Dec 25 2002
/usr/include/openssl/evp.h

Details from config.log:

configure:4937: checking for openssl/evp.h
configure:4947: gcc -E -I$(srcdir)/missing -I$(srcdir)
-I$(srcdir)/missing -I/usr/include conftest.c

/dev/null 2>conftest.out
cpp0: warning: changing search order for system
directory "/usr/include"
cpp0: warning: as it has already been specified as a
non-system directory
configure: failed program was:

line 4942 "configure"

include "confdefs.h"

include <openssl/evp.h>

print-nfs.c bug

Converted from SourceForge issue 761652, submitted by wtloren

There are bugs in print-nfs.c that were fixed in cvs
version 1.96 (see below) but are still present in the
latest release version, tcpdump-3.7.2

1.96 Mon Aug 26 9:36:20 2002 by guy
Diffs to 1.95

Fixes for:

parsefattr misuses nfsv2 version members for v3.
print_int64 prints at least 9 digits unnecessarily.
-u flag doesn't always suppress decoding handles.

from Takashi Yamamoto <[email protected]>.

Loren Brookes

DOS of tcpdump with malformed l2tp packet

Converted from SourceForge issue 864404, submitted by procana

The initial report was submitted by Przemyslaw Frasunek
regarding a crash of tcpdump on OpenBSD with a
malformed l2tp packet. However, I have found version
3.7.2 on other oses to be vulnerable to a similar
malformed l2tp packet.

In print-l2tp.c the function l2tp_avp_print does not
properly check the length and len values before calling
itself and passing bad data. The result is that
tcpdump enters an infinite loop.

Test:
perl -e 'print "\x80\x02\x00\x00\x00\x00\x00"' | nc -u
10.1.1.1 1701

I believe Otto Moerbeek has a patch for this issue on
OpenBSD.

Thanks,
Mike

compiling error on gcc -m64 flag

Converted from SourceForge issue 573005, submitted by nobody

I am running Solaris 9 with gcc version 3.1
at the Makfile change CCOPT to -O2 -m64.
If I delete the -m64 option, I could compile tcpdump
successfully.

the following error occurs:
print-esp.c: In function `esp_print_decodesecret':
print-esp.c:164: warning: cast to pointer from integer of
different size

....

gcc -O2 -m64 -DHAVE_CONFIG_H -I. -I../libpcap-0.7.1 -
I./missing -o tcpdump addrtoname.o gmt2local.o
machdep.o parsenfsfh.o print-802_11.o print-ah.o print-
arcnet.o print-arp.o print-ascii.o print-atalk.o print-atm.o
print-bgp.o print-bootp.o print-beep.o print-cdp.o print-
chdlc.o print-cip.o print-cnfp.o print-decnet.o print-
domain.o print-dvmrp.o print-egp.o print-esp.o print-ether.o
print-fddi.o print-gre.o print-hsrp.o print-icmp.o print-igmp.o
print-igrp.o print-ip.o print-ipcomp.o print-ipx.o print-
isakmp.o print-isoclns.o print-krb.o print-l2tp.o print-lane.o
print-lcp.o print-llc.o print-lwres.o print-msdp.o print-
mobile.o print-mpls.o print-nfs.o print-ntp.o print-null.o print-
ospf.o print-pim.o print-ppp.o print-pppoe.o print-pptp.o
print-radius.o print-raw.o print-rip.o print-rx.o print-sctp.o
print-sl.o print-sll.o print-snmp.o print-stp.o print-sunrpc.o
print-tcp.o print-telnet.o print-tftp.o print-timed.o print-
token.o print-udp.o print-vjc.o print-vrrp.o print-wb.o print-
zephyr.o setsignal.o tcpdump.o util.o version.o print-smb.o
smbutil.o ../libpcap-0.7.1/libpcap.a -lsocket -lnsl
ld: warning: file ../libpcap-0.7.1/libpcap.a(pcap-dlpi.o):
wrong ELF class: ELFCLASS32
Undefined first referenced
symbol in file
pcap_file tcpdump.o
pcap_geterr tcpdump.o
pcap_datalink tcpdump.o
pcap_open_offline tcpdump.o
pcap_dump tcpdump.o
pcap_dump_open tcpdump.o
pcap_stats tcpdump.o
pcap_version tcpdump.o
pcap_loop tcpdump.o
bpf_dump tcpdump.o
pcap_compile tcpdump.o
pcap_strerror util.o
pcap_lookupdev tcpdump.o
pcap_setfilter tcpdump.o
eproto_db addrtoname.o
pcap_next_etherent addrtoname.o
pcap_lookupnet tcpdump.o
pcap_close tcpdump.o
pcap_open_live tcpdump.o
pcap_snapshot tcpdump.o
pcap_dump_close tcpdump.o
ld: fatal: Symbol referencing errors. No output written to
tcpdump
collect2: ld returned 1 exit status

Buffer overflow in tcpdump

Converted from SourceForge issue 586643, submitted by nobody

Buffer overflow in tcpdump when handling NFS packets

A buffer overflow was reported by FreeBSD:
ftp://ftp.freebsd.org/pub/FreeBSD/CERT/advisories/FreeBSD-SA-02%3A29.tcpdump.asc

printing RADIUS service type 0 fails

Converted from SourceForge issue 576536, submitted by nobody

A null pointer is passed to printf when radius service
table is looked up but the first valid entry is not the
first one. possible solution:

print-radius.c:
525c525,526

< attr_type[attr_code].first_subtype) )

> attr_type[attr_code].first_subtype) &&
> data_value >=
attr_type[attr_code].first_subtype )

compiling error on gcc -m64 flag

Converted from SourceForge issue 573025, submitted by nobody

I am running Solaris 9 with gcc version 3.1
at the Makfile change CCOPT to -O2 -m64.
If I delete the -m64 option, I could compile tcpdump
successfully.

the following error occurs:
print-esp.c: In function `esp_print_decodesecret':
print-esp.c:164: warning: cast to pointer from integer of
different size

....

gcc -O2 -m64 -DHAVE_CONFIG_H -I. -I../libpcap-0.7.1 -
I./missing -o tcpdump addrtoname.o gmt2local.o
machdep.o parsenfsfh.o print-802_11.o print-ah.o print-
arcnet.o print-arp.o print-ascii.o print-atalk.o print-atm.o
print-bgp.o print-bootp.o print-beep.o print-cdp.o print-
chdlc.o print-cip.o print-cnfp.o print-decnet.o print-
domain.o print-dvmrp.o print-egp.o print-esp.o print-ether.o
print-fddi.o print-gre.o print-hsrp.o print-icmp.o print-igmp.o
print-igrp.o print-ip.o print-ipcomp.o print-ipx.o print-
isakmp.o print-isoclns.o print-krb.o print-l2tp.o print-lane.o
print-lcp.o print-llc.o print-lwres.o print-msdp.o print-
mobile.o print-mpls.o print-nfs.o print-ntp.o print-null.o print-
ospf.o print-pim.o print-ppp.o print-pppoe.o print-pptp.o
print-radius.o print-raw.o print-rip.o print-rx.o print-sctp.o
print-sl.o print-sll.o print-snmp.o print-stp.o print-sunrpc.o
print-tcp.o print-telnet.o print-tftp.o print-timed.o print-
token.o print-udp.o print-vjc.o print-vrrp.o print-wb.o print-
zephyr.o setsignal.o tcpdump.o util.o version.o print-smb.o
smbutil.o ../libpcap-0.7.1/libpcap.a -lsocket -lnsl
ld: warning: file ../libpcap-0.7.1/libpcap.a(pcap-dlpi.o):
wrong ELF class: ELFCLASS32
Undefined first referenced
symbol in file
pcap_file tcpdump.o
pcap_geterr tcpdump.o
pcap_datalink tcpdump.o
pcap_open_offline tcpdump.o
pcap_dump tcpdump.o
pcap_dump_open tcpdump.o
pcap_stats tcpdump.o
pcap_version tcpdump.o
pcap_loop tcpdump.o
bpf_dump tcpdump.o
pcap_compile tcpdump.o
pcap_strerror util.o
pcap_lookupdev tcpdump.o
pcap_setfilter tcpdump.o
eproto_db addrtoname.o
pcap_next_etherent addrtoname.o
pcap_lookupnet tcpdump.o
pcap_close tcpdump.o
pcap_open_live tcpdump.o
pcap_snapshot tcpdump.o
pcap_dump_close tcpdump.o
ld: fatal: Symbol referencing errors. No output written to
tcpdump
collect2: ld returned 1 exit status

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.