Commit Graph

67 Commits

Author SHA1 Message Date
Guy Harris
c499612a7f Add nd_{v}snprintf() routines/wrappers.
Some versions of the MSVC runtime library have a non-C99-compliant
vsnprintf(), which we want to avoid.  On Windows, use snprintf() and
vsnprintf() for VS 2015 and later, where they both exist in
C99-compliant forms, and wrap _{v}snprintf_s() otherwise (they're
guaranteed to do the null termination that we want).
2018-01-29 15:48:55 -08:00
Guy Harris
b3703ed9cf Pick up Windows snprintf and strdup replacements from libpcap. 2018-01-28 20:57:15 -08:00
Guy Harris
3e9e2b62b8 Create the missing/pcap_dump_ftell.c that's expected by autotools and CMake. 2018-01-26 00:10:48 -08:00
Guy Harris
10305e5f1c Oops, forgot to add missing/win_ether_ntohost.h. 2018-01-23 10:59:09 -08:00
Guy Harris
0d9efb9596 On Windows, we have our own ether_ntohost(); declare it.
Move the source to our own ether_ntohost() to the "missing" directory,
just as we do in libpcap for the Windows snprintf() wrapper around
_snprintf().

Add a header file for it, and include it in both the wrapper and in
addrtoname.c on Windows.
2018-01-23 09:28:44 -08:00
Guy Harris
fb2479d733 Always include <config.h> rather than "config.h".
This can prevent bizarre failures if, for example, you've done a
configuration in the top-level source directory, leaving behind one
config.h file, and then do an out-of-tree build in another directory,
with different configuration options.  This way, we always pick up the
same config.h, in the build directory.
2018-01-21 12:27:28 -08:00
Francois-Xavier Le Bail
5cea270318 Remove all storage class specifier 'register'
Let the compiler do the optimizations (or not) based on build options.

Avoid 'value has been optimized out' messages in gdb using '-O0'.
2017-12-13 19:17:47 +01:00
Ali Abdulkadir
4a000d3557 Updates for getservent.c
- fixed none _WIN32 implementation

- on windows, see if a services file exists in the same directory as tcpdump and use that
2017-11-15 18:39:39 +03:00
Ali Abdulkadir
18568bc044 Made up for missing getservent() and endservent() 2017-10-24 08:11:33 +03:00
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