Commit Graph

211 Commits

Author SHA1 Message Date
Wesley Shields
3b223f2c73 Merge branch 'master' of https://github.com/mcr/tcpdump
Conflicts:
	tcpdump.c
2012-10-01 13:10:39 -04:00
Guy Harris
fc058afcda More strictly check for numbers as arguments to -i.
Use strtol() and only treat the argument as a number if it's *all*
number, so that interface names such as 192_1_2 aren't treated as
"interface number 192".
2012-09-27 21:12:00 -07:00
Guy Harris
e26b937957 Use PATH_MAX, not NAME_MAX.
NAME_MAX is the maximum length of a file pathname *component*; PATH_MAX
is the maximum length of a file pathname.  We're dealing with pathnames,
so use PATH_MAX.  (On some systems, NAME_MAX can be as low as 14,
presumably for binary compatibility with V7-era data structures
containing file names, as there are probably few if any non-historic
UN*Xes around with 14-character file name limitations.)

Boost the default PATH_MAX to 1024 while we're at it.
2012-09-27 20:44:34 -07:00
Denis Ovsienko
81bdbfeeeb add missing double quote to fix compiling 2012-09-10 21:29:20 +04:00
Wesley Shields
1afd3f308e Merge remote-tracking branch 'upstream/master' 2012-09-10 13:05:53 -04:00
Wesley Shields
4c2790a432 Address Michael's comments.
Be more portable when opening stdin.

Refactor reading from VFile into a function.
2012-09-06 14:40:21 -04:00
Bill Parker
ffa97fff7a Indention should match now
The indentation should match on this file now
2012-09-04 11:15:29 -07:00
Bill Parker
b6fe3099e2 Sanity Checking for malloc
Added sanity checking for return value to filename being equal to NULL
2012-09-04 10:04:17 -07:00
Wesley Shields
1efaa59e47 Properly print when dlt changes.
When we open a new file we need to get new printinfo.
2012-08-11 14:34:24 -04:00
Wesley Shields
5d289dbe89 DLT change detection.
If when writing an output file, error if the DLT of subsequent files is not
the same as the original.
2012-08-11 14:19:31 -04:00
Wesley Shields
3566552dfe Add multi-file support. 2012-08-10 21:43:54 -04:00
Guy Harris
42ab2e753f Add "radius" as an option for -T.
This allows tcpdump to handle RADIUS running on non-standard ports.

Submitted-By: ssb@sourceforge.net

Man page also updated by me.
2012-06-30 15:59:18 -07:00
Michal Sekletar
19bb00ab47 Dropping root priviledges using Linux Capabilities 2012-05-25 16:26:17 +02:00
Guy Harris
2886b89df6 Back out DLT_PFSYNC support.
Unfortunately, the DLT_PFSYNC support depends on header files included
from the pfctl command's source tree, and trying to arrange to find that
would be too much trouble.
2012-02-29 21:14:50 -08:00
Guy Harris
0d2d222ffb Add DLT_PFSYNC support.
From FreeBSD PR bin/124825: tcpdump(8) does not support pfsync(4) data,
which in turn was ported over from OpenBSD.  We already have CARP
support, so we did not port that part over.
2012-02-29 01:51:27 -08:00
Kenichi Maehashi
4442071079 tcpdump now accepts SIGUSR1 as a signal to print the statistics on systems that does not support SIGINFO 2012-02-07 22:16:19 +09:00
George Neville-Neil
5d52dbf4c7 Add a CARP dissector and a command-line option to dissect proto 112 as CARP.
CARP and VRRP both use IP protocol number 112, so there needs to be a -T
flag to specify that protocol 112 be dissected as CARP rather than VRRP.

