Commit Graph

122 Commits

Author SHA1 Message Date
Guy Harris
9c7d7c8a5c Add printers for the Hilscher Ethernet link-layer types. 2011-09-15 12:56:17 -07:00
Guy Harris
a91d20cc84 Convert the IPv6 printer to use netdissect. 2010-11-07 12:50:16 -08:00
Guy Harris
af1f106abf Use ND_PRINT(). 2010-11-06 19:52:48 -07:00
Michael Richardson
28b293f330 added support and test case for QinQ packets 2010-10-07 14:47:22 -04:00
Michael Richardson
1cead823ec reworked print-ether to use netdissect 2010-10-07 14:40:50 -04:00
Guy Harris
ea5736c8c6 Process VLAN frames and Alteon jumbo frames in the Ethernet printer.
Instead of having the Ethernet-type handler process the VLAN and Alteon
jumbo frame Ethernet type values, process them in the Ethernet (and
Linux cooked-mode) dissectors.  This makes it easier for the right MAC
addresses to be printed for those packets.

As part of that, rename ether_encap_print() to ethertype_print() - it
doesn't print encapsulated Ethernet frames, it prints payloads whose
packet type is indicated by an Ethernet type field value - and remove
the no-longer-needed "extracted Ethernet type" argument.  That also lets
us eliminate it from the SNAP print routine.

Make ether_print() take a function, and an argument to pass to that
function, as parameters, so that, for example, the ATM LANE printer can
use it and put the LEC ID into the link-layer headeer printout.
2010-02-21 12:44:53 -08:00
Guy Harris
e8b5237589 Don't directly fetch multi-byte integers from packets.
Use the EXTRACT_ macros to extract multi-byte integral values from
packets, rather than just dereferencing pointers into the packet; there
is no guarantee that the packet data will be aligned on the right
boundary, and there is no guarantee that, if they're not, a direct
access will work correctly.
2010-02-21 00:27:00 -08:00
Guy Harris
f1ca3d4287 From FreeBSD: handle the non-standard Ethertypes for PPPoE that some
3Com hardware uses.
2009-07-25 10:47:00 -07:00
Guy Harris
9248d0c2fa From William J. Hulley: support for the Transparent Ethernet Bridge
ethertype in GRE.
2009-02-26 01:04:20 -08:00
guy
1789f57c36 From Andrew Silent: Realtek Remote Control Protocol support (see
OpenRRCP.org.ru for details).
2008-02-06 10:47:53 +00:00
hannes
bbb4050969 add basic support for the IEEE Link Discovery Protocol as per 802.1ab 2007-08-03 11:03:19 +00:00
hannes
9d84f80c5f change 802.1ag pre-standard codepoint to standard codepoint 2007-07-23 09:01:09 +00:00
hannes
1226a40cb0 add skeleton support for 802.1ag CFM 2006-10-12 10:26:12 +00:00
hannes
49d423e23f hexdump only - if (unrecognized llc proto) && encapsulation == (jumbo || vlan) 2006-02-20 18:13:55 +00:00
hannes
0860434f38 add basic support for MPCP 802.3ah frame printer 2006-02-10 04:52:25 +00:00
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
hannes
c56e09a204 add support for the IEEE slow protocols LACP, MARKER as per 802.3ad 2005-07-10 14:41:34 +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
hannes
0bdc0cafb7 do not auto-hexdump loopback packets as the payload is uninteresting 2005-07-01 16:15:59 +00:00
guy
a43b7b109e Have separate "struct tok" PID-to-name tables for different OUIs; don't 2005-04-25 17:56:43 +00:00
mcr
4189fb7df6 refactored ip_print() so that chained header parser (ESP/AH) can
more easily call the inner parts.
2005-04-06 21:32:38 +00:00
hannes
36ff8749d3 -resolve (print the name) the OUI field in the SNAP printer
-add the rfc 2684 PIDs as pseudo ethertypes
-display cosmetics:
 place a ":" after the LLC printer to indicate that
 a new proto layer starts
2005-01-25 16:22:56 +00:00
hannes
3b8786edf4 - hack the ethertype_values[] table to accomodate GRE flavours
- call the IP6, IPX, ATALK, MPLS dissectors within the GRE dissector
- be more verbose about the GRE proto-id (hidden under the eflag)
2004-06-12 16:32:56 +00:00
mcr
fc80a87e4c NDO-ized print-arp.c 2004-04-30 16:42:14 +00:00
mcr
5e33dbfb02 removed explicit snapend definition. 2004-04-05 00:13:59 +00:00
mcr
d2669e52ae update changes file 2004-03-30 14:42:38 +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
hannes
3a919068a9 add support for Jumbo Ethertype 0x8870 and embedded OSI traffic 2004-02-18 14:23:27 +00:00
hannes
69b12b33d4 print ethertypes in hex and fix qflag handling for unknown ethertypes 2003-12-29 19:05:37 +00:00
hannes
b02277b72c backout last commit and make the loopback decoder simply return a 0 2003-12-29 09:29:29 +00:00
hannes
b0ef8a3398 - handle the case where we know the ethertype but do not have a printer for it
the loopback protocol is a good example:
    the patch prints at least the ethertype plus the length
    rather than a empty line
