Commit Graph

77 Commits

Author SHA1 Message Date
hannes
cf9629305a clean up some confusion between Q.933 and LMI:
- NLPID 0x8 is Q9.33
  -       0x9 is LMI

  - the lmi printer in frint-fr.c is actually a (light) q.933
    printer -> rename routines and trunc marks;
2004-10-18 12:11:34 +00:00
hannes
ecdfb8a72a add baseline FRF.15 (=fragmentation) support for frame-relay 2004-10-12 21:02:00 +00:00
hannes
b17c37fdb5 -add frame-relay header documentation
-make more use of tok2str() and bittok2str()
-move the cisco-style frame format printer to
 fr_hdr_print
-rework the LMI decoder
 - spit out just a single line in non-verbose mode
  (plus all the interesting information like TX, RX Seq Nr)
 -make more use of tok2str()
 -reword some #define statments to make it appear
  frame-relay or LMI specific
2004-10-09 17:55:26 +00:00
hannes
5cc4c57d43 print frame-relay flags & DLCI # for cisco style encaps 2004-10-07 16:16:02 +00:00
hannes
de7827fb7e add support for cisco-style ethertype encaps within frame-relay 2004-10-07 16:04:06 +00:00
hannes
4d399db499 -move the nlpid definitions and tokens to a dedicated file(s)
-make use of it in the ISO, Frame-relay and CDP printers
2004-10-07 14:53:09 +00:00
guy
9bfb523ef0 Make the "addr_len" variable a "u_int", as we pass a pointer to it to a
routine that expects a "u_int *", and we never use it in a way that
requires it to be signed.
2004-04-02 06:53:19 +00:00
guy
e693f83f8d Make the "dlci" variable a u_int, as all the code that refers to it
thinks it's unsigned.
2003-12-15 03:36:05 +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
e6174e7742 Fix a typo. 2003-11-08 09:00:51 +00:00
guy
12b362108f From Krzysztof Halasa: ignore single octet IEs. 2003-10-18 00:27:16 +00:00
guy
dc3034d63d From Krzysztof Halasa <khc@pm.waw.pl>:
1. Unused things (mbuf, rtentry) have been removed.

2. I've dropped FR_CR_BIT etc. definitions as they have only meaning in
   specific location in Q.922 address. FR_EA_BIT is still there as it's
   used by all Q.922 bytes.

3. a new parse_q922_addr() parses the whole Q.922 address structure
   and produces DLCI, Q.922 byte count and flags in ASCII. While I can't
   test 3- and 4-byte Q.922 addresses (using only default 2-byte ones),
   they are supported.

4. I've trimmed comments regarding HDLC flags and CRC/FCS bytes in FR
   packet. They are wire-only things and as such are never seen by
   libpcap/tcpdump.

5. Changed NLPID_LMI into NLPID_CISCO_LMI and NLPID_Q933 into NLPID_LMI
   (the latter is used by both ANSI (T1.617 annex D) and CCITT (Q.933
   annex A) LMI).

6. fr_hdrlen() now correctly returns FR header length (4 - 6 bytes,
   7 bytes with 4-byte Q.922 and incorrectly used pad byte).

7. I've changed output text formatting: "xxx-value-yyy-value" into
   "xxx value, yyy value", to be consistent with Ethernet.
   Not sure if it's correct.

8. added IPv6 support

9. q933_print() now reads lmi_print()

10. CCITT (Q.933 annex A) LMI is now supported, and both CCITT and ANSI
    fields are now correctly displayed

10. lmi_print() no longer prints constant fields (such as always zeroed
    Q.922 C/R bit or LMI Call Reference byte) unless they are set
    incorrectly.

11. I've added ANSI_ and CCITT_ prefixes to appropriate #defines.

12. a new parse_dlci_el() should handle all (10, 16 and 23-bit)
    DLCIs correctly (corresponding to 2, 3 and 4-byte Q.922 addresses,
    respectively).
2003-10-16 09:50:36 +00:00
itojun
96a57188a8 use strlcpy/cat 2003-08-13 02:28:21 +00:00
itojun
58b83f6ad4 use snprintf 2003-08-13 02:26:52 +00:00
hannes
8f94d68a09 don't pass on src & dst MAC adresses to the isoclns decoder as MAC adresses
should be really printed in ether_print() using the eflag
2003-05-22 16:52:36 +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
fcc82f451d The "__attribute__((packed))" tag on structures causes some files not to
compile with Sun C, as "interface.h" isn't being included before the
structures are being declared.