Also update the man page.
2011-11-23 11:53:13 -08:00
Guy Harris
e40ffdfca7 Change name of Hilscher link types to say NETANALYER.
That makes the names a bit shorter, and mentions the specific Hilscher
product to which they apply.
2011-09-15 17:39:56 -07:00
Guy Harris
9c7d7c8a5c Add printers for the Hilscher Ethernet link-layer types. 2011-09-15 12:56:17 -07:00
Guy Harris
2c0a8eb4eb Note that ndo_error doesn't, and *ndo_error shouldn't, return.
Tcpdump's ndo_error() doesn't return.  Any other ndo_error routine
supplied to netdissect shouldn't, either, as printers expect it not to.
2011-06-24 18:24:11 -07:00
Guy Harris
4cc892cbff Use "-H", not "-h", for the 802.11s option, and improve error reporting.
I was rudely surprised to find that "tcpdump -h" wasn't printing a usage
message, and I'm the person who *added* the "-h" option.  Make it "-H",
and add an explicit "-h" option to print a usage message, so nobody else
makes the same mistake.  Also, don't clear opterr, so that if you give
an illegal command-line option, you get an explanatory error message.
2011-06-21 18:15:50 -07:00
Michael Richardson
5b0329a9e7 From: Darren Reed <darren.reed@oracle.com>
To: tcpdump-workers@lists.tcpdump.org
Date: Sat, 09 Apr 2011 12:51:14 +1000
Subject: [tcpdump-workers] Printing PPI packets

Printing PPI packets with tcpdump does not turn out
to be that hard.

My simple tests have produced the output as below.

It would be worthwhile having some changes made into
the tcpdump code base that were similar to the attached
that print them out.
2011-05-03 18:58:32 -04:00
Guy Harris
91942a9cb6 Fix plurals in packet count messages.
Based on a patch from cr4ckn@sourceforge.net, but with a macro
PLURAL_SUFFIX() defined to return either "s" or "" (rather than possibly
printing a NUL character with %c), and with that macro used in a couple
of cases where the equivalent had been done by hand, and with one case
the patch missed fixed as well.
2011-03-08 09:11:25 -08:00
Guy Harris
d8252d0c05 Add support for nommu systems.
Rather than hardcode the WIN32 define, add proper fork checks to the
configure script and check those.  This fixes building for nommu systems
which lack the fork function.

