Guy Harris [Sun, 5 Feb 2023 21:23:57 +0000 (13:23 -0800)]
Makefile.in: don't remove configure and config.h.in in make distclean.
In the GNU makefile standards, "make distclean" removes everything
that's not part of the source distribution; this does *not* include the
configure script or the config.h.in file, as those are in the release
tarball, so that building from a source tarball doesn't require having
autoconf. This allows somebody building from the source tarball to do a
"make distclean" and then reconfigure.
Do, however, remove any release tarball in make distclean, by having
distclean depend on clean.
Guy Harris [Sun, 5 Feb 2023 20:12:22 +0000 (12:12 -0800)]
tcpdump: plug a memory leak.
If the -V flag is used, and not all files in the -V file have the same
link-layer type, when the filter is recompiled for a new link-layer
type, the old filter program is leaked. Free the old filter before
compiling the new filter.
Guy Harris [Tue, 31 Jan 2023 07:03:16 +0000 (23:03 -0800)]
Have a common routine for converting dates and times to strings.
Have a routine that takes a buffer, a strftime format, and a struct tm *
as arguments, and:
* checks whether the struct tm * is null and, if so, returns a string
indicating that the date and time couldn't be converted;
* otherwise, passes it to strftime(), along with the buffer and the
format argument and, if strftime() returns 0, meaning the string didn't
fit into the buffer and thus that the buffer's contents are undefined,
returns a string indicating that the date and time didn't fit into the
buffer;
* otherwise, returns a pointer to the buffer.
Call that routine instead of directly calling strftime() in printers;
that prevents printing a buffer with undefined data if the buffer isn't
big enough for the string.
Also, when generating file names using an strftime format, check the
return value of strftime() to make sure the buffer didn't overflow.
Francois-Xavier Le Bail [Tue, 31 Jan 2023 10:11:12 +0000 (11:11 +0100)]
autoconf: Add autogen.sh, remove configure and config.h.in
Put autoconf-generated files in the release tarball.
The minimum required version of autoconf is currently 2.69.
If version 2.69 or later is already installed and there is no
autoconf default, it may be necessary to set the AUTORECONF
environment variable to enable the one to use, like:
AUTORECONF=autoreconf-2.69 ./autogen.sh
or
AUTORECONF=autoreconf-2.71 ./autogen.sh
Denis Ovsienko [Tue, 31 Jan 2023 12:38:49 +0000 (12:38 +0000)]
Remove unused missing/snprintf.c. [skip ci]
The file could be compiled on demand using "make snprintf.o", although
with many warnings, but tcpdump build would never use the file
regardless of the variety of the build.
Some of the code there has been commented out since commit 45aef49 in
2001, and the rest became unused after commit 1ed63b5 in 2019.
Guy Harris [Mon, 30 Jan 2023 20:46:44 +0000 (12:46 -0800)]
configure, CMakeLists.txt: don't check for snprintf().
It's specified by the C90 standard (and, as I remember, by the C89
standard, although I no longer have my paper copy); no need to worry
about ancient environments that lack it, and we have some cases where we
call it in code not protected by #ifdef HAVE_STRFTIME/#endif and haven't
seen any reports of problems.
Denis Ovsienko [Fri, 20 Jan 2023 19:35:04 +0000 (19:35 +0000)]
Reduce aclocal.m4 a little bit more. [skip ci]
Remove a copyright boilerplate that stood for IPv6 macros added via
commit c9d84d1 in 1999 and removed via commit 11f73ad in 2015. Remove
AC_LBL_SSLEAY, which is unused and obsolete. This change does not
result in any changes in any other files.
Denis Ovsienko [Thu, 19 Jan 2023 21:26:39 +0000 (21:26 +0000)]
Remove some unused declarations from aclocal.m4. [skip ci]
AC_LBL_FIXINCLUDES, AC_LBL_UNION_WAIT and AC_LBL_HAVE_RUN_PATH have no
purpose in this source tree. AC_LBL_SHLIBS_INIT does not exist. This
change does not introduce meaningful changes in any other files.
Francois-Xavier Le Bail [Mon, 16 Jan 2023 19:05:20 +0000 (20:05 +0100)]
LSP ping: Fix "Unused value" warnings from Coverity
This change should fix the following Coverity Scan issues:
CID 1397795 (#1 of 1): Unused value (UNUSED_VALUE)
assigned_pointer: Assigning value from tlv_tptr + 4UL to tlv_tptr here,
but that stored value is overwritten before it can be used.
CID 1397796 (#1 of 1): Unused value (UNUSED_VALUE)
assigned_value: Assigning value from tlv_tlen - 4UL to tlv_tlen here,
but that stored value is overwritten before it can be used.
Denis Ovsienko [Sat, 14 Jan 2023 22:25:18 +0000 (22:25 +0000)]
Remove init_crc10_table() and the entourage.
As Guy Harris points out in bug report GH #1022, the function has been a
busy no-op since commit e6c39e6 in 2010. While at it, fixup the Python
code to work on Python 3:
for i in range(len(crc_table)/8):
TypeError: 'float' object cannot be interpreted as an integer
Guy Harris [Sat, 14 Jan 2023 11:21:06 +0000 (03:21 -0800)]
configure: check for gethostbyaddr(), not gethostbyname().
We use gethostbyaddr() to translate IP addresses in packets to names; we
don't use gethostbyname() to translate names to IP addresses (libpcap
does the latter when compiling filters, so we leave that up to it, and
nothing's left for us to do).
This probably has the same effect as checking for gethostbyname(), but
it makes it a bit clearer why we'd check for it.
Denis Ovsienko [Sat, 31 Dec 2022 03:04:58 +0000 (03:04 +0000)]
CHANGES: Refine the 4.99.2 section. [skip ci]
List user-visible changes that have been made but did not appear in the
change log. Remove entries that are duplicate (including EIGRP from
4.99.1) or have been superseded by later changes (make releasetar).
Francois-Xavier Le Bail [Wed, 30 Nov 2022 11:05:07 +0000 (12:05 +0100)]
CI: Introduce and use TCPDUMP_CMAKE_TAINTED
The new environment variable provides means to declare all or some libpcap
cmake run of a specific environment (CI or a working copy) as tainted.
Add explicit conditions to exempt the cmake run that emit warnings
now and request the compiler to treat warnings as errors *iff* the cmake
run is not tainted. This way if a cmake run that is warning-free now
degrades later, CI will fail it.
The treat warnings as errors cmake option used is:
-Werror=dev
Make developer warnings errors.
Make warnings that are meant for the author of the CMake-
Lists.txt files errors. By default this will also turn on depre-
cated warnings as errors.
Francois-Xavier Le Bail [Fri, 25 Nov 2022 14:49:52 +0000 (15:49 +0100)]
cmake: Update the minimum required version to 2.8.12 (except Windows)
Windows minimum required is already 3.12.
This change avoids this warning:
CMake Deprecation Warning at CMakeLists.txt:7 (cmake_minimum_required):
Compatibility with CMake < 2.8.12 will be removed from a future version of
CMake.
Update the VERSION argument <min> value or use a ...<max> suffix to tell
CMake that the project does not need compatibility with older versions.
Francois-Xavier Le Bail [Mon, 31 Oct 2022 16:20:18 +0000 (17:20 +0100)]
Remove the release candidate rcX targets
These tricky targets used "autoreconf -f" (via "make releasetar") and
they changed the VERSION and configure files locally.
If building a release candidate tar archive is needed, it's better to:
Update VERSION with rcX suffix and configure via "autoreconf -f",
commit them, add a tag and build the archive via "make releasetar".
It should display: Archive build from tag tcpdump-...rcX.
Note: the "autoreconf -f" command changes the configure file in an
uncontrolled way (runstatedir, #define LARGE_OFF_T, etc.) depending on
the autoconf version.
It is necessary to choose the parts that will be added in the commit
with "git add -i".
Francois-Xavier Le Bail [Fri, 28 Oct 2022 16:34:55 +0000 (18:34 +0200)]
Use "git archive" for the "make releasetar" process
Use the release tag if it exists or use HEAD.
Remove the "autoreconf -f" command, because it changes the configure file
locally in an uncontrolled way (runstatedir, #define LARGE_OFF_T, etc.)
depending on the autoconf version. This command is run in the release
process before a commit and we can choose the parts that will be added
in the commit.
Note:
The following target (rcX) must be updated ou removed in a next step
because it was using "autoreconf -f" (via "make releasetar") and it
changes the VERSION and configure files locally.
This change
1) Ensures that we only release files from tag/HEAD, not locally
modified ones.
2) Avoids disclosing personal data such as the username/group of the
local user.
3) Puts by default a umask of 0002, which turns off the world write bit
on files in the archive.
4) Avoids problems on some OSes (no more tar, Git builtin tar.gz
handling).
Guy Harris [Fri, 30 Sep 2022 23:29:34 +0000 (16:29 -0700)]
configure: use pcap-config --static-pcap-only if available.
If we're linking with a libpcap in ../libpcap*, it's static, but we only
need to link with the libraries on wich it immediately depends, we don't
need to link with the libraries on which those libraries depend, etc..
So, if ../libpcap*/pcap-config supports --static-pcap-only, use that.
Sam James [Mon, 12 Sep 2022 16:28:58 +0000 (17:28 +0100)]
configure.ac: fix configure tests broken with Clang 15 (implicit function declarations)
Clang 15 makes implicit function declarations fatal by default which
leads to some of tcpdump's configure tests silently failing/returning
the wrong result.
This adds the needed #includes to various tests for the functions used,
resolving the following errors:
```
net-analyzer/tcpdump-4.99.1/clang15.log:47:error: type specifier missing, defaults to 'int'; ISO C99 and later do not support implicit int [-Wimplicit-int]
net-analyzer/tcpdump-4.99.1/clang15.log:51:error: call to undeclared library function 'strcmp' with type 'int (const char *, const char *)'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
net-analyzer/tcpdump-4.99.1/clang15.log:55:error: call to undeclared library function 'sscanf' with type 'int (const char *restrict, const char *restrict, ...)'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
net-analyzer/tcpdump-4.99.1/clang15.log:68:error: call to undeclared library function 'memset' with type 'void *(void *, int, unsigned long)'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
net-analyzer/tcpdump-4.99.1/clang15.log:112:error: call to undeclared function 'ether_ntohost'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
net-analyzer/tcpdump-4.99.1/clang15.log:115:error: call to undeclared library function 'exit' with type 'void (int) __attribute__((noreturn))'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
```
Nicholas Reilly [Wed, 31 Aug 2022 21:01:08 +0000 (17:01 -0400)]
ICMPv6: Fix the Node Information flags
Don't use htons() when defining the constants because the flags
field is already eventually swapped by fetching with GET_BE_U_2().
Remove unused flags NI_SUPTYPE_FLAG_COMPRESS and NI_FQDN_FLAG_VALIDTTL.
Add a test file with various NI_NODEADDR_FLAG* flags.