Commit Graph

31 Commits

Author SHA1 Message Date
guy
dd928cfb35 Have print_llc() clear out the extracted_ethertype argument, rather than
having its callers do so - some of its callers *weren't* doing so,
leaving random junk in that argument in some cases.

When checking for "802.3-encapsulated" IPX, check the raw values of the
SSAP and DSAP for 0xFF, don't check them after the low-order bit has
been masked off.

The "flag" values in the LLC header aren't bits, they're combinations of
bits, including the combination "no bits"; don't use "bittok2str()" on
them.  Also, combine the proper bits, namely the C/R bit (which we
weren't combining) and the P/F bit (which we were).
2005-11-13 12:12:41 +00:00
guy
d953299b94 Add a flag to suppress the "default_print()" call made in various
link-layer print routines if no other print routine claimed the packet.
Test whether that flag is set rather than testing whether neither of -x
or -q were specified, and have -x, -q, *and* -X set that flag, so that
-X suppresses it just as -x does.  That way you don't get those pckets
dumped twice if -X was specified.
2005-07-07 01:22:15 +00:00
guy
fb1b6d808f Fix up a bunch of comments - the on-the-wire length field in a
pcap_pkthdr is "len", not "length".
2004-03-17 23:24:35 +00:00
guy
bbc1cfa669 Have the configure script arrange that the Makefile define _U_
appropriately, and that GNUmakefile and the MSVC++ project file define
it apppriately, as we do with libpcap, rather than defining it in
"interface.h".

Undo the rcsid-shuffling and addition of extra #includes, as we no
longer need to arrange that "interface.h" be included before using _U_
in an RCS ID or copyright.
2003-11-16 09:36:07 +00:00
guy
3824a6c041 From Neil Spring:
use "_U_" in the definitions of "rcsid[]", to eliminate
	complaints about those variables being unused;

	move the definitions after the include of "interface.h", or add
	an include of "interface.h", so that "_U_" is defined.

Include "config.h" before including "tcpdump-stdinc.h" in
"missing/datalinks.c".
2003-11-15 00:39:12 +00:00
guy
4bec97f457 Hoist a bunch of stuff that should be done by all if_print routines into
tcpdump.c.  Have if_print routines return the length of the link-layer
header, so that the common code knows how to skip the link-layer header
when printing the packet in hex/ASCII.
2002-12-19 09:39:10 +00:00
guy
cfabfb053b Add a new routine "default_print_packet()", which takes a pointer to the
beginning of the raw packet data, the captured length of the raw packet
data, and the length of the link-layer header, and:

	if "-e" was specified, prints all the raw packet data;

	if "-e" was not specified, prints all the raw packet data past
	the link-layer header, if there is any.

Use that routine in all the "xxx_if_print()" routines if "-x" was
specified.

Make "arcnet_encap_print()" static - it's not used outside
"print-arcnet.c".

Add missing info printing code to "atm_if_print()".

Print the packet data in "lane_if_print()", not in "lane_print()", as
"lane_print()" can be called from other "xxx_if_print()" routines, and
those routines will also print the packet data if "-x" was specified -
no need to print it twice.
2002-12-18 09:41:13 +00:00
guy
e070cf232f We no longer use "packetp" for anything, so eliminate it. (If any
dissector really needs source and destination MAC addresses, we should
make global pointers to them - which would be null for packets lacking
MAC addresses, so dissectors that need them will need to do something
sensible if those pointers are null.)

Don't fake up an Ethernet header if there aren't any MAC addresses to
use when faking it up.

"bp_chaddr" in "print-bootp.c" is an array, so "bp->bp_chaddr" cannot be
null, and there's no need to test for it not being null.
2002-12-18 08:53:18 +00:00
guy
c422d3ab0f Get rid of the "-Wno-unused" flag, and fix up most of the
unused-parameter problems reported by GCC.  Add an _U_ tag to label
parameters as unused if the function is called through a pointer (so
that you can't change its signature by removing parameters) or if there
are unused parameters only because the function isn't complete.

Add some additional bounds checks the necessity for which was revealed
while cleaning up unused-parameter problems.

Make some routines static.

"lcp_print()", defined in "print-lcp.c", isn't called anywhere -
"print-ppp.c" has the code to dissect LCP.  Get rid of "print-lcp.c".
2002-09-05 21:25:34 +00:00
risso
3d932490b8 Added support for Win32, based on WinPcap. 2002-08-01 08:52:55 +00:00
guy
4c6bada758 Get rid of unneeded incomplete definitions of "struct mbuf" and "struct
rtentry", and unneded includes of <sys/uio.h>, <sys/file.h>, and
<sys/ioctl.h>.
2002-06-01 23:50:30 +00:00
guy
06181bc3ee Only do "-x" printing in the top-level interface print routine; don't do
it in the routines, called by the top-level routines, to dissect
Ethernet, FDDI, or Token Ring packets, as those routines might also be
called for bridged frames over ATM, and the interface print routine for
ATM will also do "-x" printing.
2002-05-29 10:06:24 +00:00
guy
a57421867f Support RFC 2684 bridging of Ethernet, 802.5 Token Ring, and FDDI, and
RFC 2684 encapsulation of BPDUs.
2002-04-07 09:50:30 +00:00
fenner
2a09054272 Linux does not bit-swap FDDI MAC addresses.
Submitted by:	"Maciej W. Rozycki" <macro@ds2.pg.gda.pl>
2001-11-14 16:46:34 +00:00
fenner
c78c961221 const-ify print-fddi and print-token, inspired by
Motonori Shindo <mshindo@mshindo.net>
2001-09-18 15:46:36 +00:00
fenner
2cfe2bf4a5 Add SIGINFO handler from LBL
The rest of the low-level print-*.c handlers need the infodelay
 wrapping too.
2001-07-04 22:03:13 +00:00
guy
8d35bf0e1c Fix some comments to reflect current reality. 2000-12-23 20:48:13 +00:00
guy
737c58073a Put the LINUX_SLL_P_ definitions back, and check for at least some of
them in "print-sll.c" - as a cooked-mode capture may be reading from
non-Ethernet, non-802.x devices, it may well see some
ETH_P_/LINUX_SLL_P_ types that don't mean "this is an 802.2 LLC frame".

We currently assume that the ETH_P_ values won't change in the kernel,
so we don't have to explicitly map them.

In various link-layer packet printers, if we don't handle the next layer
up of packet type, and are printing the link-layer header, use the
correct pointer to that header (i.e., if we've stepped "p" past the
link-layer header, don't use "p", use a pointer to the beginning of the
packet), and use the correct length (i.e., if we've subtracted the
length of the link-layer header, add it back in, so that we always print
the full packet length).
2000-12-22 22:45:09 +00:00
guy
7c4458eb6a Making "extracted_ethertype" static to "print-ether.c" broke other
dissectors that expected calls to "llc_print()" to set it.  (Thanks and
a tip of the hat to Olaf Kirch <okir@caldera.de> for noticing this.)

Make "ether_encap_print()" and "llc_print()" take a pointer to an
extracted-Ethertype variable as an argument, have "llc_print()" pass it
to "ether_encap_print()", and have "ether_encap_print()" set what it
points to rather than setting a static "extracted_ethertype" variable.

Get rid of said static "extracted_ethertype" variable in favor of one
local to "ether_if_print()", just as other link-layer dissectors have
local "extracted_ethertype" variables.
2000-12-18 05:41:58 +00:00
guy
d16cf6488c Some compilers may pad structures to a length that's a multiple of 2 or
4 bytes, even though no member in the structure requires such an
alignment; don't use "sizeof (struct ether_header)" or "sizeof (struct
fddi_header)", explicitly #define the header length and use that
#defined value.
2000-10-09 02:59:39 +00:00
guy
e11ed169b1 Get rid of some includes of <net/route.h>, and empty declarations of
"struct mbuf" and "struct rtentry" - they shouldn't be necessary (and
weren't on the platforms on which I tested, both with GCC and the native
compiler if it isn't GCC).
2000-10-06 04:23:10 +00:00
guy
cf53dc05f1 Get rid of includes of <netinet/in_systm.h>, and replace "n_short",
"n_long", and "n_time", defined in that file, with other types.
2000-09-29 04:58:33 +00:00
guy
8b67f77134 Get rid of unneeded includes of <net/if.h>. 2000-09-28 06:42:55 +00:00
guy
536f512583 Add an "ip.h" header, to declare the IP stuff needed by dissectors, and
have dissectors include them rather than <netinet/ip.h> or
<netinet/ip_var.h>, if they actually need that stuff.

Put the declarations of the ICMP stuff directly into "print-icmp.c".

Remove all unnecessary includes of <netinet/ip*.h> files.

Copy the byte-order stuff from "nameser.h" into "tcp.h".
2000-09-23 08:54:24 +00:00
guy
e894092542 Add definitions of Ethernet types from
"linux-includes/netinet/if_ether.h" to "ethertype.h".

Move other stuff used by dissectors from <netinet/if_ether.h> to
"ether.h", along the lines of "fddi.h" and "token.h".

Move ARP declarations from BSD include files to "print-arp.c".

Remove from dissectors includes of <netinet/if_ether.h>, and add
includes of "ethertype.h" and/or "ether.h" as necessary.

Get rid of configuration options that test declarations now made in
"ether.h" or "print-arp.c", as those declarations are now under our
control, not the OS's control.
2000-09-23 08:03:27 +00:00
assar
3cd171317f remove non-STDC code 2000-07-01 03:38:59 +00:00
fenner
7e6bad5cf5 Get rid of HAVE_FDDI cruft; FDDI is always included so the ifdef is extra. 1999-12-14 16:49:02 +00:00
fenner
b9ac23ce92 Switch to config.h instead of passing defines in DEFS. 1999-11-21 09:36:43 +00:00
assar
059030fee8 (fddi_bitswap): apparently NetBSD doesn't bitswap either. From
NetBSD's print-fddi.c:1.5 by matt@netbsd.org
1999-11-21 06:04:00 +00:00
assar
6801d8717b (fddi_if_print): make `extracted_ethertype' a local variable 1999-11-21 03:45:35 +00:00
mcr
f555c163f9 Initial revision 1999-10-07 23:47:09 +00:00