Commit Graph

77 Commits

Author SHA1 Message Date
Francois-Xavier Le Bail
99c91c3aec Rename 'tcpdump-stdinc.h' to 'netdissect-stdinc.h'
Get the full log via: git log --follow netdissect-stdinc.h
2015-09-10 08:50:40 +02:00
Francois-Xavier Le Bail
c1c3c77463 Printers must include 'netdissect.h', not 'interface.h' 2015-09-05 23:35:58 +02:00
Guy Harris
69cb46af91 Fix a bunch of de-constifications. 2015-04-26 17:24:42 -07:00
Guy Harris
59864b113d Clean up printing of LLC packets.
Don't print LLC header information for SNAP packets; if we have a SNAP
header, just call snap_print() and return its return value, regardless
of whether it's 1 or 0, don't fall into the code to print raw LLC header
information - and don't print it with -e, either.

If llc_print() returns 0, just call the default packet printer, don't
print the MAC-layer header or the extracted ethertype - llc_print() will
print the source and destination MAC addresses and whatever type
information is in the LLC or SNAP headers.

If we don't know the DSAP/LSAP, and it's an information frame (numbered
or not) and not an XID frame, return 0, so that we give a hex dump of
the raw payload.

In addition, print the length when printing SNAP header information with
-e.
2015-04-17 18:38:46 -07:00
Denis Ovsienko
38700c7f24 dismiss NETDISSECT_REWORKED macro
The purpose of this macro was to enable the file-by-file switch to NDO,
after which only tcpdump.c had a use of it and the definitions guarded
by it. Update tcpdump.c not to require them any more and dismiss the
unused definitions.
2015-03-22 10:06:15 +00:00
Denis Ovsienko
60a835d80f clean K&R style up in function declarations a bit
The function body should have its opening brace on the next line.
2015-03-05 10:35:03 +00:00
Guy Harris
e5b3ec43d3 Clean up bounds checking.
Fix link-layer header length for Cisco-style encapsulation while we're
at it.
2014-12-19 12:13:15 -08:00
Guy Harris
a6f81d534d Leave it up to ip6_print() to handle non-IPv6-capable systems.
Always define and declare ip6_print(), always compile print-ip6.c, and
always call it if we recognize a payload as IPv6.  If INET6 isn't
defined, ip6_print() will just print the length and note that printing
isn't supported.

That way, we don't do weird dissection of IPv6 packets on systems
without IPv6 support, due to, for example, ethertype_print() returning 0
("not dissected") for IPv6 packets on those systems (IPv6-over-Frame
Relay was dissected weirdly due to this).
2014-10-01 15:32:11 -07:00
Guy Harris
ed85e20e4d u_intN_t is dead, long live uintN_t.
And, as we require at least autoconf 2.61, and as autoconf 2.61 and
later have AC_TYPE_UINTn_T and AC_TYPE_INTn_T macros, we use them to
define the uintN_t and intN_t macros if the system doesn't define them
for us.

This lets us get rid of bitypes.h as well.
2014-04-23 00:20:40 -07:00
Guy Harris
1cde6435df Netdissectify the to-name resolution routines.
Have them take a netdissect_options * argument, and get the "no name
resolution" flag from it.