Furthermore, in the files that Sun C *can* compile, it doesn't cause Sun
C to generate code that's safe with unaligned accesses, as
"__attribute__" is defined as a do-nothing macro with compilers that
don't support it.

Therefore, we get rid of that tag on the structures to which it was
added, and instead use "EXTRACT_16BIT()" and "EXTRACT_32BIT()" to fetch
16-bit and 32-bit big-endian quantities from packets.  We also fix some
other references to multi-byte quantities to get rid of code that tries
to do unaligned loads on platforms that don't support them.

We also throw in a hack that makes those macros use
"__attribute__((packed))" on structures containing only one 16-bit or
32-bit integer to get the compiler to generate unaligned-safe code
rather than doing it by hand.  (GCC on SPARC produces the same code that
doing it by hand does; I don't know if GCC on any other big-endian
strict-alignment processor generates better code for that case.  On
little-endian processors, as "ntohs()" and "ntohl()" might be functions,
that might actually produce worse code.)

Fix some places to use "%u" rather than "%d" to print unsigned
quantities.
2002-12-11 07:13:49 +00:00
itojun
10afb02ac8 put __attribute__((packed)) to packet headers. s/u_short/u_int16_t/ and so
forth while i'm here
2002-11-09 17:19:16 +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
guy
edb0e92cdc Add a few more GCC warnings on GCC >= 2 for ".devel" builds.
From Neil T. Spring: fixes for many of those warnings:

	addrtoname.c, configure.in: Linux needs netinet/ether.h for
	ether_ntohost

	print-*.c: change char *foo = "bar" to const char *foo = "bar"
	to appease -Wwrite-strings; should affect no run-time behavior.

	print-*.c: make some variables unsigned.

	print-bgp.c: plen ('prefix len') is unsigned, no reason to
	validate by comparing to zero.

	print-cnfp.c, print-rx.c: use intoa, provided by addrtoname,
	instead of inet_ntoa.

	print-domain.c: unsigned int l; (l=foo()) < 0 is guaranteed to
	be false, so check for (u_int)-1, which represents failure,
	explicitly.

	print-isakmp.c: complete initialization of attrmap objects.

	print-lwres.c: "if(x); print foo;" seemed much more likely to be
	intended to be "if(x) { print foo; }".

	print-smb.c: complete initialization of some structures.

In addition, add some fixes for the signed vs. unsigned comparison
warnings:

	extract.h: cast the result of the byte-extraction-and-combining,
	as, at least for the 16-bit version, C's integral promotions
	will turn "u_int16_t" into "int" if there are other "int"s
	nearby.

	print-*.c: make some more variables unsigned, or add casts to an
	unsigned type of signed values known not to be negative, or add
	casts to "int" of unsigned values known to fit in an "int", and
	make other changes needed to handle the aforementioned variables
	now being unsigned.

	print-isakmp.c: clean up the handling of error/status indicators
	in notify messages.

	print-ppp.c: get rid of a check that an unsigned quantity is >=
	0.

	print-radius.c: clean up some of the bounds checking.

	print-smb.c: extract the word count into a "u_int" to avoid the
	aforementioned problems with C's integral promotions.

	print-snmp.c: change a check that an unsigned variable is >= 0
	to a check that it's != 0.

Also, fix some formats to use "%u" rather than "%d" for unsigned
quantities.
2002-09-05 00:00:07 +00:00
risso
3d932490b8 Added support for Win32, based on WinPcap. 2002-08-01 08:52:55 +00:00
guy
156bb68661 ETHERTYPE_IP will never show up as an NLPID in a Frame Relay packet, as
the NLPID is 1 byte and 0x800 doesn't fit in one byte.
2002-07-16 04:09:27 +00:00
guy
c2b35f3e46 Make "snap_print()" take an argument specifying the padding for bridged
LAN frames; it's 0 bytes for Frame Relay and 2 bytes for ATM.
2002-07-11 08:27:03 +00:00
guy
6d6270c6b4 From Paul S. Traina: FreeBSD's Frame Relay printer.
Make the code to print a SNAP-encapsulated packet a separate routine,
for use by the Frame Relay code.
2002-07-11 08:09:45 +00:00