]> The Tcpdump Group git mirrors - tcpdump/commit
Untangle detection of pcap_findalldevs().
authorDenis Ovsienko <[email protected]>
Fri, 24 Feb 2023 23:10:04 +0000 (23:10 +0000)
committerGuy Harris <[email protected]>
Tue, 27 Feb 2024 21:21:07 +0000 (13:21 -0800)
commit8cf21a46bebd0ed263c49a46cfb40fb8ae3922fb
treed54f19a46e5a936ddf6c89e0307ea3956d8bb289
parent2f4f63b7a58723e1ff00698c7e8ed0fd7944a122
Untangle detection of pcap_findalldevs().

tcpdump.c requires both HAVE_PCAP_IF_T and HAVE_PCAP_FINDALLDEVS to
manage the code that depends on pcap_findalldevs().  Other than that,
the Autoconf and CMake checks that produce these two macros do not
relate directly, so having the check for pcap_if_t conditional on the
check for pcap_findalldevs() is an unnecessary complication.

More importantly, in the CMake case this places the check_type_size()
for pcap_if_t into a context with CMAKE_REQUIRED_LIBRARIES already set
to PCAP_LIBRARIES.  This works only if check_type_size() does not have
to check for <sys/types.h>, <stdint.h> or <stddef.h> implicitly.  This
was the case so long as another check_type_size() before the
CMAKE_REQUIRED_LIBRARIES change made the implicit checks and cached the
results, but removing that earlier instance resulted in a warning:

  Policy CMP0075 is not set: Include file check macros honor
  CMAKE_REQUIRED_LIBRARIES.  Run "cmake --help-policy CMP0075" for policy
  details.  Use the cmake_policy command to set the policy and suppress this
  warning.

  CMAKE_REQUIRED_LIBRARIES is set to:

    /usr/lib/x86_64-linux-gnu/libpcap.so

  For compatibility with CMake 3.11 and below this check is ignoring it.

To fix that, in both Autoconf and CMake make the two checks separate and
unconditional and place the check for pcap_if_t where it fits better.
In CMake remove the earlier workaround with in6_addr.

(backported from commit 161c18fa34a4f28d9671afa5bdc10f53bc2ef422)
CMakeLists.txt
configure.ac