Commit Graph

58 Commits

Author SHA1 Message Date
Guy Harris
11f73ad248 Don't require IPv6 library support in order to support IPv6 addresses.
Have our own routines to convert between IPv4/IPv6 addresses and
strings; that helps if, for example, we want to build binary versions of
tcpdump for Windows that can run both on NT 5 (W2K/WXP), which doesn't
have inet_ntop() or inet_pton(), and NT 6 (Vista/7/8/10), which do.  It
also means that we don't require IPv6 library support on UN*X to print
addresses (if somebody wants to build tcpdump for older UN*Xes lacking
IPv6 support in the system library or in add-on libraries).

Get rid of files in the missing directory that we don't need, and
various no-longer-necessary autoconf tests.
2015-09-17 14:56:44 -07:00
Francois-Xavier Le Bail
f5fe14663d libnetdissect code must include 'netdissect.h', not 'interface.h'
Moreover:
Remove netdissect.h include in interface.h
Move thiszone declaration in netdissect.h
Update a comment
2015-09-11 13:22:56 +02:00
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
Guy Harris
3dd9240cc3 Do case-insensitive comparisons assuming ASCII strings.
Do the case-insensitive comparisons in a locale-independent fashion that
only maps ASCII letters, in the standard English-language fashion; that
way, we don't get bitten by, for example, Turkish having separate "i
with dot" and "i without dot" letters, with lower-case "i with dot" being
mapped to upper-case "I with dot" rather than being mapped to "I".
2015-06-11 15:47:44 -07:00
Francois-Xavier Le Bail
65aafc0c1d Delete trailing spaces/tabs 2015-06-04 15:23:21 +02:00
Francois-Xavier Le Bail
5520a233cf Fix a warning for 'strsep' function on Solaris
The warning was:
./missing/strsep.c:54:1: warning: no previous prototype for 'strsep' [-Wmissing-prototypes]
2015-01-26 10:58:04 +01:00
Guy Harris
d0de5eb941 opterr should default to 1, so illegal options are reported. 2014-05-07 12:05:29 -07:00
Guy Harris
27991a20a8 Include <errno.h> on both Windows and UN*X.
We need <errno.h> on UN*X in some files that include tcpdump-stdinc.h,
such as missing/inet_pton.c.

Remove includes of <errno.h> from files that include tcpdump-stdinc.h.
2014-05-04 10:08:58 -07:00
Gisle Vanem
3ce257e42b Update inet_pton.c
Removed <errno.h> here since it's already included in ./tcpdump-stdinc.h. The local 'win32/Include/errno.h' is deleted.
2014-05-02 05:06:38 -07:00
Guy Harris
5d00de50ff Oops, forgot to fix missing/getopt_long.c to include getopt_long.h. 2014-05-01 19:17:42 -07:00
Gisle Vanem
9221e6a1b5 Define optarg, optind, opterr, and optopt.
That's necessary on Windows, where you're not going to get them defined
by getopt().
2014-05-01 16:13:06 -07:00
Guy Harris
7f56cb1b84 Put in missing getopt_long() files. 2014-05-01 09:36:26 -07:00
Gisle Vanem
3425f9366f fix missing/inet_ntop.c again
All tests that should print IPv6-addresses failed since 'INET6' wasn't
set when my missing/inet_ntop.c was compiled. Due to "config.h" was not
included.

Also got rid of 2 warnings:
 Missing/inet_ntop.c:146:23: warning: 'cur.len' may be used
 uninitialized in this function [-Wmaybe-uninitialized]

