Commit Graph

12 Commits

Author SHA1 Message Date
Guy Harris
1ed63b5d06 Remove more old-compiler compensation.
We require an environment with a C99-compatible snprintf(), so we don't
need to work around older implementations.  Make the configuration
process fail if we don't have snprintf() and vsnprintf().

We require at least VS 2015, so we don't have to check for _MSC_VER >=
1400.  Make the build fail if we don't have at least VS 2015.

We apparently do, however, have to use __inline, as the VS 2015
documentation doesn't meaning plain old "inline".  Update a comment.
2019-08-08 23:21:35 -07:00
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
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
513f782ae1 Use quoted include netdissect-stdinc.h instead of angle-bracketed one 2018-01-21 10:28:15 +01:00
Guy Harris
e4f2243521 Get rid of unnecessary casts. 2017-11-23 13:09:21 -08:00
Guy Harris
761e1c4699 Clean up addrtostr6().
"Word" in "words" means "16-bit words", or "16-bit piece of an IPv6
address".  Declare it so.

Instead of going over the IPv6 address a byte at a time, process 2 bytes
at a time; it makes what the code's doing more obvious.

Should squelch Coverity CID 1324572.
2017-09-13 12:25:44 +01:00
Guy Harris
d1a2d18539 Clean up some stuff.
Make the loop index an int, and just cast the (small) size of an IPv6
address, in units of two-byte chunks, to int.

Use int rather than long for the base and length; they'll never be large
enough to require a long.
2017-08-19 18:42:18 -07:00
Guy Harris
9e9347f3dc Do the addrtostr6() bounds checking while we're generating the string.
That obviates the need for a temporary buffer, and eliminates complaints
about using sprintf().
2016-08-07 17:48:27 -07:00
Guy Harris
3ac642ee4c Let strlcpy() do the truncation check. 2016-08-07 16:55:08 -07:00
Guy Harris
d6aacc676d Squelch a Coverity warning.
See Coverity CID 1324572 for tcpdump - the unsigned octets from the IPv6
address were getting extended to ints as a result of getting shifted
left by an int, so make the loop counter unsigned.
2015-11-18 13:07:34 -08:00
Guy Harris
938056a4b6 Remove debugging printouts. 2015-11-18 12:46:25 -08: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