summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorDenis Ovsienko <denis@ovsienko.info>2023-02-21 08:02:28 +0000
committerDenis Ovsienko <denis@ovsienko.info>2023-02-22 20:05:58 +0000
commit10b807441e79f9c9e557bbb44ae0ecfe01ed5151 (patch)
treed7da9a0f2ba7dad133266afd85c376d061fdb5e1 /configure.ac
parent64a786abab1ede316c9b23b0ba6efb28bf51917e (diff)
downloadtcpdump-10b807441e79f9c9e557bbb44ae0ecfe01ed5151.tar.gz
Detect OS IPv6 support using AF_INET6 only.
tcpdump source code has not been using struct in6_addr since commit 0c9cfdc in 2019, so lose the conditional structure declaration, which is a no-op. Since commit de7c619 in 2015 netdissect-stdinc.h on Windows defines HAVE_OS_IPV6_SUPPORT if AF_INET6 if defined, which makes it equivalent to AF_INET6. On Unix-like systems taking struct in6_addr out of scope would make HAVE_OS_IPV6_SUPPORT equivalent to AF_INET6, thus after removing struct in6_addr remove HAVE_OS_IPV6_SUPPORT together with Autoconf and CMake checks that define it. Leave an unrelated CMake workaround in place for later debugging. On Windows do not define AF_INET6 if it is not defined, which makes AF_INET6 a universal indicator of the OS IPv6 support on all supported OSes. The few remaining use cases that genuinely need AF_INET6 use it to make OS API calls, so if the macro is not defined, it most likely means such an API call in the best case would return just a well-formed error status. With this in mind, in win32_gethostbyaddr() and ip6addr_string() guard all IPv6-specific code with #ifdef AF_INET6. In tcpdump.c add a comment to note why a guard is not required for Casper-specific conditional code that uses AF_INET6. This way when the OS does not support IPv6, IPv6 addresses will not resolve to names, which is expected. Other than that, tcpdump should be able to process IPv6 addresses the usual way regardless if the OS would be able to process the packets with these addresses.
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac41
1 files changed, 0 insertions, 41 deletions
diff --git a/configure.ac b/configure.ac
index 2b12f58f..ee26ffc0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -261,47 +261,6 @@ fi
#
AC_LBL_LIBRARY_NET
-#
-# Check whether AF_INET6 and struct in6_addr are defined.
-# If they aren't both defined, we don't have sufficient OS
-# support for IPv6, so we don't look for IPv6 support libraries,
-# and we define AF_INET6 and struct in6_addr ourselves.
-#
-AC_MSG_CHECKING([whether the operating system supports IPv6])
-AC_COMPILE_IFELSE(
- [
- AC_LANG_SOURCE(
- [[
-#include <string.h>
-/* AF_INET6 available check */
-#include <sys/types.h>
-#ifdef _WIN32
-#include <ws2tcpip.h>
-#else
-#include <sys/socket.h>
-#include <netinet/in.h>
-#endif
-#ifdef AF_INET6
-void
-foo(struct in6_addr *addr)
-{
- memset(addr, 0, sizeof (struct in6_addr));
-}
-#else
-#error "AF_INET6 not defined"
-#endif
- ]])
- ],
- [
- AC_MSG_RESULT(yes)
- AC_DEFINE(HAVE_OS_IPV6_SUPPORT, 1,
- [define if the OS provides AF_INET6 and struct in6_addr])
- ],
- [
- AC_MSG_RESULT(no)
- ]
-)
-
AC_REPLACE_FUNCS(strlcat strlcpy strsep getservent getopt_long)
AC_CHECK_FUNCS(fork vfork)
AC_CHECK_FUNCS(setlinebuf)