While we're here though, add support for this functionality via vfork
so that it does work on nommu systems.  And fix an old bug where we
exit properly in the forked child when the exec failed instead of just
returning to the calling code (which isn't expecting it).

Reviewed-By: Guy Harris <guy@alum.mit.edu>
2010-11-30 16:18:32 -08:00
Paul Ferrell
d2c7d4e92b Switch user ID/root directory with -Z before opening savefiles for output.
In addition to Paul's change, I added a comment explaining why we do
this, and explaining that doing so after opening the first savefile
doesn't help with subsequent savefiles, so you'll have to come up with a
better fix if you want the savefiles opened by the original UID or
outside the chroot.

Reviewed-By: Guy Harris <guy@alum.mit.edu>
2010-11-06 19:28:10 -07:00
Michael Richardson
1cead823ec reworked print-ether to use netdissect 2010-10-07 14:40:50 -04:00
Guy Harris
ce0f1d2e8e Document -j and -J. List -h in the usage message. 2010-08-23 15:30:56 -07:00
Guy Harris
53e8e5567d Handle DLT_IEEE802_15_4_NOFCS like DLT_IEEE802_15_4. 2010-08-22 18:00:27 -07:00
Guy Harris
14fff3bc4e Print a -L-like header for -J. 2010-08-22 17:59:00 -07:00
Guy Harris
a20a6126fc Add support for setting the time stamp type for a capture.
Based on a patch from Scott Mcmillan <scott.a.mcmillan@intel.com>.

While we're at it, make some error messages a bit less geeky.
2010-08-22 17:32:26 -07:00
Romain Francoise
768c379e64 If -U is specified, flush the file after creating it, so it's not zero-length.
Reading from a capture file that has not yet received any packets fails
with "truncated dump file"; to avoid this, flush the file (forcing the
pcap header out) immediately after opening it.

(Added Romain to the credits.)

Reviewed-By: Guy Harris <guy@alum.mit.edu>
2010-06-05 00:37:27 -07:00
Guy Harris
fe209f3b17 Add a -h flag, and only attempt to recognize 802.11s mesh headers if it's set.
I give up.  I have no access to the 802.11s drafts, I can't find
anything that suggests whether a heuristic check for an 802.11s header
should check for To DS and From DS both being set or either being set or
unset, or whether it should check for a QoS frame type (the examples in
all the documentation I can find have To DS and From DS set, and have a
QoS field, in the 802.11 header, but that might just be an example
802.11 header showing all the fields), so I'm just adding a -h
command-line flag; you need to specify it to get tcpdump to try to guess
whether a frame has a mesh header or not.  I'll leave it up to somebody
else to figure out what the best heuristic for detecting the presence of
mesh headers is (note that tcpdump and Wireshark have different
heuristics, both of which can probably get false positives, especially
with encrypted frames where the first payload byte just *happens* not to
have any of the reserved bits in the mesh header flags set).
2010-05-27 23:58:01 -07:00
Michael Richardson
04347dbebf Merge branch 'master' of git+ssh://bpf.tcpdump.org/tcpdump/master/git/tcpdump 2010-05-13 14:31:05 -04:00
Michael Richardson
1ace87d57b moved ieee802.15.4 to NDO system 2010-05-13 14:30:59 -04:00
Guy Harris
ab0166f9be When printing the link-layer type list, send *all* output to stderr. 2010-05-07 01:11:45 -07:00
Dmitry Eremin-Solenikov
721345da68 tcpdump.c: fix merge error: ieee802_15_4_if_print isn't a new style printer
Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
2010-03-09 18:13:48 +03:00
Dmitry Eremin-Solenikov
ec799d60f6 Merge remote branch 'origin/master' 2010-03-09 17:36:58 +03:00
Kovarththanan Rajaratnam
bc60860d5e tcpdump.c: mark several variables as static 2010-02-20 09:02:30 +01:00
Guy Harris
d50d7fd82e Recognize -b as a flag. 2010-02-08 02:33:12 -08:00
Guy Harris
06d0d52170 Mention the b flag in the usage message. 2010-02-08 02:24:10 -08:00
Guy Harris
071cdba2b3 Handle the 48-byte and 64-byte Linux USB headers differently; for now,
the difference isn't major, but it might be more important later.
2010-01-25 15:25:33 -08:00
Guy Harris
e00f13631d raw_if_print() isn't yet a new-style print routine. 2010-01-10 13:34:22 -08:00
Michael Richardson
b45fabd132 This commit makes ipnet_if_print the first NDO aware top-level
printer.
Merge commit 'origin/master'

Conflicts:
	netdissect.h
2010-01-10 14:36:07 -05:00
Michael Richardson
accfcf9a24 make new list of printers that take ndo argument, and use it as appropriate 2010-01-10 14:27:33 -05:00
Guy Harris
e9eff7f57e Add support for DLT_IPV4 and DLT_IPV6.
While we're at it, clean up some whitespace.
2010-01-04 12:11:04 -08:00
Guy Harris
576af3ab43 When printing a list of link-layer types for -L, give the name of the
device for which they're being reported, so if no -i flag was given
people don't think it's something such as the union of of all link-layer
types supported by all devices, and, if we can determine whether the
device supports monitor mode (with libpcap 1.0.0 and later), indicate
whether the link-layer types are the ones supported when not in monitor
mode (if -I wasn't specified) or when in monitor mode (if -I was
specified), so people don't wonder why some types aren't available (as
some are available only in monitor mode, and others are available only
when not in monitor mode, on some platforms).
2009-12-01 00:39:54 -08:00
Darren Reed
b116cd9ac4 The patches attached to this email are required to get a fully working tcpdump
on OpenSolaris, or Solaris Express Community Edition, build 125 and later.

The attached patch introduces support for printing out the IPNET headers used
for packet capture inside of zones that share their networking with the global
zone and for packets "transmitted" between zones.

tcpdump 4.0.0 will ship with builds 129 and later of OpenSolaris/SXCE and
when run as root with the '-L' option, should behave as below to indicate that
the system is fully functional:

Data link types (use option -y to set):
 DOCSIS (DOCSIS) (printing not supported)
 IPNET (Solaris IPNET)
 EN10MB (Ethernet)

Cheers,
Darren
2009-11-24 21:20:25 -05:00
Guy Harris
eb0f011bb7 Report ps_ifdrop if it's non-zero. 2009-09-07 16:52:15 -07:00
Dmitry Eremin-Solenikov
2158a39074 Add support for IEEE 802.15.4 packets
Add a dummy printer for ieee 802.15.4 pakets.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
2009-08-09 18:06:27 +04:00
Guy Harris
a82daa17d6 From Karl Norby: print the unsigned packet statistics with %u, not %d. 2009-07-31 18:08:12 -07:00