Commit Graph

19 Commits

Author SHA1 Message Date
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
itojun
111ff8a61d whitespace cleanup 2002-06-11 17:08:37 +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
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
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
itojun
febfc92d3f include string.h for memcpy/memset.
on some architecutrees, sizeof(void *) > sizeof(int).   don't try to cast
pointer to int to check alignment issues.
2000-10-03 04:19:07 +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
86f858ef54 (token_if_print): remove unused variable 2000-07-30 05:55:44 +00:00
guy
277dc1f0ec Add a token-ring link-layer dissector, made by merging the FreeBSD and
NetBSD ones; use it for DLT_IEEE802, which in many OSes is used for
token ring.
2000-07-25 05:28:11 +00:00