Move the declaration of dnaddr_string to addrtoname.h, along with the
other XXX-to-string routines.
2014-04-04 00:43:46 -07:00
Denis Ovsienko
8863fc0e5d NDOize some generic code 2014-04-03 17:43:33 +04:00
Denis Ovsienko
fc6f112b40 NDOize LLDP, PPP and RSVP decoders 2014-04-02 18:22:28 +04:00
Denis Ovsienko
51670d1949 NDOize safeputs() and safeputchar() 2014-04-01 19:46:05 +04:00
Denis Ovsienko
2210a967cb NDOize ISO CLNS decoder 2014-03-28 14:08:48 +04:00
Denis Ovsienko
979fc38d03 make use of ND_DEFAULTPRINT() 2014-03-26 18:52:40 +04:00
Denis Ovsienko
bed843855d NDOize Frame Relay, LMP and RADIUS decoders 2014-03-18 16:30:50 +04:00
Denis Ovsienko
d1cffd99e6 NDOize LLC decoder 2014-03-15 15:32:15 +04:00
Denis Ovsienko
88e479b75e don't include pcap.h needlessly
Both interface.h and netdissect.h include <pcap.h>, thus most files
should not include it regardless if these need it or not. The only
exceptions so far remain:
* addrtoname.c
* missing/datalinks.c
* missing/dlnames.c
* tcpdump.c
2014-02-28 18:11:09 +04:00
Denis Ovsienko
fe3253b9b8 remove tcpdump's own CVS keywords
Remove lots of $Header's and a few $Id's that all belong to the former
CVS repository of tcpdump itself. These keywords have been frozen since
the migration to git in late 2008.
2014-01-03 00:59:08 +04:00
Michael Richardson
ac910c086e ndo-ize print-ascii: hex_print_with_offset() 2014-01-01 21:31:18 -05:00
Michael Richardson
a97fb2f3ae whitespace changes 2014-01-01 21:31:18 -05:00
Denis Ovsienko
d8b3af528a make more array declarations static/const 2013-12-19 14:25:01 +04:00
Denis Ovsienko
7de355927b justify declarations of struct tok arrays
Make sure all of them are declared const and most of them -- static.
Proper declaration of token arrays is a common review point for new code
that is based on existing decoders. Thus fix the issue at its root.
2013-09-24 20:54:03 +04:00
Guy Harris
a91d20cc84 Convert the IPv6 printer to use netdissect. 2010-11-07 12:50:16 -08: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
hannes
072e016c6c code cosmetics: bracketize the on-liners after if statements, proper length decrement for ANSI LMI frames 2006-06-23 22:20:32 +00:00
hannes
aebfcfe1f6 rework the ARP printer & add support for Frame-Relay ARP 2006-02-11 22:11:40 +00:00
hannes
997e4c6954 add support for FRF.16 Multilink Frame-Relay (DLT_MFR) 2005-12-13 13:44:29 +00:00
guy
e06503a1aa Clear out the flags field when parsing the Frame Relay header, rather
than leaving random junk in the lower 16 bits.
2005-11-13 11:53:19 +00:00
hannes
5aa9c17da2 add support for PPP over Frame-Relay 2005-11-04 07:16:58 +00:00
guy
e2d1667dcc Fix a test (as per a compiler warning). 2005-08-23 03:15:32 +00:00
hannes
646a88f264 hexdump MFR middle or last fragments 2005-08-09 20:06:34 +00:00
hannes
84fcf28a11 -share some code between the FRF.15 and FRF.16 printer
-display B, E & C header flags in the FRF.16 printer
-evaluate the correct data [!flags] in the FRF.15 printer
  for deciding if the frame is a end-to-end frag or an interface frag
2005-07-27 09:01:03 +00:00
guy
4fe64c9d25 Pointers into packet data should usually be pointers to unsigned 1-byte
values.
2005-07-27 00:25:58 +00:00
hannes
224bdf9595 don't print the null-termination byte in FRF.16 link/bundle msgs 2005-07-26 13:18:07 +00:00
hannes
b4eb98e7b0 fix 'Bundle ID' typo 2005-07-21 11:52:00 +00:00
hannes
831c9aa42f link codeset 1 (lmi messages) to codeset 5, add IE = 0 sanity check, print codeset 2005-07-21 11:48:43 +00:00
hannes
751cd0a385 add support for MFR FRF.16 IE Message printing, add boundary checks 2005-07-21 08:26:45 +00:00
hannes
bf8dae10fa add basic support for FRF.16 Frame-Relay dissector, fix garbled output from twice calling fr_q933_print_ie_codeset 2005-07-20 22:12:38 +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
af9f8b63e5 split up the frame-relay printer into
fr_if_print and fr_print similar to PPP;
fr_print can be called from outside without supplying a pcap_header;
2005-05-27 14:53:48 +00:00
guy
fead98c71d Make "snap_print()" handle fetching and printing the OUI.
Don't copy the LLC header to a "struct llc", just construct the
individual fields.

Fetch the control field early in the dissection process, and check to
make sure we have at least 4 bytes of LLC header if it's not a U frame.
Fetch both bytes of the control field for I and S frames, and display
all 4 hex digits of it.

Only dissect UI frames as BPDUs, and pass the BPDU dissector a pointer
to the beginning of the BPDU, not the beginning of the LLC header - not
all BPDUs are encapsulated in LLC headers.

Only dissect UI frames as IP packets.

Do bounds checking in "snap_print()".
2005-04-26 07:26:33 +00:00
guy
0a0363f416 Dereference the *right* function pointer. 2005-04-25 19:17:25 +00:00
guy
4ff4565fe6 Base all interpretion of IE contents on the code set.
Get rid of an extra blank.
2005-04-25 16:29:00 +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
9c2d2a42b5 move the SNAP OUI values out of the llc printer into
the global oui.c file and make all SNAP printers use it

make the display output of the frame-relay SNAP printer consistent
  to the LLC SNAP printer (= print oui{id,name}, proto-id)
2005-04-06 20:09:07 +00:00
hannes
b9bc936cc6 -add basic support for codeset shifting for IE printing in the frame-relay printer
-harden tok2str() and bittok2str() to catch NULL refs
-don't attempt to print a frame-relay IE if there is not enough bytes on the wire
 to print at least a full TLV
2005-03-21 11:35:55 +00:00
hannes
efd5520f66 -export the q933 printer and call it from the OSI printer
-display cosmetics:
 make the comma settings eflag compatible
 place a colon after printing the OSI proto-ID to indicate
  that we are crossing a layer boundary
2005-01-27 10:13:51 +00:00
hannes
a64785304c bugfix: OSI printers require data to start with the NLPID 2005-01-25 15:02:59 +00:00