The tests also failed since the inet_ntop_v6() was returning hex-chars
in upper-case. So this patch returns string in lower-case.
2014-05-01 14:39:17 +04:00
Guy Harris
dbddfda2c8 More getting rid of old u_intN_t. 2014-04-23 00:45:13 -07:00
Francois-Xavier Le Bail
4708c526a3 get rid of "no previous prototype" warnings for 'strlcat' and 'strlcpy' 2014-04-01 17:14:28 +02:00
Gisle Vanem
05baeecfff missing/inet_ntop.c fix (GH #358)
The extra 'return (NULL)' is dead code.
2014-01-24 19:14:11 +04:00
Guy Harris
35d9d59de0 We don't use missing/sockstorage.h, so get rid of it. 2014-01-17 12:52:22 -08: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
Guy Harris
687b442022 Get rid of unnecessary configure script tests and missing/XXX.h headers.
This also fixes configure-script problems on OSes that have IPv6 support
but don't have <netinet6/in6.h> - no standard I could find requires that
header for IPv6 support (the Single UNIX Specification speaks of
<netinet/in.h> for both IPv4 and IPv6, and RFCs 2292 and 3542 don't
mention <netinet6/in6.h>, just <netinet/in.h> and <netinet6/ip6.h>).
2011-02-01 02:08:41 -08:00
Guy Harris
e67e304a58 Our bittypes.h is needed only on Windows. Move it to win32/Include. 2010-04-04 13:24:32 -07:00
Guy Harris
a2fb078ab4 Nothing in missing/getaddrinfo.c is used in tcpdump, and it's a pain to
make it build on Tru64 UNIX, so get rid of it.
2009-07-08 01:18:11 -07:00
Guy Harris
7c567e9ae8 Cast argument to isdigit to unsigned char, so if the characters 8th bit
is set, it doesn't get treated as a negative number.
2009-07-02 12:00:55 -07:00
guy
273460ed88 From Gisle Vanem:
the _errno() stuff isn't needed for current versions of MinGW;

	get rid of some definitions not needed with MSVC++ and other
	non-MinGW32/non-Watcom compilers;

	add IPv6 capability to inet_pton.c, courtesy of Paul Vixie;

	add inline ntoh{ls}/hton{ls} functions for GCC/i386.
2005-02-09 02:25:45 +00:00
guy
147aa43a0d "_int64" is signed. "unsigned _int64" is unsigned. 2004-09-19 20:56:33 +00:00
guy
bc40acf4a7 It's "%I64[doux]", not "%i64[doux]", to print 64-bit integral data types
with Windows printf.
2004-06-20 17:51:01 +00:00
guy
faf8160c18 Second stage of adding support for 64-bit integral data types - this
causes the configure script to attempt to define the PRI[doux]64 macros
if they're not defined by including <inttypes.h>, and causes
"missing/bittypes.h" to attempt to define them, if undefined, in a
fashion that should, with any luck, work on MSVC++ and various flavors
of GNU C on Windows.

Fix the spelling of "Mac OS X".
2004-04-17 08:44:49 +00:00
guy
1875b8ffe1 First stage of adding support for 64-bit integral data types - this
causes "int64_t" and "u_int64_t" to be defined by the configure script,
and causes "missing/bittypes.h" to attempt to define "u_int64_t" in a
fashion that should, with any luck, work on MSVC++ and various flavors
of GNU C on Windows.
2004-04-17 04:33:16 +00:00
guy
0cf35b497d Print both the name and the description of a link-layer type (the name
isn't always very suggestive - for example, somebody might think
"EN10MB" is always 10 MB/s, and might not know that "IEEE802" is Token
Ring), using "pcap_datalink_val_to_description()".  Supply our own
"pcap_datalink_val_to_description()" if libpcap doesn't have it (even if
it has "pcap_datalink_name_to_val()").
2003-11-18 23:09:42 +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
118b73551b Digital UNIX 4.0's <net/bpf.h> doesn't define DLT_SLIP_BSDOS or
DLT_PPP_BSDOS - don't assume they're defined, check whether they're
defined before using them.
2003-05-02 08:46:28 +00:00
guy
0b22abf27a Fix up some compiler warnings. 2003-03-25 08:33:48 +00:00
guy
58159be647 Get rid of the include of <sys/cdefs.h>, as that's a BSDism, and put in a
standard tcpdump RCS ID.
2003-03-03 00:56:31 +00:00
guy
24f5540899 From Gisle Vanem: make print-esp.c work with more (maybe all?) OpenSSL
versions, and changes to make it work on DOS/Windows with various
compilers and C support libraries.
2003-03-02 23:19:33 +00:00
guy
6076158547 NetBSD support for multiple data link types on an interface, from David
Young <dyoung@ojctech.com>, with some minor changes by Jason R. Thorpe
<thorpej@netbsd.org>, and further changes by me to:

	use "-y" rather than "-D" to set the link type ("-D" was already
	taken);

	use libpcap APIs to map between data link type names and values;

	supply stub versions of missing-but-needed libpcap APIs.

Update Jason Thorpe's e-mail address (Zembu is going away, if it hasn't
done so already).
2002-12-19 09:27:54 +00:00
guy
4d98413d6c Make the definitions of "strlcat()" and "strcpy()" prototype
definitions, to squelch warnings from some compilers.
2002-08-02 04:38:12 +00:00
risso
3d932490b8 Added support for Win32, based on WinPcap. 2002-08-01 08:52:55 +00:00
itojun
24ec836293 __ss_len/family is now nonstandard. standards were clarified to use
ss_len/family.
2002-06-11 17:15:30 +00:00
itojun
a0fe532816 whitespace 2002-06-11 17:13:36 +00:00
guy
84018cc541 Patch from Pekka Savola <pekkas@netcore.fi> to get rid of "savestr()"
(which doesn't actually seem to be significantly more efficient than
"strdup()", at least not to the extent that it makes any difference to
"tcpdump"), modified to use the BSD "strdup()", rather than the old
"savestr()", on platforms that lack "strdup()".
2001-01-20 07:22:20 +00:00
guy
45aef49d89 "#if 0" out stuff for "asprintf()", "asnprintf()", "vasprintf()", and
"vasnprintf()", as we're not using any of them, and we're not declaring
them in "interface.h" (keep them around for now in case we decide we
need them; they may be useful if we ever want to "sprintf" a string and
want the string to grow dynamically to hold what we're putting into it).
2001-01-12 10:14:40 +00:00
guy
3d6bd825ee As GCC "2.96" notes, "short int' is promoted to int' when passed
through `...'", and therefore "...you should pass `int' not `short int'
to `va_arg'".

GCC "2.96" apparently fails to compile code that passes "short int" to
"va_arg()", and Red Hat Linux 7.0 uses GCC "2.96", so we fix this, as
per Pekka Savola's note.
2001-01-02 22:33:04 +00:00
fenner
c09e6737ee Eliminate __P(). 2000-10-24 00:56:48 +00:00
itojun
88633a8337 repair 1-byte buffer overrun 2000-10-07 05:20:24 +00:00
itojun
b9947fc471 split checks for struct addrinfo and NI_xxx.
From: Juergen Schoenwaelder <schoenw@ibr.cs.tu-bs.de>
2000-01-21 04:06:17 +00:00
itojun
63ac2af9fd need strl{cat,cpy} badly for buffer overflow 2000-01-19 05:34:17 +00:00
itojun
250306eca9 bring in latest kame getaddrinfo (couple of bug fixes).
more portability checks for getaddrinfo.

checked on: netbsd141, kame/netbsd141
2000-01-19 04:42:20 +00:00
fenner
809bf16230 Include <sys/types.h> to allow compilation on Solaris. 2000-01-10 16:57:44 +00:00
fenner
34ff77ff43 Unify rcsid[]'s. 2000-01-09 21:34:14 +00:00
assar
0f84554363 add snprintf implementation 2000-01-07 16:01:38 +00:00