2003-12-29 09:19:38 +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
6f93affaeb Define "ethertype_values[]" in "print-ether.c", make it not static, and
have "ethertype.h" just declare it, so that

	1) we only have one such table, shared by all dissectors that
	   use it

and

	2) GCC 3.3 doesn't complain that it's defined but not used in
	   those dissectors that incldue "ethertype.h" but don't use
	   "ethertype_values[]".
2003-07-01 19:10:26 +00:00
hannes
7c7089d732 hide the 802.1Q header if eflag, print ethertype during 802.1Q stack recursion if eflag, misc. cleanups 2003-05-28 12:56:52 +00:00
hannes
2668ed2807 forgot message log on last commit, sorry :-(
here we are:
- suppress printing the ethertype when encaps is 802.2
2003-05-22 14:31:36 +00:00
hannes
84092be49e *** empty log message *** 2003-05-22 14:24:31 +00:00
hannes
381b94ccaf fix typo from previous commit 2003-05-08 14:40:54 +00:00
hannes
5f14fcebd2 align eflag printing style with ppp printer 2003-05-08 14:39:05 +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
hannes
54e26228a1 "support" for the loopback ethertype 0x9000 2002-07-12 20:22:11 +00:00
itojun
111ff8a61d whitespace cleanup 2002-06-11 17:08:37 +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
guy
13ccad293f From Heinz-Ado Arnolds <Ado.Arnolds@dhm-systems.de>: mark IPX packets
according to whether they're Ethernet II, 802.3, or 802.2.
2001-11-25 02:01:47 +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
itojun
544c52e1ef MPLS label encapsulation decoding, per RFC3032.
TODO: multiple labels.  other media types.
2001-06-21 17:56:02 +00:00
guy
9298dc84c8 Assorted PPTP and GRE enhancements from Motonori Shindo
<mshindo@mshindo.net>.
2001-03-12 00:24:54 +00:00
fenner
cbb769e118 Handle (GRE-encapsulated) PPTP 2001-02-04 02:19:23 +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
988eb73c0a Improved VLAN support, from Peter Jeremy - "vlan" filtering keyword,
letting you filter based on the VLAN to which a packet belongs, and an
improvement to the printing of VLAN packets (adding an extra space to
separate the VLAN priority and flags from the next stuff printed).
2000-10-22 04:17:52 +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
itojun
e7eb00b756 no need to include ip6.h 2000-10-07 05:46:21 +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
7b50febe28 Add "tcp.h" and "udp.h" headers, to declare the TCP and UDP stuff needed
by dissectors, and have dissectors include them rather than
<netinet/udp.h>, <netinet/udp_var.h>, or <netinet/tcp.h>, if they
actually need that stuff.

Remove all unnecessary includes of <netinet/udp*.h> or <netinet/tcp*.h>
files.
2000-09-23 08:26:30 +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
assar
15677fd749 (ether_encap_print): add ETHERTYPE_IPX: From Jeffrey Hutzelman
<jhutz@cmu.edu>
2000-06-10 13:49:52 +00:00
itojun
3cf5ed30ce some style. u_int16_t. 2000-04-28 11:38:38 +00:00
fenner
b9ac23ce92 Switch to config.h instead of passing defines in DEFS. 1999-11-21 09:36:43 +00:00
assar
664d914056 made extracted_ethertype static. Added 802.1Q (vlan) and PPPoE. From
kuznet@ms2.inr.ac.ru
1999-11-21 03:53:34 +00:00
itojun
c9d84d15c5 Bring in KAME IPv6 tcpdump. replaces esp/ah/isakmp decoder.
Hope I did not break anything.  Portability on IPv4-only node needs checking,
I'll do this very soon.  (sorry for rather jumbo commit)

XXx what is _FAVOR_BSD?
1999-10-30 05:11:06 +00:00
mcr
f6fa6a40d4 patches to help build on Linux 2.2 1999-10-17 21:37:10 +00:00
mcr
f555c163f9 Initial revision 1999-10-07 23:47:09 +00:00