Commit Graph

32 Commits

Author SHA1 Message Date
guy
2b27594dec From Kazushi Sugyo: make "-E alog:0x[0-9a-fA-F]" work. 2003-02-05 02:38:45 +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
guy
aa83d4fdee From Kazushi Sugyo: use the length from the IPv4 or IPv6 header to limit
how far into the packet we parse, so that we don't dissect trailers or,
if it's part of the packet data, an FCS.
2002-11-13 09:35:13 +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
fenner
b675700261 Initial support for OpenSSL version 0.9.7 and higher.
configure doesn't know how to handle this yet.
2002-07-28 04:23:00 +00:00
guy
dc97370ce2 From Kazushi Sugyo <sugyo@pb.jp.nec.com>: patch for newesp and fix for
"none" algorithm decode.
2002-07-27 19:30:36 +00:00
itojun
111ff8a61d whitespace cleanup 2002-06-11 17:08:37 +00:00
guy
6aa353579f From Maciej W. Rozycki <macro@ds2.pg.gda.pl>:
Here is a patch that addresses a few SSL-related issues noticed:

	1. The "/usr" directory is not the best choice to start looking
	   for SSL libraries when cross-compiling.  The patch adds
	   "/usr/${host_alias}" at the front.  Actually the test is quite
	   bogus anyway -- there might be no libcrypto.a library at all
	   (but e.g. libcrypto.so), so a better approach would be trying to
	   link against -lcrypto and seeing if that works.  First with no
	   additional options (it might be in the default compiler/linker's
	   search patch, like on sane systems), then with the -L<dir>
	option.

	2. The "cast.h" and "rc5.h" headers should include the
	   "openssl/" path as that is what is used throughout the code.
	   Right now they are simply not found by configure.

	3. The buggy CAST128 test should use a cache variable to permit
	   overriding by an educated user.

	I think I may actually rewrite the test as described in #1 above
	one day, but my time is quite limited and tcpdump is not my
	priority task, so it might not happen soon.  I won't mind if
	someone does it earlier.
2002-04-07 02:16:03 +00:00
itojun
4313bd158f void void * arith 2002-02-18 08:54:56 +00:00
guy
b654029413 Get rid of a warning if libcrypto isn't present. 2002-01-25 05:51:51 +00:00
itojun
5d4403d867 need stdlib.h for malloc(3). strict prototype 2002-01-23 05:23:16 +00:00
mcr
19fb01819f print-esp understands various algorithms and RFC2406 encoding. 2002-01-21 11:39:58 +00:00
fenner
31a13fa966 Don't try decrypting a fragmented ESP packet; the IP proto number and
padding info are in the last fragment but the header is in the first
 fragment.
Pass padding length back to IP to allow trimming the padding.
Update in_cksum() prototype to allow using it for checksums including
 the pseudo-header.
2001-08-20 17:52:38 +00:00
itojun
d7e0b408cc correct openssl include pathname management. <openssl/foo.h> should be
used (see openssl docs).
2001-04-13 02:56:37 +00:00
itojun
8e338956f8 print SPI in hex. 2000-12-12 09:58:40 +00:00
itojun
ce132b307b put stripped-down version of ip6.h and icmp6.h into tcpdump tree.
ip6.h is almost normal RFC2292 header.
icmp6.h has couple of extensions (not covered by RFC2292),
like MLD, ICMPv6 nodeinfo, and router renumber.

XXX how to synchronize with future kame changes?
2000-10-07 05:53:09 +00:00
itojun
b0385536d7 move ah/esp struct declratiaon into separate header (ah.h and esp.h).
they are from KAME.

use ah.h and esp.h where necessary.
2000-10-06 11:32:17 +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
fb75d3cd5a always use u_intXX_t for protocol format declaration. char/short/int may not
come with exact size.  while at it, correct signedness of ip/udp header field.
nuke most of the use of bitfield.
TODO: bitfield in namser.h
2000-10-03 02:54:54 +00:00
itojun
64b4695379 typo in comment. from jinmei@kame.net 2000-10-03 02:19:04 +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
mcr
1ab95d4cf9 switch to HAVE_LIBCRYPTO 2000-01-15 02:33:06 +00:00
fenner
95be1abb35 Put back the $'s in the Header RCS strings.
Make rcsid const to quiet warnings.
1999-12-15 08:10:17 +00:00
fenner
b9ac23ce92 Switch to config.h instead of passing defines in DEFS. 1999-11-21 09:36:43 +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
5c4f91da94 compilable AH/ESP patches 1999-10-17 22:18:00 +00:00
mcr
2d86b23ecd ASCII patches for tcpdump.
AH/ESP printing.
1999-10-17 21:56:53 +00:00