mirror of
https://github.com/freebsd/freebsd-src.git
synced 2024-11-26 20:12:44 +00:00
tcpdump: Update to 4.99.5
Changes: https://git.tcpdump.org/tcpdump/blob/4a789712f187e3ac7b2c0044c3a3f8c71b83646e:/CHANGES Obtained from: https://www.tcpdump.org/release/tcpdump-4.99.5.tar.xz Sponsored by: The FreeBSD Foundation
This commit is contained in:
commit
0a7e5f1f02
@ -1,3 +1,128 @@
|
||||
Friday, August 30, 2024 / The Tcpdump Group
|
||||
Summary for 4.99.5 tcpdump release
|
||||
Refine protocol decoding for:
|
||||
Arista: Use the test .pcap file from pull request #955 (HwInfo).
|
||||
BGP: Fix an undefined behavior when it tries to parse a too-short packet.
|
||||
CARP: Print the protocol name before any GET_().
|
||||
CDP: only hex-dump unknown TLVs in verbose mode.
|
||||
DHCP: parse the SZTP redirect tag.
|
||||
DHCPv6: client-id/server-id DUID type 2 correction; parse the user class,
|
||||
boot file URL, and SZTP redirect options; add DUID-UUID printing
|
||||
(RFC6355).
|
||||
DNS: Detect and correctly handle too-short URI RRs.
|
||||
EAP: Assign ndo_protocol in the eap_print() function.
|
||||
ESP: Don't use EVP_add_cipher_alias() (fixes building on OpenBSD 7.5).
|
||||
Frame Relay (Multilink): Fix the Timestamp Information Element printing.
|
||||
ICMPv6: Fix printing the Home Agent Address Discovery Reply Message.
|
||||
IEEE 802.11: no need for an element ID in the structures for IEs, make
|
||||
the length in the IE structures a u_int, include the "TA" field while
|
||||
printing Block Ack Control frame.
|
||||
IP: Enable TSO (TCP Segmentation Offload) support; fix printing invalid
|
||||
cases as invalid, not truncated; use ND_ICHECKMSG_ZU() to test the
|
||||
header length.
|
||||
IPv6: Fix printing invalid cases as invalid, not truncated; use
|
||||
ND_ICHECKMSG_U() to print an invalid version.
|
||||
IPv6: Fix invalid 32-bit versus 64-bit printouts of fragment headers.
|
||||
ISAKMP: Fix printing Delete payload SPI when size is zero.
|
||||
Kerberos: Print the protocol name, remove a redundant bounds check.
|
||||
lwres: Fix an undefined behavior in pointer arithmetic.
|
||||
OpenFlow 1.0: Fix indentation of PORT_MOD, improve handling of
|
||||
some lengths, and fix handling of snapend.
|
||||
TCP: Test ports < 1024 in port order to select the printer.
|
||||
UDP: Move source port equal BCM_LI_PORT to bottom of long if else chain.
|
||||
UDP: Test ports < 1024 in port order to select the printer.
|
||||
LDP: Add missing fields of the Common Session Parameters TLV and fix the
|
||||
offset for the A&D bits.
|
||||
NFLOG: Use correct AF code points on all OSes.
|
||||
NFS: Avoid printing non-ASCII characters.
|
||||
OSPF: Pad TLVs in LS_OPAQUE_TYPE_RI to multiples of 4 bytes.
|
||||
OSPF: Update LS-Ack printing not to run off the end of the packet.
|
||||
OSPF6: Fix an undefined behavior.
|
||||
pflog: use nd_ types in struct pfloghdr.
|
||||
PPP: Check if there is some data to hexdump.
|
||||
PPP: Remove an extra colon before LCP Callback Operation.
|
||||
Use the buffer stack for de-escaping PPP; fixes CVE-2024-2397;
|
||||
Note: This problem does not affect any tcpdump release.
|
||||
PTP: Fix spelling of type SIGNALING, Parse major and minor version
|
||||
correctly, Print majorSdoId field instead of just the first bit.
|
||||
RIP: Make a couple trivial protocol updates.
|
||||
RPKI-Router: Refine length and bounds checks.
|
||||
RX: Use the "%Y-%m-%d" date format.
|
||||
smbutil.c: Use the "%Y-%m-%d" date format.
|
||||
SNMP: Fix two undefined behaviors.
|
||||
Text protocols: Fix printing truncation if it is not the case.
|
||||
ZEP: Use the "%Y-%m-%d" date format.
|
||||
ZMTP: Replace custom code with bittok2str().
|
||||
User interface:
|
||||
Print the supported time stamp types (-J) to stdout instead of stderr.
|
||||
Print the list of data link types (-L) to stdout instead of stderr.
|
||||
Use symmetrical quotation characters in error messages.
|
||||
Update --version option to print 32/64-bit build and time_t size.
|
||||
Improve error messages for invalid interface indexes specified
|
||||
with -i.
|
||||
Support "3des" as an alias for "des_ede3_cbc" even if the crypto
|
||||
library doesn't support adding aliases.
|
||||
Source code:
|
||||
tcpdump: Fix a memory leak.
|
||||
child_cleanup: reap as many child processes as possible.
|
||||
Ignore failures when setting the default "any" device DLL to LINUX_SLL2.
|
||||
Fix for backends which doesn't support capsicum.
|
||||
Update ND_BYTES_BETWEEN() macro for better accuracy.
|
||||
Update ND_BYTES_AVAILABLE_AFTER() macro for better accuracy.
|
||||
Introduce new ND_ICHECK*() macros to deduplicate more code.
|
||||
Skip privilege dropping when using -Z root on --with-user builds.
|
||||
Add a nd_printjn() function.
|
||||
Make nd_trunc_longjmp() not static inline.
|
||||
Include <time.h> from netdissect.h.
|
||||
Remove init_crc10_table() and the entourage.
|
||||
Initialize tzcode early.
|
||||
Capsicum support: Fix a 'not defined' macro error.
|
||||
Update the "Error converting time" tests for packet times.
|
||||
Fix warnings when building for 32-bit and defining _TIME_BITS=64.
|
||||
Free interface list just before exiting where it wasn't being
|
||||
freed.
|
||||
Building and testing:
|
||||
Add a configure option to help debugging (--enable-instrument-functions).
|
||||
At build time require a proof of suitable snprintf(3) implementation in
|
||||
libc (and document Solaris 9 as unsupported because of that).
|
||||
Makefile.in: Add two "touch .devel" commands in the releasecheck target.
|
||||
Autoconf: Get --with-user and --with-chroot right.
|
||||
Autoconf: Fix --static-pcap-only test on Solaris 10.
|
||||
Autoconf: Add some warning flags for clang 13 or newer.
|
||||
Autoconf: Update config.{guess,sub}, timestamps 2024-01-01.
|
||||
Autoconf: Add autogen.sh, remove configure and config.h.in and put
|
||||
these generated files in the release tarball.
|
||||
Autoconf: Update the install-sh script to the 2020-11-14.01 version.
|
||||
configure: Apply autoupdate 2.69.
|
||||
CMake: improve the comment before project(tcpdump C).
|
||||
Do not require vsnprintf().
|
||||
tests: Use the -tttt option, by default, for the tests.
|
||||
Autoconf, CMake: Get the size of a void * and a time_t.
|
||||
Fix propagation of cc_werr_cflags() output.
|
||||
Makefile.in: Fix the depend target.
|
||||
mkdep: Exit with a non-zero status if a command fails.
|
||||
Autoconf: use V_INCLS to update the list of include search paths.
|
||||
Autoconf: don't put anything before -I and -L flags for local libpcap.
|
||||
Autoconf, CMake: work around an Xcode 15+ issue.
|
||||
Autoconf, CMake: use pkg-config and Homebrew when looking for
|
||||
libcrypto.
|
||||
Fix Sun C invocation from CMake.
|
||||
mkdep: Use TMPDIR if it is set and not null.
|
||||
Add initial support for building with TinyCC.
|
||||
Makefile.in: Use the variable MAKE instead of the make command.
|
||||
Makefile.in: Add instrumentation configuration in releasecheck target.
|
||||
Make various improvements to the TESTrun script.
|
||||
Untangle detection of pcap_findalldevs().
|
||||
Autoconf: don't use egrep, use $EGREP.
|
||||
Autoconf: check for gethostbyaddr(), not gethostbyname().
|
||||
Autoconf, CMake: search for gethostbyaddr() in libnetwork.
|
||||
Make illumos build warning-free.
|
||||
Documentation:
|
||||
Fixed errors in doc/README.Win32.md and renamed it to README.windows.md.
|
||||
Make various improvements to the man page.
|
||||
Add initial README file for Haiku.
|
||||
Make various improvements to CONTRIBUTING.md.
|
||||
|
||||
Friday, April 7, 2023 / The Tcpdump Group
|
||||
Summary for 4.99.4 tcpdump release
|
||||
Source code:
|
||||
@ -184,7 +309,7 @@ Wednesday, June 9, 2021 by gharris
|
||||
Fix "make clean" for out-of-tree autotools builds
|
||||
CMake: add stuff from CMAKE_PREFIX_PATH to PKG_CONFIG_PATH.
|
||||
Documentation:
|
||||
man: Update a reference as www.cifs.org is gone. [skip ci]
|
||||
man: Update a reference as www.cifs.org is gone.
|
||||
man: Update DNS sections
|
||||
Solaris:
|
||||
Fix a compile error with Sun C
|
||||
@ -913,7 +1038,7 @@ Wed. April 25, 2007. ken@xelerance.com. Summary for 3.9.6 tcpdump release
|
||||
RFC 4340.
|
||||
Add support for per-VLAN spanning tree and per-VLAN rapid spanning tree
|
||||
Add support for Multiple-STP as per 802.1s
|
||||
Add support for the cisco propriatry 'dynamic trunking protocol'
|
||||
Add support for the cisco proprietary 'dynamic trunking protocol'
|
||||
Add support for the cisco proprietary VTP protocol
|
||||
Update dhcp6 options table as per IETF standardization activities
|
||||
|
||||
@ -1687,7 +1812,7 @@ v2.0.1 Sun Jan 26 21:10:10 PDT
|
||||
- Ultrix 4.0 is supported (also thanks to Jeff Mogul).
|
||||
|
||||
- IBM RT and Stanford Enetfilter support has been added by
|
||||
Rayan Zachariassen <rayan@canet.ca>. Tcpdump has been tested under
|
||||
Rayan Zachariassen <rayan@canet.ca>. tcpdump has been tested under
|
||||
both the vanilla Enetfilter interface, and the extended interface
|
||||
(#ifdef'd by IBMRTPC) present in the MERIT version of the Enetfilter.
|
||||
|
||||
|
@ -2,21 +2,26 @@ if(WIN32)
|
||||
#
|
||||
# We need 3.12 or later, so that we can set policy CMP0074; see
|
||||
# below.
|
||||
#
|
||||
cmake_minimum_required(VERSION 3.12)
|
||||
else(WIN32)
|
||||
#
|
||||
# For now, require only 2.8.6, just in case somebody is
|
||||
# configuring with CMake on a "long-term support" version
|
||||
# of some OS and that version supplies an older version of
|
||||
# CMake.
|
||||
# For now:
|
||||
#
|
||||
# If this is ever updated to CMake 3.1 or later, remove the
|
||||
# stuff in cmake/Modules/FindPCAP.cmake that appends subdirectories
|
||||
# of directories from CMAKE_PREFIX_PATH to the PKG_CONFIG_PATH
|
||||
# environment variable when running pkg-config, to make sure
|
||||
# it finds any .pc file from there.
|
||||
# if this is a version of CMake less than 3.5, require only
|
||||
# 2.8.12, just in case somebody is configuring with CMake
|
||||
# on a "long-term support" version # of some OS and that
|
||||
# version supplies an older version of CMake;
|
||||
#
|
||||
cmake_minimum_required(VERSION 2.8.12)
|
||||
# otherwise, require 3.5, so we don't get messages warning
|
||||
# that support for versions of CMake lower than 3.5 is
|
||||
# deprecated.
|
||||
#
|
||||
if(CMAKE_VERSION VERSION_LESS "3.5")
|
||||
cmake_minimum_required(VERSION 2.8.12)
|
||||
else()
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
endif()
|
||||
endif(WIN32)
|
||||
|
||||
#
|
||||
@ -77,7 +82,7 @@ endif()
|
||||
# If, for whatever reason, directories in which we search for external
|
||||
# libraries, other than the standard system library directories, are
|
||||
# added to the executable's rpath in the build process, we most
|
||||
# defintely want them in the installed image's rpath if they are
|
||||
# definitely want them in the installed image's rpath if they are
|
||||
# necessary in order to find the libraries at run time.
|
||||
#
|
||||
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
|
||||
@ -85,7 +90,13 @@ set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules)
|
||||
|
||||
#
|
||||
# OK, this is a royal pain.
|
||||
# We explicitly indicate what languages are used in tcpdump to avoid
|
||||
# checking for a C++ compiler.
|
||||
#
|
||||
# One reason to avoid that check is that there's no need to waste
|
||||
# configuration time performing it.
|
||||
#
|
||||
# Another reason is that:
|
||||
#
|
||||
# CMake will try to determine the sizes of some data types, including
|
||||
# void *, early in the process of configuration; apparently, it's done
|
||||
@ -111,11 +122,88 @@ set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules)
|
||||
# building 32-bit, the size for C++ will win, and, again, hilarity
|
||||
# will ensue.
|
||||
#
|
||||
# So we *explicitly* state that only C is used; there is currently no
|
||||
# C++ code in tcpdump.
|
||||
#
|
||||
project(tcpdump C)
|
||||
|
||||
#
|
||||
# Export the size of void * as SIZEOF_VOID_P so that it can be
|
||||
# tested with #if.
|
||||
#
|
||||
set(SIZEOF_VOID_P "${CMAKE_SIZEOF_VOID_P}")
|
||||
|
||||
#
|
||||
# Show the bit width for which we're compiling.
|
||||
# This can help debug problems if you're dealing with a compiler that
|
||||
# defaults to generating 32-bit code even when running on a 64-bit
|
||||
# platform, and where that platform may provide only 64-bit versions of
|
||||
# libraries that we might use (looking at *you*, Oracle Studio!).
|
||||
#
|
||||
if(CMAKE_SIZEOF_VOID_P EQUAL 4)
|
||||
message(STATUS "Building 32-bit")
|
||||
elseif(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
message(STATUS "Building 64-bit")
|
||||
endif()
|
||||
|
||||
#
|
||||
# Solaris pkg-config is annoying. For at least one package (D-Bus, I'm
|
||||
# looking at *you*!), there are separate include files for 32-bit and
|
||||
# 64-bit builds (I guess using "unsigned long long" as a 64-bit integer
|
||||
# type on a 64-bit build is like crossing the beams or something), and
|
||||
# there are two separate .pc files, so if we're doing a 32-bit build we
|
||||
# should make sure we look in /usr/lib/pkgconfig for .pc files and if
|
||||
# we're doing a 64-bit build we should make sure we look in
|
||||
# /usr/lib/amd64/pkgconfig for .pc files.
|
||||
#
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "SunOS" AND CMAKE_SYSTEM_VERSION MATCHES "5[.][0-9.]*")
|
||||
#
|
||||
# Note: string(REPLACE) does not appear to support using ENV{...}
|
||||
# as an argument, so we set a variable and then use set() to set
|
||||
# the environment variable.
|
||||
#
|
||||
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
#
|
||||
# 64-bit build. If /usr/lib/pkgconfig appears in the path,
|
||||
# prepend /usr/lib/amd64/pkgconfig to it; otherwise,
|
||||
# put /usr/lib/amd64 at the end.
|
||||
#
|
||||
if((NOT DEFINED ENV{PKG_CONFIG_PATH}) OR "$ENV{PKG_CONFIG_PATH}" EQUAL "")
|
||||
#
|
||||
# Not set, or empty. Set it to /usr/lib/amd64/pkgconfig.
|
||||
#
|
||||
set(fixed_path "/usr/lib/amd64/pkgconfig")
|
||||
elseif("$ENV{PKG_CONFIG_PATH}" MATCHES "/usr/lib/pkgconfig")
|
||||
#
|
||||
# It contains /usr/lib/pkgconfig. Prepend
|
||||
# /usr/lib/amd64/pkgconfig to /usr/lib/pkgconfig.
|
||||
#
|
||||
string(REPLACE "/usr/lib/pkgconfig"
|
||||
"/usr/lib/amd64/pkgconfig:/usr/lib/pkgconfig"
|
||||
fixed_path "$ENV{PKG_CONFIG_PATH}")
|
||||
else()
|
||||
#
|
||||
# Not empty, but doesn't contain /usr/lib/pkgconfig.
|
||||
# Append /usr/lib/amd64/pkgconfig to it.
|
||||
#
|
||||
set(fixed_path "$ENV{PKG_CONFIG_PATH}:/usr/lib/amd64/pkgconfig")
|
||||
endif()
|
||||
set(ENV{PKG_CONFIG_PATH} "${fixed_path}")
|
||||
elseif(CMAKE_SIZEOF_VOID_P EQUAL 4)
|
||||
#
|
||||
# 32-bit build. If /usr/amd64/lib/pkgconfig appears in the path,
|
||||
# prepend /usr/lib/pkgconfig to it.
|
||||
#
|
||||
if("$ENV{PKG_CONFIG_PATH}" MATCHES "/usr/lib/amd64/pkgconfig")
|
||||
#
|
||||
# It contains /usr/lib/amd64/pkgconfig. Prepend
|
||||
# /usr/lib/pkgconfig to /usr/lib/amd64/pkgconfig.
|
||||
#
|
||||
string(REPLACE "/usr/lib/amd64/pkgconfig"
|
||||
"/usr/lib/pkgconfig:/usr/lib/amd64/pkgconfig"
|
||||
fixed_path "$ENV{PKG_CONFIG_PATH}")
|
||||
set(ENV{PKG_CONFIG_PATH} "${fixed_path}")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
#
|
||||
# For checking if a compiler flag works and adding it if it does.
|
||||
#
|
||||
@ -266,8 +354,6 @@ file(STRINGS ${tcpdump_SOURCE_DIR}/VERSION
|
||||
# Project settings
|
||||
######################################
|
||||
|
||||
add_definitions(-DHAVE_CONFIG_H)
|
||||
|
||||
include_directories(
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
${tcpdump_SOURCE_DIR}
|
||||
@ -320,10 +406,17 @@ include(CheckStructHasMember)
|
||||
include(CheckVariableExists)
|
||||
include(CheckTypeSize)
|
||||
|
||||
#
|
||||
# Get the size of a time_t, to know whether it's 32-bit or 64-bit.
|
||||
#
|
||||
cmake_push_check_state()
|
||||
set(CMAKE_EXTRA_INCLUDE_FILES time.h)
|
||||
check_type_size("time_t" SIZEOF_TIME_T)
|
||||
cmake_pop_check_state()
|
||||
|
||||
#
|
||||
# Header files.
|
||||
#
|
||||
check_include_file(fcntl.h HAVE_FCNTL_H)
|
||||
check_include_file(rpc/rpc.h HAVE_RPC_RPC_H)
|
||||
check_include_file(net/if.h HAVE_NET_IF_H)
|
||||
if(HAVE_RPC_RPC_H)
|
||||
@ -368,7 +461,12 @@ else(WIN32)
|
||||
if(LIBNSL_HAS_GETHOSTBYADDR)
|
||||
set(TCPDUMP_LINK_LIBRARIES ${TCPDUMP_LINK_LIBRARIES} nsl)
|
||||
else(LIBNSL_HAS_GETHOSTBYADDR)
|
||||
message(FATAL_ERROR "gethostbyaddr is required, but wasn't found")
|
||||
check_library_exists(network gethostbyaddr "" LIBNETWORK_HAS_GETHOSTBYADDR)
|
||||
if(LIBNETWORK_HAS_GETHOSTBYADDR)
|
||||
set(TCPDUMP_LINK_LIBRARIES ${TCPDUMP_LINK_LIBRARIES} network)
|
||||
else(LIBNETWORK_HAS_GETHOSTBYADDR)
|
||||
message(FATAL_ERROR "gethostbyaddr is required, but wasn't found")
|
||||
endif(LIBNETWORK_HAS_GETHOSTBYADDR)
|
||||
endif(LIBNSL_HAS_GETHOSTBYADDR)
|
||||
endif(LIBSOCKET_HAS_GETHOSTBYADDR)
|
||||
endif(NOT STDLIBS_HAVE_GETHOSTBYADDR)
|
||||
@ -396,20 +494,68 @@ endif(STDLIBS_HAVE_GETSERVENT)
|
||||
cmake_pop_check_state()
|
||||
|
||||
#
|
||||
# Make sure we have vsnprintf() and snprintf(); we require them.
|
||||
# We use check_symbol_exists(), as they aren't necessarily external
|
||||
# functions - in Visual Studio, for example, they're inline functions
|
||||
# calling a common external function.
|
||||
# Make sure we have snprintf(); we require it.
|
||||
# We use check_symbol_exists(), as it isn't necessarily an external
|
||||
# function - in Visual Studio, for example, it is an inline function
|
||||
# calling an external function.
|
||||
#
|
||||
check_symbol_exists(vsnprintf "stdio.h" HAVE_VSNPRINTF)
|
||||
if(NOT HAVE_VSNPRINTF)
|
||||
message(FATAL_ERROR "vsnprintf() is required but wasn't found")
|
||||
endif(NOT HAVE_VSNPRINTF)
|
||||
check_symbol_exists(snprintf "stdio.h" HAVE_SNPRINTF)
|
||||
if(NOT HAVE_SNPRINTF)
|
||||
message(FATAL_ERROR "snprintf() is required but wasn't found")
|
||||
endif()
|
||||
|
||||
#
|
||||
# Require a proof of suitable snprintf(3), same as in Autoconf.
|
||||
#
|
||||
include(CheckCSourceRuns)
|
||||
check_c_source_runs("
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <inttypes.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
char buf[100];
|
||||
uint64_t t = (uint64_t)1 << 32;
|
||||
|
||||
snprintf(buf, sizeof(buf), \"%zu\", sizeof(buf));
|
||||
if (strncmp(buf, \"100\", sizeof(buf)))
|
||||
return 1;
|
||||
|
||||
snprintf(buf, sizeof(buf), \"%zd\", -sizeof(buf));
|
||||
if (strncmp(buf, \"-100\", sizeof(buf)))
|
||||
return 2;
|
||||
|
||||
snprintf(buf, sizeof(buf), \"%\" PRId64, -t);
|
||||
if (strncmp(buf, \"-4294967296\", sizeof(buf)))
|
||||
return 3;
|
||||
|
||||
snprintf(buf, sizeof(buf), \"0o%\" PRIo64, t);
|
||||
if (strncmp(buf, \"0o40000000000\", sizeof(buf)))
|
||||
return 4;
|
||||
|
||||
snprintf(buf, sizeof(buf), \"0x%\" PRIx64, t);
|
||||
if (strncmp(buf, \"0x100000000\", sizeof(buf)))
|
||||
return 5;
|
||||
|
||||
snprintf(buf, sizeof(buf), \"%\" PRIu64, t);
|
||||
if (strncmp(buf, \"4294967296\", sizeof(buf)))
|
||||
return 6;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
"
|
||||
SUITABLE_SNPRINTF
|
||||
)
|
||||
if(NOT SUITABLE_SNPRINTF)
|
||||
message(FATAL_ERROR
|
||||
"The snprintf(3) implementation in this libc is not suitable,
|
||||
tcpdump would not work correctly even if it managed to compile."
|
||||
)
|
||||
endif()
|
||||
|
||||
check_function_exists(getopt_long HAVE_GETOPT_LONG)
|
||||
check_function_exists(setlinebuf HAVE_SETLINEBUF)
|
||||
#
|
||||
@ -618,6 +764,14 @@ set(CMAKE_REQUIRED_INCLUDES ${PCAP_INCLUDE_DIRS})
|
||||
#
|
||||
check_include_file(pcap/pcap-inttypes.h HAVE_PCAP_PCAP_INTTYPES_H)
|
||||
|
||||
#
|
||||
# At compile time HAVE_PCAP_FINDALLDEVS depends on HAVE_PCAP_IF_T.
|
||||
#
|
||||
cmake_push_check_state()
|
||||
set(CMAKE_EXTRA_INCLUDE_FILES pcap.h)
|
||||
check_type_size(pcap_if_t PCAP_IF_T)
|
||||
cmake_pop_check_state()
|
||||
|
||||
#
|
||||
# Check for various functions in libpcap/WinPcap/Npcap.
|
||||
#
|
||||
@ -707,19 +861,6 @@ endif(HAVE_PCAP_CREATE)
|
||||
# if we have them.
|
||||
#
|
||||
check_function_exists(pcap_findalldevs HAVE_PCAP_FINDALLDEVS)
|
||||
if(HAVE_PCAP_FINDALLDEVS)
|
||||
#
|
||||
# Check for libpcap having pcap_findalldevs() but the pcap.h header
|
||||
# not having pcap_if_t; some versions of Mac OS X shipped with pcap.h
|
||||
# from 0.6 and libpcap 0.8, so that libpcap had pcap_findalldevs but
|
||||
# pcap.h didn't have pcap_if_t.
|
||||
#
|
||||
cmake_push_check_state()
|
||||
set(CMAKE_REQUIRED_INCLUDES ${PCAP_INCLUDE_DIRS})
|
||||
set(CMAKE_EXTRA_INCLUDE_FILES pcap.h)
|
||||
check_type_size(pcap_if_t PCAP_IF_T)
|
||||
cmake_pop_check_state()
|
||||
endif(HAVE_PCAP_FINDALLDEVS)
|
||||
check_function_exists(pcap_dump_flush HAVE_PCAP_DUMP_FLUSH)
|
||||
check_function_exists(pcap_lib_version HAVE_PCAP_LIB_VERSION)
|
||||
if(NOT HAVE_PCAP_LIB_VERSION)
|
||||
@ -728,8 +869,56 @@ endif(NOT HAVE_PCAP_LIB_VERSION)
|
||||
check_function_exists(pcap_setdirection HAVE_PCAP_SETDIRECTION)
|
||||
check_function_exists(pcap_set_immediate_mode HAVE_PCAP_SET_IMMEDIATE_MODE)
|
||||
check_function_exists(pcap_dump_ftell64 HAVE_PCAP_DUMP_FTELL64)
|
||||
check_function_exists(pcap_open HAVE_PCAP_OPEN)
|
||||
check_function_exists(pcap_findalldevs_ex HAVE_PCAP_FINDALLDEVS_EX)
|
||||
#
|
||||
# macOS Sonoma's libpcap includes stub versions of the remote-
|
||||
# capture APIs. They are exported as "weakly linked symbols".
|
||||
#
|
||||
# Xcode 15 offers only a macOS Sonoma SDK, which has a .tbd
|
||||
# file for libpcap that claims it includes those APIs. (Newer
|
||||
# versions of macOS don't provide the system shared libraries,
|
||||
# they only provide the dyld shared cache containing those
|
||||
# libraries, so the OS provides SDKs that include a .tbd file
|
||||
# to use when linking.)
|
||||
#
|
||||
# This means that check_function_exists() will think that
|
||||
# the remote-capture APIs are present, including pcap_open()
|
||||
# and pcap_findalldevs_ex().
|
||||
#
|
||||
# However, they are *not* present in macOS Ventura and earlier,
|
||||
# which means that building on Ventura with Xcode 15 produces
|
||||
# executables that fail to start because one of those APIs
|
||||
# isn't found in the system libpcap.
|
||||
#
|
||||
# Protecting calls to those APIs with __builtin_available()
|
||||
# does not prevent this, because the libpcap header files
|
||||
# in the Sonoma SDK mark them as being first available
|
||||
# in macOS 10.13, just like all the other routines introduced
|
||||
# in libpcap 1.9, even though they're only available if libpcap
|
||||
# is built with remote capture enabled or stub routines are
|
||||
# provided. (A fix to enable this has been checked into the
|
||||
# libpcap repository, and may end up in a later version of
|
||||
# the SDK.)
|
||||
#
|
||||
# Given all that, and given that the versions of the
|
||||
# remote-capture APIs in Sonoma are stubs that always fail,
|
||||
# there doesn't seem to be any point in checking for pcap_open()
|
||||
# and pcap_findalldevs_ex() if we're linking against the Apple libpcap.
|
||||
#
|
||||
# However, if we're *not* linking against the Apple libpcap,
|
||||
# we should check for it, so that we can use it if it's present.
|
||||
#
|
||||
# So we check for pcap_open() and pcap_findalldevs_ex() if 1) this isn't
|
||||
# macOS or 2) the the libpcap we found is not a system library, meaning
|
||||
# that its path begins neither with /usr/lib (meaning it's a system
|
||||
# dylib) nor /Application/Xcode.app (meaning it's a file in
|
||||
# the Xcode SDK).
|
||||
#
|
||||
if(NOT APPLE OR NOT
|
||||
(PCAP_LIBRARIES MATCHES "/usr/lib/.*" OR
|
||||
PCAP_LIBRARIES MATCHES "/Application/Xcode.app/.*"))
|
||||
check_function_exists(pcap_open HAVE_PCAP_OPEN)
|
||||
check_function_exists(pcap_findalldevs_ex HAVE_PCAP_FINDALLDEVS_EX)
|
||||
endif()
|
||||
|
||||
#
|
||||
# On Windows, check for pcap_wsockinit(); if we don't have it, check for
|
||||
@ -787,11 +976,6 @@ endif(WITH_SMI)
|
||||
if(WITH_CRYPTO)
|
||||
find_package(CRYPTO)
|
||||
if(CRYPTO_FOUND)
|
||||
#
|
||||
# Check for some headers and functions.
|
||||
#
|
||||
check_include_file(openssl/evp.h HAVE_OPENSSL_EVP_H)
|
||||
|
||||
#
|
||||
# 1) do we have EVP_CIPHER_CTX_new?
|
||||
# If so, we use it to allocate an EVP_CIPHER_CTX, as
|
||||
@ -958,9 +1142,9 @@ if(EXISTS ${CMAKE_SOURCE_DIR}/.devel OR EXISTS ${CMAKE_BINARY_DIR}/.devel)
|
||||
# We do *not* care whether a structure had padding added at
|
||||
# the end because of __declspec(align) - *we* don't use
|
||||
# __declspec(align), because the only structures whose layout
|
||||
# we precisely specify are those that get overlayed on packet
|
||||
# we precisely specify are those that get overlaid on packet
|
||||
# data, and in those every element is an array of octets so
|
||||
# that we have full control over the size and aligmnet, and,
|
||||
# that we have full control over the size and alignment, and,
|
||||
# apparently, jmp_buf has such a declaration on x86, meaning
|
||||
# that everything that includes netdissect.h, i.e. almost every
|
||||
# file in tcpdump, gets a warning.
|
||||
@ -979,12 +1163,19 @@ if(EXISTS ${CMAKE_SOURCE_DIR}/.devel OR EXISTS ${CMAKE_BINARY_DIR}/.devel)
|
||||
check_and_add_compiler_option(-Wmissing-prototypes)
|
||||
check_and_add_compiler_option(-Wmissing-variable-declarations)
|
||||
check_and_add_compiler_option(-Wold-style-definition)
|
||||
check_and_add_compiler_option(-Wpedantic)
|
||||
if(NOT CMAKE_C_COMPILER_ID MATCHES "Sun")
|
||||
# In Sun C versions that implement GCC compatibility "-Wpedantic"
|
||||
# means the same as "-pedantic". The latter is mutually exclusive
|
||||
# with several other options. One of those is "-xc99", which has
|
||||
# already been set for Sun C above.
|
||||
check_and_add_compiler_option(-Wpedantic)
|
||||
endif()
|
||||
check_and_add_compiler_option(-Wpointer-arith)
|
||||
check_and_add_compiler_option(-Wpointer-sign)
|
||||
check_and_add_compiler_option(-Wshadow)
|
||||
check_and_add_compiler_option(-Wsign-compare)
|
||||
check_and_add_compiler_option(-Wstrict-prototypes)
|
||||
check_and_add_compiler_option(-Wundef)
|
||||
check_and_add_compiler_option(-Wunreachable-code-return)
|
||||
check_and_add_compiler_option(-Wused-but-marked-unused)
|
||||
check_and_add_compiler_option(-Wwrite-strings)
|
||||
@ -998,9 +1189,13 @@ endif()
|
||||
# usage: cmake -DEXTRA_CFLAGS='-Wall -Wextra -Werror' ...
|
||||
#
|
||||
if(NOT "${EXTRA_CFLAGS}" STREQUAL "")
|
||||
foreach(_extra_cflag ${EXTRA_CFLAGS})
|
||||
check_and_add_compiler_option("${_extra_cflag}")
|
||||
endforeach(_extra_cflag)
|
||||
# The meaning of EXTRA_CFLAGS is "use the exact specified options, or the
|
||||
# build risks failing to fail", not "try every specified option, omit those
|
||||
# that do not work and use the rest". Thus use add_compile_options(), not
|
||||
# foreach()/check_and_add_compiler_option(). Another reason to do that is
|
||||
# that the effect lasts in testprogs/ and testprogs/fuzz/.
|
||||
string(REPLACE " " ";" _extra_cflags_list ${EXTRA_CFLAGS})
|
||||
add_compile_options(${_extra_cflags_list})
|
||||
message(STATUS "Added extra compile options (${EXTRA_CFLAGS})")
|
||||
endif()
|
||||
|
||||
|
@ -36,17 +36,17 @@ and ask!
|
||||
|
||||
## How to add new code and to update existing code
|
||||
|
||||
0) Check that there isn't a pull request already opened for the changes you
|
||||
1) Check that there isn't a pull request already opened for the changes you
|
||||
intend to make.
|
||||
|
||||
1) [Fork](https://help.github.com/articles/fork-a-repo/) the Tcpdump
|
||||
2) [Fork](https://help.github.com/articles/fork-a-repo/) the Tcpdump
|
||||
[repository](https://github.com/the-tcpdump-group/tcpdump).
|
||||
|
||||
2) The easiest way to test your changes on multiple operating systems and
|
||||
3) The easiest way to test your changes on multiple operating systems and
|
||||
architectures is to let the upstream CI test your pull request (more on
|
||||
this below).
|
||||
|
||||
3) Setup your git working copy
|
||||
4) Setup your git working copy
|
||||
```
|
||||
git clone https://github.com/<username>/tcpdump.git
|
||||
cd tcpdump
|
||||
@ -54,19 +54,19 @@ and ask!
|
||||
git fetch upstream
|
||||
```
|
||||
|
||||
4) Do a `touch .devel` in your working directory.
|
||||
5) Do a `touch .devel` in your working directory.
|
||||
Currently, the effect is
|
||||
* add (via `configure`, in `Makefile`) some warnings options (`-Wall`,
|
||||
`-Wmissing-prototypes`, `-Wstrict-prototypes`, ...) to the compiler if it
|
||||
supports these options,
|
||||
* have the `Makefile` support `make depend` and the `configure` script run it.
|
||||
|
||||
5) Configure and build
|
||||
6) Configure and build
|
||||
```
|
||||
./configure && make -s && make check
|
||||
```
|
||||
|
||||
6) Add/update tests
|
||||
7) Add/update tests
|
||||
The `tests` directory contains regression tests of the dissection of captured
|
||||
packets. Those captured packets were saved running tcpdump with option
|
||||
`-w sample.pcap`. Additional options, such as `-n`, are used to create relevant
|
||||
@ -96,12 +96,12 @@ and ask!
|
||||
It is often useful to have test outputs with different verbosity levels
|
||||
(none, `-v`, `-vv`, `-vvv`, etc.) depending on the code.
|
||||
|
||||
7) Test using `make check` (current build options) and `./build_matrix.sh`
|
||||
8) Test using `make check` (current build options) and `./build_matrix.sh`
|
||||
(a multitude of build options, build systems and compilers). If you can,
|
||||
test on more than one operating system. Don't send a pull request until
|
||||
all tests pass.
|
||||
|
||||
8) Try to rebase your commits to keep the history simple.
|
||||
9) Try to rebase your commits to keep the history simple.
|
||||
```
|
||||
git fetch upstream
|
||||
git rebase upstream/master
|
||||
@ -109,32 +109,76 @@ and ask!
|
||||
(If the rebase fails and you cannot resolve, issue `git rebase --abort`
|
||||
and ask for help in the pull request comment.)
|
||||
|
||||
9) Once 100% happy, put your work into your forked repository using `git push`.
|
||||
10) Once 100% happy, put your work into your forked repository using `git push`.
|
||||
|
||||
10) [Initiate and send](https://help.github.com/articles/using-pull-requests/)
|
||||
11) [Initiate and send](https://help.github.com/articles/using-pull-requests/)
|
||||
a pull request.
|
||||
This will trigger the upstream repository CI tests.
|
||||
|
||||
|
||||
## Code style and generic remarks
|
||||
* A thorough reading of some other printers code is useful.
|
||||
1) A thorough reading of some other printers code is useful.
|
||||
|
||||
* Put the normative reference if any as comments (RFC, etc.).
|
||||
2) To help learn how tcpdump works or to help debugging:
|
||||
You can configure and build tcpdump with the instrumentation of functions:
|
||||
```
|
||||
$ ./configure --enable-instrument-functions
|
||||
$ make -s clean all
|
||||
```
|
||||
|
||||
* Put the format of packets/headers/options as comments if there is no
|
||||
This generates instrumentation calls for entry and exit to functions.
|
||||
Just after function entry and just before function exit, these
|
||||
profiling functions are called and print the function names with
|
||||
indentation and call level.
|
||||
|
||||
If entering in a function, it prints also the calling function name with
|
||||
file name and line number. There may be a small shift in the line number.
|
||||
|
||||
In some cases, with Clang 11, the file number is unknown (printed '??')
|
||||
or the line number is unknown (printed '?'). In this case, use GCC.
|
||||
|
||||
If the environment variable INSTRUMENT is
|
||||
- unset or set to an empty string, print nothing, like with no
|
||||
instrumentation
|
||||
- set to "all" or "a", print all the functions names
|
||||
- set to "global" or "g", print only the global functions names
|
||||
|
||||
This allows to run:
|
||||
```
|
||||
$ INSTRUMENT=a ./tcpdump ...
|
||||
$ INSTRUMENT=g ./tcpdump ...
|
||||
$ INSTRUMENT= ./tcpdump ...
|
||||
```
|
||||
or
|
||||
```
|
||||
$ export INSTRUMENT=global
|
||||
$ ./tcpdump ...
|
||||
```
|
||||
|
||||
The library libbfd is used, therefore the binutils-dev package is required.
|
||||
|
||||
3) Put the normative reference if any as comments (RFC, etc.).
|
||||
|
||||
4) Put the format of packets/headers/options as comments if there is no
|
||||
published normative reference.
|
||||
|
||||
* The printer may receive incomplete packet in the buffer, truncated at any
|
||||
5) The printer may receive incomplete packet in the buffer, truncated at any
|
||||
random position, for example by capturing with `-s size` option.
|
||||
This means that an attempt to fetch packet data based on the expected
|
||||
format of the packet may run the risk of overrunning the buffer.
|
||||
|
||||
Furthermore, if the packet is complete, but is not correctly formed,
|
||||
that can also cause a printer to overrun the buffer, as it will be
|
||||
fetching packet data based on the expected format of the packet.
|
||||
|
||||
Therefore, integral, IPv4 address, and octet sequence values should
|
||||
be fetched using the `GET_*()` macros, which are defined in
|
||||
`extract.h`.
|
||||
|
||||
If your code reads and decodes every byte of the protocol packet, then to
|
||||
ensure proper and complete bounds checks it would be sufficient to read all
|
||||
packet data using the `GET_*()` macros, typically:
|
||||
```
|
||||
GET_U_1(p)
|
||||
GET_S_1(p)
|
||||
GET_BE_U_n(p), n in { 2, 3, 4, 5, 6, 7, 8 }
|
||||
GET_BE_S_n(p), n in { 2, 3, 4, 5, 6, 7, 8 }
|
||||
```
|
||||
packet data using the `GET_*()` macros.
|
||||
|
||||
If your code uses the macros above only on some packet data, then the gaps
|
||||
would have to be bounds-checked using the `ND_TCHECK_*()` macros:
|
||||
```
|
||||
@ -142,7 +186,14 @@ and ask!
|
||||
ND_TCHECK_SIZE(p)
|
||||
ND_TCHECK_LEN(p, l)
|
||||
```
|
||||
For the `ND_TCHECK_*` macros (if not already done):
|
||||
|
||||
where *p* points to the data not being decoded. For `ND_CHECK_n()`,
|
||||
*n* is the length of the gap, in bytes. For `ND_CHECK_SIZE()`, the
|
||||
length of the gap, in bytes, is the size of an item of the data type
|
||||
to which *p* points. For `ND_CHECK_LEN()`, *l* is the length of the
|
||||
gap, in bytes.
|
||||
|
||||
For the `GET_*()` and `ND_TCHECK_*` macros (if not already done):
|
||||
* Assign: `ndo->ndo_protocol = "protocol";`
|
||||
* Define: `ND_LONGJMP_FROM_TCHECK` before including `netdissect.h`
|
||||
* Make sure that the intersection of `GET_*()` and `ND_TCHECK_*()` is minimal,
|
||||
@ -155,19 +206,170 @@ and ask!
|
||||
```
|
||||
You should try several values for snaplen to do various truncation.
|
||||
|
||||
* Do invalid packet checks in code: Think that your code can receive in input
|
||||
* The `GET_*()` macros that fetch integral values are:
|
||||
```
|
||||
GET_U_1(p)
|
||||
GET_S_1(p)
|
||||
GET_BE_U_n(p), n in { 2, 3, 4, 5, 6, 7, 8 }
|
||||
GET_BE_S_n(p), n in { 2, 3, 4, 5, 6, 7, 8 }
|
||||
GET_LE_U_n(p), n in { 2, 3, 4, 5, 6, 7, 8 }
|
||||
GET_LE_S_n(p), n in { 2, 3, 4, 5, 6, 7, 8 }
|
||||
```
|
||||
|
||||
where *p* points to the integral value in the packet buffer. The
|
||||
macro returns the integral value at that location.
|
||||
|
||||
`U` indicates that an unsigned value is fetched; `S` indicates that a
|
||||
signed value is fetched. For multi-byte values, `BE` indicates that
|
||||
a big-endian value ("network byte order") is fetched, and `LE`
|
||||
indicates that a little-endian value is fetched. *n* is the length,
|
||||
in bytes, of the multi-byte integral value to be fetched.
|
||||
|
||||
In addition to the bounds checking the `GET_*()` macros perform,
|
||||
using those macros has other advantages:
|
||||
|
||||
* tcpdump runs on both big-endian and little-endian systems, so
|
||||
fetches of multi-byte integral values must be done in a fashion
|
||||
that works regardless of the byte order of the machine running
|
||||
tcpdump. The `GET_BE_*()` macros will fetch a big-endian value and
|
||||
return a host-byte-order value on both big-endian and little-endian
|
||||
machines, and the `GET_LE_*()` macros will fetch a little-endian
|
||||
value and return a host-byte-order value on both big-endian and
|
||||
little-endian machines.
|
||||
|
||||
* tcpdump runs on machines that do not support unaligned access to
|
||||
multi-byte values, and packet values are not guaranteed to be
|
||||
aligned on the proper boundary. The `GET_BE_*()` and `GET_LE_*()`
|
||||
macros will fetch values even if they are not aligned on the proper
|
||||
boundary.
|
||||
|
||||
* The `GET_*()` macros that fetch IPv4 address values are:
|
||||
```
|
||||
GET_IPV4_TO_HOST_ORDER(p)
|
||||
GET_IPV4_TO_NETWORK_ORDER(p)
|
||||
```
|
||||
|
||||
where *p* points to the address in the packet buffer.
|
||||
`GET_IPV4_TO_HOST_ORDER()` returns the address in the byte order of
|
||||
the host that is running tcpdump; `GET_IPV4_TO_NETWORK_ORDER()`
|
||||
returns it in network byte order.
|
||||
|
||||
Like the integral `GET_*()` macros, these macros work correctly on
|
||||
both big-endian and little-endian machines and will fetch values even
|
||||
if they are not aligned on the proper boundary.
|
||||
|
||||
* The `GET_*()` macro that fetches an arbitrary sequences of bytes is:
|
||||
```
|
||||
GET_CPY_BYTES(dst, p, len)
|
||||
```
|
||||
|
||||
where *dst* is the destination to which the sequence of bytes should
|
||||
be copied, *p* points to the first byte of the sequence of bytes, and
|
||||
*len* is the number of bytes to be copied. The bytes are copied in
|
||||
the order in which they appear in the packet.
|
||||
|
||||
* To fetch a network address and convert it to a printable string, use
|
||||
the following `GET_*()` macros, defined in `addrtoname.h`, to
|
||||
perform bounds checks to make sure the entire address is within the
|
||||
buffer and to translate the address to a string to print:
|
||||
```
|
||||
GET_IPADDR_STRING(p)
|
||||
GET_IP6ADDR_STRING(p)
|
||||
GET_MAC48_STRING(p)
|
||||
GET_EUI64_STRING(p)
|
||||
GET_EUI64LE_STRING(p)
|
||||
GET_LINKADDR_STRING(p, type, len)
|
||||
GET_ISONSAP_STRING(nsap, nsap_length)
|
||||
```
|
||||
|
||||
`GET_IPADDR_STRING()` fetches an IPv4 address pointed to by *p* and
|
||||
returns a string that is either a host name, if the `-n` flag wasn't
|
||||
specified and a host name could be found for the address, or the
|
||||
standard XXX.XXX.XXX.XXX-style representation of the address.
|
||||
|
||||
`GET_IP6ADDR_STRING()` fetches an IPv6 address pointed to by *p* and
|
||||
returns a string that is either a host name, if the `-n` flag wasn't
|
||||
specified and a host name could be found for the address, or the
|
||||
standard XXXX::XXXX-style representation of the address.
|
||||
|
||||
`GET_MAC48_STRING()` fetches a 48-bit MAC address (Ethernet, 802.11,
|
||||
etc.) pointed to by *p* and returns a string that is either a host
|
||||
name, if the `-n` flag wasn't specified and a host name could be
|
||||
found in the ethers file for the address, or the standard
|
||||
XX:XX:XX:XX:XX:XX-style representation of the address.
|
||||
|
||||
`GET_EUI64_STRING()` fetches a 64-bit EUI pointed to by *p* and
|
||||
returns a string that is the standard XX:XX:XX:XX:XX:XX:XX:XX-style
|
||||
representation of the address.
|
||||
|
||||
`GET_EUI64LE_STRING()` fetches a 64-bit EUI, in reverse byte order,
|
||||
pointed to by *p* and returns a string that is the standard
|
||||
XX:XX:XX:XX:XX:XX:XX:XX-style representation of the address.
|
||||
|
||||
`GET_LINKADDR_STRING()` fetches an octet string, of length *length*
|
||||
and type *type*, pointed to by *p* and returns a string whose format
|
||||
depends on the value of *type*:
|
||||
|
||||
* `LINKADDR_MAC48` - if the length is 6, the string has the same
|
||||
value as `GET_MAC48_STRING()` would return for that address,
|
||||
otherwise, the string is a sequence of XX:XX:... values for the bytes
|
||||
of the address;
|
||||
|
||||
* `LINKADDR_FRELAY` - the string is "DLCI XXX", where XXX is the
|
||||
DLCI, if the address is a valid Q.922 header, and an error indication
|
||||
otherwise;
|
||||
|
||||
* `LINKADDR_EUI64`, `LINKADDR_ATM`, `LINKADDR_OTHER` -
|
||||
the string is a sequence of XX:XX:... values for the bytes
|
||||
of the address.
|
||||
|
||||
6) When defining a structure corresponding to a packet or part of a
|
||||
packet, so that a pointer to packet data can be cast to a pointer to
|
||||
that structure and that structure pointer used to refer to fields in
|
||||
the packet, use the `nd_*` types for the structure members.
|
||||
|
||||
Those types all are aligned only on a 1-byte boundary, so a
|
||||
compiler will not assume that the structure is aligned on a boundary
|
||||
stricter than one byte; there is no guarantee that fields in packets
|
||||
are aligned on any particular boundary.
|
||||
|
||||
This means that all padding in the structure must be explicitly
|
||||
declared as fields in the structure.
|
||||
|
||||
The `nd_*` types for integral values are:
|
||||
|
||||
* `nd_uintN_t`, for unsigned integral values, where *N* is the number
|
||||
of bytes in the value.
|
||||
* `nd_intN_t`, for signed integral values, where *N* is the number
|
||||
of bytes in the value.
|
||||
|
||||
The `nd_*` types for IP addresses are:
|
||||
|
||||
* `nd_ipv4`, for IPv4 addresses;
|
||||
* `nd_ipv6`, for IPv6 addresses.
|
||||
|
||||
The `nd_*` types for link-layer addresses are:
|
||||
|
||||
* `nd_mac48`, for MAC-48 (Ethernet, 802.11, etc.) addresses;
|
||||
* `nd_eui64`, for EUI-64 values.
|
||||
|
||||
The `nd_*` type for a byte in a sequence of bytes is `nd_byte`; an
|
||||
*N*-byte sequence should be declared as `nd_byte[N]`.
|
||||
|
||||
7) Do invalid packet checks in code: Think that your code can receive in input
|
||||
not only a valid packet but any arbitrary random sequence of octets (packet
|
||||
* built malformed originally by the sender or by a fuzz tester,
|
||||
* became corrupted in transit or for some other reason).
|
||||
|
||||
Print with: `nd_print_invalid(ndo); /* to print " (invalid)" */`
|
||||
|
||||
* Use `struct tok` for indexed strings and print them with
|
||||
8) Use `struct tok` for indexed strings and print them with
|
||||
`tok2str()` or `bittok2str()` (for flags).
|
||||
All `struct tok` must end with `{ 0, NULL }`.
|
||||
|
||||
* Avoid empty lines in output of printers.
|
||||
9) Avoid empty lines in output of printers.
|
||||
|
||||
* A commit message must have:
|
||||
10) A commit message must have:
|
||||
```
|
||||
First line: Capitalized short summary in the imperative (50 chars or less)
|
||||
|
||||
@ -179,13 +381,14 @@ and ask!
|
||||
the body.
|
||||
```
|
||||
|
||||
* Avoid non-ASCII characters in code and commit messages.
|
||||
11) Avoid non-ASCII characters in code and commit messages.
|
||||
|
||||
* Use the style of the modified sources.
|
||||
12) Use the style of the modified sources.
|
||||
|
||||
* Don't mix declarations and code.
|
||||
13) Don't mix declarations and code.
|
||||
|
||||
* Don't use `//` for comments.
|
||||
Not all C compilers accept C++/C99 comments by default.
|
||||
14) tcpdump requires a compiler that supports C99 or later, so C99
|
||||
features may be used in code, but C11 or later features should not be
|
||||
used.
|
||||
|
||||
* Avoid trailing tabs/spaces
|
||||
15) Avoid trailing tabs/spaces
|
||||
|
@ -8,15 +8,15 @@ The current maintainers (in alphabetical order):
|
||||
|
||||
Additional people who have contributed patches (in alphabetical order):
|
||||
Aaron Campbell <aaron at arbor dot net>
|
||||
A Costa <agcosta at gis dot net>
|
||||
ABHIMANYU <agupta07 at sourceforge dot net>
|
||||
A Costa <agcosta at gis dot net>
|
||||
Adam Sampson <ats at offog dot org>
|
||||
Ahmed Abdelsalam <ahabdels at gmail dot com>
|
||||
Ajith Adapa <adapa dot ajith at gmail dot com>
|
||||
Albert Chin <china at thewrittenword dot com>
|
||||
Alexandra Kossovsky <alexandra1975 at sourceforge dot net>
|
||||
Alexandr Nedvedicky <alexandr dot nedvedicky at oracle dot com>
|
||||
Alexandre Ferrieux <alexandre dot ferrieux at orange dot com>
|
||||
Alexandr Nedvedicky <alexandr dot nedvedicky at oracle dot com>
|
||||
Alexis La Goutte <alexis dot lagoutte at gmail dot com>
|
||||
Alfredo Andres <aandres at s21sec dot com>
|
||||
Ali Abdulkadir <autostart dot ini at gmail dot com>
|
||||
@ -58,6 +58,7 @@ Additional people who have contributed patches (in alphabetical order):
|
||||
bugyo <bugyo at users dot noreply dot github dot com>
|
||||
Carles Kishimoto Bisbe <ckishimo at ac dot upc dot es>
|
||||
Casey Deccio <casey at deccio dot net>
|
||||
Casper Andersson <casper dot casan at gmail dot com>
|
||||
Charles (Chas) Williams <chwillia at ciena dot com>
|
||||
Charles M. Hannum <mycroft at netbsd dot org>
|
||||
Charlie Lenahan <clenahan at fortresstech dot com>
|
||||
@ -71,6 +72,7 @@ Additional people who have contributed patches (in alphabetical order):
|
||||
Craig Leres <leres at xse dot com>
|
||||
Craig Rodrigues <rodrigc at mediaone dot net>
|
||||
Crist J. Clark <cjclark at alum dot mit dot edu>
|
||||
Dag-Erling Smørgrav <des at FreeBSD dot org>
|
||||
Dagobert Michelsen <dam at opencsw dot org>
|
||||
Daniel Hagerty <hag at ai dot mit dot edu>
|
||||
Daniel Lee <Longinus00 at gmail dot com>
|
||||
@ -81,18 +83,22 @@ Additional people who have contributed patches (in alphabetical order):
|
||||
David Cronin <davidcronin94 at gmail dot com>
|
||||
Davide Caratti <dcaratti at redhat dot com>
|
||||
David Horn <dhorn2000 at gmail dot com>
|
||||
David Karoly <david dot karoly at outlook dot com>
|
||||
David Mirabito <davidjm at arista dot com>
|
||||
David Smith <dsmith at redhat dot com>
|
||||
David Young <dyoung at ojctech dot com>
|
||||
Dion Bosschieter <dbosschieter at transip dot nl>
|
||||
Dmitrij Tejblum <tejblum at yandex-team dot ru>
|
||||
Dmitry Eremin-Solenikov <dbaryshkov at gmail dot com>
|
||||
Don Ebright <Don dot Ebright at compuware dot com>
|
||||
Dominique Martinet <dominique dot martinet at atmark-techno dot com>
|
||||
Donatas Abraitis <donatas dot abraitis at gmail dot com>
|
||||
Don Ebright <Don dot Ebright at compuware dot com>
|
||||
d simonov <simonov-d at yandex-team dot ru>
|
||||
Duane Wessels <dwessels at verisign dot com>
|
||||
Eamon Doyle <eamonjd at arista dot com>
|
||||
Eddie Kohler <xexd at sourceforge dot net>
|
||||
Ege Cetin <egecetin at hotmail dot com dot tr>
|
||||
Ed Maste <emaste at FreeBSD dot org>
|
||||
Ege Çetin <egecetin at hotmail dot com dot tr>
|
||||
Eliot Lear <lear at upstairs dot ofcourseimright dot com>
|
||||
Elmar Kirchner <elmar at juniper dot net>
|
||||
Eric S. Raymond <esr at thyrsus dot com>
|
||||
@ -109,10 +115,9 @@ Additional people who have contributed patches (in alphabetical order):
|
||||
Frank Volf <volf at oasis dot IAEhv dot nl>
|
||||
Fulvio Risso <risso at polito dot it>
|
||||
George Bakos <gbakos at ists dot dartmouth dot edu>
|
||||
Gerald Combs <gerald at ethereal dot com>
|
||||
Gerard Garcia <ggarcia at deic dot uab dot cat>
|
||||
George Neville-Neil <gnn at freebsd dot org>
|
||||
Gerald Combs <gerald at wireshark dot org>
|
||||
Gerard Garcia <ggarcia at deic dot uab dot cat>
|
||||
Gerrit Renker <gerrit at erg dot abdn dot ac dot uk>
|
||||
Gert Doering <gert at greenie dot muc dot de>
|
||||
Gianluca Varenni <gianluca dot varenni at gmail dot com>
|
||||
@ -130,6 +135,7 @@ Additional people who have contributed patches (in alphabetical order):
|
||||
Hannes Gredler <hannes at gredler dot at>
|
||||
Hannes Viertel <hviertel at juniper dot net>
|
||||
Hanno Böck <hanno at hboeck dot de>
|
||||
Hans Petter Selasky <hps at selasky dot org>
|
||||
Harry Raaymakers <harryr at connect dot com dot au>
|
||||
Heinz-Ado Arnolds <Ado dot Arnolds at dhm-systems dot de>
|
||||
Hendrik Scholz <hendrik at scholz dot net>
|
||||
@ -144,6 +150,7 @@ Additional people who have contributed patches (in alphabetical order):
|
||||
Jamal Hadi Salim <hadi at cyberus dot ca>
|
||||
James Ko <jck at exegin dot com>
|
||||
Jamie Bainbridge <jamie dot bainbridge at gmail dot com>
|
||||
Janne Heß <janne at hess dot ooo>
|
||||
Jan Oravec <wsx at wsx6 dot net>
|
||||
Jason L. Wright <jason at thought dot net>
|
||||
Jason R. Thorpe <thorpej at netbsd dot org>
|
||||
@ -152,15 +159,19 @@ Additional people who have contributed patches (in alphabetical order):
|
||||
Jefferson Ogata <jogata at nodc dot noaa dot gov>
|
||||
Jeffrey Hutzelman <jhutz at cmu dot edu>
|
||||
Jeremy Browne <jer at ifni dot ca>
|
||||
Jerome Duval <jerome dot duval at gmail dot com>
|
||||
Jesper Peterson <jesper at endace dot com>
|
||||
Jesse Gross <jesse at nicira dot com>
|
||||
Jesse Rosenstock <jmr at google dot com>
|
||||
Jim Hutchins <jim at ca dot sandia dot gov>
|
||||
João Medeiros <ignotus21 at sourceforge dot net>
|
||||
Job Snijders <job at instituut dot net>
|
||||
Joerg Mayer <jmayer at loplof dot de>
|
||||
Jonas Chianu <jchianu at onx-jchianu-02 dot ciena dot com>
|
||||
Jonathan Heusser <jonny at drugphish dot ch>
|
||||
Jorge Boncompte [DTI2] <jorge at dti2 dot net>
|
||||
Jørgen Thomsen <jth at jth dot net>
|
||||
Josh Soref <2119212+jsoref at users dot noreply dot github dot com>
|
||||
Julian Cowley <julian at lava dot net>
|
||||
Juliusz Chroboczek <jch at pps dot jussieu dot fr>
|
||||
Kaarthik Sivakumar <kaarthik at torrentnet dot com>
|
||||
@ -200,8 +211,10 @@ Additional people who have contributed patches (in alphabetical order):
|
||||
Martin Buck <mb-tmp-tvguho dot pbz at gromit dot dyndns dot org>
|
||||
Martin Husemann <martin at netbsd dot org>
|
||||
Martin Sehnoutka <msehnout at redhat dot com>
|
||||
Martin Willi <martin at strongswan dot org>
|
||||
Matt Eaton <agnosticdev at gmail dot com>
|
||||
Matthew Luckie <matthewluckie at sourceforge dot net>
|
||||
Matthew Martin <phy1729 at gmail dot com>
|
||||
Matthieu Boutier <boutier at pps dot univ-paris-diderot dot fr>
|
||||
Max Laier <max at love2party dot net>
|
||||
Michael A. Meffie III <meffie at sourceforge dot net>
|
||||
@ -232,11 +245,11 @@ Additional people who have contributed patches (in alphabetical order):
|
||||
Neil T. Spring <bluehal at users dot sourceforge dot net>
|
||||
Nicholas Reilly <nreilly at blackberry dot com>
|
||||
Nickolai Zeldovich <kolya at MIT dot EDU>
|
||||
Nikolay Edigaryev <edigaryev at gmail dot com>
|
||||
Nicolas Ferrero <toorop at babylo dot net>
|
||||
niks3089 <niks3089 at gmail dot com>
|
||||
Niels Provos <provos at openbsd dot org>
|
||||
Nikhil AP <nikhilap at arista dot com>
|
||||
Nikolay Edigaryev <edigaryev at gmail dot com>
|
||||
niks3089 <niks3089 at gmail dot com>
|
||||
Noritoshi Demizu <demizu at users dot sourceforge dot net>
|
||||
Olaf Kirch <okir at caldera dot de>
|
||||
Ola Martin Lykkja <ola dot lykkja at q-free dot com>
|
||||
@ -281,12 +294,13 @@ Additional people who have contributed patches (in alphabetical order):
|
||||
Roderick Schertler <roderick at argon dot org>
|
||||
Romain Francoise <rfrancoise at debian dot org>
|
||||
Romero Malaquias <romero dot malaquias at gmail dot com>
|
||||
Rose <83477269+AtariDreams at users dot noreply dot github dot com>
|
||||
Ruben Kerkhof <ruben at rubenkerkhof dot com>
|
||||
Rui Paulo <rpaulo at FreeBSD dot org>
|
||||
Sabrina Dubroca <sd at queasysnail dot net>
|
||||
Sagun Shakya <sagun dot shakya at sun dot com>
|
||||
Sam James <sam at gentoo dot org>
|
||||
Sami Farin <safari at iki dot fi>
|
||||
Sam James <sam at gentoo dot org>
|
||||
Sascha Wildner <swildner at sourceforge dot net>
|
||||
Sawssen Hadded <saw dot hadded at gmail dot com>
|
||||
Scott Mcmillan <scott dot a dot mcmillan at intel dot com>
|
||||
@ -304,8 +318,8 @@ Additional people who have contributed patches (in alphabetical order):
|
||||
Steinar Haug <sthaug at nethelp dot no>
|
||||
Stephane Bortzmeyer <stephane+github at bortzmeyer dot org>
|
||||
Steve Kay <stevekay at gmail dot com>
|
||||
Steve-o <fnjordy at sourceforge dot net>
|
||||
Steven H. Wang <wang dot steven dot h at gmail dot com>
|
||||
Steve-o <fnjordy at sourceforge dot net>
|
||||
Swaathi Vetrivel <swaathiv at juniper dot net>
|
||||
Swaminathan Chandrasekaran <chander at juniper dot net>
|
||||
Takashi Yamamoto <yamt at mwd dot biglobe dot ne dot jp>
|
||||
|
@ -3,7 +3,7 @@ If you have not built libpcap, and your system does not have libpcap
|
||||
installed, install libpcap first. Your system might provide a version
|
||||
of libpcap that can be installed; if so, to compile tcpdump you might
|
||||
need to install a "developer" version of libpcap as well as the
|
||||
"run-time" version. You can also install tcpdump.org's version of
|
||||
"run-time" version. You can also install The Tcpdump Group version of
|
||||
libpcap; see [this file](README.md) for the location.
|
||||
|
||||
You will need a C99 compiler to build tcpdump. The build system
|
||||
@ -12,16 +12,34 @@ the generally available GNU C compiler (GCC) or Clang.
|
||||
|
||||
After libpcap has been built (either install it with `make install` or
|
||||
make sure both the libpcap and tcpdump source trees are in the same
|
||||
directory), run `./configure` (a shell script). `configure` will
|
||||
determine your system attributes and generate an appropriate `Makefile`
|
||||
from `Makefile.in`. Now build tcpdump by running `make`.
|
||||
directory), do the following steps:
|
||||
|
||||
If everything builds ok, `su` and type `make install`. This will install
|
||||
* If you build from a git clone rather than from a release archive,
|
||||
run `./autogen.sh` (a shell script). The autogen.sh script will
|
||||
build the `configure` and `config.h.in` files.
|
||||
|
||||
On some system, you may need to set the `AUTORECONF` variable, like:
|
||||
`AUTORECONF=autoreconf-2.69 ./autogen.sh`
|
||||
to select the `autoreconf` version you want to use.
|
||||
|
||||
* Run `./configure` (a shell script). The configure script will
|
||||
determine your system attributes and generate an appropriate `Makefile`
|
||||
from `Makefile.in`. The configure script has a number of options to
|
||||
control the configuration of tcpdump; `./configure --help` will show
|
||||
them.
|
||||
|
||||
* Next, build tcpdump by running `make`.
|
||||
|
||||
On OpenBSD, you may need to set, before the `make`, the `AUTOCONF_VERSION`
|
||||
variable like:
|
||||
`AUTOCONF_VERSION=2.69 make`
|
||||
|
||||
If everything builds fine, `su` and type `make install`. This will install
|
||||
tcpdump and the manual entry. Any user will be able to use tcpdump to
|
||||
read saved captures. Whether a user will be able to capture traffic
|
||||
depends on the OS and the configuration of the system; see the
|
||||
[tcpdump man page](https://www.tcpdump.org/manpages/tcpdump.1.html)
|
||||
for details. DO NOT give untrusted users the ability to
|
||||
for details. Do **NOT** give untrusted users the ability to
|
||||
capture traffic. If a user can capture traffic, he or she could use
|
||||
utilities such as tcpdump to capture any traffic on your net, including
|
||||
passwords.
|
||||
@ -29,11 +47,11 @@ passwords.
|
||||
Note that most systems ship tcpdump, but usually an older version.
|
||||
Building tcpdump from source as explained above will usually install the
|
||||
binary as `/usr/local/bin/tcpdump`. If your system has other tcpdump
|
||||
binaries, you might need to deinstall these or to set the PATH environment
|
||||
binaries, you might need to deinstall these or to set the `PATH` environment
|
||||
variable if you need the `tcpdump` command to run the new binary
|
||||
(`tcpdump --version` can be used to tell different versions apart).
|
||||
|
||||
If your system is not one which we have tested tcpdump on, you may have
|
||||
If your system is not one that we have tested tcpdump on, you may have
|
||||
to modify the `configure` script and `Makefile.in`. Please
|
||||
[send us patches](https://www.tcpdump.org/index.html#patches)
|
||||
for any modifications you need to make.
|
||||
@ -62,15 +80,14 @@ ascii_strcasecmp.c - locale-independent case-independent string comparison
|
||||
routines
|
||||
atime.awk - TCP ack awk script
|
||||
atm.h - ATM traffic type definitions
|
||||
autogen.sh - build configure and config.h.in (run this first)
|
||||
bpf_dump.c - BPF program printing routines, in case libpcap doesn't
|
||||
have them
|
||||
chdlc.h - Cisco HDLC definitions
|
||||
cpack.c - functions to extract packed data
|
||||
cpack.h - declarations of functions to extract packed data
|
||||
config.guess - autoconf support
|
||||
config.h.in - autoconf input
|
||||
config.sub - autoconf support
|
||||
configure - configure script (run this first)
|
||||
configure.ac - configure script source
|
||||
doc/README.* - some building documentation
|
||||
ethertype.h - Ethernet type value definitions
|
||||
|
@ -329,7 +329,8 @@ TAGHDR = \
|
||||
TAGFILES = $(SRC) $(HDR) $(TAGHDR) $(LIBNETDISSECT_SRC) \
|
||||
print-smb.c smbutil.c
|
||||
|
||||
CLEANFILES = $(PROG) $(OBJ) $(LIBNETDISSECT_OBJ) print-smb.o smbutil.o
|
||||
CLEANFILES = $(PROG) $(OBJ) $(LIBNETDISSECT_OBJ) \
|
||||
print-smb.o smbutil.o instrument-functions.o
|
||||
|
||||
EXTRA_DIST = \
|
||||
CHANGES \
|
||||
@ -343,6 +344,7 @@ EXTRA_DIST = \
|
||||
README.md \
|
||||
VERSION \
|
||||
aclocal.m4 \
|
||||
autogen.sh \
|
||||
atime.awk \
|
||||
bpf_dump.c \
|
||||
cmake/Modules/FindCRYPTO.cmake \
|
||||
@ -351,15 +353,15 @@ EXTRA_DIST = \
|
||||
cmake_uninstall.cmake.in \
|
||||
cmakeconfig.h.in \
|
||||
config.guess \
|
||||
config.h.in \
|
||||
config.sub \
|
||||
configure \
|
||||
configure.ac \
|
||||
doc/README.aix.md \
|
||||
doc/README.haiku.md \
|
||||
doc/README.NetBSD.md \
|
||||
doc/README.solaris.md \
|
||||
doc/README.Win32.md \
|
||||
doc/README.windows.md \
|
||||
install-sh \
|
||||
instrument-functions.c \
|
||||
lbl/os-osf4.h \
|
||||
lbl/os-solaris2.h \
|
||||
lbl/os-sunos4.h \
|
||||
@ -384,7 +386,7 @@ EXTRA_DIST = \
|
||||
stime.awk \
|
||||
tcpdump.1.in
|
||||
|
||||
TEST_DIST= `git ls-files tests | grep -v 'tests/\..*'`
|
||||
TEST_DIST= `git -C "$$DIR" ls-files tests | grep -v 'tests/\..*'`
|
||||
|
||||
RELEASE_FILES = $(CSRC) $(HDR) $(LIBNETDISSECT_SRC) $(EXTRA_DIST) $(TEST_DIST)
|
||||
|
||||
@ -440,10 +442,11 @@ lint:
|
||||
grep -v 'possible pointer alignment problem'
|
||||
|
||||
clean:
|
||||
rm -f $(CLEANFILES) $(PROG)-`cat ${srcdir}/VERSION`.tar.gz
|
||||
rm -f $(CLEANFILES) $(PROG)-`cat ${srcdir}/VERSION`.tar.gz \
|
||||
config.h.in~ configure~ configure.ac~
|
||||
|
||||
distclean:
|
||||
rm -f $(CLEANFILES) Makefile config.cache config.log config.status \
|
||||
distclean: clean
|
||||
rm -f Makefile config.cache config.log config.status \
|
||||
config.h os-proto.h stamp-h stamp-h.in $(PROG).1 \
|
||||
libnetdissect.a tests/.failed tests/.passed \
|
||||
tests/failure-outputs.txt
|
||||
@ -461,17 +464,52 @@ tags: $(TAGFILES)
|
||||
TAGS: $(TAGFILES)
|
||||
etags $(TAGFILES)
|
||||
|
||||
#
|
||||
# Use git archive piped to tar to construct a subdirectory whose name
|
||||
# is tcpdump-{release}, containing all the checked-in source files,
|
||||
# and then run autoreconf in that directory to generate the configure
|
||||
# script and other files from that source. Then remove autom4te.cache,
|
||||
# construct the release tarball from that subdirectory, and remove
|
||||
# the subdirectory.
|
||||
#
|
||||
# The --format=tar is to force git archive to write a non-compressed
|
||||
# archive, in case the platform's tar command doesn't have built-in
|
||||
# decompression.
|
||||
#
|
||||
# The ^{tree} is there to force git archive not to write out the
|
||||
# "helpful" global extended pax header with a commit ID, as not all
|
||||
# versions of tar can handle that (Solaris tar can't, for example).
|
||||
# (It turns HEAD, or a tag, both of which are apparently "tree-ish"es,
|
||||
# into a tree; apparently, unlike HEAD, or a tag, which have a commit
|
||||
# ID associated with them, the tree associated with them doesn't have
|
||||
# a commit ID, so no commit ID is available to write, and thus
|
||||
# git archive doesn't write one.)
|
||||
#
|
||||
releasetar:
|
||||
@TAG=$(PROG)-`cat VERSION` && \
|
||||
if git show-ref --tags --quiet --verify -- "refs/tags/$$TAG"; then \
|
||||
git archive --prefix="$$TAG"/ -o "$$TAG".tar.gz "$$TAG" \
|
||||
$(RELEASE_FILES) && \
|
||||
if [ ! -d .git ]; then echo 'Not in a git clone, stop.'; exit 1; fi && \
|
||||
TMPTESTFILE=`mktemp -t tmptestfile_XXXXXXXX` && \
|
||||
rm -f "$$TMPTESTFILE" && \
|
||||
AUTORECONF_DIR=`dirname "$$TMPTESTFILE"`/"$(PROG)"_build_autoreconf_$$$$ && \
|
||||
DIR=`pwd` && \
|
||||
rm -rf "$$AUTORECONF_DIR" && \
|
||||
mkdir "$$AUTORECONF_DIR" && \
|
||||
cd "$$AUTORECONF_DIR" && \
|
||||
if git -C "$$DIR" show-ref --tags --quiet --verify -- "refs/tags/$$TAG"; then \
|
||||
(git -C "$$DIR" archive --format=tar --prefix="$$TAG"/ "$$TAG^{tree}" $(RELEASE_FILES) | \
|
||||
tar xf -) && \
|
||||
echo "Archive build from tag $$TAG."; \
|
||||
else \
|
||||
git archive --prefix="$$TAG"/ -o "$$TAG".tar.gz HEAD \
|
||||
$(RELEASE_FILES) && \
|
||||
(git -C "$$DIR" archive --format=tar --prefix="$$TAG"/ "HEAD^{tree}" $(RELEASE_FILES) | \
|
||||
tar xf -) && \
|
||||
echo "No $$TAG tag. Archive build from HEAD."; \
|
||||
fi
|
||||
fi && \
|
||||
(cd "$$TAG" && "$${AUTORECONF:-autoreconf}" && rm -rf autom4te.cache) && \
|
||||
tar cf "$$DIR/$$TAG".tar "$$TAG" && \
|
||||
rm -f "$$DIR/$$TAG".tar.gz && \
|
||||
gzip --best "$$DIR/$$TAG".tar && \
|
||||
cd "$$DIR" && \
|
||||
rm -rf "$$AUTORECONF_DIR"
|
||||
|
||||
releasecheck: releasetar
|
||||
@TAG=$(PROG)-`cat VERSION` && \
|
||||
@ -482,17 +520,21 @@ releasecheck: releasetar
|
||||
rm -rf "$$INSTALL_DIR" && \
|
||||
tar xf "$$DIR"/"$$TAG".tar.gz && \
|
||||
cd "$$TAG" && \
|
||||
echo "[$@] $$ ./configure --enable-smb --quiet --prefix=$$INSTALL_DIR" && \
|
||||
./configure --enable-smb --quiet --prefix="$$INSTALL_DIR" && \
|
||||
echo '[$@] $$ make -s all check' && \
|
||||
make -s all check >/dev/null && \
|
||||
echo '[$@] $$ make -s install' && \
|
||||
make -s install && \
|
||||
echo "[$@] $$ touch .devel" && \
|
||||
touch .devel && \
|
||||
echo "[$@] $$ ./configure --enable-instrument-functions --enable-smb --quiet --prefix=$$INSTALL_DIR" && \
|
||||
./configure --enable-instrument-functions --enable-smb --quiet --prefix="$$INSTALL_DIR" && \
|
||||
echo '[$@] $$ $(MAKE) -s all check' && \
|
||||
$(MAKE) -s all check >/dev/null && \
|
||||
echo '[$@] $$ $(MAKE) -s install' && \
|
||||
$(MAKE) -s install && \
|
||||
cd .. && \
|
||||
rm -rf "$$TAG" && \
|
||||
rm -rf "$$INSTALL_DIR" && \
|
||||
tar xf "$$DIR"/"$$TAG".tar.gz && \
|
||||
cd "$$TAG" && \
|
||||
echo "[$@] $$ touch .devel" && \
|
||||
touch .devel && \
|
||||
mkdir build && \
|
||||
cd build && \
|
||||
echo '[$@] $$ cmake -DENABLE_SMB=yes [...] ..' && \
|
||||
@ -502,10 +544,10 @@ releasecheck: releasetar
|
||||
-DCMAKE_RULE_MESSAGES=OFF \
|
||||
-DCMAKE_INSTALL_MESSAGE=NEVER \
|
||||
.. && \
|
||||
echo '[$@] $$ make -s all check' && \
|
||||
make -s all check >/dev/null && \
|
||||
echo '[$@] $$ make -s install' && \
|
||||
make -s install && \
|
||||
echo '[$@] $$ $(MAKE) -s all check' && \
|
||||
$(MAKE) -s all check >/dev/null && \
|
||||
echo '[$@] $$ $(MAKE) -s install' && \
|
||||
$(MAKE) -s install && \
|
||||
cd ../.. && \
|
||||
rm -rf "$$TAG" && \
|
||||
rm -rf "$$INSTALL_DIR" && \
|
||||
@ -518,8 +560,7 @@ whitespacecheck:
|
||||
exit 1; \
|
||||
fi
|
||||
@# trailing tab(s)?
|
||||
@# install-sh has a tab at the end of one line
|
||||
@if git grep -I -n ' $$' $$(git ls-files|grep -vE '^(tests/|install-sh$$)'); then \
|
||||
@if git grep -I -n ' $$' $$(git ls-files|grep -v '^tests/'); then \
|
||||
echo 'Error: Trailing tabs(s).'; \
|
||||
exit 1; \
|
||||
fi
|
||||
@ -533,7 +574,8 @@ testlist:
|
||||
echo $(TEST_DIST)
|
||||
|
||||
depend:
|
||||
$(MKDEP) -c "$(CC)" -m "$(DEPENDENCY_CFLAG)" -s "$(srcdir)" $(DEFS) $(INCLS) $(SRC) $(LIBNETDISSECT_SRC)
|
||||
@echo $(MKDEP) -c $(CC) -m "$(DEPENDENCY_CFLAG)" -s "$(srcdir)" $(DEFS) $(INCLS) $(SRC) '<libnetdissect src list>'
|
||||
@$(MKDEP) -c $(CC) -m "$(DEPENDENCY_CFLAG)" -s "$(srcdir)" $(DEFS) $(INCLS) $(SRC) $(LIBNETDISSECT_SRC)
|
||||
|
||||
shellcheck:
|
||||
shellcheck -f gcc -e SC2006 build.sh build_matrix.sh build_common.sh
|
||||
shellcheck -f gcc -e SC2006 autogen.sh build.sh build_matrix.sh build_common.sh mkdep .ci-coverity-scan-build.sh
|
||||
|
@ -1 +1 @@
|
||||
4.99.4
|
||||
4.99.5
|
||||
|
@ -22,9 +22,7 @@
|
||||
* and address to string conversion routines
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CASPER
|
||||
#include <libcasper.h>
|
||||
@ -526,8 +524,7 @@ lookup_nsap(netdissect_options *ndo, const u_char *nsap,
|
||||
k = (ensap[0] << 8) | ensap[1];
|
||||
j = (ensap[2] << 8) | ensap[3];
|
||||
i = (ensap[4] << 8) | ensap[5];
|
||||
}
|
||||
else
|
||||
} else
|
||||
i = j = k = 0;
|
||||
|
||||
tp = &nsaptable[(i ^ j) & (HASHNAMESIZE-1)];
|
||||
@ -1116,7 +1113,7 @@ static const struct ipxsap_ent {
|
||||
{ 0x030a, "GalacticommWorldgroupServer" },
|
||||
{ 0x030c, "IntelNetport2/HP JetDirect/HP Quicksilver" },
|
||||
{ 0x0320, "AttachmateGateway" },
|
||||
{ 0x0327, "MicrosoftDiagnostiocs" },
|
||||
{ 0x0327, "MicrosoftDiagnostics" },
|
||||
{ 0x0328, "WATCOM SQL Server" },
|
||||
{ 0x0335, "MultiTechSystems MultisynchCommServer" },
|
||||
{ 0x0343, "Xylogics RemoteAccessServer/LANModem" },
|
||||
|
@ -36,9 +36,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include "netdissect-stdinc.h"
|
||||
#include "addrtostr.h"
|
||||
@ -127,16 +125,12 @@ addrtostr6 (const void *src, char *dst, size_t size)
|
||||
best.base = -1;
|
||||
cur.len = 0;
|
||||
cur.base = -1;
|
||||
for (i = 0; i < (IN6ADDRSZ / INT16SZ); i++)
|
||||
{
|
||||
if (words[i] == 0)
|
||||
{
|
||||
for (i = 0; i < (IN6ADDRSZ / INT16SZ); i++) {
|
||||
if (words[i] == 0) {
|
||||
if (cur.base == -1)
|
||||
cur.base = i, cur.len = 1;
|
||||
else cur.len++;
|
||||
}
|
||||
else if (cur.base != -1)
|
||||
{
|
||||
} else if (cur.base != -1) {
|
||||
if (best.base == -1 || cur.len > best.len)
|
||||
best = cur;
|
||||
cur.base = -1;
|
||||
@ -160,12 +154,10 @@ addrtostr6 (const void *src, char *dst, size_t size)
|
||||
*dp++ = c; \
|
||||
space_left--; \
|
||||
}
|
||||
for (i = 0; i < (IN6ADDRSZ / INT16SZ); i++)
|
||||
{
|
||||
for (i = 0; i < (IN6ADDRSZ / INT16SZ); i++) {
|
||||
/* Are we inside the best run of 0x00's?
|
||||
*/
|
||||
if (best.base != -1 && i >= best.base && i < (best.base + best.len))
|
||||
{
|
||||
if (best.base != -1 && i >= best.base && i < (best.base + best.len)) {
|
||||
if (i == best.base)
|
||||
APPEND_CHAR(':');
|
||||
continue;
|
||||
@ -181,8 +173,7 @@ addrtostr6 (const void *src, char *dst, size_t size)
|
||||
if (i == 6 && best.base == 0 &&
|
||||
(best.len == 6 || (best.len == 5 && words[5] == 0xffff)))
|
||||
{
|
||||
if (!addrtostr(srcaddr+12, dp, space_left))
|
||||
{
|
||||
if (!addrtostr(srcaddr+12, dp, space_left)) {
|
||||
errno = ENOSPC;
|
||||
return (NULL);
|
||||
}
|
||||
@ -194,8 +185,7 @@ addrtostr6 (const void *src, char *dst, size_t size)
|
||||
snprintfed = snprintf (dp, space_left, "%x", words[i]);
|
||||
if (snprintfed < 0)
|
||||
return (NULL);
|
||||
if ((size_t) snprintfed >= space_left)
|
||||
{
|
||||
if ((size_t) snprintfed >= space_left) {
|
||||
errno = ENOSPC;
|
||||
return (NULL);
|
||||
}
|
||||
|
@ -15,9 +15,7 @@
|
||||
* Original code by Hannes Gredler (hannes@gredler.at)
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include "netdissect-stdinc.h"
|
||||
#include "netdissect.h"
|
||||
|
25
contrib/tcpdump/autogen.sh
Executable file
25
contrib/tcpdump/autogen.sh
Executable file
@ -0,0 +1,25 @@
|
||||
#!/bin/sh -e
|
||||
|
||||
: "${AUTORECONF:=autoreconf}"
|
||||
|
||||
AUTORECONFVERSION=`$AUTORECONF --version 2>&1 | grep "^autoreconf" | sed 's/.*) *//'`
|
||||
|
||||
maj=`echo "$AUTORECONFVERSION" | cut -d. -f1`
|
||||
min=`echo "$AUTORECONFVERSION" | cut -d. -f2`
|
||||
# The minimum required version of autoconf is currently 2.69.
|
||||
if [ "$maj" = "" ] || [ "$min" = "" ] || \
|
||||
[ "$maj" -lt 2 ] || { [ "$maj" -eq 2 ] && [ "$min" -lt 69 ]; }; then
|
||||
cat >&2 <<-EOF
|
||||
Please install the 'autoconf' package version 2.69 or later.
|
||||
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
|
||||
EOF
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "$AUTORECONF identification: $AUTORECONFVERSION"
|
||||
"$AUTORECONF" -f
|
@ -19,9 +19,7 @@
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include "netdissect-stdinc.h"
|
||||
|
||||
|
@ -17,16 +17,13 @@
|
||||
* Original code by Hannes Gredler (hannes@gredler.at)
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include "netdissect-stdinc.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "netdissect.h"
|
||||
|
||||
@ -44,7 +41,7 @@ for i in range(256):
|
||||
accum ^= 0x633
|
||||
crc_table.append(accum)
|
||||
|
||||
for i in range(len(crc_table)/8):
|
||||
for i in range(int(len(crc_table)/8)):
|
||||
for j in range(8):
|
||||
sys.stdout.write("0x%04x, " % crc_table[i*8+j])
|
||||
sys.stdout.write("\n")
|
||||
@ -86,36 +83,12 @@ static const uint16_t crc10_table[256] =
|
||||
0x021e, 0x002d, 0x004b, 0x0278, 0x0087, 0x02b4, 0x02d2, 0x00e1
|
||||
};
|
||||
|
||||
static void
|
||||
init_crc10_table(void)
|
||||
{
|
||||
#define CRC10_POLYNOMIAL 0x633
|
||||
int i, j;
|
||||
uint16_t accum;
|
||||
uint16_t verify_crc10_table[256];
|
||||
|
||||
for ( i = 0; i < 256; i++ )
|
||||
{
|
||||
accum = ((unsigned short) i << 2);
|
||||
for ( j = 0; j < 8; j++ )
|
||||
{
|
||||
if ((accum <<= 1) & 0x400) accum ^= CRC10_POLYNOMIAL;
|
||||
}
|
||||
verify_crc10_table[i] = accum;
|
||||
}
|
||||
assert(memcmp(verify_crc10_table,
|
||||
crc10_table,
|
||||
sizeof(verify_crc10_table)) == 0);
|
||||
#undef CRC10_POLYNOMIAL
|
||||
}
|
||||
|
||||
uint16_t
|
||||
verify_crc10_cksum(uint16_t accum, const u_char *p, int length)
|
||||
{
|
||||
int i;
|
||||
|
||||
for ( i = 0; i < length; i++ )
|
||||
{
|
||||
for ( i = 0; i < length; i++ ) {
|
||||
accum = ((accum << 8) & 0x3ff)
|
||||
^ crc10_table[( accum >> 2) & 0xff]
|
||||
^ *p++;
|
||||
@ -123,14 +96,6 @@ verify_crc10_cksum(uint16_t accum, const u_char *p, int length)
|
||||
return accum;
|
||||
}
|
||||
|
||||
/* precompute checksum tables */
|
||||
void
|
||||
init_checksum(void) {
|
||||
|
||||
init_crc10_table();
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Creates the OSI Fletcher checksum. See 8473-1, Appendix C, section C.3.
|
||||
* The checksum field of the passed PDU does not need to be reset to zero.
|
||||
|
@ -2,23 +2,186 @@
|
||||
# Try to find libcrypto.
|
||||
#
|
||||
|
||||
# Try to find the header
|
||||
find_path(CRYPTO_INCLUDE_DIR openssl/crypto.h)
|
||||
#
|
||||
# Were we told where to look for libcrypto?
|
||||
#
|
||||
if(NOT CRYPTO_ROOT)
|
||||
#
|
||||
# No.
|
||||
#
|
||||
# First, try looking for it with pkg-config, if we have it.
|
||||
#
|
||||
find_package(PkgConfig)
|
||||
|
||||
# Try to find the library
|
||||
find_library(CRYPTO_LIBRARY crypto)
|
||||
#
|
||||
# Homebrew's pkg-config does not, by default, look for
|
||||
# pkg-config files for packages it has installed.
|
||||
# Furthermore, at least for OpenSSL, they appear to be
|
||||
# dumped in package-specific directories whose paths are
|
||||
# not only package-specific but package-version-specific.
|
||||
#
|
||||
# So the only way to find openssl is to get the value of
|
||||
# PKG_CONFIG_PATH from "brew --env openssl" and add that
|
||||
# to PKG_CONFIG_PATH. (No, we can't just assume it's under
|
||||
# /usr/local; Homebrew have conveniently chosen to put it
|
||||
# under /opt/homebrew on ARM.)
|
||||
#
|
||||
# That's the nice thing about Homebrew - it makes things easier!
|
||||
# Thanks!
|
||||
#
|
||||
find_program(BREW brew)
|
||||
if(BREW)
|
||||
#
|
||||
# We have Homebrew.
|
||||
# Get the pkg-config directory for openssl.
|
||||
#
|
||||
execute_process(COMMAND "${BREW}" "--env" "--plain" "openssl"
|
||||
RESULT_VARIABLE BREW_RESULT
|
||||
OUTPUT_VARIABLE BREW_OUTPUT
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
if(BREW_RESULT EQUAL 0)
|
||||
#
|
||||
# brew --env --plain openssl succeeded.
|
||||
# Split its output into a list, one entry per line.
|
||||
#
|
||||
string(REGEX MATCHALL "[^\n\r]+" BREW_OUTPUT_LINES "${BREW_OUTPUT}")
|
||||
|
||||
#
|
||||
# Find the line that begins with "PKG_CONFIG_PATH: ", and extract
|
||||
# the path following that.
|
||||
#
|
||||
foreach(LINE IN LISTS BREW_OUTPUT_LINES)
|
||||
if(LINE MATCHES "PKG_CONFIG_PATH: \(.*\)")
|
||||
string(REGEX REPLACE "PKG_CONFIG_PATH: \(.*\)"
|
||||
"\\1" OPENSSL_PKGCONFIG_DIR
|
||||
${LINE})
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
#
|
||||
# Save the current value of the PKG_CONFIG_PATH environment
|
||||
# variable.
|
||||
#
|
||||
set(SAVE_PKG_CONFIG_PATH $ENV{PKG_CONFIG_PATH})
|
||||
|
||||
#
|
||||
# If we got an additional pkg-config directory from Homebrew, add
|
||||
# it to the PKG_CONFIG_PATH environment variable.
|
||||
#
|
||||
if(OPENSSL_PKGCONFIG_DIR)
|
||||
set(ENV{PKG_CONFIG_PATH} "${OPENSSL_PKGCONFIG_DIR}:$ENV{PKG_CONFIG_PATH}")
|
||||
endif()
|
||||
|
||||
#
|
||||
# Use pkg-config to find libcrypto.
|
||||
#
|
||||
pkg_check_modules(CRYPTO libcrypto)
|
||||
|
||||
#
|
||||
# Revert the change to PKG_CONFIG_PATH.
|
||||
#
|
||||
set(ENV{PKG_CONFIG_PATH} "${SAVE_PKG_CONFIG_PATH}")
|
||||
|
||||
#
|
||||
# Did pkg-config find it?
|
||||
#
|
||||
if(CRYPTO_FOUND)
|
||||
#
|
||||
# This "helpfully" supplies CRYPTO_LIBRARIES as a bunch of
|
||||
# library names - not paths - and CRYPTO_LIBRARY_DIRS as
|
||||
# a bunch of directories.
|
||||
#
|
||||
# CMake *really* doesn't like the notion of specifying "here are
|
||||
# the directories in which to look for libraries" except in
|
||||
# find_library() calls; it *really* prefers using full paths to
|
||||
# library files, rather than library names.
|
||||
#
|
||||
# Find the libraries and add their full paths.
|
||||
#
|
||||
set(CRYPTO_LIBRARY_FULLPATHS)
|
||||
foreach(_lib IN LISTS CRYPTO_LIBRARIES)
|
||||
#
|
||||
# Try to find this library, so we get its full path.
|
||||
#
|
||||
find_library(_libfullpath ${_lib} HINTS ${CRYPTO_LIBRARY_DIRS})
|
||||
list(APPEND CRYPTO_LIBRARY_FULLPATHS ${_libfullpath})
|
||||
endforeach()
|
||||
set(CRYPTO_LIBRARIES "${CRYPTO_LIBRARY_FULLPATHS}")
|
||||
else()
|
||||
#
|
||||
# No. If we have Homebrew installed, see if it's in Homebrew.
|
||||
#
|
||||
if(BREW)
|
||||
#
|
||||
# The brew man page lies when it speaks of
|
||||
# $BREW --prefix --installed <formula>
|
||||
# outputting nothing. In Homebrew 3.3.16,
|
||||
# it produces output regardless of whether
|
||||
# the formula is installed or not, so we
|
||||
# send the standard output and error to
|
||||
# the bit bucket.
|
||||
#
|
||||
# libcrypto isn't a formula, openssl is a formula.
|
||||
#
|
||||
execute_process(COMMAND "${BREW}" "--prefix" "--installed" "openssl"
|
||||
RESULT_VARIABLE BREW_RESULT
|
||||
OUTPUT_QUIET
|
||||
)
|
||||
if(BREW_RESULT EQUAL 0)
|
||||
#
|
||||
# Yes. Get the include directory and library
|
||||
# directory. (No, we can't just assume it's
|
||||
# under /usr/local; Homebrew have conveniently
|
||||
# chosen to put it under /opt/homebrew on ARM.)
|
||||
#
|
||||
execute_process(COMMAND "${BREW}" "--prefix" "openssl"
|
||||
RESULT_VARIABLE BREW_RESULT
|
||||
OUTPUT_VARIABLE OPENSSL_PATH
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
set(CRYPTO_INCLUDE_DIRS "${OPENSSL_PATH}/include")
|
||||
|
||||
#
|
||||
# Search for the libcrypto library under lib.
|
||||
#
|
||||
find_library(CRYPTO_LIBRARIES crypto
|
||||
PATHS "${OPENSSL_PATH}/lib"
|
||||
NO_DEFAULT_PATH)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
#
|
||||
# Have we found it with pkg-config or Homebrew?
|
||||
#
|
||||
if(NOT CRYPTO_INCLUDE_DIRS)
|
||||
#
|
||||
# No.
|
||||
# Try to find the openss/evp.h header.
|
||||
# We search for that header to make sure that it's installed (if
|
||||
# it's just a shared library for the benefit of existing
|
||||
# programs, that's not useful).
|
||||
#
|
||||
find_path(CRYPTO_INCLUDE_DIRS openssl/evp.h)
|
||||
|
||||
#
|
||||
# Try to find the library.
|
||||
#
|
||||
find_library(CRYPTO_LIBRARIES crypto)
|
||||
endif()
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(CRYPTO
|
||||
DEFAULT_MSG
|
||||
CRYPTO_INCLUDE_DIR
|
||||
CRYPTO_LIBRARY
|
||||
CRYPTO_INCLUDE_DIRS
|
||||
CRYPTO_LIBRARIES
|
||||
)
|
||||
|
||||
mark_as_advanced(
|
||||
CRYPTO_INCLUDE_DIR
|
||||
CRYPTO_LIBRARY
|
||||
CRYPTO_INCLUDE_DIRS
|
||||
CRYPTO_LIBRARIES
|
||||
)
|
||||
|
||||
set(CRYPTO_INCLUDE_DIRS ${CRYPTO_INCLUDE_DIR})
|
||||
set(CRYPTO_LIBRARIES ${CRYPTO_LIBRARY})
|
||||
|
@ -39,9 +39,6 @@
|
||||
/* Define to 1 if you have the `EVP_DecryptInit_ex' function. */
|
||||
#cmakedefine HAVE_EVP_DECRYPTINIT_EX 1
|
||||
|
||||
/* Define to 1 if you have the <fcntl.h> header file. */
|
||||
#cmakedefine HAVE_FCNTL_H 1
|
||||
|
||||
/* Define to 1 if you have the `fork' function. */
|
||||
#cmakedefine HAVE_FORK 1
|
||||
|
||||
@ -60,7 +57,7 @@
|
||||
/* Define to 1 if you have the `cap-ng' library (-lcap-ng). */
|
||||
#cmakedefine HAVE_LIBCAP_NG 1
|
||||
|
||||
/* Define to 1 if you have the `crypto' library (-lcrypto). */
|
||||
/* Define to 1 if you have a usable `crypto' library (-lcrypto). */
|
||||
#cmakedefine HAVE_LIBCRYPTO 1
|
||||
|
||||
/* Define to 1 if you have the `rpc' library (-lrpc). */
|
||||
@ -75,9 +72,6 @@
|
||||
/* Define to 1 if you have the `openat' function. */
|
||||
#cmakedefine HAVE_OPENAT 1
|
||||
|
||||
/* Define to 1 if you have the <openssl/evp.h> header file. */
|
||||
#cmakedefine HAVE_OPENSSL_EVP_H 1
|
||||
|
||||
/* define if the OS provides AF_INET6 and struct in6_addr */
|
||||
#cmakedefine HAVE_OS_IPV6_SUPPORT 1
|
||||
|
||||
@ -246,6 +240,12 @@
|
||||
/* Define to the version of this package. */
|
||||
#cmakedefine PACKAGE_VERSION "@PACKAGE_VERSION@"
|
||||
|
||||
/* The size of `time_t', as computed by sizeof. */
|
||||
#cmakedefine SIZEOF_TIME_T @SIZEOF_TIME_T@
|
||||
|
||||
/* The size of `void *', as computed by sizeof. */
|
||||
#cmakedefine SIZEOF_VOID_P @SIZEOF_VOID_P@
|
||||
|
||||
/* Define to 1 if you have the ANSI C header files. */
|
||||
#cmakedefine STDC_HEADERS 1
|
||||
|
||||
|
62
contrib/tcpdump/config.guess
vendored
62
contrib/tcpdump/config.guess
vendored
@ -1,10 +1,10 @@
|
||||
#! /bin/sh
|
||||
# Attempt to guess a canonical system name.
|
||||
# Copyright 1992-2023 Free Software Foundation, Inc.
|
||||
# Copyright 1992-2024 Free Software Foundation, Inc.
|
||||
|
||||
# shellcheck disable=SC2006,SC2268 # see below for rationale
|
||||
|
||||
timestamp='2023-01-01'
|
||||
timestamp='2024-01-01'
|
||||
|
||||
# This file is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License as published by
|
||||
@ -47,7 +47,7 @@ me=`echo "$0" | sed -e 's,.*/,,'`
|
||||
usage="\
|
||||
Usage: $0 [OPTION]
|
||||
|
||||
Output the configuration name of the system \`$me' is run on.
|
||||
Output the configuration name of the system '$me' is run on.
|
||||
|
||||
Options:
|
||||
-h, --help print this help, then exit
|
||||
@ -60,13 +60,13 @@ version="\
|
||||
GNU config.guess ($timestamp)
|
||||
|
||||
Originally written by Per Bothner.
|
||||
Copyright 1992-2023 Free Software Foundation, Inc.
|
||||
Copyright 1992-2024 Free Software Foundation, Inc.
|
||||
|
||||
This is free software; see the source for copying conditions. There is NO
|
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
|
||||
|
||||
help="
|
||||
Try \`$me --help' for more information."
|
||||
Try '$me --help' for more information."
|
||||
|
||||
# Parse command line
|
||||
while test $# -gt 0 ; do
|
||||
@ -102,8 +102,8 @@ GUESS=
|
||||
# temporary files to be created and, as you can see below, it is a
|
||||
# headache to deal with in a portable fashion.
|
||||
|
||||
# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
|
||||
# use `HOST_CC' if defined, but it is deprecated.
|
||||
# Historically, 'CC_FOR_BUILD' used to be named 'HOST_CC'. We still
|
||||
# use 'HOST_CC' if defined, but it is deprecated.
|
||||
|
||||
# Portable tmp directory creation inspired by the Autoconf team.
|
||||
|
||||
@ -155,6 +155,9 @@ Linux|GNU|GNU/*)
|
||||
|
||||
set_cc_for_build
|
||||
cat <<-EOF > "$dummy.c"
|
||||
#if defined(__ANDROID__)
|
||||
LIBC=android
|
||||
#else
|
||||
#include <features.h>
|
||||
#if defined(__UCLIBC__)
|
||||
LIBC=uclibc
|
||||
@ -162,6 +165,8 @@ Linux|GNU|GNU/*)
|
||||
LIBC=dietlibc
|
||||
#elif defined(__GLIBC__)
|
||||
LIBC=gnu
|
||||
#elif defined(__LLVM_LIBC__)
|
||||
LIBC=llvm
|
||||
#else
|
||||
#include <stdarg.h>
|
||||
/* First heuristic to detect musl libc. */
|
||||
@ -169,6 +174,7 @@ Linux|GNU|GNU/*)
|
||||
LIBC=musl
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
EOF
|
||||
cc_set_libc=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`
|
||||
eval "$cc_set_libc"
|
||||
@ -459,7 +465,7 @@ case $UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION in
|
||||
UNAME_RELEASE=`uname -v`
|
||||
;;
|
||||
esac
|
||||
# Japanese Language versions have a version number like `4.1.3-JL'.
|
||||
# Japanese Language versions have a version number like '4.1.3-JL'.
|
||||
SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/'`
|
||||
GUESS=sparc-sun-sunos$SUN_REL
|
||||
;;
|
||||
@ -904,7 +910,7 @@ EOF
|
||||
fi
|
||||
;;
|
||||
*:FreeBSD:*:*)
|
||||
UNAME_PROCESSOR=`/usr/bin/uname -p`
|
||||
UNAME_PROCESSOR=`uname -p`
|
||||
case $UNAME_PROCESSOR in
|
||||
amd64)
|
||||
UNAME_PROCESSOR=x86_64 ;;
|
||||
@ -976,7 +982,27 @@ EOF
|
||||
GUESS=$UNAME_MACHINE-unknown-minix
|
||||
;;
|
||||
aarch64:Linux:*:*)
|
||||
GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
|
||||
set_cc_for_build
|
||||
CPU=$UNAME_MACHINE
|
||||
LIBCABI=$LIBC
|
||||
if test "$CC_FOR_BUILD" != no_compiler_found; then
|
||||
ABI=64
|
||||
sed 's/^ //' << EOF > "$dummy.c"
|
||||
#ifdef __ARM_EABI__
|
||||
#ifdef __ARM_PCS_VFP
|
||||
ABI=eabihf
|
||||
#else
|
||||
ABI=eabi
|
||||
#endif
|
||||
#endif
|
||||
EOF
|
||||
cc_set_abi=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^ABI' | sed 's, ,,g'`
|
||||
eval "$cc_set_abi"
|
||||
case $ABI in
|
||||
eabi | eabihf) CPU=armv8l; LIBCABI=$LIBC$ABI ;;
|
||||
esac
|
||||
fi
|
||||
GUESS=$CPU-unknown-linux-$LIBCABI
|
||||
;;
|
||||
aarch64_be:Linux:*:*)
|
||||
UNAME_MACHINE=aarch64_be
|
||||
@ -1042,6 +1068,15 @@ EOF
|
||||
k1om:Linux:*:*)
|
||||
GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
|
||||
;;
|
||||
kvx:Linux:*:*)
|
||||
GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
|
||||
;;
|
||||
kvx:cos:*:*)
|
||||
GUESS=$UNAME_MACHINE-unknown-cos
|
||||
;;
|
||||
kvx:mbr:*:*)
|
||||
GUESS=$UNAME_MACHINE-unknown-mbr
|
||||
;;
|
||||
loongarch32:Linux:*:* | loongarch64:Linux:*:*)
|
||||
GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
|
||||
;;
|
||||
@ -1197,7 +1232,7 @@ EOF
|
||||
GUESS=$UNAME_MACHINE-pc-sysv4.2uw$UNAME_VERSION
|
||||
;;
|
||||
i*86:OS/2:*:*)
|
||||
# If we were able to find `uname', then EMX Unix compatibility
|
||||
# If we were able to find 'uname', then EMX Unix compatibility
|
||||
# is probably installed.
|
||||
GUESS=$UNAME_MACHINE-pc-os2-emx
|
||||
;;
|
||||
@ -1338,7 +1373,7 @@ EOF
|
||||
GUESS=ns32k-sni-sysv
|
||||
fi
|
||||
;;
|
||||
PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
|
||||
PENTIUM:*:4.0*:*) # Unisys 'ClearPath HMP IX 4000' SVR4/MP effort
|
||||
# says <Richard.M.Bartel@ccMail.Census.GOV>
|
||||
GUESS=i586-unisys-sysv4
|
||||
;;
|
||||
@ -1560,6 +1595,9 @@ EOF
|
||||
*:Unleashed:*:*)
|
||||
GUESS=$UNAME_MACHINE-unknown-unleashed$UNAME_RELEASE
|
||||
;;
|
||||
*:Ironclad:*:*)
|
||||
GUESS=$UNAME_MACHINE-unknown-ironclad
|
||||
;;
|
||||
esac
|
||||
|
||||
# Do we have a guess based on uname results?
|
||||
|
@ -3,6 +3,9 @@
|
||||
/* Define to 1 if arpa/inet.h declares `ether_ntohost' */
|
||||
#undef ARPA_INET_H_DECLARES_ETHER_NTOHOST
|
||||
|
||||
/* define if you want to build the instrument functions code */
|
||||
#undef ENABLE_INSTRUMENT_FUNCTIONS
|
||||
|
||||
/* define if you want to build the possibly-buggy SMB printer */
|
||||
#undef ENABLE_SMB
|
||||
|
||||
@ -39,9 +42,6 @@
|
||||
/* Define to 1 if you have the `EVP_DecryptInit_ex' function. */
|
||||
#undef HAVE_EVP_DECRYPTINIT_EX
|
||||
|
||||
/* Define to 1 if you have the <fcntl.h> header file. */
|
||||
#undef HAVE_FCNTL_H
|
||||
|
||||
/* Define to 1 if you have the `fork' function. */
|
||||
#undef HAVE_FORK
|
||||
|
||||
@ -60,27 +60,18 @@
|
||||
/* Define to 1 if you have the `cap-ng' library (-lcap-ng). */
|
||||
#undef HAVE_LIBCAP_NG
|
||||
|
||||
/* Define to 1 if you have the `crypto' library (-lcrypto). */
|
||||
/* Define to 1 if you have a usable `crypto' library (-lcrypto). */
|
||||
#undef HAVE_LIBCRYPTO
|
||||
|
||||
/* Define to 1 if you have the `rpc' library (-lrpc). */
|
||||
#undef HAVE_LIBRPC
|
||||
|
||||
/* Define to 1 if you have the <memory.h> header file. */
|
||||
#undef HAVE_MEMORY_H
|
||||
|
||||
/* Define to 1 if you have the <net/if.h> header file. */
|
||||
#undef HAVE_NET_IF_H
|
||||
|
||||
/* Define to 1 if printf(3) does not support the z length modifier. */
|
||||
#undef HAVE_NO_PRINTF_Z
|
||||
|
||||
/* Define to 1 if you have the `openat' function. */
|
||||
#undef HAVE_OPENAT
|
||||
|
||||
/* Define to 1 if you have the <openssl/evp.h> header file. */
|
||||
#undef HAVE_OPENSSL_EVP_H
|
||||
|
||||
/* define if the OS provides AF_INET6 and struct in6_addr */
|
||||
#undef HAVE_OS_IPV6_SUPPORT
|
||||
|
||||
@ -174,6 +165,9 @@
|
||||
/* Define to 1 if you have the <stdint.h> header file. */
|
||||
#undef HAVE_STDINT_H
|
||||
|
||||
/* Define to 1 if you have the <stdio.h> header file. */
|
||||
#undef HAVE_STDIO_H
|
||||
|
||||
/* Define to 1 if you have the <stdlib.h> header file. */
|
||||
#undef HAVE_STDLIB_H
|
||||
|
||||
@ -243,10 +237,15 @@
|
||||
/* Define to the version of this package. */
|
||||
#undef PACKAGE_VERSION
|
||||
|
||||
/* The size of `time_t', as computed by sizeof. */
|
||||
#undef SIZEOF_TIME_T
|
||||
|
||||
/* The size of `void *', as computed by sizeof. */
|
||||
#undef SIZEOF_VOID_P
|
||||
|
||||
/* Define to 1 if you have the ANSI C header files. */
|
||||
/* Define to 1 if all of the C90 standard headers exist (not just the ones
|
||||
required in a freestanding environment). This macro is provided for
|
||||
backward compatibility; new code need not use it. */
|
||||
#undef STDC_HEADERS
|
||||
|
||||
/* Define to 1 if sys/ethernet.h declares `ether_ntohost' */
|
||||
|
230
contrib/tcpdump/config.sub
vendored
230
contrib/tcpdump/config.sub
vendored
@ -1,10 +1,10 @@
|
||||
#! /bin/sh
|
||||
# Configuration validation subroutine script.
|
||||
# Copyright 1992-2023 Free Software Foundation, Inc.
|
||||
# Copyright 1992-2024 Free Software Foundation, Inc.
|
||||
|
||||
# shellcheck disable=SC2006,SC2268 # see below for rationale
|
||||
|
||||
timestamp='2023-01-21'
|
||||
timestamp='2024-01-01'
|
||||
|
||||
# This file is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License as published by
|
||||
@ -76,13 +76,13 @@ Report bugs and patches to <config-patches@gnu.org>."
|
||||
version="\
|
||||
GNU config.sub ($timestamp)
|
||||
|
||||
Copyright 1992-2023 Free Software Foundation, Inc.
|
||||
Copyright 1992-2024 Free Software Foundation, Inc.
|
||||
|
||||
This is free software; see the source for copying conditions. There is NO
|
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
|
||||
|
||||
help="
|
||||
Try \`$me --help' for more information."
|
||||
Try '$me --help' for more information."
|
||||
|
||||
# Parse command line
|
||||
while test $# -gt 0 ; do
|
||||
@ -130,7 +130,7 @@ IFS=$saved_IFS
|
||||
# Separate into logical components for further validation
|
||||
case $1 in
|
||||
*-*-*-*-*)
|
||||
echo Invalid configuration \`"$1"\': more than four components >&2
|
||||
echo "Invalid configuration '$1': more than four components" >&2
|
||||
exit 1
|
||||
;;
|
||||
*-*-*-*)
|
||||
@ -145,7 +145,8 @@ case $1 in
|
||||
nto-qnx* | linux-* | uclinux-uclibc* \
|
||||
| uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* \
|
||||
| netbsd*-eabi* | kopensolaris*-gnu* | cloudabi*-eabi* \
|
||||
| storm-chaos* | os2-emx* | rtmk-nova* | managarm-*)
|
||||
| storm-chaos* | os2-emx* | rtmk-nova* | managarm-* \
|
||||
| windows-* )
|
||||
basic_machine=$field1
|
||||
basic_os=$maybe_os
|
||||
;;
|
||||
@ -943,7 +944,7 @@ $basic_machine
|
||||
EOF
|
||||
IFS=$saved_IFS
|
||||
;;
|
||||
# We use `pc' rather than `unknown'
|
||||
# We use 'pc' rather than 'unknown'
|
||||
# because (1) that's what they normally are, and
|
||||
# (2) the word "unknown" tends to confuse beginning users.
|
||||
i*86 | x86_64)
|
||||
@ -1180,7 +1181,7 @@ case $cpu-$vendor in
|
||||
case $cpu in
|
||||
1750a | 580 \
|
||||
| a29k \
|
||||
| aarch64 | aarch64_be \
|
||||
| aarch64 | aarch64_be | aarch64c | arm64ec \
|
||||
| abacus \
|
||||
| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] \
|
||||
| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] \
|
||||
@ -1199,12 +1200,14 @@ case $cpu-$vendor in
|
||||
| d10v | d30v | dlx | dsp16xx \
|
||||
| e2k | elxsi | epiphany \
|
||||
| f30[01] | f700 | fido | fr30 | frv | ft32 | fx80 \
|
||||
| javascript \
|
||||
| h8300 | h8500 \
|
||||
| hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
|
||||
| hexagon \
|
||||
| i370 | i*86 | i860 | i960 | ia16 | ia64 \
|
||||
| ip2k | iq2000 \
|
||||
| k1om \
|
||||
| kvx \
|
||||
| le32 | le64 \
|
||||
| lm32 \
|
||||
| loongarch32 | loongarch64 \
|
||||
@ -1213,36 +1216,13 @@ case $cpu-$vendor in
|
||||
| m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x \
|
||||
| m88110 | m88k | maxq | mb | mcore | mep | metag \
|
||||
| microblaze | microblazeel \
|
||||
| mips | mipsbe | mipseb | mipsel | mipsle \
|
||||
| mips16 \
|
||||
| mips64 | mips64eb | mips64el \
|
||||
| mips64octeon | mips64octeonel \
|
||||
| mips64orion | mips64orionel \
|
||||
| mips64r5900 | mips64r5900el \
|
||||
| mips64vr | mips64vrel \
|
||||
| mips64vr4100 | mips64vr4100el \
|
||||
| mips64vr4300 | mips64vr4300el \
|
||||
| mips64vr5000 | mips64vr5000el \
|
||||
| mips64vr5900 | mips64vr5900el \
|
||||
| mipsisa32 | mipsisa32el \
|
||||
| mipsisa32r2 | mipsisa32r2el \
|
||||
| mipsisa32r3 | mipsisa32r3el \
|
||||
| mipsisa32r5 | mipsisa32r5el \
|
||||
| mipsisa32r6 | mipsisa32r6el \
|
||||
| mipsisa64 | mipsisa64el \
|
||||
| mipsisa64r2 | mipsisa64r2el \
|
||||
| mipsisa64r3 | mipsisa64r3el \
|
||||
| mipsisa64r5 | mipsisa64r5el \
|
||||
| mipsisa64r6 | mipsisa64r6el \
|
||||
| mipsisa64sb1 | mipsisa64sb1el \
|
||||
| mipsisa64sr71k | mipsisa64sr71kel \
|
||||
| mipsr5900 | mipsr5900el \
|
||||
| mipstx39 | mipstx39el \
|
||||
| mips* \
|
||||
| mmix \
|
||||
| mn10200 | mn10300 \
|
||||
| moxie \
|
||||
| mt \
|
||||
| msp430 \
|
||||
| nanomips* \
|
||||
| nds32 | nds32le | nds32be \
|
||||
| nfp \
|
||||
| nios | nios2 | nios2eb | nios2el \
|
||||
@ -1274,6 +1254,7 @@ case $cpu-$vendor in
|
||||
| ubicom32 \
|
||||
| v70 | v850 | v850e | v850e1 | v850es | v850e2 | v850e2v3 \
|
||||
| vax \
|
||||
| vc4 \
|
||||
| visium \
|
||||
| w65 \
|
||||
| wasm32 | wasm64 \
|
||||
@ -1285,7 +1266,7 @@ case $cpu-$vendor in
|
||||
;;
|
||||
|
||||
*)
|
||||
echo Invalid configuration \`"$1"\': machine \`"$cpu-$vendor"\' not recognized 1>&2
|
||||
echo "Invalid configuration '$1': machine '$cpu-$vendor' not recognized" 1>&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
@ -1306,11 +1287,12 @@ esac
|
||||
|
||||
# Decode manufacturer-specific aliases for certain operating systems.
|
||||
|
||||
if test x$basic_os != x
|
||||
if test x"$basic_os" != x
|
||||
then
|
||||
|
||||
# First recognize some ad-hoc cases, or perhaps split kernel-os, or else just
|
||||
# set os.
|
||||
obj=
|
||||
case $basic_os in
|
||||
gnu/linux*)
|
||||
kernel=linux
|
||||
@ -1510,10 +1492,16 @@ case $os in
|
||||
os=eabi
|
||||
;;
|
||||
*)
|
||||
os=elf
|
||||
os=
|
||||
obj=elf
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
aout* | coff* | elf* | pe*)
|
||||
# These are machine code file formats, not OSes
|
||||
obj=$os
|
||||
os=
|
||||
;;
|
||||
*)
|
||||
# No normalization, but not necessarily accepted, that comes below.
|
||||
;;
|
||||
@ -1532,12 +1520,15 @@ else
|
||||
# system, and we'll never get to this point.
|
||||
|
||||
kernel=
|
||||
obj=
|
||||
case $cpu-$vendor in
|
||||
score-*)
|
||||
os=elf
|
||||
os=
|
||||
obj=elf
|
||||
;;
|
||||
spu-*)
|
||||
os=elf
|
||||
os=
|
||||
obj=elf
|
||||
;;
|
||||
*-acorn)
|
||||
os=riscix1.2
|
||||
@ -1547,28 +1538,35 @@ case $cpu-$vendor in
|
||||
os=gnu
|
||||
;;
|
||||
arm*-semi)
|
||||
os=aout
|
||||
os=
|
||||
obj=aout
|
||||
;;
|
||||
c4x-* | tic4x-*)
|
||||
os=coff
|
||||
os=
|
||||
obj=coff
|
||||
;;
|
||||
c8051-*)
|
||||
os=elf
|
||||
os=
|
||||
obj=elf
|
||||
;;
|
||||
clipper-intergraph)
|
||||
os=clix
|
||||
;;
|
||||
hexagon-*)
|
||||
os=elf
|
||||
os=
|
||||
obj=elf
|
||||
;;
|
||||
tic54x-*)
|
||||
os=coff
|
||||
os=
|
||||
obj=coff
|
||||
;;
|
||||
tic55x-*)
|
||||
os=coff
|
||||
os=
|
||||
obj=coff
|
||||
;;
|
||||
tic6x-*)
|
||||
os=coff
|
||||
os=
|
||||
obj=coff
|
||||
;;
|
||||
# This must come before the *-dec entry.
|
||||
pdp10-*)
|
||||
@ -1590,19 +1588,24 @@ case $cpu-$vendor in
|
||||
os=sunos3
|
||||
;;
|
||||
m68*-cisco)
|
||||
os=aout
|
||||
os=
|
||||
obj=aout
|
||||
;;
|
||||
mep-*)
|
||||
os=elf
|
||||
os=
|
||||
obj=elf
|
||||
;;
|
||||
mips*-cisco)
|
||||
os=elf
|
||||
os=
|
||||
obj=elf
|
||||
;;
|
||||
mips*-*)
|
||||
os=elf
|
||||
mips*-*|nanomips*-*)
|
||||
os=
|
||||
obj=elf
|
||||
;;
|
||||
or32-*)
|
||||
os=coff
|
||||
os=
|
||||
obj=coff
|
||||
;;
|
||||
*-tti) # must be before sparc entry or we get the wrong os.
|
||||
os=sysv3
|
||||
@ -1611,7 +1614,8 @@ case $cpu-$vendor in
|
||||
os=sunos4.1.1
|
||||
;;
|
||||
pru-*)
|
||||
os=elf
|
||||
os=
|
||||
obj=elf
|
||||
;;
|
||||
*-be)
|
||||
os=beos
|
||||
@ -1692,10 +1696,12 @@ case $cpu-$vendor in
|
||||
os=uxpv
|
||||
;;
|
||||
*-rom68k)
|
||||
os=coff
|
||||
os=
|
||||
obj=coff
|
||||
;;
|
||||
*-*bug)
|
||||
os=coff
|
||||
os=
|
||||
obj=coff
|
||||
;;
|
||||
*-apple)
|
||||
os=macos
|
||||
@ -1713,10 +1719,11 @@ esac
|
||||
|
||||
fi
|
||||
|
||||
# Now, validate our (potentially fixed-up) OS.
|
||||
# Now, validate our (potentially fixed-up) individual pieces (OS, OBJ).
|
||||
|
||||
case $os in
|
||||
# Sometimes we do "kernel-libc", so those need to count as OSes.
|
||||
musl* | newlib* | relibc* | uclibc*)
|
||||
llvm* | musl* | newlib* | relibc* | uclibc*)
|
||||
;;
|
||||
# Likewise for "kernel-abi"
|
||||
eabi* | gnueabi*)
|
||||
@ -1724,6 +1731,9 @@ case $os in
|
||||
# VxWorks passes extra cpu info in the 4th filed.
|
||||
simlinux | simwindows | spe)
|
||||
;;
|
||||
# See `case $cpu-$os` validation below
|
||||
ghcjs)
|
||||
;;
|
||||
# Now accept the basic system types.
|
||||
# The portable systems comes first.
|
||||
# Each alternative MUST end in a * to match a version number.
|
||||
@ -1732,7 +1742,7 @@ case $os in
|
||||
| hpux* | unos* | osf* | luna* | dgux* | auroraux* | solaris* \
|
||||
| sym* | plan9* | psp* | sim* | xray* | os68k* | v88r* \
|
||||
| hiux* | abug | nacl* | netware* | windows* \
|
||||
| os9* | macos* | osx* | ios* \
|
||||
| os9* | macos* | osx* | ios* | tvos* | watchos* \
|
||||
| mpw* | magic* | mmixware* | mon960* | lnews* \
|
||||
| amigaos* | amigados* | msdos* | newsos* | unicos* | aof* \
|
||||
| aos* | aros* | cloudabi* | sortix* | twizzler* \
|
||||
@ -1741,11 +1751,11 @@ case $os in
|
||||
| mirbsd* | netbsd* | dicos* | openedition* | ose* \
|
||||
| bitrig* | openbsd* | secbsd* | solidbsd* | libertybsd* | os108* \
|
||||
| ekkobsd* | freebsd* | riscix* | lynxos* | os400* \
|
||||
| bosx* | nextstep* | cxux* | aout* | elf* | oabi* \
|
||||
| ptx* | coff* | ecoff* | winnt* | domain* | vsta* \
|
||||
| bosx* | nextstep* | cxux* | oabi* \
|
||||
| ptx* | ecoff* | winnt* | domain* | vsta* \
|
||||
| udi* | lites* | ieee* | go32* | aux* | hcos* \
|
||||
| chorusrdb* | cegcc* | glidix* | serenity* \
|
||||
| cygwin* | msys* | pe* | moss* | proelf* | rtems* \
|
||||
| cygwin* | msys* | moss* | proelf* | rtems* \
|
||||
| midipix* | mingw32* | mingw64* | mint* \
|
||||
| uxpv* | beos* | mpeix* | udk* | moxiebox* \
|
||||
| interix* | uwin* | mks* | rhapsody* | darwin* \
|
||||
@ -1758,62 +1768,116 @@ case $os in
|
||||
| onefs* | tirtos* | phoenix* | fuchsia* | redox* | bme* \
|
||||
| midnightbsd* | amdhsa* | unleashed* | emscripten* | wasi* \
|
||||
| nsk* | powerunix* | genode* | zvmoe* | qnx* | emx* | zephyr* \
|
||||
| fiwix* | mlibc* )
|
||||
| fiwix* | mlibc* | cos* | mbr* | ironclad* )
|
||||
;;
|
||||
# This one is extra strict with allowed versions
|
||||
sco3.2v2 | sco3.2v[4-9]* | sco5v6*)
|
||||
# Don't forget version if it is 3.2v4 or newer.
|
||||
;;
|
||||
# This refers to builds using the UEFI calling convention
|
||||
# (which depends on the architecture) and PE file format.
|
||||
# Note that this is both a different calling convention and
|
||||
# different file format than that of GNU-EFI
|
||||
# (x86_64-w64-mingw32).
|
||||
uefi)
|
||||
;;
|
||||
none)
|
||||
;;
|
||||
kernel* )
|
||||
kernel* | msvc* )
|
||||
# Restricted further below
|
||||
;;
|
||||
'')
|
||||
if test x"$obj" = x
|
||||
then
|
||||
echo "Invalid configuration '$1': Blank OS only allowed with explicit machine code file format" 1>&2
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
echo Invalid configuration \`"$1"\': OS \`"$os"\' not recognized 1>&2
|
||||
echo "Invalid configuration '$1': OS '$os' not recognized" 1>&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
case $obj in
|
||||
aout* | coff* | elf* | pe*)
|
||||
;;
|
||||
'')
|
||||
# empty is fine
|
||||
;;
|
||||
*)
|
||||
echo "Invalid configuration '$1': Machine code format '$obj' not recognized" 1>&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# Here we handle the constraint that a (synthetic) cpu and os are
|
||||
# valid only in combination with each other and nowhere else.
|
||||
case $cpu-$os in
|
||||
# The "javascript-unknown-ghcjs" triple is used by GHC; we
|
||||
# accept it here in order to tolerate that, but reject any
|
||||
# variations.
|
||||
javascript-ghcjs)
|
||||
;;
|
||||
javascript-* | *-ghcjs)
|
||||
echo "Invalid configuration '$1': cpu '$cpu' is not valid with os '$os$obj'" 1>&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# As a final step for OS-related things, validate the OS-kernel combination
|
||||
# (given a valid OS), if there is a kernel.
|
||||
case $kernel-$os in
|
||||
linux-gnu* | linux-dietlibc* | linux-android* | linux-newlib* \
|
||||
| linux-musl* | linux-relibc* | linux-uclibc* | linux-mlibc* )
|
||||
case $kernel-$os-$obj in
|
||||
linux-gnu*- | linux-android*- | linux-dietlibc*- | linux-llvm*- \
|
||||
| linux-mlibc*- | linux-musl*- | linux-newlib*- \
|
||||
| linux-relibc*- | linux-uclibc*- )
|
||||
;;
|
||||
uclinux-uclibc* )
|
||||
uclinux-uclibc*- )
|
||||
;;
|
||||
managarm-mlibc* | managarm-kernel* )
|
||||
managarm-mlibc*- | managarm-kernel*- )
|
||||
;;
|
||||
-dietlibc* | -newlib* | -musl* | -relibc* | -uclibc* | -mlibc* )
|
||||
windows*-msvc*-)
|
||||
;;
|
||||
-dietlibc*- | -llvm*- | -mlibc*- | -musl*- | -newlib*- | -relibc*- \
|
||||
| -uclibc*- )
|
||||
# These are just libc implementations, not actual OSes, and thus
|
||||
# require a kernel.
|
||||
echo "Invalid configuration \`$1': libc \`$os' needs explicit kernel." 1>&2
|
||||
echo "Invalid configuration '$1': libc '$os' needs explicit kernel." 1>&2
|
||||
exit 1
|
||||
;;
|
||||
-kernel* )
|
||||
echo "Invalid configuration \`$1': \`$os' needs explicit kernel." 1>&2
|
||||
-kernel*- )
|
||||
echo "Invalid configuration '$1': '$os' needs explicit kernel." 1>&2
|
||||
exit 1
|
||||
;;
|
||||
*-kernel* )
|
||||
echo "Invalid configuration \`$1': \`$kernel' does not support \`$os'." 1>&2
|
||||
*-kernel*- )
|
||||
echo "Invalid configuration '$1': '$kernel' does not support '$os'." 1>&2
|
||||
exit 1
|
||||
;;
|
||||
kfreebsd*-gnu* | kopensolaris*-gnu*)
|
||||
*-msvc*- )
|
||||
echo "Invalid configuration '$1': '$os' needs 'windows'." 1>&2
|
||||
exit 1
|
||||
;;
|
||||
vxworks-simlinux | vxworks-simwindows | vxworks-spe)
|
||||
kfreebsd*-gnu*- | kopensolaris*-gnu*-)
|
||||
;;
|
||||
nto-qnx*)
|
||||
vxworks-simlinux- | vxworks-simwindows- | vxworks-spe-)
|
||||
;;
|
||||
os2-emx)
|
||||
nto-qnx*-)
|
||||
;;
|
||||
*-eabi* | *-gnueabi*)
|
||||
os2-emx-)
|
||||
;;
|
||||
-*)
|
||||
*-eabi*- | *-gnueabi*-)
|
||||
;;
|
||||
none--*)
|
||||
# None (no kernel, i.e. freestanding / bare metal),
|
||||
# can be paired with an machine code file format
|
||||
;;
|
||||
-*-)
|
||||
# Blank kernel with real OS is always fine.
|
||||
;;
|
||||
*-*)
|
||||
echo "Invalid configuration \`$1': Kernel \`$kernel' not known to work with OS \`$os'." 1>&2
|
||||
--*)
|
||||
# Blank kernel and OS with real machine code file format is always fine.
|
||||
;;
|
||||
*-*-*)
|
||||
echo "Invalid configuration '$1': Kernel '$kernel' not known to work with OS '$os'." 1>&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
@ -1896,7 +1960,7 @@ case $vendor in
|
||||
;;
|
||||
esac
|
||||
|
||||
echo "$cpu-$vendor-${kernel:+$kernel-}$os"
|
||||
echo "$cpu-$vendor${kernel:+-$kernel}${os:+-$os}${obj:+-$obj}"
|
||||
exit
|
||||
|
||||
# Local variables:
|
||||
|
8034
contrib/tcpdump/configure
vendored
8034
contrib/tcpdump/configure
vendored
File diff suppressed because it is too large
Load Diff
@ -13,8 +13,8 @@ dnl
|
||||
# config.sub.
|
||||
#
|
||||
|
||||
AC_PREREQ(2.69)
|
||||
AC_INIT(tcpdump, m4_esyscmd_s([cat VERSION]))
|
||||
AC_PREREQ([2.69])
|
||||
AC_INIT([tcpdump],[m4_esyscmd_s(cat VERSION)])
|
||||
AC_CONFIG_SRCDIR(tcpdump.c)
|
||||
|
||||
AC_CANONICAL_HOST
|
||||
@ -31,7 +31,16 @@ fi
|
||||
AC_LBL_C_INIT(V_CCOPT, V_INCLS)
|
||||
AC_LBL_C_INLINE
|
||||
|
||||
AC_CHECK_HEADERS(fcntl.h rpc/rpc.h rpc/rpcent.h net/if.h)
|
||||
AC_CHECK_HEADERS(rpc/rpc.h rpc/rpcent.h net/if.h)
|
||||
#
|
||||
# Get the size of a void *, to know whether this is a 32-bit or 64-bit build.
|
||||
#
|
||||
AC_CHECK_SIZEOF([void *])
|
||||
|
||||
#
|
||||
# Get the size of a time_t, to know whether it's 32-bit or 64-bit.
|
||||
#
|
||||
AC_CHECK_SIZEOF([time_t],,[#include <time.h>])
|
||||
|
||||
case "$host_os" in
|
||||
|
||||
@ -63,6 +72,15 @@ darwin*)
|
||||
;;
|
||||
esac
|
||||
|
||||
#
|
||||
# Do we have pkg-config?
|
||||
#
|
||||
PKG_PROG_PKG_CONFIG
|
||||
|
||||
#
|
||||
# Do we have the brew command from Homebrew?
|
||||
#
|
||||
AC_PATH_PROG([BREW], [brew])
|
||||
|
||||
AC_ARG_WITH([smi],
|
||||
[AS_HELP_STRING([--with-smi],
|
||||
@ -84,8 +102,7 @@ if test "x$with_smi" != "xno" ; then
|
||||
AC_MSG_CHECKING([whether to enable libsmi])
|
||||
savedlibs="$LIBS"
|
||||
LIBS="-lsmi $LIBS"
|
||||
AC_TRY_RUN(
|
||||
[
|
||||
AC_RUN_IFELSE([AC_LANG_SOURCE([[
|
||||
/* libsmi available check */
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@ -106,6 +123,7 @@ int main()
|
||||
exit(4);
|
||||
exit(0);
|
||||
}
|
||||
]])
|
||||
],
|
||||
[
|
||||
AC_MSG_RESULT(yes)
|
||||
@ -137,6 +155,33 @@ int main()
|
||||
])
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING([whether to enable the instrument functions code])
|
||||
AC_ARG_ENABLE([instrument-functions],
|
||||
[AS_HELP_STRING([--enable-instrument-functions],
|
||||
[enable instrument functions code [default=no]])],
|
||||
[],
|
||||
[enableval=no])
|
||||
case "$enableval" in
|
||||
yes) AC_MSG_RESULT(yes)
|
||||
AC_CHECK_LIB([bfd], [bfd_init],
|
||||
[true],
|
||||
[AC_MSG_ERROR(
|
||||
[--enable-instrument-functions was given, but test for library libbfd failed. Please install the 'binutils-dev' package.])],
|
||||
[])
|
||||
AC_DEFINE(ENABLE_INSTRUMENT_FUNCTIONS, 1,
|
||||
[define if you want to build the instrument functions code])
|
||||
LOCALSRC="$LOCALSRC instrument-functions.c"
|
||||
# Add '-finstrument-functions' instrumentation option to generate
|
||||
# instrumentation calls for entry and exit to functions.
|
||||
# Try to avoid Address Space Layout Randomization (ALSR).
|
||||
CFLAGS="$CFLAGS -O0 -ggdb -finstrument-functions -fno-stack-protector -fno-pic"
|
||||
LDFLAGS="$LDFLAGS -O0 -ggdb -fno-stack-protector -no-pie"
|
||||
LIBS="$LIBS -lbfd"
|
||||
;;
|
||||
*) AC_MSG_RESULT(no)
|
||||
;;
|
||||
esac
|
||||
|
||||
AC_MSG_CHECKING([whether to enable the possibly-buggy SMB printer])
|
||||
AC_ARG_ENABLE([smb],
|
||||
[AS_HELP_STRING([--enable-smb],
|
||||
@ -153,25 +198,42 @@ yes) AC_MSG_RESULT(yes)
|
||||
;;
|
||||
esac
|
||||
|
||||
AC_ARG_WITH(user, [ --with-user=USERNAME drop privileges by default to USERNAME])
|
||||
AC_MSG_CHECKING([whether to drop root privileges by default])
|
||||
if test ! -z "$with_user" ; then
|
||||
AC_DEFINE_UNQUOTED(WITH_USER, "$withval",
|
||||
[define if should drop privileges by default])
|
||||
AC_MSG_RESULT(to \"$withval\")
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
AC_ARG_WITH(
|
||||
[user],
|
||||
[AS_HELP_STRING([--with-user=USERNAME],
|
||||
[drop privileges by default to USERNAME]
|
||||
)],
|
||||
[],
|
||||
[withval=no])
|
||||
AS_CASE(["$withval"],
|
||||
[no], [AC_MSG_RESULT(no)],
|
||||
[''|yes], [AC_MSG_ERROR([--with-user requires a username])],
|
||||
[
|
||||
AC_DEFINE_UNQUOTED(WITH_USER, "$withval",
|
||||
[define if should drop privileges by default])
|
||||
AC_MSG_RESULT([yes, to user "$withval"])
|
||||
]
|
||||
)
|
||||
|
||||
AC_ARG_WITH(chroot, [ --with-chroot=DIRECTORY when dropping privileges, chroot to DIRECTORY])
|
||||
AC_MSG_CHECKING([whether to chroot])
|
||||
if test ! -z "$with_chroot" && test "$with_chroot" != "no" ; then
|
||||
AC_DEFINE_UNQUOTED(WITH_CHROOT, "$withval",
|
||||
[define if should chroot when dropping privileges])
|
||||
AC_MSG_RESULT(to \"$withval\")
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
AC_ARG_WITH(
|
||||
[chroot],
|
||||
[AS_HELP_STRING([--with-chroot=DIRECTORY],
|
||||
[when dropping privileges, chroot to DIRECTORY]
|
||||
)],
|
||||
[],
|
||||
[withval=no]
|
||||
)
|
||||
AS_CASE(["$withval"],
|
||||
[no], [AC_MSG_RESULT(no)],
|
||||
[''|yes], [AC_MSG_ERROR([--with-chroot requires a directory])],
|
||||
[
|
||||
AC_DEFINE_UNQUOTED(WITH_CHROOT, "$withval",
|
||||
[define if should chroot when dropping privileges])
|
||||
AC_MSG_RESULT([yes, to directory "$withval"])
|
||||
]
|
||||
)
|
||||
|
||||
AC_ARG_WITH(sandbox-capsicum,
|
||||
AS_HELP_STRING([--with-sandbox-capsicum],
|
||||
@ -384,29 +446,64 @@ AC_CHECK_FUNCS(fork vfork)
|
||||
AC_CHECK_FUNCS(setlinebuf)
|
||||
|
||||
#
|
||||
# Make sure we have vsnprintf() and snprintf(); we require them.
|
||||
# Make sure we have snprintf(); we require it.
|
||||
#
|
||||
AC_CHECK_FUNC(vsnprintf,,
|
||||
AC_MSG_ERROR([vsnprintf() is required but wasn't found]))
|
||||
AC_CHECK_FUNC(snprintf,,
|
||||
AC_MSG_ERROR([snprintf() is required but wasn't found]))
|
||||
|
||||
#
|
||||
# Define HAVE_NO_PRINTF_Z to make it possible to disable test cases that
|
||||
# depend on %zu.
|
||||
# It became apparent at some point that using a suitable C99 compiler does not
|
||||
# automatically mean snprintf(3) implementation in the libc supports all the
|
||||
# modifiers and specifiers used in the project, so let's test that before the
|
||||
# build, not after.
|
||||
#
|
||||
AC_MSG_CHECKING([whether printf(3) supports the z length modifier])
|
||||
# Testing the sizeof_t length modifier takes making an snprintf() call and
|
||||
# comparing the actual result with the expected result. If this fails, it will
|
||||
# most likely happen at run time, not compile time.
|
||||
#
|
||||
# Testing the 64-bit conversion specifiers in addition to that requires the
|
||||
# <inttypes.h> header to be present and the macros to be defined, so if this
|
||||
# fails, it will more likely happen at compile time.
|
||||
#
|
||||
AC_MSG_CHECKING([whether snprintf is suitable])
|
||||
AC_RUN_IFELSE(
|
||||
[
|
||||
AC_LANG_SOURCE([[
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <inttypes.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
char buf[100];
|
||||
uint64_t t = (uint64_t)1 << 32;
|
||||
|
||||
snprintf(buf, sizeof(buf), "%zu", sizeof(buf));
|
||||
return strncmp(buf, "100", sizeof(buf)) ? 1 : 0;
|
||||
if (strncmp(buf, "100", sizeof(buf)))
|
||||
return 1;
|
||||
|
||||
snprintf(buf, sizeof(buf), "%zd", -sizeof(buf));
|
||||
if (strncmp(buf, "-100", sizeof(buf)))
|
||||
return 2;
|
||||
|
||||
snprintf(buf, sizeof(buf), "%" PRId64, -t);
|
||||
if (strncmp(buf, "-4294967296", sizeof(buf)))
|
||||
return 3;
|
||||
|
||||
snprintf(buf, sizeof(buf), "0o%" PRIo64, t);
|
||||
if (strncmp(buf, "0o40000000000", sizeof(buf)))
|
||||
return 4;
|
||||
|
||||
snprintf(buf, sizeof(buf), "0x%" PRIx64, t);
|
||||
if (strncmp(buf, "0x100000000", sizeof(buf)))
|
||||
return 5;
|
||||
|
||||
snprintf(buf, sizeof(buf), "%" PRIu64, t);
|
||||
if (strncmp(buf, "4294967296", sizeof(buf)))
|
||||
return 6;
|
||||
|
||||
return 0;
|
||||
}
|
||||
]])
|
||||
],
|
||||
@ -415,8 +512,9 @@ int main()
|
||||
],
|
||||
[
|
||||
AC_MSG_RESULT(no)
|
||||
AC_DEFINE(HAVE_NO_PRINTF_Z, 1,
|
||||
[Define to 1 if printf(3) does not support the z length modifier.])
|
||||
AC_MSG_ERROR(
|
||||
[The snprintf(3) implementation in this libc is not suitable,
|
||||
tcpdump would not work correctly even if it managed to compile.])
|
||||
],
|
||||
[
|
||||
AC_MSG_RESULT(not while cross-compiling)
|
||||
@ -448,7 +546,7 @@ AC_LBL_LIBPCAP(V_PCAPDEP, V_INCLS)
|
||||
#
|
||||
AC_CHECK_FUNCS(ether_ntohost, [
|
||||
AC_CACHE_CHECK(for buggy ether_ntohost, ac_cv_buggy_ether_ntohost, [
|
||||
AC_TRY_RUN([
|
||||
AC_RUN_IFELSE([AC_LANG_SOURCE([[
|
||||
#include <netdb.h>
|
||||
#include <netinet/ether.h>
|
||||
#include <stdlib.h>
|
||||
@ -465,6 +563,7 @@ AC_CHECK_FUNCS(ether_ntohost, [
|
||||
ether_ntohost(name, (struct ether_addr *)ea);
|
||||
exit(0);
|
||||
}
|
||||
]])
|
||||
], [ac_cv_buggy_ether_ntohost=no],
|
||||
[ac_cv_buggy_ether_ntohost=yes],
|
||||
[ac_cv_buggy_ether_ntohost="not while cross-compiling"])])
|
||||
@ -506,7 +605,7 @@ if test "$ac_cv_func_ether_ntohost" = yes -a \
|
||||
unset ac_cv_have_decl_ether_ntohost
|
||||
AC_CHECK_DECL(ether_ntohost,
|
||||
[
|
||||
AC_DEFINE(NETINET_ETHER_H_DECLARES_ETHER_NTOHOST,,
|
||||
AC_DEFINE(NETINET_ETHER_H_DECLARES_ETHER_NTOHOST,1,
|
||||
[Define to 1 if netinet/ether.h declares `ether_ntohost'])
|
||||
],,
|
||||
[
|
||||
@ -701,27 +800,17 @@ fi
|
||||
# if we have them.
|
||||
#
|
||||
AC_CHECK_FUNCS(pcap_findalldevs)
|
||||
if test $ac_cv_func_pcap_findalldevs = "yes" ; then
|
||||
dnl Check for libpcap having pcap_findalldevs() but the pcap.h header
|
||||
dnl not having pcap_if_t; some versions of Mac OS X shipped with pcap.h
|
||||
dnl from 0.6 and libpcap 0.8, so that libpcap had pcap_findalldevs but
|
||||
dnl pcap.h didn't have pcap_if_t.
|
||||
savedcppflags="$CPPFLAGS"
|
||||
CPPFLAGS="$CPPFLAGS $V_INCLS"
|
||||
AC_CHECK_TYPES(pcap_if_t, , , [#include <pcap.h>])
|
||||
CPPFLAGS="$savedcppflags"
|
||||
fi
|
||||
AC_CHECK_FUNCS(pcap_dump_flush pcap_lib_version)
|
||||
if test $ac_cv_func_pcap_lib_version = "no" ; then
|
||||
AC_MSG_CHECKING(whether pcap_version is defined by libpcap)
|
||||
AC_TRY_LINK([],
|
||||
[
|
||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
|
||||
extern char pcap_version[];
|
||||
|
||||
return (int)pcap_version;
|
||||
]])
|
||||
],
|
||||
ac_lbl_cv_pcap_version_defined=yes,
|
||||
ac_lbl_cv_pcap_version_defined=no)
|
||||
[ac_lbl_cv_pcap_version_defined=yes],
|
||||
[ac_lbl_cv_pcap_version_defined=no])
|
||||
if test "$ac_lbl_cv_pcap_version_defined" = yes ; then
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_PCAP_VERSION, 1, [define if libpcap has pcap_version])
|
||||
@ -730,7 +819,14 @@ if test $ac_cv_func_pcap_lib_version = "no" ; then
|
||||
fi
|
||||
fi
|
||||
AC_CHECK_FUNCS(pcap_setdirection pcap_set_immediate_mode pcap_dump_ftell64)
|
||||
AC_CHECK_FUNCS(pcap_open pcap_findalldevs_ex)
|
||||
#
|
||||
# See the comment in AC_LBL_LIBPCAP in aclocal.m4 for the reason
|
||||
# why we don't check for remote-capture APIs if we're building
|
||||
# with the system libpcap on macOS.
|
||||
#
|
||||
if test "$_dont_check_for_remote_apis" != "yes"; then
|
||||
AC_CHECK_FUNCS(pcap_open pcap_findalldevs_ex)
|
||||
fi
|
||||
AC_REPLACE_FUNCS(pcap_dump_ftell)
|
||||
|
||||
#
|
||||
@ -743,14 +839,14 @@ if test "$ac_cv_func_pcap_set_parser_debug" = "no" ; then
|
||||
# filter expression parser debug flag; can we directly set the
|
||||
# flag?
|
||||
AC_MSG_CHECKING(whether pcap_debug is defined by libpcap)
|
||||
AC_TRY_LINK([],
|
||||
[
|
||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
|
||||
extern int pcap_debug;
|
||||
|
||||
return pcap_debug;
|
||||
]])
|
||||
],
|
||||
ac_lbl_cv_pcap_debug_defined=yes,
|
||||
ac_lbl_cv_pcap_debug_defined=no)
|
||||
[ac_lbl_cv_pcap_debug_defined=yes],
|
||||
[ac_lbl_cv_pcap_debug_defined=no])
|
||||
if test "$ac_lbl_cv_pcap_debug_defined" = yes ; then
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_PCAP_DEBUG, 1, [define if libpcap has pcap_debug])
|
||||
@ -760,14 +856,14 @@ if test "$ac_cv_func_pcap_set_parser_debug" = "no" ; then
|
||||
# OK, what about "yydebug"?
|
||||
#
|
||||
AC_MSG_CHECKING(whether yydebug is defined by libpcap)
|
||||
AC_TRY_LINK([],
|
||||
[
|
||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
|
||||
extern int yydebug;
|
||||
|
||||
return yydebug;
|
||||
]])
|
||||
],
|
||||
ac_lbl_cv_yydebug_defined=yes,
|
||||
ac_lbl_cv_yydebug_defined=no)
|
||||
[ac_lbl_cv_yydebug_defined=yes],
|
||||
[ac_lbl_cv_yydebug_defined=no])
|
||||
if test "$ac_lbl_cv_yydebug_defined" = yes ; then
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_YYDEBUG, 1, [define if libpcap has yydebug])
|
||||
@ -779,10 +875,6 @@ fi
|
||||
AC_CHECK_FUNCS(pcap_set_optimizer_debug)
|
||||
AC_REPLACE_FUNCS(bpf_dump) dnl moved to libpcap in 0.6
|
||||
|
||||
V_GROUP=0
|
||||
if test -f /etc/group -a ! -z "`grep '^wheel:' /etc/group`" ; then
|
||||
V_GROUP=wheel
|
||||
fi
|
||||
#
|
||||
# Assume V7/BSD convention for man pages (file formats in section 5,
|
||||
# miscellaneous info in section 7).
|
||||
@ -825,8 +917,6 @@ osf*)
|
||||
;;
|
||||
|
||||
solaris*)
|
||||
V_GROUP=sys
|
||||
|
||||
#
|
||||
# Use System V conventions for man pages.
|
||||
#
|
||||
@ -835,23 +925,26 @@ solaris*)
|
||||
;;
|
||||
esac
|
||||
|
||||
if test -f /dev/bpf0 ; then
|
||||
V_GROUP=bpf
|
||||
fi
|
||||
|
||||
#
|
||||
# Make sure we have a definition for C99's uintptr_t (regardless of
|
||||
# whether the environment is a C99 environment or not).
|
||||
#
|
||||
AC_TYPE_UINTPTR_T
|
||||
|
||||
savedcppflags="$CPPFLAGS"
|
||||
CPPFLAGS="$CPPFLAGS $V_INCLS"
|
||||
|
||||
#
|
||||
# Check whether we have pcap/pcap-inttypes.h.
|
||||
# If we do, we use that to get the C99 types defined.
|
||||
#
|
||||
savedcppflags="$CPPFLAGS"
|
||||
CPPFLAGS="$CPPFLAGS $V_INCLS"
|
||||
AC_CHECK_HEADERS(pcap/pcap-inttypes.h)
|
||||
|
||||
#
|
||||
# At compile time HAVE_PCAP_FINDALLDEVS depends on HAVE_PCAP_IF_T.
|
||||
#
|
||||
AC_CHECK_TYPES(pcap_if_t, , , [#include <pcap.h>])
|
||||
|
||||
CPPFLAGS="$savedcppflags"
|
||||
|
||||
#
|
||||
@ -913,13 +1006,6 @@ AC_ARG_WITH(crypto,
|
||||
want_libcrypto=yes
|
||||
libcrypto_root=$withval
|
||||
AC_MSG_RESULT([yes, using the version installed in $withval])
|
||||
|
||||
#
|
||||
# Put the subdirectories of the libcrypto root directory
|
||||
# at the front of the header and library search path.
|
||||
#
|
||||
CFLAGS="-I$withval/include $CFLAGS"
|
||||
LIBS="-L$withval/lib $LIBS"
|
||||
fi
|
||||
],[
|
||||
#
|
||||
@ -931,42 +1017,216 @@ AC_ARG_WITH(crypto,
|
||||
])
|
||||
if test "$want_libcrypto" != "no"; then
|
||||
#
|
||||
# Don't check for libcrypto unless we have its headers;
|
||||
# Apple, bless their pointy little heads, apparently ship
|
||||
# libcrypto as a library, but not the header files, in
|
||||
# El Capitan, probably because they don't want you writing
|
||||
# nasty portable code that could run on other UN*Xes, they
|
||||
# want you writing code that uses their Shiny New Crypto
|
||||
# Library and that only runs on macOS.
|
||||
# Were we told where to look for libcrypto?
|
||||
#
|
||||
AC_CHECK_HEADER(openssl/crypto.h,
|
||||
[
|
||||
AC_CHECK_LIB(crypto, DES_cbc_encrypt)
|
||||
if test "$ac_cv_lib_crypto_DES_cbc_encrypt" = "yes"; then
|
||||
AC_CHECK_HEADERS(openssl/evp.h)
|
||||
#
|
||||
# OK, then:
|
||||
#
|
||||
# 1) do we have EVP_CIPHER_CTX_new?
|
||||
# If so, we use it to allocate an
|
||||
# EVP_CIPHER_CTX, as EVP_CIPHER_CTX may be
|
||||
# opaque; otherwise, we allocate it ourselves.
|
||||
#
|
||||
# 2) do we have EVP_DecryptInit_ex()?
|
||||
# If so, we use it, because we need to be
|
||||
# able to make two "initialize the cipher"
|
||||
# calls, one with the cipher and key, and
|
||||
# one with the IV, and, as of OpenSSL 1.1,
|
||||
# You Can't Do That with EVP_DecryptInit(),
|
||||
# because a call to EVP_DecryptInit() will
|
||||
# unconditionally clear the context, and
|
||||
# if you don't supply a cipher, it'll
|
||||
# clear the cipher, rendering the context
|
||||
# unusable and causing a crash.
|
||||
#
|
||||
AC_CHECK_FUNCS(EVP_CIPHER_CTX_new EVP_DecryptInit_ex)
|
||||
if test -z "$libcrypto_root"; then
|
||||
#
|
||||
# No.
|
||||
#
|
||||
# First, try looking for it with pkg-config, if we have it.
|
||||
#
|
||||
# Homebrew's pkg-config does not, by default, look for
|
||||
# pkg-config files for packages it has installed.
|
||||
# Furthermore, at least for OpenSSL, they appear to be
|
||||
# dumped in package-specific directories whose paths are
|
||||
# not only package-specific but package-version-specific.
|
||||
#
|
||||
# So the only way to find openssl is to get the value of
|
||||
# PKG_CONFIG_PATH from "brew --env openssl" and add that
|
||||
# to PKG_CONFIG_PATH. (No, we can't just assume it's under
|
||||
# /usr/local; Homebrew have conveniently chosen to put it
|
||||
# under /opt/homebrew on ARM.)
|
||||
#
|
||||
# That's the nice thing about Homebrew - it makes things easier!
|
||||
# Thanks!
|
||||
#
|
||||
save_PKG_CONFIG_PATH="$PKG_CONFIG_PATH"
|
||||
if test -n "$BREW"; then
|
||||
openssl_pkgconfig_dir=`$BREW --env --plain openssl | sed -n 's/PKG_CONFIG_PATH: //p'`
|
||||
PKG_CONFIG_PATH="$openssl_pkgconfig_dir:$PKG_CONFIG_PATH"
|
||||
fi
|
||||
])
|
||||
PKG_CHECK_MODULE(LIBCRYPTO, libcrypto,
|
||||
[
|
||||
#
|
||||
# We found OpenSSL/libressl libcrypto.
|
||||
#
|
||||
HAVE_LIBCRYPTO=yes
|
||||
])
|
||||
PKG_CONFIG_PATH="$save_PKG_CONFIG_PATH"
|
||||
|
||||
#
|
||||
# If it wasn't found, and we have Homebrew installed, see
|
||||
# if it's in Homebrew.
|
||||
#
|
||||
if test "x$HAVE_LIBCRYPTO" != "xyes" -a -n "$BREW"; then
|
||||
AC_MSG_CHECKING(for openssl in Homebrew)
|
||||
#
|
||||
# The brew man page lies when it speaks of
|
||||
# $BREW --prefix --installed <formula>
|
||||
# outputting nothing. In Homebrew 3.3.16,
|
||||
# it produces output regardless of whether
|
||||
# the formula is installed or not, so we
|
||||
# send the standard output and error to
|
||||
# the bit bucket.
|
||||
#
|
||||
# libcrypto isn't a formula, openssl is a formula.
|
||||
#
|
||||
if $BREW --prefix --installed openssl >/dev/null 2>&1; then
|
||||
#
|
||||
# Yes. Get the include directory and library
|
||||
# directory. (No, we can't just assume it's
|
||||
# under /usr/local; Homebrew have conveniently
|
||||
# chosen to put it under /opt/homebrew on ARM.)
|
||||
#
|
||||
AC_MSG_RESULT(yes)
|
||||
HAVE_LIBCRYPTO=yes
|
||||
openssl_path=`$BREW --prefix openssl`
|
||||
LIBCRYPTO_CFLAGS="-I$openssl_path/include"
|
||||
LIBCRYPTO_LIBS="-L$openssl_path/lib -lcrypto"
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
fi
|
||||
|
||||
#
|
||||
# If it wasn't found, and /usr/local/include and /usr/local/lib
|
||||
# exist, check if it's in /usr/local. (We check whether they
|
||||
# exist because, if they don't exist, the compiler will warn
|
||||
# about that and then ignore the argument, so they test
|
||||
# using just the system header files and libraries.)
|
||||
#
|
||||
# We include the standard include file to 1) make sure that
|
||||
# it's installed (if it's just a shared library for the
|
||||
# benefit of existing programs, that's not useful) and 2)
|
||||
# because SSL_library_init() is a library routine in some
|
||||
# versions and a #defined wrapper around OPENSSL_init_ssl()
|
||||
# in others.
|
||||
#
|
||||
if test "x$HAVE_LIBCRYPTO" != "xyes" -a -d "/usr/local/include" -a -d "/usr/local/lib"; then
|
||||
AC_LBL_SAVE_CHECK_STATE
|
||||
CFLAGS="$CFLAGS -I/usr/local/include"
|
||||
LIBS="$LIBS -L/usr/local/lib -lcrypto"
|
||||
AC_MSG_CHECKING(whether we have an OpenSSL/libressl libcrypto in /usr/local that we can use)
|
||||
AC_LINK_IFELSE([AC_LANG_PROGRAM(
|
||||
[[
|
||||
#include <openssl/evp.h>
|
||||
]],
|
||||
[[
|
||||
EVP_CIPHER_CTX_block_size((EVP_CIPHER_CTX *)0);
|
||||
return 0;
|
||||
]])],
|
||||
[
|
||||
AC_MSG_RESULT(yes)
|
||||
HAVE_LIBCRYPTO=yes
|
||||
LIBCRYPTO_CFLAGS="-I/usr/local/include"
|
||||
LIBCRYPTO_LIBS="-L/usr/local/lib -lcrypto"
|
||||
],
|
||||
AC_MSG_RESULT(no))
|
||||
AC_LBL_RESTORE_CHECK_STATE
|
||||
fi
|
||||
|
||||
#
|
||||
# If it wasn't found, check if it's a system library.
|
||||
#
|
||||
# We include the standard include file to 1) make sure that
|
||||
# it's installed (if it's just a shared library for the
|
||||
# benefit of existing programs, that's not useful) and 2)
|
||||
# make sure this isn't a newer macOS that provides libcrypto
|
||||
# as a shared library but doesn't provide headers - Apple,
|
||||
# bless their pointy little heads, apparently ship libcrypto
|
||||
# as a library, but not the header files, in El Capitan and
|
||||
# later, probably because they don't want you writing nasty
|
||||
# portable code that could run on other UN*Xes, they want you
|
||||
# writing code that uses their Shiny New Crypto Library and
|
||||
# that thus only runs on macOS.
|
||||
#
|
||||
if test "x$HAVE_LIBCRYPTO" != "xyes"; then
|
||||
AC_LBL_SAVE_CHECK_STATE
|
||||
LIBS="$LIBS -lcrypto"
|
||||
AC_MSG_CHECKING(whether we have a system OpenSSL/libressl that we can use)
|
||||
AC_LINK_IFELSE([AC_LANG_PROGRAM(
|
||||
[[
|
||||
#include <openssl/evp.h>
|
||||
]],
|
||||
[[
|
||||
EVP_CIPHER_CTX_block_size((EVP_CIPHER_CTX *)0);
|
||||
return 0;
|
||||
]])],
|
||||
[
|
||||
AC_MSG_RESULT(yes)
|
||||
HAVE_LIBCRYPTO=yes
|
||||
LIBCRYPTO_LIBS="-lcrypto"
|
||||
],
|
||||
AC_MSG_RESULT(no))
|
||||
AC_LBL_RESTORE_CHECK_STATE
|
||||
fi
|
||||
else
|
||||
#
|
||||
# Yes.
|
||||
#
|
||||
# Look for it there.
|
||||
#
|
||||
AC_LBL_SAVE_CHECK_STATE
|
||||
CFLAGS="$CFLAGS -I$libcrypto_root/include"
|
||||
LIBS="$LIBS -L$libcrypto_root/lib -lcrypto"
|
||||
AC_MSG_CHECKING(whether we have a system OpenSSL/libressl that we can use)
|
||||
AC_LINK_IFELSE([AC_LANG_PROGRAM(
|
||||
[[
|
||||
#include <openssl/evp.h>
|
||||
]],
|
||||
[[
|
||||
EVP_CIPHER_CTX_block_size((EVP_CIPHER_CTX *)0);
|
||||
return 0;
|
||||
]])],
|
||||
[
|
||||
AC_MSG_RESULT(yes)
|
||||
HAVE_LIBCRYPTO=yes
|
||||
LIBCRYPTO_CFLAGS="-I$libcrypto_root/include"
|
||||
LIBCRYPTO_LIBS="-L$libcrypto_root/lib -lcrypto"
|
||||
],
|
||||
AC_MSG_RESULT(no))
|
||||
AC_LBL_RESTORE_CHECK_STATE
|
||||
fi
|
||||
|
||||
#
|
||||
# OK, did we find it?
|
||||
#
|
||||
if test "x$HAVE_LIBCRYPTO" = "xyes"; then
|
||||
AC_DEFINE([HAVE_LIBCRYPTO], [1], [Define to 1 if you have a usable `crypto' library (-lcrypto).])
|
||||
|
||||
#
|
||||
# Put the subdirectories of the libcrypto root directory
|
||||
# at the end of the header and library search path, to
|
||||
# make sure they come after any -I or -L flags for
|
||||
# a local libpcap - those must take precedence of any
|
||||
# directory that might contain an installed version of
|
||||
# libpcap.
|
||||
#
|
||||
V_INCLS="$V_INCLS $LIBCRYPTO_CFLAGS"
|
||||
LIBS="$LIBS $LIBCRYPTO_LIBS"
|
||||
|
||||
#
|
||||
# OK, then:
|
||||
#
|
||||
# 1) do we have EVP_CIPHER_CTX_new?
|
||||
# If so, we use it to allocate an EVP_CIPHER_CTX, as
|
||||
# EVP_CIPHER_CTX may be opaque; otherwise, we allocate it
|
||||
# ourselves.
|
||||
#
|
||||
# 2) do we have EVP_DecryptInit_ex()?
|
||||
# If so, we use it, because we need to be able to make
|
||||
# two "initialize the cipher" calls, one with the cipher
|
||||
# and key, and one with the IV, and, as of OpenSSL 1.1,
|
||||
# You Can't Do That with EVP_DecryptInit(), because a
|
||||
# call to EVP_DecryptInit() will unconditionally clear
|
||||
# the context, and if you don't supply a cipher, it'll
|
||||
# clear the cipher, rendering the context unusable and
|
||||
# causing a crash.
|
||||
#
|
||||
AC_CHECK_FUNCS(EVP_CIPHER_CTX_new EVP_DecryptInit_ex)
|
||||
else
|
||||
AC_MSG_NOTICE(OpenSSL/libressl libcrypto not found)
|
||||
fi
|
||||
fi
|
||||
|
||||
# Check for libcap-ng
|
||||
@ -1007,7 +1267,6 @@ fi
|
||||
|
||||
AC_SUBST(V_CCOPT)
|
||||
AC_SUBST(V_DEFS)
|
||||
AC_SUBST(V_GROUP)
|
||||
AC_SUBST(V_INCLS)
|
||||
AC_SUBST(V_PCAPDEP)
|
||||
AC_SUBST(LOCALSRC)
|
||||
@ -1018,10 +1277,11 @@ AC_PROG_INSTALL
|
||||
|
||||
AC_CONFIG_HEADER(config.h)
|
||||
|
||||
AC_OUTPUT_COMMANDS([if test -f .devel; then
|
||||
AC_CONFIG_COMMANDS([.devel],[[if test -f .devel; then
|
||||
echo timestamp > stamp-h
|
||||
cat $srcdir/Makefile-devel-adds >> Makefile
|
||||
make depend || exit 1
|
||||
fi])
|
||||
AC_OUTPUT(Makefile tcpdump.1)
|
||||
fi]],[[]])
|
||||
AC_CONFIG_FILES([Makefile tcpdump.1])
|
||||
AC_OUTPUT
|
||||
exit 0
|
||||
|
@ -27,9 +27,7 @@
|
||||
* OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
@ -60,11 +60,6 @@
|
||||
DIAG_DO_PRAGMA(clang diagnostic ignored "-Wassign-enum")
|
||||
#define DIAG_ON_ASSIGN_ENUM \
|
||||
DIAG_DO_PRAGMA(clang diagnostic pop)
|
||||
|
||||
#define DIAG_OFF_CAST_QUAL
|
||||
#define DIAG_ON_CAST_QUAL
|
||||
#define DIAG_OFF_DEPRECATION
|
||||
#define DIAG_ON_DEPRECATION
|
||||
/*
|
||||
* The current clang compilers also define __GNUC__ and __GNUC_MINOR__
|
||||
* thus we need to test the clang case before the GCC one
|
||||
@ -124,10 +119,21 @@
|
||||
#define DIAG_ON_C11_EXTENSIONS \
|
||||
DIAG_DO_PRAGMA(clang diagnostic pop)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* When Clang correctly detects an old-style function prototype after
|
||||
* preprocessing, the warning can be irrelevant to this source tree because
|
||||
* the prototype comes from a system header macro.
|
||||
*/
|
||||
#if ND_IS_AT_LEAST_CLANG_VERSION(5,0)
|
||||
#define DIAG_OFF_STRICT_PROTOTYPES \
|
||||
DIAG_DO_PRAGMA(clang diagnostic push) \
|
||||
DIAG_DO_PRAGMA(clang diagnostic ignored "-Wstrict-prototypes")
|
||||
#define DIAG_ON_STRICT_PROTOTYPES \
|
||||
DIAG_DO_PRAGMA(clang diagnostic pop)
|
||||
#endif
|
||||
#elif ND_IS_AT_LEAST_GNUC_VERSION(4,2)
|
||||
/* GCC apparently doesn't complain about ORing enums together. */
|
||||
#define DIAG_OFF_ASSIGN_ENUM
|
||||
#define DIAG_ON_ASSIGN_ENUM
|
||||
|
||||
/*
|
||||
* It does, however, complain about casting away constness in
|
||||
@ -139,6 +145,22 @@
|
||||
#define DIAG_ON_CAST_QUAL \
|
||||
DIAG_DO_PRAGMA(GCC diagnostic pop)
|
||||
|
||||
#if ND_IS_AT_LEAST_GNUC_VERSION(4,5)
|
||||
/*
|
||||
* GCC warns about unused return values if a function is marked as
|
||||
* "warn about ignoring this function's return value".
|
||||
*
|
||||
* Clang appears to let you ignore a result without a warning by
|
||||
* casting the function result to void, so we don't appear to
|
||||
* need this for Clang.
|
||||
*/
|
||||
#define DIAG_OFF_WARN_UNUSED_RESULT \
|
||||
DIAG_DO_PRAGMA(GCC diagnostic push) \
|
||||
DIAG_DO_PRAGMA(GCC diagnostic ignored "-Wunused-result")
|
||||
#define DIAG_ON_WARN_UNUSED_RESULT \
|
||||
DIAG_DO_PRAGMA(GCC diagnostic pop)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Suppress deprecation warnings.
|
||||
*/
|
||||
@ -150,21 +172,10 @@
|
||||
/*
|
||||
* GCC supports -Wc99-c11-compat since version 5.1.0, but the warning does
|
||||
* not trigger for now, so let's just leave it be.
|
||||
*
|
||||
* GCC does not currently generate any -Wstrict-prototypes warnings that
|
||||
* would need silencing as is done for Clang above.
|
||||
*/
|
||||
#else
|
||||
#define DIAG_OFF_ASSIGN_ENUM
|
||||
#define DIAG_ON_ASSIGN_ENUM
|
||||
#define DIAG_OFF_CAST_QUAL
|
||||
#define DIAG_ON_CAST_QUAL
|
||||
#define DIAG_OFF_DEPRECATION
|
||||
#define DIAG_ON_DEPRECATION
|
||||
#endif
|
||||
|
||||
#ifndef DIAG_OFF_C11_EXTENSIONS
|
||||
#define DIAG_OFF_C11_EXTENSIONS
|
||||
#endif
|
||||
#ifndef DIAG_ON_C11_EXTENSIONS
|
||||
#define DIAG_ON_C11_EXTENSIONS
|
||||
#endif
|
||||
|
||||
/*
|
||||
@ -179,8 +190,46 @@
|
||||
* So please remember to use this very carefully.
|
||||
*/
|
||||
#define ND_UNREACHABLE __builtin_unreachable();
|
||||
#else
|
||||
#define ND_UNREACHABLE
|
||||
#endif
|
||||
|
||||
#ifndef DIAG_OFF_ASSIGN_ENUM
|
||||
#define DIAG_OFF_ASSIGN_ENUM
|
||||
#endif
|
||||
#ifndef DIAG_ON_ASSIGN_ENUM
|
||||
#define DIAG_ON_ASSIGN_ENUM
|
||||
#endif
|
||||
#ifndef DIAG_OFF_CAST_QUAL
|
||||
#define DIAG_OFF_CAST_QUAL
|
||||
#endif
|
||||
#ifndef DIAG_ON_CAST_QUAL
|
||||
#define DIAG_ON_CAST_QUAL
|
||||
#endif
|
||||
#ifndef DIAG_OFF_WARN_UNUSED_RESULT
|
||||
#define DIAG_OFF_WARN_UNUSED_RESULT
|
||||
#endif
|
||||
#ifndef DIAG_ON_WARN_UNUSED_RESULT
|
||||
#define DIAG_ON_WARN_UNUSED_RESULT
|
||||
#endif
|
||||
#ifndef DIAG_OFF_DEPRECATION
|
||||
#define DIAG_OFF_DEPRECATION
|
||||
#endif
|
||||
#ifndef DIAG_ON_DEPRECATION
|
||||
#define DIAG_ON_DEPRECATION
|
||||
#endif
|
||||
#ifndef DIAG_OFF_C11_EXTENSIONS
|
||||
#define DIAG_OFF_C11_EXTENSIONS
|
||||
#endif
|
||||
#ifndef DIAG_ON_C11_EXTENSIONS
|
||||
#define DIAG_ON_C11_EXTENSIONS
|
||||
#endif
|
||||
#ifndef DIAG_OFF_STRICT_PROTOTYPES
|
||||
#define DIAG_OFF_STRICT_PROTOTYPES
|
||||
#endif
|
||||
#ifndef DIAG_ON_STRICT_PROTOTYPES
|
||||
#define DIAG_ON_STRICT_PROTOTYPES
|
||||
#endif
|
||||
#ifndef ND_UNREACHABLE
|
||||
#define ND_UNREACHABLE
|
||||
#endif
|
||||
|
||||
#endif /* _diag_control_h */
|
||||
|
@ -1,200 +0,0 @@
|
||||
Building tcpdump on Windows with Visual Studio
|
||||
==============================================
|
||||
|
||||
Unlike the UN*Xes on which libpcap can capture network traffic, Windows
|
||||
has no network traffic capture mechanism that libpcap can use.
|
||||
Therefore, libpcap requires a driver, and a library to access the
|
||||
driver, provided by the Npcap or WinPcap projects.
|
||||
|
||||
Those projects include versions of libpcap built to use that driver and
|
||||
library; these instructions are for people who want to build libpcap
|
||||
source releases, or libpcap from the Git repository, as a replacement
|
||||
for the version provided with Npcap or WinPcap.
|
||||
|
||||
Npcap and WinPcap SDK
|
||||
---------------------
|
||||
|
||||
In order to build tcpdump, you will need to download Npcap and its
|
||||
software development kit (SDK) or WinPcap and its software development
|
||||
kit.
|
||||
|
||||
Npcap is currently being developed and maintained, and offers many
|
||||
additional capabilities that WinPcap does not.
|
||||
|
||||
WinPcap is no longer being developed or maintained; it should be used
|
||||
only if there is some other requirement to use it rather than Npcap,
|
||||
such as a requirement to support versions of Windows earlier than
|
||||
Windows Vista, which is the earliest version supported by Npcap.
|
||||
|
||||
Npcap and its SDK can be downloaded from its [home page](https://npcap.com).
|
||||
The SDK is a ZIP archive; create a folder on your `C:` drive, e.g.
|
||||
`C:\npcap-sdk`, and put the contents of the ZIP archive into that folder.
|
||||
|
||||
The WinPcap installer can be downloaded from
|
||||
[here](https://www.winpcap.org/install/default.htm)
|
||||
and the WinPcap Developer's Kit can be downloaded from
|
||||
[here](https://www.winpcap.org/devel.htm).
|
||||
|
||||
Required build tools
|
||||
--------------------
|
||||
|
||||
The Developer's Kit is a ZIP archive; it contains a folder named
|
||||
`WpdPack`, which you should place on your `C:` drive, e.g. `C:\WpdPack`.
|
||||
|
||||
Building tcpdump on Windows requires Visual Studio 2015 or later. The
|
||||
Community Edition of Visual Studio can be downloaded at no cost from
|
||||
[here](https://visualstudio.microsoft.com).
|
||||
|
||||
Additional tools are also required. Chocolatey is a package manager for
|
||||
Windows with which those tools, and other tools, can be installed; it
|
||||
can be downloaded from [here](https://chocolatey.org).
|
||||
|
||||
It is a command-line tool; a GUI tool, Chocolatey GUI, is provided as a
|
||||
Chocolatey package, which can be installed from the command line:
|
||||
|
||||
```
|
||||
choco install chocolateygui
|
||||
```
|
||||
|
||||
For convenience, the `choco install` command can be run with the `-y`
|
||||
flag, forcing it to automatically answer all questions asked of the user
|
||||
with "yes":
|
||||
|
||||
```
|
||||
choco install -y chocolateygui
|
||||
```
|
||||
|
||||
The required tools are:
|
||||
|
||||
### CMake ###
|
||||
|
||||
libpcap does not provide supported project files for Visual Studio
|
||||
(there are currently unsupported project files provided, but we do not
|
||||
guarantee that they will work or that we will continue to provide them).
|
||||
It does provide files for CMake, which is a cross-platform tool that
|
||||
runs on UN\*Xes and on Windows and that can generate project files for
|
||||
UN\*X Make, the Ninja build system, and Visual Studio, among other build
|
||||
systems.
|
||||
|
||||
Visual Studio 2015 does not provide CMake; an installer can be
|
||||
downloaded from [here](https://cmake.org/download/).
|
||||
|
||||
When you run the installer, you should choose to add CMake to the system
|
||||
`PATH` for all users and to create the desktop icon.
|
||||
|
||||
CMake can also be installed as the Chocolatey package `cmake`:
|
||||
|
||||
```
|
||||
choco install -y cmake
|
||||
```
|
||||
|
||||
Visual Studio 2017 and later provide CMake, so you will not need to
|
||||
install CMake if you have installed Visual Studio 2017 or later. They
|
||||
include built-in support for CMake-based projects as described
|
||||
[here](https://devblogs.microsoft.com/cppblog/cmake-support-in-visual-studio/).
|
||||
|
||||
For Visual Studio 2017, make sure "Visual C++ tools for CMake" is
|
||||
installed; for Visual Studio 2019, make sure "C++ CMake tools for
|
||||
Windows" is installed.
|
||||
|
||||
Git
|
||||
---
|
||||
|
||||
An optional tool, required only if you will be building from a Git
|
||||
repository rather than from a release source tarball, is Git. Git is
|
||||
provided as an optional installation component, "Git for Windows", with
|
||||
Visual Studio 2017 and later.
|
||||
|
||||
Building from the Visual Studio GUI
|
||||
-----------------------------------
|
||||
|
||||
### Visual Studio 2017 ###
|
||||
|
||||
Open the folder containing the libpcap source with Open > Folder.
|
||||
Visual Studio will run CMake; however, you will need to indicate where
|
||||
the Npcap or WinPcap SDK is installed.
|
||||
|
||||
To do this, go to Project > "Change CMake Settings" > tcpdump and:
|
||||
|
||||
Choose which configuration type to build, if you don't want the default
|
||||
Debug build.
|
||||
|
||||
In the CMakeSettings.json tab, change cmakeCommandArgs to include
|
||||
|
||||
```
|
||||
-DPacket_ROOT={path-to-sdk}
|
||||
```
|
||||
|
||||
where `{path-to-sdk}` is the path of the directory containing the Npcap or
|
||||
WinPcap SDK. Note that backslashes in the path must be specified as two
|
||||
backslashes.
|
||||
|
||||
Save the configuration changes with File > "Save CMakeSettings.json" or
|
||||
with Control-S.
|
||||
|
||||
Visual Studio will then re-run CMake. If that completes without errors,
|
||||
you can build with CMake > "Build All".
|
||||
|
||||
### Visual Studio 2019 ###
|
||||
|
||||
Open the folder containing the libpcap source with Open > Folder.
|
||||
Visual Studio will run CMake; however, you will need to indicate where
|
||||
the Npcap or WinPcap SDK is installed.
|
||||
|
||||
To do this, go to Project > "CMake Settings for tcpdump" and:
|
||||
|
||||
Choose which configuration type to build, if you don't want the default
|
||||
Debug build.
|
||||
|
||||
Scroll down to "Cmake variables and cache", scroll through the list
|
||||
looking for the entry for Packet_ROOT, and either type in the path of
|
||||
the directory containing the Npcap or WinPcap SDK or use the "Browse..."
|
||||
button to browse for that directory.
|
||||
|
||||
Save the configuration changes with File > "Save CMakeSettings.json" or
|
||||
with Control-S.
|
||||
|
||||
Visual Studio will then re-run CMake. If that completes without errors,
|
||||
you can build with Build > "Build All".
|
||||
|
||||
Building from the command line
|
||||
------------------------------
|
||||
|
||||
Start the appropriate Native Tools command line prompt.
|
||||
|
||||
Change to the directory into which you want to build tcpdump, possibly
|
||||
after creating it first. One choice is to create it as a subdirectory
|
||||
of the tcpdump source directory.
|
||||
|
||||
Run the command
|
||||
|
||||
```
|
||||
cmake "-DPacket_ROOT={path-to-sdk}" -G {generator} {path-to-tcpdump-source}
|
||||
```
|
||||
|
||||
`{path-to-sdk}` is the path of the directory containing the Npcap or
|
||||
WinPcap SDK.
|
||||
|
||||
`{generator}` is the string "Visual Studio N YYYY", where `N` is the
|
||||
version of Visual Studio and `YYYY` is the year number for that version;
|
||||
if you are building a 64-bit version of tcpdump, `YYYY` must be followed
|
||||
by a space and "Win64". For example, to build a 32-bit version of
|
||||
tcpdump with Visual Studio 2017, `{generator}` would be "Visual Studio
|
||||
15 2017" and to build a 64-bit version of tcpdump with Visual Studio
|
||||
2017, `{generator}` would be "Visual Studio 15 2017 Win64".
|
||||
|
||||
`{path-to-tcpdump-source}` is the pathname of the top-level source
|
||||
directory for tcpdump.
|
||||
|
||||
Run the command
|
||||
|
||||
```
|
||||
msbuild /m /nologo /p:Configuration={configuration} tcpdump.sln
|
||||
```
|
||||
|
||||
where `{configuration}` can be "Release", "Debug", or "RelWithDebInfo".
|
||||
|
||||
Building with MinGW
|
||||
-------------------
|
||||
|
||||
(XXX - this should be added)
|
33
contrib/tcpdump/doc/README.haiku.md
Normal file
33
contrib/tcpdump/doc/README.haiku.md
Normal file
@ -0,0 +1,33 @@
|
||||
# Compiling tcpdump on Haiku
|
||||
|
||||
## 64-bit x86 R1/beta4
|
||||
|
||||
* Both system and local libpcap are suitable.
|
||||
* Autoconf 2.71 works.
|
||||
* CMake 3.24.2 works.
|
||||
* GCC 11.2.0 works.
|
||||
* Clang 12.0.1 works with the latest llvm12_clang-12.0.1-5 version.
|
||||
|
||||
The following command will install respective non-default packages:
|
||||
```
|
||||
pkgman install libpcap_devel cmake llvm12_clang
|
||||
```
|
||||
|
||||
For reference, the tests were done using a system installed from
|
||||
`haiku-r1beta4-x86_64-anyboot.iso`.
|
||||
|
||||
## 32-bit x86 R1/beta4
|
||||
|
||||
* Both system and local libpcap are suitable.
|
||||
* Autoconf 2.71 works.
|
||||
* CMake 3.24.2 works.
|
||||
* GCC 11.2.0 works.
|
||||
* Clang does not work.
|
||||
|
||||
The following command will install respective non-default packages:
|
||||
```
|
||||
pkgman install libpcap_x86_devel cmake_x86
|
||||
```
|
||||
|
||||
For reference, the tests were done using a system installed from
|
||||
`haiku-r1beta4-x86_gcc2h-anyboot.iso`.
|
@ -39,3 +39,8 @@ developer/gcc
|
||||
developer/llvm/clang
|
||||
ENDOFTEXT
|
||||
```
|
||||
|
||||
## Solaris 9
|
||||
|
||||
This version of this OS is not supported because the snprintf(3) implementation
|
||||
in its libc is not suitable.
|
||||
|
@ -261,7 +261,7 @@ EXTRACT_IPV4_TO_HOST_ORDER(const void *p)
|
||||
* quantities the hard way - fetch the bytes one at a time and
|
||||
* assemble them.
|
||||
*
|
||||
* XXX - ARM is a special case. ARMv1 through ARMv5 didn't suppory
|
||||
* XXX - ARM is a special case. ARMv1 through ARMv5 didn't support
|
||||
* unaligned loads; ARMv6 and later support it *but* have a bit in
|
||||
* the system control register that the OS can set and that causes
|
||||
* unaligned loads to fault rather than succeeding.
|
||||
|
@ -64,7 +64,7 @@
|
||||
/*
|
||||
* We need this to get the versions of socket functions that
|
||||
* use socklen_t. Define it only if it's not already defined,
|
||||
* so we don't get redefiniton warnings.
|
||||
* so we don't get redefinition warnings.
|
||||
*/
|
||||
#ifndef _XOPEN_SOURCE_EXTENDED
|
||||
#define _XOPEN_SOURCE_EXTENDED
|
||||
|
@ -52,13 +52,14 @@
|
||||
|| ND_IS_AT_LEAST_GNUC_VERSION(2,5) \
|
||||
|| ND_IS_AT_LEAST_SUNC_VERSION(5,9) \
|
||||
|| ND_IS_AT_LEAST_XL_C_VERSION(10,1) \
|
||||
|| ND_IS_AT_LEAST_HP_C_VERSION(6,10)
|
||||
|| ND_IS_AT_LEAST_HP_C_VERSION(6,10) \
|
||||
|| __TINYC__
|
||||
/*
|
||||
* Compiler with support for __attribute((noreturn)), or GCC 2.5 and
|
||||
* later, or some compiler asserting compatibility with GCC 2.5 and
|
||||
* later, or Solaris Studio 12 (Sun C 5.9) and later, or IBM XL C 10.1
|
||||
* and later (do any earlier versions of XL C support this?), or HP aCC
|
||||
* A.06.10 and later.
|
||||
* A.06.10 and later, or current TinyCC.
|
||||
*/
|
||||
#define NORETURN __attribute((noreturn))
|
||||
|
||||
|
@ -13,9 +13,7 @@
|
||||
* Original code by Hannes Gredler (hannes@gredler.at)
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include "netdissect-stdinc.h"
|
||||
|
||||
|
@ -35,9 +35,7 @@
|
||||
* @(#)in_cksum.c 8.1 (Berkeley) 6/10/93
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include "netdissect-stdinc.h"
|
||||
|
||||
|
@ -1,250 +1,541 @@
|
||||
#! /bin/sh
|
||||
#
|
||||
#!/bin/sh
|
||||
# install - install a program, script, or datafile
|
||||
# This comes from X11R5 (mit/util/scripts/install.sh).
|
||||
|
||||
scriptversion=2020-11-14.01; # UTC
|
||||
|
||||
# This originates from X11R5 (mit/util/scripts/install.sh), which was
|
||||
# later released in X11R6 (xc/config/util/install.sh) with the
|
||||
# following copyright and license.
|
||||
#
|
||||
# Copyright 1991 by the Massachusetts Institute of Technology
|
||||
# Copyright (C) 1994 X Consortium
|
||||
#
|
||||
# Permission to use, copy, modify, distribute, and sell this software and its
|
||||
# documentation for any purpose is hereby granted without fee, provided that
|
||||
# the above copyright notice appear in all copies and that both that
|
||||
# copyright notice and this permission notice appear in supporting
|
||||
# documentation, and that the name of M.I.T. not be used in advertising or
|
||||
# publicity pertaining to distribution of the software without specific,
|
||||
# written prior permission. M.I.T. makes no representations about the
|
||||
# suitability of this software for any purpose. It is provided "as is"
|
||||
# without express or implied warranty.
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to
|
||||
# deal in the Software without restriction, including without limitation the
|
||||
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
# sell copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
|
||||
# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
#
|
||||
# Except as contained in this notice, the name of the X Consortium shall not
|
||||
# be used in advertising or otherwise to promote the sale, use or other deal-
|
||||
# ings in this Software without prior written authorization from the X Consor-
|
||||
# tium.
|
||||
#
|
||||
#
|
||||
# FSF changes to this file are in the public domain.
|
||||
#
|
||||
# Calling this script install-sh is preferred over install.sh, to prevent
|
||||
# `make' implicit rules from creating a file called install from it
|
||||
# 'make' implicit rules from creating a file called install from it
|
||||
# when there is no Makefile.
|
||||
#
|
||||
# This script is compatible with the BSD install script, but was written
|
||||
# from scratch. It can only install one file at a time, a restriction
|
||||
# shared with many OS's install programs.
|
||||
# from scratch.
|
||||
|
||||
|
||||
# set DOITPROG to echo to test this script
|
||||
|
||||
# Don't use :- since 4.3BSD and earlier shells don't like it.
|
||||
doit="${DOITPROG-}"
|
||||
|
||||
|
||||
# put in absolute paths if you don't have them in your path; or use env. vars.
|
||||
|
||||
mvprog="${MVPROG-mv}"
|
||||
cpprog="${CPPROG-cp}"
|
||||
chmodprog="${CHMODPROG-chmod}"
|
||||
chownprog="${CHOWNPROG-chown}"
|
||||
chgrpprog="${CHGRPPROG-chgrp}"
|
||||
stripprog="${STRIPPROG-strip}"
|
||||
rmprog="${RMPROG-rm}"
|
||||
mkdirprog="${MKDIRPROG-mkdir}"
|
||||
|
||||
transformbasename=""
|
||||
transform_arg=""
|
||||
instcmd="$mvprog"
|
||||
chmodcmd="$chmodprog 0755"
|
||||
chowncmd=""
|
||||
chgrpcmd=""
|
||||
stripcmd=""
|
||||
rmcmd="$rmprog -f"
|
||||
mvcmd="$mvprog"
|
||||
src=""
|
||||
dst=""
|
||||
dir_arg=""
|
||||
|
||||
while [ x"$1" != x ]; do
|
||||
case $1 in
|
||||
-c) instcmd="$cpprog"
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-d) dir_arg=true
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-m) chmodcmd="$chmodprog $2"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-o) chowncmd="$chownprog $2"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-g) chgrpcmd="$chgrpprog $2"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-s) stripcmd="$stripprog"
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-t=*) transformarg=`echo $1 | sed 's/-t=//'`
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-b=*) transformbasename=`echo $1 | sed 's/-b=//'`
|
||||
shift
|
||||
continue;;
|
||||
|
||||
*) if [ x"$src" = x ]
|
||||
then
|
||||
src=$1
|
||||
else
|
||||
# this colon is to work around a 386BSD /bin/sh bug
|
||||
:
|
||||
dst=$1
|
||||
fi
|
||||
shift
|
||||
continue;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ x"$src" = x ]
|
||||
then
|
||||
echo "install: no input file specified"
|
||||
exit 1
|
||||
else
|
||||
true
|
||||
fi
|
||||
|
||||
if [ x"$dir_arg" != x ]; then
|
||||
dst=$src
|
||||
src=""
|
||||
|
||||
if [ -d $dst ]; then
|
||||
instcmd=:
|
||||
else
|
||||
instcmd=mkdir
|
||||
fi
|
||||
else
|
||||
|
||||
# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
|
||||
# might cause directories to be created, which would be especially bad
|
||||
# if $src (and thus $dsttmp) contains '*'.
|
||||
|
||||
if [ -f $src -o -d $src ]
|
||||
then
|
||||
true
|
||||
else
|
||||
echo "install: $src does not exist"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ x"$dst" = x ]
|
||||
then
|
||||
echo "install: no destination specified"
|
||||
exit 1
|
||||
else
|
||||
true
|
||||
fi
|
||||
|
||||
# If destination is a directory, append the input filename; if your system
|
||||
# does not like double slashes in filenames, you may need to add some logic
|
||||
|
||||
if [ -d $dst ]
|
||||
then
|
||||
dst="$dst"/`basename $src`
|
||||
else
|
||||
true
|
||||
fi
|
||||
fi
|
||||
|
||||
## this sed command emulates the dirname command
|
||||
dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
|
||||
|
||||
# Make sure that the destination directory exists.
|
||||
# this part is taken from Noah Friedman's mkinstalldirs script
|
||||
|
||||
# Skip lots of stat calls in the usual case.
|
||||
if [ ! -d "$dstdir" ]; then
|
||||
defaultIFS='
|
||||
tab=' '
|
||||
nl='
|
||||
'
|
||||
IFS="${IFS-${defaultIFS}}"
|
||||
IFS=" $tab$nl"
|
||||
|
||||
oIFS="${IFS}"
|
||||
# Some sh's can't handle IFS=/ for some reason.
|
||||
IFS='%'
|
||||
set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
|
||||
IFS="${oIFS}"
|
||||
# Set DOITPROG to "echo" to test this script.
|
||||
|
||||
pathcomp=''
|
||||
doit=${DOITPROG-}
|
||||
doit_exec=${doit:-exec}
|
||||
|
||||
while [ $# -ne 0 ] ; do
|
||||
pathcomp="${pathcomp}${1}"
|
||||
shift
|
||||
# Put in absolute file names if you don't have them in your path;
|
||||
# or use environment vars.
|
||||
|
||||
if [ ! -d "${pathcomp}" ] ;
|
||||
then
|
||||
$mkdirprog "${pathcomp}"
|
||||
else
|
||||
true
|
||||
fi
|
||||
chgrpprog=${CHGRPPROG-chgrp}
|
||||
chmodprog=${CHMODPROG-chmod}
|
||||
chownprog=${CHOWNPROG-chown}
|
||||
cmpprog=${CMPPROG-cmp}
|
||||
cpprog=${CPPROG-cp}
|
||||
mkdirprog=${MKDIRPROG-mkdir}
|
||||
mvprog=${MVPROG-mv}
|
||||
rmprog=${RMPROG-rm}
|
||||
stripprog=${STRIPPROG-strip}
|
||||
|
||||
pathcomp="${pathcomp}/"
|
||||
posix_mkdir=
|
||||
|
||||
# Desired mode of installed file.
|
||||
mode=0755
|
||||
|
||||
# Create dirs (including intermediate dirs) using mode 755.
|
||||
# This is like GNU 'install' as of coreutils 8.32 (2020).
|
||||
mkdir_umask=22
|
||||
|
||||
backupsuffix=
|
||||
chgrpcmd=
|
||||
chmodcmd=$chmodprog
|
||||
chowncmd=
|
||||
mvcmd=$mvprog
|
||||
rmcmd="$rmprog -f"
|
||||
stripcmd=
|
||||
|
||||
src=
|
||||
dst=
|
||||
dir_arg=
|
||||
dst_arg=
|
||||
|
||||
copy_on_change=false
|
||||
is_target_a_directory=possibly
|
||||
|
||||
usage="\
|
||||
Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
|
||||
or: $0 [OPTION]... SRCFILES... DIRECTORY
|
||||
or: $0 [OPTION]... -t DIRECTORY SRCFILES...
|
||||
or: $0 [OPTION]... -d DIRECTORIES...
|
||||
|
||||
In the 1st form, copy SRCFILE to DSTFILE.
|
||||
In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
|
||||
In the 4th, create DIRECTORIES.
|
||||
|
||||
Options:
|
||||
--help display this help and exit.
|
||||
--version display version info and exit.
|
||||
|
||||
-c (ignored)
|
||||
-C install only if different (preserve data modification time)
|
||||
-d create directories instead of installing files.
|
||||
-g GROUP $chgrpprog installed files to GROUP.
|
||||
-m MODE $chmodprog installed files to MODE.
|
||||
-o USER $chownprog installed files to USER.
|
||||
-p pass -p to $cpprog.
|
||||
-s $stripprog installed files.
|
||||
-S SUFFIX attempt to back up existing files, with suffix SUFFIX.
|
||||
-t DIRECTORY install into DIRECTORY.
|
||||
-T report an error if DSTFILE is a directory.
|
||||
|
||||
Environment variables override the default commands:
|
||||
CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
|
||||
RMPROG STRIPPROG
|
||||
|
||||
By default, rm is invoked with -f; when overridden with RMPROG,
|
||||
it's up to you to specify -f if you want it.
|
||||
|
||||
If -S is not specified, no backups are attempted.
|
||||
|
||||
Email bug reports to bug-automake@gnu.org.
|
||||
Automake home page: https://www.gnu.org/software/automake/
|
||||
"
|
||||
|
||||
while test $# -ne 0; do
|
||||
case $1 in
|
||||
-c) ;;
|
||||
|
||||
-C) copy_on_change=true;;
|
||||
|
||||
-d) dir_arg=true;;
|
||||
|
||||
-g) chgrpcmd="$chgrpprog $2"
|
||||
shift;;
|
||||
|
||||
--help) echo "$usage"; exit $?;;
|
||||
|
||||
-m) mode=$2
|
||||
case $mode in
|
||||
*' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*)
|
||||
echo "$0: invalid mode: $mode" >&2
|
||||
exit 1;;
|
||||
esac
|
||||
shift;;
|
||||
|
||||
-o) chowncmd="$chownprog $2"
|
||||
shift;;
|
||||
|
||||
-p) cpprog="$cpprog -p";;
|
||||
|
||||
-s) stripcmd=$stripprog;;
|
||||
|
||||
-S) backupsuffix="$2"
|
||||
shift;;
|
||||
|
||||
-t)
|
||||
is_target_a_directory=always
|
||||
dst_arg=$2
|
||||
# Protect names problematic for 'test' and other utilities.
|
||||
case $dst_arg in
|
||||
-* | [=\(\)!]) dst_arg=./$dst_arg;;
|
||||
esac
|
||||
shift;;
|
||||
|
||||
-T) is_target_a_directory=never;;
|
||||
|
||||
--version) echo "$0 $scriptversion"; exit $?;;
|
||||
|
||||
--) shift
|
||||
break;;
|
||||
|
||||
-*) echo "$0: invalid option: $1" >&2
|
||||
exit 1;;
|
||||
|
||||
*) break;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
# We allow the use of options -d and -T together, by making -d
|
||||
# take the precedence; this is for compatibility with GNU install.
|
||||
|
||||
if test -n "$dir_arg"; then
|
||||
if test -n "$dst_arg"; then
|
||||
echo "$0: target directory not allowed when installing a directory." >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ x"$dir_arg" != x ]
|
||||
then
|
||||
$doit $instcmd $dst &&
|
||||
if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
|
||||
# When -d is used, all remaining arguments are directories to create.
|
||||
# When -t is used, the destination is already specified.
|
||||
# Otherwise, the last argument is the destination. Remove it from $@.
|
||||
for arg
|
||||
do
|
||||
if test -n "$dst_arg"; then
|
||||
# $@ is not empty: it contains at least $arg.
|
||||
set fnord "$@" "$dst_arg"
|
||||
shift # fnord
|
||||
fi
|
||||
shift # arg
|
||||
dst_arg=$arg
|
||||
# Protect names problematic for 'test' and other utilities.
|
||||
case $dst_arg in
|
||||
-* | [=\(\)!]) dst_arg=./$dst_arg;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
|
||||
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
|
||||
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
|
||||
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
|
||||
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
|
||||
else
|
||||
if test $# -eq 0; then
|
||||
if test -z "$dir_arg"; then
|
||||
echo "$0: no input file specified." >&2
|
||||
exit 1
|
||||
fi
|
||||
# It's OK to call 'install-sh -d' without argument.
|
||||
# This can happen when creating conditional directories.
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# If we're going to rename the final executable, determine the name now.
|
||||
if test -z "$dir_arg"; then
|
||||
if test $# -gt 1 || test "$is_target_a_directory" = always; then
|
||||
if test ! -d "$dst_arg"; then
|
||||
echo "$0: $dst_arg: Is not a directory." >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ x"$transformarg" = x ]
|
||||
if test -z "$dir_arg"; then
|
||||
do_exit='(exit $ret); exit $ret'
|
||||
trap "ret=129; $do_exit" 1
|
||||
trap "ret=130; $do_exit" 2
|
||||
trap "ret=141; $do_exit" 13
|
||||
trap "ret=143; $do_exit" 15
|
||||
|
||||
# Set umask so as not to create temps with too-generous modes.
|
||||
# However, 'strip' requires both read and write access to temps.
|
||||
case $mode in
|
||||
# Optimize common cases.
|
||||
*644) cp_umask=133;;
|
||||
*755) cp_umask=22;;
|
||||
|
||||
*[0-7])
|
||||
if test -z "$stripcmd"; then
|
||||
u_plus_rw=
|
||||
else
|
||||
u_plus_rw='% 200'
|
||||
fi
|
||||
cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
|
||||
*)
|
||||
if test -z "$stripcmd"; then
|
||||
u_plus_rw=
|
||||
else
|
||||
u_plus_rw=,u+rw
|
||||
fi
|
||||
cp_umask=$mode$u_plus_rw;;
|
||||
esac
|
||||
fi
|
||||
|
||||
for src
|
||||
do
|
||||
# Protect names problematic for 'test' and other utilities.
|
||||
case $src in
|
||||
-* | [=\(\)!]) src=./$src;;
|
||||
esac
|
||||
|
||||
if test -n "$dir_arg"; then
|
||||
dst=$src
|
||||
dstdir=$dst
|
||||
test -d "$dstdir"
|
||||
dstdir_status=$?
|
||||
# Don't chown directories that already exist.
|
||||
if test $dstdir_status = 0; then
|
||||
chowncmd=""
|
||||
fi
|
||||
else
|
||||
|
||||
# Waiting for this to be detected by the "$cpprog $src $dsttmp" command
|
||||
# might cause directories to be created, which would be especially bad
|
||||
# if $src (and thus $dsttmp) contains '*'.
|
||||
if test ! -f "$src" && test ! -d "$src"; then
|
||||
echo "$0: $src does not exist." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if test -z "$dst_arg"; then
|
||||
echo "$0: no destination specified." >&2
|
||||
exit 1
|
||||
fi
|
||||
dst=$dst_arg
|
||||
|
||||
# If destination is a directory, append the input filename.
|
||||
if test -d "$dst"; then
|
||||
if test "$is_target_a_directory" = never; then
|
||||
echo "$0: $dst_arg: Is a directory" >&2
|
||||
exit 1
|
||||
fi
|
||||
dstdir=$dst
|
||||
dstbase=`basename "$src"`
|
||||
case $dst in
|
||||
*/) dst=$dst$dstbase;;
|
||||
*) dst=$dst/$dstbase;;
|
||||
esac
|
||||
dstdir_status=0
|
||||
else
|
||||
dstdir=`dirname "$dst"`
|
||||
test -d "$dstdir"
|
||||
dstdir_status=$?
|
||||
fi
|
||||
fi
|
||||
|
||||
case $dstdir in
|
||||
*/) dstdirslash=$dstdir;;
|
||||
*) dstdirslash=$dstdir/;;
|
||||
esac
|
||||
|
||||
obsolete_mkdir_used=false
|
||||
|
||||
if test $dstdir_status != 0; then
|
||||
case $posix_mkdir in
|
||||
'')
|
||||
# With -d, create the new directory with the user-specified mode.
|
||||
# Otherwise, rely on $mkdir_umask.
|
||||
if test -n "$dir_arg"; then
|
||||
mkdir_mode=-m$mode
|
||||
else
|
||||
mkdir_mode=
|
||||
fi
|
||||
|
||||
posix_mkdir=false
|
||||
# The $RANDOM variable is not portable (e.g., dash). Use it
|
||||
# here however when possible just to lower collision chance.
|
||||
tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
|
||||
|
||||
trap '
|
||||
ret=$?
|
||||
rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null
|
||||
exit $ret
|
||||
' 0
|
||||
|
||||
# Because "mkdir -p" follows existing symlinks and we likely work
|
||||
# directly in world-writeable /tmp, make sure that the '$tmpdir'
|
||||
# directory is successfully created first before we actually test
|
||||
# 'mkdir -p'.
|
||||
if (umask $mkdir_umask &&
|
||||
$mkdirprog $mkdir_mode "$tmpdir" &&
|
||||
exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/dev/null 2>&1
|
||||
then
|
||||
dstfile=`basename $dst`
|
||||
if test -z "$dir_arg" || {
|
||||
# Check for POSIX incompatibilities with -m.
|
||||
# HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
|
||||
# other-writable bit of parent directory when it shouldn't.
|
||||
# FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
|
||||
test_tmpdir="$tmpdir/a"
|
||||
ls_ld_tmpdir=`ls -ld "$test_tmpdir"`
|
||||
case $ls_ld_tmpdir in
|
||||
d????-?r-*) different_mode=700;;
|
||||
d????-?--*) different_mode=755;;
|
||||
*) false;;
|
||||
esac &&
|
||||
$mkdirprog -m$different_mode -p -- "$test_tmpdir" && {
|
||||
ls_ld_tmpdir_1=`ls -ld "$test_tmpdir"`
|
||||
test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
|
||||
}
|
||||
}
|
||||
then posix_mkdir=:
|
||||
fi
|
||||
rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir"
|
||||
else
|
||||
dstfile=`basename $dst $transformbasename |
|
||||
sed $transformarg`$transformbasename
|
||||
# Remove any dirs left behind by ancient mkdir implementations.
|
||||
rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 2>/dev/null
|
||||
fi
|
||||
trap '' 0;;
|
||||
esac
|
||||
|
||||
# don't allow the sed command to completely eliminate the filename
|
||||
if
|
||||
$posix_mkdir && (
|
||||
umask $mkdir_umask &&
|
||||
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
|
||||
)
|
||||
then :
|
||||
else
|
||||
|
||||
if [ x"$dstfile" = x ]
|
||||
then
|
||||
dstfile=`basename $dst`
|
||||
else
|
||||
true
|
||||
fi
|
||||
# mkdir does not conform to POSIX,
|
||||
# or it failed possibly due to a race condition. Create the
|
||||
# directory the slow way, step by step, checking for races as we go.
|
||||
|
||||
# Make a temp file name in the proper directory.
|
||||
case $dstdir in
|
||||
/*) prefix='/';;
|
||||
[-=\(\)!]*) prefix='./';;
|
||||
*) prefix='';;
|
||||
esac
|
||||
|
||||
dsttmp=$dstdir/#inst.$$#
|
||||
oIFS=$IFS
|
||||
IFS=/
|
||||
set -f
|
||||
set fnord $dstdir
|
||||
shift
|
||||
set +f
|
||||
IFS=$oIFS
|
||||
|
||||
# Move or copy the file name to the temp name
|
||||
prefixes=
|
||||
|
||||
$doit $instcmd $src $dsttmp &&
|
||||
for d
|
||||
do
|
||||
test X"$d" = X && continue
|
||||
|
||||
trap "rm -f ${dsttmp}" 0 &&
|
||||
prefix=$prefix$d
|
||||
if test -d "$prefix"; then
|
||||
prefixes=
|
||||
else
|
||||
if $posix_mkdir; then
|
||||
(umask $mkdir_umask &&
|
||||
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
|
||||
# Don't fail if two instances are running concurrently.
|
||||
test -d "$prefix" || exit 1
|
||||
else
|
||||
case $prefix in
|
||||
*\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
|
||||
*) qprefix=$prefix;;
|
||||
esac
|
||||
prefixes="$prefixes '$qprefix'"
|
||||
fi
|
||||
fi
|
||||
prefix=$prefix/
|
||||
done
|
||||
|
||||
# and set any options; do chmod last to preserve setuid bits
|
||||
if test -n "$prefixes"; then
|
||||
# Don't fail if two instances are running concurrently.
|
||||
(umask $mkdir_umask &&
|
||||
eval "\$doit_exec \$mkdirprog $prefixes") ||
|
||||
test -d "$dstdir" || exit 1
|
||||
obsolete_mkdir_used=true
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# If any of these fail, we abort the whole thing. If we want to
|
||||
# ignore errors from any of these, just make sure not to ignore
|
||||
# errors from the above "$doit $instcmd $src $dsttmp" command.
|
||||
if test -n "$dir_arg"; then
|
||||
{ test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
|
||||
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
|
||||
{ test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
|
||||
test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
|
||||
else
|
||||
|
||||
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
|
||||
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
|
||||
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
|
||||
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
|
||||
# Make a couple of temp file names in the proper directory.
|
||||
dsttmp=${dstdirslash}_inst.$$_
|
||||
rmtmp=${dstdirslash}_rm.$$_
|
||||
|
||||
# Now rename the file to the real destination.
|
||||
# Trap to clean up those temp files at exit.
|
||||
trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
|
||||
|
||||
$doit $rmcmd -f $dstdir/$dstfile &&
|
||||
$doit $mvcmd $dsttmp $dstdir/$dstfile
|
||||
# Copy the file name to the temp name.
|
||||
(umask $cp_umask &&
|
||||
{ test -z "$stripcmd" || {
|
||||
# Create $dsttmp read-write so that cp doesn't create it read-only,
|
||||
# which would cause strip to fail.
|
||||
if test -z "$doit"; then
|
||||
: >"$dsttmp" # No need to fork-exec 'touch'.
|
||||
else
|
||||
$doit touch "$dsttmp"
|
||||
fi
|
||||
}
|
||||
} &&
|
||||
$doit_exec $cpprog "$src" "$dsttmp") &&
|
||||
|
||||
fi &&
|
||||
# and set any options; do chmod last to preserve setuid bits.
|
||||
#
|
||||
# If any of these fail, we abort the whole thing. If we want to
|
||||
# ignore errors from any of these, just make sure not to ignore
|
||||
# errors from the above "$doit $cpprog $src $dsttmp" command.
|
||||
#
|
||||
{ test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
|
||||
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
|
||||
{ test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
|
||||
{ test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
|
||||
|
||||
# If -C, don't bother to copy if it wouldn't change the file.
|
||||
if $copy_on_change &&
|
||||
old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
|
||||
new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
|
||||
set -f &&
|
||||
set X $old && old=:$2:$4:$5:$6 &&
|
||||
set X $new && new=:$2:$4:$5:$6 &&
|
||||
set +f &&
|
||||
test "$old" = "$new" &&
|
||||
$cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
|
||||
then
|
||||
rm -f "$dsttmp"
|
||||
else
|
||||
# If $backupsuffix is set, and the file being installed
|
||||
# already exists, attempt a backup. Don't worry if it fails,
|
||||
# e.g., if mv doesn't support -f.
|
||||
if test -n "$backupsuffix" && test -f "$dst"; then
|
||||
$doit $mvcmd -f "$dst" "$dst$backupsuffix" 2>/dev/null
|
||||
fi
|
||||
|
||||
exit 0
|
||||
# Rename the file to the real destination.
|
||||
$doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
|
||||
|
||||
# The rename failed, perhaps because mv can't rename something else
|
||||
# to itself, or perhaps because mv is so ancient that it does not
|
||||
# support -f.
|
||||
{
|
||||
# Now remove or move aside any old file at destination location.
|
||||
# We try this two ways since rm can't unlink itself on some
|
||||
# systems and the destination file might be busy for other
|
||||
# reasons. In this case, the final cleanup might fail but the new
|
||||
# file should still install successfully.
|
||||
{
|
||||
test ! -f "$dst" ||
|
||||
$doit $rmcmd "$dst" 2>/dev/null ||
|
||||
{ $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
|
||||
{ $doit $rmcmd "$rmtmp" 2>/dev/null; :; }
|
||||
} ||
|
||||
{ echo "$0: cannot unlink or rename $dst" >&2
|
||||
(exit 1); exit 1
|
||||
}
|
||||
} &&
|
||||
|
||||
# Now rename the file to the real destination.
|
||||
$doit $mvcmd "$dsttmp" "$dst"
|
||||
}
|
||||
fi || exit 1
|
||||
|
||||
trap '' 0
|
||||
fi
|
||||
done
|
||||
|
||||
# Local variables:
|
||||
# eval: (add-hook 'before-save-hook 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC0"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
||||
|
250
contrib/tcpdump/instrument-functions.c
Normal file
250
contrib/tcpdump/instrument-functions.c
Normal file
@ -0,0 +1,250 @@
|
||||
/*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that: (1) source code
|
||||
* distributions retain the above copyright notice and this paragraph
|
||||
* in its entirety, and (2) distributions including binary code include
|
||||
* the above copyright notice and this paragraph in its entirety in
|
||||
* the documentation or other materials provided with the distribution.
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND
|
||||
* WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT
|
||||
* LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <bfd.h>
|
||||
|
||||
/*
|
||||
* Generate instrumentation calls for entry and exit to functions.
|
||||
* Just after function entry and just before function exit, the
|
||||
* following profiling functions are called with the address of the
|
||||
* current function and its call site (currently not use).
|
||||
*
|
||||
* The attribute 'no_instrument_function' causes this instrumentation is
|
||||
* not done.
|
||||
*
|
||||
* These profiling functions call print_debug(). This function prints the
|
||||
* current function name with indentation and call level.
|
||||
* If entering in a function it prints also the calling function name with
|
||||
* file name and line number.
|
||||
*
|
||||
* If the environment variable INSTRUMENT is
|
||||
* unset or set to an empty string, print nothing, like with no instrumentation
|
||||
* set to "all" or "a", print all the functions names
|
||||
* set to "global" or "g", print only the global functions names
|
||||
*/
|
||||
|
||||
#define ND_NO_INSTRUMENT __attribute__((no_instrument_function))
|
||||
|
||||
/* Store the function call level, used also in pretty_print_packet() */
|
||||
extern int profile_func_level;
|
||||
int profile_func_level = -1;
|
||||
|
||||
typedef enum {
|
||||
ENTER,
|
||||
EXIT
|
||||
} action_type;
|
||||
|
||||
void __cyg_profile_func_enter(void *this_fn, void *call_site) ND_NO_INSTRUMENT;
|
||||
|
||||
void __cyg_profile_func_exit(void *this_fn, void *call_site) ND_NO_INSTRUMENT;
|
||||
|
||||
static void print_debug(void *this_fn, void *call_site, action_type action)
|
||||
ND_NO_INSTRUMENT;
|
||||
|
||||
void
|
||||
__cyg_profile_func_enter(void *this_fn, void *call_site)
|
||||
{
|
||||
print_debug(this_fn, call_site, ENTER);
|
||||
}
|
||||
|
||||
void
|
||||
__cyg_profile_func_exit(void *this_fn, void *call_site)
|
||||
{
|
||||
print_debug(this_fn, call_site, EXIT);
|
||||
}
|
||||
|
||||
static void print_debug(void *this_fn, void *call_site, action_type action)
|
||||
{
|
||||
static bfd* abfd;
|
||||
static asymbol **symtab;
|
||||
static long symcount;
|
||||
static asection *text;
|
||||
static bfd_vma vma;
|
||||
static int instrument_set;
|
||||
static int instrument_off;
|
||||
static int instrument_global;
|
||||
|
||||
if (!instrument_set) {
|
||||
static char *instrument_type;
|
||||
|
||||
/* Get the configuration environment variable INSTRUMENT value if any */
|
||||
instrument_type = getenv("INSTRUMENT");
|
||||
/* unset or set to an empty string ? */
|
||||
if (instrument_type == NULL ||
|
||||
!strncmp(instrument_type, "", sizeof(""))) {
|
||||
instrument_off = 1;
|
||||
} else {
|
||||
/* set to "global" or "g" ? */
|
||||
if (!strncmp(instrument_type, "global", sizeof("global")) ||
|
||||
!strncmp(instrument_type, "g", sizeof("g")))
|
||||
instrument_global = 1;
|
||||
else if (strncmp(instrument_type, "all", sizeof("all")) &&
|
||||
strncmp(instrument_type, "a", sizeof("a"))) {
|
||||
fprintf(stderr, "INSTRUMENT can be only \"\", \"all\", \"a\", "
|
||||
"\"global\" or \"g\".\n");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
instrument_set = 1;
|
||||
}
|
||||
|
||||
if (instrument_off)
|
||||
return;
|
||||
|
||||
/* If no errors, this block should be executed one time */
|
||||
if (!abfd) {
|
||||
char pgm_name[1024];
|
||||
long symsize;
|
||||
|
||||
ssize_t ret = readlink("/proc/self/exe", pgm_name, sizeof(pgm_name));
|
||||
if (ret == -1) {
|
||||
perror("failed to find executable");
|
||||
return;
|
||||
}
|
||||
if (ret == sizeof(pgm_name)) {
|
||||
/* no space for the '\0' */
|
||||
printf("truncation may have occurred\n");
|
||||
return;
|
||||
}
|
||||
pgm_name[ret] = '\0';
|
||||
|
||||
bfd_init();
|
||||
|
||||
abfd = bfd_openr(pgm_name, NULL);
|
||||
if (!abfd) {
|
||||
bfd_perror("bfd_openr");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!bfd_check_format(abfd, bfd_object)) {
|
||||
bfd_perror("bfd_check_format");
|
||||
return;
|
||||
}
|
||||
|
||||
if((symsize = bfd_get_symtab_upper_bound(abfd)) == -1) {
|
||||
bfd_perror("bfd_get_symtab_upper_bound");
|
||||
return;
|
||||
}
|
||||
|
||||
symtab = (asymbol **)malloc((size_t)symsize);
|
||||
symcount = bfd_canonicalize_symtab(abfd, symtab);
|
||||
if (symcount < 0) {
|
||||
free(symtab);
|
||||
bfd_perror("bfd_canonicalize_symtab");
|
||||
return;
|
||||
}
|
||||
|
||||
if ((text = bfd_get_section_by_name(abfd, ".text")) == NULL) {
|
||||
bfd_perror("bfd_get_section_by_name");
|
||||
return;
|
||||
}
|
||||
vma = text->vma;
|
||||
}
|
||||
|
||||
if (instrument_global) {
|
||||
symbol_info syminfo;
|
||||
int found;
|
||||
long i;
|
||||
|
||||
i = 0;
|
||||
found = 0;
|
||||
while (i < symcount && !found) {
|
||||
bfd_get_symbol_info(abfd, symtab[i], &syminfo);
|
||||
if ((void *)syminfo.value == this_fn) {
|
||||
found = 1;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
/* type == 'T' for a global function */
|
||||
if (found == 1 && syminfo.type != 'T')
|
||||
return;
|
||||
}
|
||||
|
||||
/* Current function */
|
||||
if ((bfd_vma)this_fn < vma) {
|
||||
printf("[ERROR address this_fn]");
|
||||
} else {
|
||||
const char *file;
|
||||
const char *func;
|
||||
unsigned int line;
|
||||
|
||||
if (!bfd_find_nearest_line(abfd, text, symtab, (bfd_vma)this_fn - vma,
|
||||
&file, &func, &line)) {
|
||||
printf("[ERROR bfd_find_nearest_line this_fn]");
|
||||
} else {
|
||||
int i;
|
||||
|
||||
if (action == ENTER)
|
||||
profile_func_level += 1;
|
||||
/* Indentation */
|
||||
for (i = 0 ; i < profile_func_level ; i++)
|
||||
putchar(' ');
|
||||
if (action == ENTER)
|
||||
printf("[>> ");
|
||||
else
|
||||
printf("[<< ");
|
||||
/* Function name */
|
||||
if (func == NULL || *func == '\0')
|
||||
printf("???");
|
||||
else
|
||||
printf("%s", func);
|
||||
printf(" (%d)", profile_func_level);
|
||||
/* Print the "from" part except for the main function) */
|
||||
if (action == ENTER && func != NULL &&
|
||||
strncmp(func, "main", sizeof("main"))) {
|
||||
/* Calling function */
|
||||
if ((bfd_vma)call_site < vma) {
|
||||
printf("[ERROR address call_site]");
|
||||
} else {
|
||||
if (!bfd_find_nearest_line(abfd, text, symtab,
|
||||
(bfd_vma)call_site - vma, &file,
|
||||
&func, &line)) {
|
||||
printf("[ERROR bfd_find_nearest_line call_site]");
|
||||
} else {
|
||||
printf(" from ");
|
||||
/* Function name */
|
||||
if (func == NULL || *func == '\0')
|
||||
printf("???");
|
||||
else
|
||||
printf("%s", func);
|
||||
/* File name */
|
||||
if (file == NULL || *file == '\0')
|
||||
printf(" ??:");
|
||||
else {
|
||||
char *slashp = strrchr(file, '/');
|
||||
if (slashp != NULL)
|
||||
file = slashp + 1;
|
||||
printf(" %s:", file);
|
||||
}
|
||||
/* Line number */
|
||||
if (line == 0)
|
||||
printf("?");
|
||||
else
|
||||
printf("%u", line);
|
||||
printf("]");
|
||||
}
|
||||
}
|
||||
}
|
||||
putchar('\n');
|
||||
if (action == EXIT)
|
||||
profile_func_level -= 1;
|
||||
}
|
||||
}
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
/* vi: set tabstop=4 softtabstop=0 shiftwidth=4 smarttab autoindent : */
|
@ -63,7 +63,7 @@ struct bpf_program;
|
||||
* With Capsicum bpf_dump() may be not declared even if HAVE_BPF_DUMP is set.
|
||||
*/
|
||||
#if !defined(HAVE_BPF_DUMP) || \
|
||||
(defined(HAVE_BPF_DUMP) && HAVE_CAPSICUM && !defined(bpf_dump))
|
||||
(defined(HAVE_BPF_DUMP) && defined(HAVE_CAPSICUM) && !defined(bpf_dump))
|
||||
extern void bpf_dump(const struct bpf_program *, int);
|
||||
|
||||
#endif
|
||||
|
@ -107,7 +107,6 @@ struct ip {
|
||||
#define IPOPT_RFC1393 82 /* traceroute RFC 1393 */
|
||||
#define IPOPT_SECURITY 130 /* provide s,c,h,tcc */
|
||||
#define IPOPT_LSRR 131 /* loose source route */
|
||||
#define IPOPT_SATID 136 /* satnet id */
|
||||
#define IPOPT_SSRR 137 /* strict source route */
|
||||
#define IPOPT_RA 148 /* router-alert, rfc2113 */
|
||||
|
||||
|
@ -13,9 +13,7 @@
|
||||
* Original code by Hannes Gredler (hannes@gredler.at)
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include "netdissect-stdinc.h"
|
||||
|
||||
|
@ -13,9 +13,7 @@
|
||||
* Original code by Hannes Gredler (hannes@gredler.at)
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include "netdissect-stdinc.h"
|
||||
#include "netdissect.h"
|
||||
|
@ -19,9 +19,7 @@
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
|
@ -36,7 +36,7 @@
|
||||
#
|
||||
# This script needs to be run by "gawk" (GNU awk). "nawk" will work, but
|
||||
# dump will get a recursion error if you process LARGE mibs. While it would
|
||||
# by farily easy to rewrite this not to use recursion (and also easy to
|
||||
# by fairly easy to rewrite this not to use recursion (and also easy to
|
||||
# eliminate use of gsub and functions to use classic "awk"), you have to
|
||||
# order the structure declarations in defined-first order for the compiler
|
||||
# not to barf; too bad tsort doesn't take arguments.
|
||||
|
@ -765,13 +765,13 @@ _icmpInParmProbs_obj = {
|
||||
"icmpInParmProbs", 5, 0,
|
||||
NULL, &_icmpInTimeExcds_obj
|
||||
},
|
||||
_icmpInSrcQuenchs_obj = {
|
||||
"icmpInSrcQuenchs", 6, 0,
|
||||
_icmpInSrcQuenches_obj = {
|
||||
"icmpInSrcQuenches", 6, 0,
|
||||
NULL, &_icmpInParmProbs_obj
|
||||
},
|
||||
_icmpInRedirects_obj = {
|
||||
"icmpInRedirects", 7, 0,
|
||||
NULL, &_icmpInSrcQuenchs_obj
|
||||
NULL, &_icmpInSrcQuenches_obj
|
||||
},
|
||||
_icmpInEchos_obj = {
|
||||
"icmpInEchos", 8, 0,
|
||||
@ -817,13 +817,13 @@ _icmpOutParmProbs_obj = {
|
||||
"icmpOutParmProbs", 18, 0,
|
||||
NULL, &_icmpOutTimeExcds_obj
|
||||
},
|
||||
_icmpOutSrcQuenchs_obj = {
|
||||
"icmpOutSrcQuenchs", 19, 0,
|
||||
_icmpOutSrcQuenches_obj = {
|
||||
"icmpOutSrcQuenches", 19, 0,
|
||||
NULL, &_icmpOutParmProbs_obj
|
||||
},
|
||||
_icmpOutRedirects_obj = {
|
||||
"icmpOutRedirects", 20, 0,
|
||||
NULL, &_icmpOutSrcQuenchs_obj
|
||||
NULL, &_icmpOutSrcQuenches_obj
|
||||
},
|
||||
_icmpOutEchos_obj = {
|
||||
"icmpOutEchos", 21, 0,
|
||||
|
@ -31,9 +31,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <netdissect-stdinc.h>
|
||||
|
||||
|
@ -31,9 +31,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <netdissect-stdinc.h>
|
||||
|
||||
|
@ -419,8 +419,7 @@ start:
|
||||
permute_args(nonopt_start, nonopt_end,
|
||||
optind, nargv);
|
||||
optind -= nonopt_end - nonopt_start;
|
||||
}
|
||||
else if (nonopt_start != -1) {
|
||||
} else if (nonopt_start != -1) {
|
||||
/*
|
||||
* If we skipped non-options, set optind
|
||||
* to the first of them.
|
||||
|
@ -34,9 +34,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <netdissect-stdinc.h>
|
||||
#include <getservent.h>
|
||||
|
@ -31,9 +31,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
|
@ -28,9 +28,7 @@
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <netdissect-stdinc.h>
|
||||
|
||||
|
@ -28,9 +28,7 @@
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <netdissect-stdinc.h>
|
||||
|
||||
|
@ -31,9 +31,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <netdissect-stdinc.h>
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/bin/sh -
|
||||
#!/bin/sh -e
|
||||
#
|
||||
# Copyright (c) 1994, 1996
|
||||
# The Regents of the University of California. All rights reserved.
|
||||
@ -63,20 +63,20 @@ if [ $# = 0 ] ; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -w $MAKE ]; then
|
||||
if [ ! -w "$MAKE" ]; then
|
||||
echo "mkdep: no writeable file \"$MAKE\""
|
||||
exit 1
|
||||
fi
|
||||
|
||||
TMP=/tmp/mkdep$$
|
||||
TMP=${TMPDIR:-/tmp}/mkdep$$
|
||||
|
||||
trap 'rm -f $TMP ; exit 1' 1 2 3 13 15
|
||||
trap 'rm -f "$TMP" ; exit 1' HUP INT QUIT PIPE TERM
|
||||
|
||||
cp $MAKE ${MAKE}.bak
|
||||
cp "$MAKE" "${MAKE}.bak"
|
||||
|
||||
sed -e '/DO NOT DELETE THIS LINE/,$d' < $MAKE > $TMP
|
||||
sed -e '/DO NOT DELETE THIS LINE/,$d' < "$MAKE" > "$TMP"
|
||||
|
||||
cat << _EOF_ >> $TMP
|
||||
cat << _EOF_ >> "$TMP"
|
||||
# DO NOT DELETE THIS LINE -- mkdep uses it.
|
||||
# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY.
|
||||
|
||||
@ -94,23 +94,25 @@ _EOF_
|
||||
# Construct a list of source files with paths relative to the source directory.
|
||||
#
|
||||
sources=""
|
||||
for srcfile in $*
|
||||
for srcfile in "$@"
|
||||
do
|
||||
sources="$sources $SOURCE_DIRECTORY/$srcfile"
|
||||
done
|
||||
|
||||
# XXX this doesn't work with things like "-DDECLWAITSTATUS=union\ wait"
|
||||
$CC $DEPENDENCY_CFLAG $flags $sources |
|
||||
# $flags and $sources are meant to expand
|
||||
# shellcheck disable=SC2086
|
||||
"$CC" "$DEPENDENCY_CFLAG" $flags $sources |
|
||||
sed "
|
||||
s; \./; ;g
|
||||
$SED" >> $TMP
|
||||
$SED" >> "$TMP"
|
||||
|
||||
cat << _EOF_ >> $TMP
|
||||
cat << _EOF_ >> "$TMP"
|
||||
|
||||
# IF YOU PUT ANYTHING HERE IT WILL GO AWAY
|
||||
_EOF_
|
||||
|
||||
# copy to preserve permissions
|
||||
cp $TMP $MAKE
|
||||
rm -f ${MAKE}.bak $TMP
|
||||
cp "$TMP" "$MAKE"
|
||||
rm -f "${MAKE}.bak" "$TMP"
|
||||
exit 0
|
||||
|
@ -87,7 +87,7 @@
|
||||
#define UPDATEMA 0xd /* modify all named resource record */
|
||||
|
||||
#define ZONEINIT 0xe /* initial zone transfer */
|
||||
#define ZONEREF 0xf /* incremental zone referesh */
|
||||
#define ZONEREF 0xf /* incremental zone refresh */
|
||||
|
||||
/*
|
||||
* Undefine various #defines from various System V-flavored OSes (Solaris,
|
||||
@ -112,7 +112,7 @@
|
||||
#define NOERROR 0 /* no error */
|
||||
#define FORMERR 1 /* format error */
|
||||
#define SERVFAIL 2 /* server failure */
|
||||
#define NXDOMAIN 3 /* non existent domain */
|
||||
#define NXDOMAIN 3 /* nonexistent domain */
|
||||
#define NOTIMP 4 /* not implemented */
|
||||
#define REFUSED 5 /* query refused */
|
||||
/* non standard */
|
||||
@ -125,7 +125,7 @@
|
||||
#define T_NS 2 /* authoritative server */
|
||||
#define T_MD 3 /* mail destination */
|
||||
#define T_MF 4 /* mail forwarder */
|
||||
#define T_CNAME 5 /* connonical name */
|
||||
#define T_CNAME 5 /* canonical name */
|
||||
#define T_SOA 6 /* start of authority zone */
|
||||
#define T_MB 7 /* mailbox domain name */
|
||||
#define T_MG 8 /* mail group member */
|
||||
@ -182,7 +182,7 @@
|
||||
#define T_CDS 59 /* Child Delegation Signer */
|
||||
#define T_CDNSKEY 60 /* Child DNSKEY */
|
||||
#define T_OPENPGPKEY 61 /* OpenPGP KEY */
|
||||
#define T_CSYNC 62 /* Child to parent SYNCronization */
|
||||
#define T_CSYNC 62 /* Child to parent SYNChronization */
|
||||
#define T_ZONEMD 63 /* ZONE data Message Digest */
|
||||
#define T_SVCB 64 /* SerViCe Binding */
|
||||
#define T_HTTPS 65 /* HTTPS binding */
|
||||
|
@ -14,9 +14,7 @@
|
||||
* FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include "netdissect-alloc.h"
|
||||
|
@ -22,9 +22,7 @@
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include "netdissect-stdinc.h"
|
||||
#include "netdissect.h"
|
||||
@ -299,3 +297,17 @@ nd_pop_all_packet_info(netdissect_options *ndo)
|
||||
while (ndo->ndo_packet_info_stack != NULL)
|
||||
nd_pop_packet_info(ndo);
|
||||
}
|
||||
|
||||
NORETURN void
|
||||
nd_trunc_longjmp(netdissect_options *ndo)
|
||||
{
|
||||
longjmp(ndo->ndo_early_end, ND_TRUNCATED);
|
||||
#ifdef _AIX
|
||||
/*
|
||||
* In AIX <setjmp.h> decorates longjmp() with "#pragma leaves", which tells
|
||||
* XL C that the function is noreturn, but GCC remains unaware of that and
|
||||
* yields a "'noreturn' function does return" warning.
|
||||
*/
|
||||
ND_UNREACHABLE
|
||||
#endif /* _AIX */
|
||||
}
|
||||
|
@ -30,6 +30,7 @@
|
||||
#endif
|
||||
#include <sys/types.h>
|
||||
#include <setjmp.h>
|
||||
#include <time.h>
|
||||
#include "status-exit-codes.h"
|
||||
#include "funcattrs.h" /* for PRINTFLIKE_FUNCPTR() */
|
||||
#include "diag-control.h" /* for ND_UNREACHABLE */
|
||||
@ -58,9 +59,16 @@ typedef signed char nd_int8_t[1];
|
||||
|
||||
/*
|
||||
* "unsigned char" so that sign extension isn't done on the
|
||||
* individual bytes while they're being assembled.
|
||||
* individual bytes while they're being assembled. Use
|
||||
* GET_S_BE_n() and GET_S_LE_n() macros to extract the value
|
||||
* as a signed integer.
|
||||
*/
|
||||
typedef unsigned char nd_int16_t[2];
|
||||
typedef unsigned char nd_int24_t[3];
|
||||
typedef unsigned char nd_int32_t[4];
|
||||
typedef unsigned char nd_int40_t[5];
|
||||
typedef unsigned char nd_int48_t[6];
|
||||
typedef unsigned char nd_int56_t[7];
|
||||
typedef unsigned char nd_int64_t[8];
|
||||
|
||||
#define FMAXINT (4294967296.0) /* floating point rep. of MAXINT */
|
||||
@ -268,19 +276,10 @@ extern void nd_change_snaplen(netdissect_options *, const u_char *, const u_int)
|
||||
extern void nd_pop_packet_info(netdissect_options *);
|
||||
extern void nd_pop_all_packet_info(netdissect_options *);
|
||||
|
||||
static inline NORETURN void
|
||||
nd_trunc_longjmp(netdissect_options *ndo)
|
||||
{
|
||||
longjmp(ndo->ndo_early_end, ND_TRUNCATED);
|
||||
#ifdef _AIX
|
||||
/*
|
||||
* In AIX <setjmp.h> decorates longjmp() with "#pragma leaves", which tells
|
||||
* XL C that the function is noreturn, but GCC remains unaware of that and
|
||||
* yields a "'noreturn' function does return" warning.
|
||||
*/
|
||||
ND_UNREACHABLE
|
||||
#endif /* _AIX */
|
||||
}
|
||||
/*
|
||||
* Report a packet truncation with a longjmp().
|
||||
*/
|
||||
NORETURN void nd_trunc_longjmp(netdissect_options *ndo);
|
||||
|
||||
#define PT_VAT 1 /* Visual Audio Tool */
|
||||
#define PT_WB 2 /* distributed White Board */
|
||||
@ -386,35 +385,47 @@ nd_trunc_longjmp(netdissect_options *ndo)
|
||||
/*
|
||||
* Number of bytes between two pointers.
|
||||
*/
|
||||
#define ND_BYTES_BETWEEN(p1, p2) ((u_int)(((const uint8_t *)(p1)) - (const uint8_t *)(p2)))
|
||||
#define ND_BYTES_BETWEEN(p1, p2) ((const u_char *)(p1) >= (const u_char *)(p2) ? 0 : ((u_int)(((const u_char *)(p2)) - (const u_char *)(p1))))
|
||||
|
||||
/*
|
||||
* Number of bytes remaining in the captured data, starting at the
|
||||
* byte pointed to by the argument.
|
||||
*/
|
||||
#define ND_BYTES_AVAILABLE_AFTER(p) ND_BYTES_BETWEEN(ndo->ndo_snapend, (p))
|
||||
#define ND_BYTES_AVAILABLE_AFTER(p) ((const u_char *)(p) < ndo->ndo_packetp ? 0 : ND_BYTES_BETWEEN((p), ndo->ndo_snapend))
|
||||
|
||||
/* Check length < minimum for invalid packet with a custom message, format %u */
|
||||
#define ND_LCHECKMSG_U(length, minimum, what) \
|
||||
if ((length) < (minimum)) { \
|
||||
ND_PRINT(" [%s %u < %u]", (what), (length), (minimum)); \
|
||||
/*
|
||||
* Check (expression_1 operator expression_2) for invalid packet with
|
||||
* a custom message, format %u
|
||||
*/
|
||||
#define ND_ICHECKMSG_U(message, expression_1, operator, expression_2) \
|
||||
if ((expression_1) operator (expression_2)) { \
|
||||
ND_PRINT(" [%s %u %s %u]", (message), (expression_1), (#operator), (expression_2)); \
|
||||
goto invalid; \
|
||||
}
|
||||
|
||||
/* Check length < minimum for invalid packet with #length message, format %u */
|
||||
#define ND_LCHECK_U(length, minimum) \
|
||||
ND_LCHECKMSG_U((length), (minimum), (#length))
|
||||
/*
|
||||
* Check (expression_1 operator expression_2) for invalid packet with
|
||||
* "expression_1" message, format %u
|
||||
*/
|
||||
#define ND_ICHECK_U(expression_1, operator, expression_2) \
|
||||
ND_ICHECKMSG_U((#expression_1), (expression_1), operator, (expression_2))
|
||||
|
||||
/* Check length < minimum for invalid packet with a custom message, format %zu */
|
||||
#define ND_LCHECKMSG_ZU(length, minimum, what) \
|
||||
if ((length) < (minimum)) { \
|
||||
ND_PRINT(" [%s %u < %zu]", (what), (length), (minimum)); \
|
||||
/*
|
||||
* Check (expression_1 operator expression_2) for invalid packet with
|
||||
* a custom message, format %zu
|
||||
*/
|
||||
#define ND_ICHECKMSG_ZU(message, expression_1, operator, expression_2) \
|
||||
if ((expression_1) operator (expression_2)) { \
|
||||
ND_PRINT(" [%s %u %s %zu]", (message), (expression_1), (#operator), (expression_2)); \
|
||||
goto invalid; \
|
||||
}
|
||||
|
||||
/* Check length < minimum for invalid packet with #length message, format %zu */
|
||||
#define ND_LCHECK_ZU(length, minimum) \
|
||||
ND_LCHECKMSG_ZU((length), (minimum), (#length))
|
||||
/*
|
||||
* Check (expression_1 operator expression_2) for invalid packet with
|
||||
* "expression_1" message, format %zu
|
||||
*/
|
||||
#define ND_ICHECK_ZU(expression_1, operator, expression_2) \
|
||||
ND_ICHECKMSG_ZU((#expression_1), (expression_1), operator, (expression_2))
|
||||
|
||||
#define ND_PRINT(...) (ndo->ndo_printf)(ndo, __VA_ARGS__)
|
||||
#define ND_DEFAULTPRINT(ap, length) (*ndo->ndo_default_print)(ndo, ap, length)
|
||||
@ -430,6 +441,7 @@ extern void fn_print_char(netdissect_options *, u_char);
|
||||
extern void fn_print_str(netdissect_options *, const u_char *);
|
||||
extern u_int nd_printztn(netdissect_options *, const u_char *, u_int, const u_char *);
|
||||
extern int nd_printn(netdissect_options *, const u_char *, u_int, const u_char *);
|
||||
extern void nd_printjn(netdissect_options *, const u_char *, u_int);
|
||||
extern void nd_printjnp(netdissect_options *, const u_char *, u_int);
|
||||
|
||||
/*
|
||||
@ -645,7 +657,7 @@ extern void igmp_print(netdissect_options *, const u_char *, u_int);
|
||||
extern void igrp_print(netdissect_options *, const u_char *, u_int);
|
||||
extern void ip6_print(netdissect_options *, const u_char *, u_int);
|
||||
extern void ipN_print(netdissect_options *, const u_char *, u_int);
|
||||
extern void ip_print(netdissect_options *, const u_char *, u_int);
|
||||
extern void ip_print(netdissect_options *, const u_char *, const u_int);
|
||||
extern void ipcomp_print(netdissect_options *, const u_char *);
|
||||
extern void ipx_netbios_print(netdissect_options *, const u_char *, u_int);
|
||||
extern void ipx_print(netdissect_options *, const u_char *, u_int);
|
||||
@ -754,7 +766,6 @@ extern void zmtp1_datagram_print(netdissect_options *, const u_char *, const u_i
|
||||
extern void someip_print(netdissect_options *, const u_char *, const u_int);
|
||||
|
||||
/* checksum routines */
|
||||
extern void init_checksum(void);
|
||||
extern uint16_t verify_crc10_cksum(uint16_t, const u_char *, int);
|
||||
extern uint16_t create_osi_cksum(const uint8_t *, int, int);
|
||||
|
||||
|
@ -13,9 +13,7 @@
|
||||
* Original code by Hannes Gredler (hannes@gredler.at)
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include "netdissect-stdinc.h"
|
||||
#include "netdissect.h"
|
||||
|
@ -20,9 +20,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include "ntp.h"
|
||||
|
||||
|
@ -13,9 +13,7 @@
|
||||
* Original code by Hannes Gredler (hannes@gredler.at)
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include "netdissect-stdinc.h"
|
||||
#include "netdissect.h"
|
||||
|
@ -40,14 +40,13 @@
|
||||
* Western Research Laboratory
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include "netdissect-stdinc.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <limits.h>
|
||||
|
||||
#include "netdissect-ctype.h"
|
||||
|
||||
@ -138,8 +137,7 @@ Parse_fh(netdissect_options *ndo, const unsigned char *fh, u_int len,
|
||||
/* bytes[2,3] == (0,0); must be Auspex */
|
||||
/* XXX or could be Ultrix+MASSBUS "hp" disk? */
|
||||
fhtype = FHT_AUSPEX;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
/*
|
||||
* bytes[2,3] != (0,0); rules out Auspex, could be
|
||||
* DECOSF, SUNOS4, or IRIX4
|
||||
@ -148,23 +146,20 @@ Parse_fh(netdissect_options *ndo, const unsigned char *fh, u_int len,
|
||||
(GET_U_1(fhp + 8) == 12) && (GET_U_1(fhp + 9) == 0)) {
|
||||
/* seems to be DECOSF, with minor == 0 */
|
||||
fhtype = FHT_DECOSF;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
/* could be SUNOS4 or IRIX4 */
|
||||
/* XXX the test of fhp[5] == 8 could be wrong */
|
||||
if ((GET_U_1(fhp + 4) == 0) && (GET_U_1(fhp + 5) == 8) && (GET_U_1(fhp + 6) == 0) &&
|
||||
(GET_U_1(fhp + 7) == 0)) {
|
||||
/* looks like a length, not a file system typecode */
|
||||
fhtype = FHT_IRIX4;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
/* by elimination */
|
||||
fhtype = FHT_SUNOS4;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
/*
|
||||
* bytes[0,1] != (0,0); rules out Auspex, IRIX4, SUNOS4
|
||||
* could be IRIX5, DECOSF, UCX, Ultrix, SUNOS5
|
||||
@ -183,35 +178,30 @@ Parse_fh(netdissect_options *ndo, const unsigned char *fh, u_int len,
|
||||
/*XXX we probably only need to test of these two bytes */
|
||||
else if ((len >= 24/4) && (GET_U_1(fhp + 21) == 0) && (GET_U_1(fhp + 23) == 0)) {
|
||||
fhtype = FHT_ULTRIX;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
/* Could be SUNOS5/IRIX5, maybe AIX */
|
||||
/* XXX no obvious difference between SUNOS5 and IRIX5 */
|
||||
if (GET_U_1(fhp + 9) == 10)
|
||||
fhtype = FHT_SUNOS5;
|
||||
/* XXX what about AIX? */
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
/*
|
||||
* bytes[2,3] != (0,0); rules out Ultrix, could be
|
||||
* DECOSF, SUNOS5, IRIX5, AIX, HP-UX, or UCX
|
||||
*/
|
||||
if ((GET_U_1(fhp + 8) == 12) && (GET_U_1(fhp + 9) == 0)) {
|
||||
fhtype = FHT_DECOSF;
|
||||
}
|
||||
else if ((GET_U_1(fhp + 8) == 0) && (GET_U_1(fhp + 9) == 10)) {
|
||||
} else if ((GET_U_1(fhp + 8) == 0) && (GET_U_1(fhp + 9) == 10)) {
|
||||
/* could be SUNOS5/IRIX5, AIX, HP-UX */
|
||||
if ((GET_U_1(fhp + 7) == 0) && (GET_U_1(fhp + 6) == 0) &&
|
||||
(GET_U_1(fhp + 5) == 0) && (GET_U_1(fhp + 4) == 0)) {
|
||||
/* XXX is this always true of HP-UX? */
|
||||
fhtype = FHT_HPUX9;
|
||||
}
|
||||
else if (GET_U_1(fhp + 7) == 2) {
|
||||
} else if (GET_U_1(fhp + 7) == 2) {
|
||||
/* This would be MNT_NFS on AIX, which is impossible */
|
||||
fhtype = FHT_SUNOS5; /* or maybe IRIX5 */
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
/*
|
||||
* XXX Could be SUNOS5/IRIX5 or AIX. I don't
|
||||
* XXX see any way to disambiguate these, so
|
||||
@ -220,12 +210,10 @@ Parse_fh(netdissect_options *ndo, const unsigned char *fh, u_int len,
|
||||
*/
|
||||
fhtype = FHT_SUNOS5; /* or maybe IRIX5 */
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
if (is_UCX(ndo, fhp, len)) {
|
||||
fhtype = FHT_VMSUCX;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
fhtype = FHT_UNKNOWN;
|
||||
}
|
||||
}
|
||||
@ -346,8 +334,7 @@ Parse_fh(netdissect_options *ndo, const unsigned char *fh, u_int len,
|
||||
memset((char *)fsidp, 0, sizeof(*fsidp));
|
||||
/* just use the whole thing */
|
||||
memcpy((char *)fsidp, (const char *)fh, 14);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
uint32_t tempa[4]; /* at least 16 bytes, maybe more */
|
||||
|
||||
memset((char *)tempa, 0, sizeof(tempa));
|
||||
@ -401,6 +388,7 @@ Parse_fh(netdissect_options *ndo, const unsigned char *fh, u_int len,
|
||||
(void)fprintf(stderr, "\n");
|
||||
#endif
|
||||
/* Save the actual handle, so it can be display with -u */
|
||||
/* XXX really ? When -u is used this function is not called */
|
||||
for (i = 0; i < len*4 && i*2 < sizeof(fsidp->Opaque_Handle) - 1; i++)
|
||||
(void)snprintf(&(fsidp->Opaque_Handle[i*2]), 3, "%.2X",
|
||||
GET_U_1(fhp + i));
|
||||
@ -408,11 +396,12 @@ Parse_fh(netdissect_options *ndo, const unsigned char *fh, u_int len,
|
||||
|
||||
/* XXX for now, give "bogus" values to aid debugging */
|
||||
fsidp->fsid_code = 0;
|
||||
fsidp->Fsid_dev.Minor = 257;
|
||||
fsidp->Fsid_dev.Major = 257;
|
||||
fsidp->Fsid_dev.Minor = UINT_MAX;
|
||||
fsidp->Fsid_dev.Major = UINT_MAX;
|
||||
*inop = 1;
|
||||
|
||||
/* display will show this string instead of (257,257) */
|
||||
/* display will show this string instead of (UINT_MAX,UINT_MAX) */
|
||||
/* XXX really ? */
|
||||
if (fsnamep)
|
||||
*fsnamep = "Unknown";
|
||||
|
||||
@ -449,12 +438,10 @@ is_UCX(netdissect_options *ndo, const unsigned char *fhp, u_int len)
|
||||
return(0);
|
||||
else
|
||||
continue;
|
||||
}
|
||||
else if (GET_U_1(fhp + i) == 0) {
|
||||
} else if (GET_U_1(fhp + i) == 0) {
|
||||
seen_null = 1;
|
||||
continue;
|
||||
}
|
||||
else
|
||||
} else
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
@ -116,37 +116,36 @@ struct pf_addr {
|
||||
};
|
||||
|
||||
struct pfloghdr {
|
||||
uint8_t length;
|
||||
uint8_t af;
|
||||
uint8_t action;
|
||||
uint8_t reason;
|
||||
nd_uint8_t length;
|
||||
nd_uint8_t af;
|
||||
nd_uint8_t action;
|
||||
nd_uint8_t reason;
|
||||
char ifname[PFLOG_IFNAMSIZ];
|
||||
char ruleset[PFLOG_RULESET_NAME_SIZE];
|
||||
uint32_t rulenr;
|
||||
uint32_t subrulenr;
|
||||
uint32_t uid;
|
||||
int32_t pid;
|
||||
uint32_t rule_uid;
|
||||
int32_t rule_pid;
|
||||
uint8_t dir;
|
||||
nd_uint32_t rulenr;
|
||||
nd_uint32_t subrulenr;
|
||||
nd_uint32_t uid;
|
||||
nd_int32_t pid;
|
||||
nd_uint32_t rule_uid;
|
||||
nd_int32_t rule_pid;
|
||||
nd_uint8_t dir;
|
||||
/* Minimum header length (without padding): 61 */
|
||||
#define MIN_PFLOG_HDRLEN 61
|
||||
#if defined(__OpenBSD__)
|
||||
uint8_t rewritten;
|
||||
uint8_t naf;
|
||||
uint8_t pad[1];
|
||||
nd_uint8_t rewritten;
|
||||
nd_uint8_t naf;
|
||||
nd_uint8_t pad[1];
|
||||
#else
|
||||
uint8_t pad[3];
|
||||
nd_uint8_t pad[3];
|
||||
#endif
|
||||
#if defined(__FreeBSD__)
|
||||
uint32_t ridentifier;
|
||||
uint8_t reserve;
|
||||
uint8_t pad2[3];
|
||||
nd_uint32_t ridentifier;
|
||||
nd_uint8_t reserve;
|
||||
nd_uint8_t pad2[3];
|
||||
#elif defined(__OpenBSD__)
|
||||
struct pf_addr saddr;
|
||||
struct pf_addr daddr;
|
||||
uint16_t sport;
|
||||
uint16_t dport;
|
||||
nd_uint16_t sport;
|
||||
nd_uint16_t dport;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
@ -22,9 +22,7 @@
|
||||
|
||||
/* \summary: IEEE 802.11 printer */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include "netdissect-stdinc.h"
|
||||
|
||||
@ -67,7 +65,7 @@
|
||||
#define IEEE802_11_STATUS_LEN 2
|
||||
#define IEEE802_11_REASON_LEN 2
|
||||
|
||||
/* Length of previous AP in reassocation frame */
|
||||
/* Length of previous AP in reassociation frame */
|
||||
#define IEEE802_11_AP_LEN 6
|
||||
|
||||
#define T_MGMT 0x0 /* management */
|
||||
@ -193,26 +191,22 @@ struct mgmt_header_t {
|
||||
#define CAPABILITY_PRIVACY(cap) ((cap) & 0x0010)
|
||||
|
||||
struct ssid_t {
|
||||
uint8_t element_id;
|
||||
uint8_t length;
|
||||
u_int length;
|
||||
u_char ssid[33]; /* 32 + 1 for null */
|
||||
};
|
||||
|
||||
struct rates_t {
|
||||
uint8_t element_id;
|
||||
uint8_t length;
|
||||
u_int length;
|
||||
uint8_t rate[16];
|
||||
};
|
||||
|
||||
struct challenge_t {
|
||||
uint8_t element_id;
|
||||
uint8_t length;
|
||||
u_int length;
|
||||
uint8_t text[254]; /* 1-253 + 1 for null */
|
||||
};
|
||||
|
||||
struct fh_t {
|
||||
uint8_t element_id;
|
||||
uint8_t length;
|
||||
u_int length;
|
||||
uint16_t dwell_time;
|
||||
uint8_t hop_set;
|
||||
uint8_t hop_pattern;
|
||||
@ -220,14 +214,12 @@ struct fh_t {
|
||||
};
|
||||
|
||||
struct ds_t {
|
||||
uint8_t element_id;
|
||||
uint8_t length;
|
||||
u_int length;
|
||||
uint8_t channel;
|
||||
};
|
||||
|
||||
struct cf_t {
|
||||
uint8_t element_id;
|
||||
uint8_t length;
|
||||
u_int length;
|
||||
uint8_t count;
|
||||
uint8_t period;
|
||||
uint16_t max_duration;
|
||||
@ -235,8 +227,7 @@ struct cf_t {
|
||||
};
|
||||
|
||||
struct tim_t {
|
||||
uint8_t element_id;
|
||||
uint8_t length;
|
||||
u_int length;
|
||||
uint8_t count;
|
||||
uint8_t period;
|
||||
uint8_t bitmap_control;
|
||||
@ -369,9 +360,11 @@ struct ctrl_ba_hdr_t {
|
||||
nd_uint16_t fc;
|
||||
nd_uint16_t duration;
|
||||
nd_mac_addr ra;
|
||||
nd_mac_addr ta;
|
||||
};
|
||||
|
||||
#define CTRL_BA_HDRLEN (IEEE802_11_FC_LEN+IEEE802_11_DUR_LEN+IEEE802_11_RA_LEN)
|
||||
#define CTRL_BA_HDRLEN (IEEE802_11_FC_LEN+IEEE802_11_DUR_LEN+\
|
||||
IEEE802_11_RA_LEN+IEEE802_11_TA_LEN)
|
||||
|
||||
struct ctrl_bar_hdr_t {
|
||||
nd_uint16_t fc;
|
||||
@ -410,15 +403,15 @@ struct meshcntl_t {
|
||||
ND_PRINT("%s%2.1f%s", _sep, (.5 * ((_r) & 0x7f)), _suf)
|
||||
#define PRINT_RATES(p) \
|
||||
if (p.rates_present) { \
|
||||
int z; \
|
||||
const char *sep = " ["; \
|
||||
for (z = 0; z < p.rates.length ; z++) { \
|
||||
PRINT_RATE(sep, p.rates.rate[z], \
|
||||
(p.rates.rate[z] & 0x80 ? "*" : "")); \
|
||||
sep = " "; \
|
||||
} \
|
||||
if (p.rates.length != 0) \
|
||||
if (p.rates.length != 0) { \
|
||||
for (u_int z = 0; z < p.rates.length ; z++) { \
|
||||
PRINT_RATE(sep, p.rates.rate[z], \
|
||||
(p.rates.rate[z] & 0x80 ? "*" : "")); \
|
||||
sep = " "; \
|
||||
} \
|
||||
ND_PRINT(" Mbit]"); \
|
||||
} \
|
||||
}
|
||||
|
||||
#define PRINT_DS_CHANNEL(p) \
|
||||
@ -1170,7 +1163,7 @@ parse_elements(netdissect_options *ndo,
|
||||
|
||||
switch (GET_U_1(p + offset)) {
|
||||
case E_SSID:
|
||||
memcpy(&ssid, p + offset, 2);
|
||||
ssid.length = elementlen;
|
||||
offset += 2;
|
||||
length -= 2;
|
||||
if (ssid.length != 0) {
|
||||
@ -1194,7 +1187,7 @@ parse_elements(netdissect_options *ndo,
|
||||
}
|
||||
break;
|
||||
case E_CHALLENGE:
|
||||
memcpy(&challenge, p + offset, 2);
|
||||
challenge.length = elementlen;
|
||||
offset += 2;
|
||||
length -= 2;
|
||||
if (challenge.length != 0) {
|
||||
@ -1220,7 +1213,7 @@ parse_elements(netdissect_options *ndo,
|
||||
}
|
||||
break;
|
||||
case E_RATES:
|
||||
memcpy(&rates, p + offset, 2);
|
||||
rates.length = elementlen;
|
||||
offset += 2;
|
||||
length -= 2;
|
||||
if (rates.length != 0) {
|
||||
@ -1252,7 +1245,7 @@ parse_elements(netdissect_options *ndo,
|
||||
}
|
||||
break;
|
||||
case E_DS:
|
||||
memcpy(&ds, p + offset, 2);
|
||||
ds.length = elementlen;
|
||||
offset += 2;
|
||||
length -= 2;
|
||||
if (ds.length != 1) {
|
||||
@ -1276,7 +1269,7 @@ parse_elements(netdissect_options *ndo,
|
||||
}
|
||||
break;
|
||||
case E_CF:
|
||||
memcpy(&cf, p + offset, 2);
|
||||
cf.length = elementlen;
|
||||
offset += 2;
|
||||
length -= 2;
|
||||
if (cf.length != 6) {
|
||||
@ -1309,7 +1302,7 @@ parse_elements(netdissect_options *ndo,
|
||||
}
|
||||
break;
|
||||
case E_TIM:
|
||||
memcpy(&tim, p + offset, 2);
|
||||
tim.length = elementlen;
|
||||
offset += 2;
|
||||
length -= 2;
|
||||
if (tim.length <= 3U) {
|
||||
@ -1749,7 +1742,7 @@ handle_action(netdissect_options *ndo,
|
||||
case 7: ND_PRINT("HT "); PRINT_HT_ACTION(GET_U_1(p + 1)); break;
|
||||
case 13: ND_PRINT("MeshAction "); PRINT_MESH_ACTION(GET_U_1(p + 1)); break;
|
||||
case 14:
|
||||
ND_PRINT("MultiohopAction ");
|
||||
ND_PRINT("MultihopAction");
|
||||
PRINT_MULTIHOP_ACTION(GET_U_1(p + 1)); break;
|
||||
case 15:
|
||||
ND_PRINT("SelfprotectAction ");
|
||||
@ -2017,8 +2010,9 @@ ctrl_header_print(netdissect_options *ndo, uint16_t fc, const u_char *p)
|
||||
GET_LE_U_2(((const struct ctrl_bar_hdr_t *)p)->seq));
|
||||
break;
|
||||
case CTRL_BA:
|
||||
ND_PRINT("RA:%s ",
|
||||
GET_ETHERADDR_STRING(((const struct ctrl_ba_hdr_t *)p)->ra));
|
||||
ND_PRINT("RA:%s TA:%s ",
|
||||
GET_ETHERADDR_STRING(((const struct ctrl_ba_hdr_t *)p)->ra),
|
||||
GET_ETHERADDR_STRING(((const struct ctrl_ba_hdr_t *)p)->ta));
|
||||
break;
|
||||
case CTRL_PS_POLL:
|
||||
ND_PRINT("BSSID:%s TA:%s ",
|
||||
|
@ -22,9 +22,7 @@
|
||||
|
||||
/* \summary: IEEE 802.15.4 printer */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include "netdissect-stdinc.h"
|
||||
|
||||
@ -250,7 +248,7 @@ static const char *p_mlme_short_names[] = {
|
||||
"TVWS PHY Operating Mode Description IE", /* 0x2b */
|
||||
"TVWS Device Capabilities IE", /* 0x2c */
|
||||
"TVWS Device Category IE", /* 0x2d */
|
||||
"TVWS Device Identiication IE", /* 0x2e */
|
||||
"TVWS Device Identification IE", /* 0x2e */
|
||||
"TVWS Device Location IE", /* 0x2f */
|
||||
"TVWS Channel Information Query IE", /* 0x30 */
|
||||
"TVWS Channel Information Source IE", /* 0x31 */
|
||||
@ -418,7 +416,7 @@ static const char *mac_c_names[] = {
|
||||
#define FC_ADDRESSING_MODE_LONG 0x03
|
||||
|
||||
/*
|
||||
* IEEE 802.15.4 CRC 16 function. This is using CCITT polynomical of 0x1021,
|
||||
* IEEE 802.15.4 CRC 16 function. This is using the CCITT polynomial of 0x1021,
|
||||
* but the initial value is 0, and the bits are reversed for both in and out.
|
||||
* See section 7.2.10 of 802.15.4-2015 for more information.
|
||||
*/
|
||||
@ -470,7 +468,7 @@ ieee802_15_4_reverse32(uint32_t x)
|
||||
}
|
||||
|
||||
/*
|
||||
* IEEE 802.15.4 CRC 32 function. This is using ANSI X3.66-1979 polynomical of
|
||||
* IEEE 802.15.4 CRC 32 function. This is using the ANSI X3.66-1979 polynomial of
|
||||
* 0x04C11DB7, but the initial value is 0, and the bits are reversed for both
|
||||
* in and out. See section 7.2.10 of 802.15.4-2015 for more information.
|
||||
*/
|
||||
@ -1299,11 +1297,11 @@ ieee802_15_4_print_mlme_ie_list(netdissect_options *ndo,
|
||||
ND_PRINT("] ");
|
||||
p += sub_ie_len;
|
||||
ie_len -= 2 + sub_ie_len;
|
||||
} while (ie_len > 0);
|
||||
} while (ie_len != 0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Multiplexd IE (802.15.9) parsing and printing.
|
||||
* Multiplexed IE (802.15.9) parsing and printing.
|
||||
*
|
||||
* Returns number of bytes consumed from packet or -1 in case of error.
|
||||
*/
|
||||
@ -1502,7 +1500,7 @@ ieee802_15_4_print_payload_ie_list(netdissect_options *ndo,
|
||||
if (group_id == 0xf) {
|
||||
break;
|
||||
}
|
||||
} while (caplen > 0);
|
||||
} while (caplen != 0);
|
||||
return len;
|
||||
}
|
||||
|
||||
@ -1664,7 +1662,7 @@ ieee802_15_4_print_command_data(netdissect_options *ndo,
|
||||
return caplen;
|
||||
}
|
||||
break;
|
||||
case 0x03: /* Diassociation Notification command */
|
||||
case 0x03: /* Disassociation Notification command */
|
||||
if (caplen != 1) {
|
||||
ND_PRINT("Invalid Disassociation Notification command length");
|
||||
return -1;
|
||||
@ -2038,19 +2036,19 @@ ieee802_15_4_std_frames(netdissect_options *ndo,
|
||||
}
|
||||
|
||||
switch (security_level) {
|
||||
case 0: /*FALLTHOUGH */
|
||||
case 0: /*FALLTHROUGH */
|
||||
case 4:
|
||||
miclen = 0;
|
||||
break;
|
||||
case 1: /*FALLTHOUGH */
|
||||
case 1: /*FALLTHROUGH */
|
||||
case 5:
|
||||
miclen = 4;
|
||||
break;
|
||||
case 2: /*FALLTHOUGH */
|
||||
case 2: /*FALLTHROUGH */
|
||||
case 6:
|
||||
miclen = 8;
|
||||
break;
|
||||
case 3: /*FALLTHOUGH */
|
||||
case 3: /*FALLTHROUGH */
|
||||
case 7:
|
||||
miclen = 16;
|
||||
break;
|
||||
@ -2360,19 +2358,19 @@ ieee802_15_4_mp_frame(netdissect_options *ndo,
|
||||
}
|
||||
|
||||
switch (security_level) {
|
||||
case 0: /*FALLTHOUGH */
|
||||
case 0: /*FALLTHROUGH */
|
||||
case 4:
|
||||
miclen = 0;
|
||||
break;
|
||||
case 1: /*FALLTHOUGH */
|
||||
case 1: /*FALLTHROUGH */
|
||||
case 5:
|
||||
miclen = 4;
|
||||
break;
|
||||
case 2: /*FALLTHOUGH */
|
||||
case 2: /*FALLTHROUGH */
|
||||
case 6:
|
||||
miclen = 8;
|
||||
break;
|
||||
case 3: /*FALLTHOUGH */
|
||||
case 3: /*FALLTHROUGH */
|
||||
case 7:
|
||||
miclen = 16;
|
||||
break;
|
||||
|
@ -23,9 +23,7 @@
|
||||
|
||||
/* \summary: IPSEC Authentication Header printer */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include "netdissect-stdinc.h"
|
||||
|
||||
|
@ -29,9 +29,7 @@
|
||||
|
||||
/* Based on draft-chroboczek-ahcp-00 and source code of ahcpd-0.53 */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include "netdissect-stdinc.h"
|
||||
|
||||
|
@ -32,9 +32,7 @@
|
||||
|
||||
/* \summary: Ad hoc On-Demand Distance Vector (AODV) Routing printer */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include "netdissect-stdinc.h"
|
||||
|
||||
|
@ -31,9 +31,7 @@
|
||||
* https://web.archive.org/web/20161025044402/http://brantleycoilecompany.com/AoEr11.pdf
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include "netdissect-stdinc.h"
|
||||
|
||||
|
@ -21,9 +21,7 @@
|
||||
|
||||
/* \summary: Apple IP-over-IEEE 1394 printer */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include "netdissect-stdinc.h"
|
||||
|
||||
|
@ -23,9 +23,7 @@
|
||||
|
||||
/* \summary: Attached Resource Computer NETwork (ARCNET) printer */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include "netdissect-stdinc.h"
|
||||
|
||||
|
@ -2,9 +2,7 @@
|
||||
|
||||
/* \summary: EtherType protocol for Arista Networks printer */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include "netdissect-stdinc.h"
|
||||
|
||||
|
@ -21,9 +21,7 @@
|
||||
|
||||
/* \summary: Address Resolution Protocol (ARP) printer */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include "netdissect-stdinc.h"
|
||||
|
||||
|
@ -38,9 +38,7 @@
|
||||
|
||||
/* \summary: ASCII packet dump printer */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include "netdissect-stdinc.h"
|
||||
|
||||
@ -67,7 +65,7 @@ ascii_print(netdissect_options *ndo,
|
||||
int truncated = FALSE;
|
||||
|
||||
ndo->ndo_protocol = "ascii";
|
||||
caplength = (ndo->ndo_snapend > cp) ? ND_BYTES_AVAILABLE_AFTER(cp) : 0;
|
||||
caplength = ND_BYTES_AVAILABLE_AFTER(cp);
|
||||
if (length > caplength) {
|
||||
length = caplength;
|
||||
truncated = TRUE;
|
||||
@ -113,7 +111,7 @@ hex_and_ascii_print_with_offset(netdissect_options *ndo, const char *ident,
|
||||
char hexstuff[HEXDUMP_SHORTS_PER_LINE*HEXDUMP_HEXSTUFF_PER_SHORT+1], *hsp;
|
||||
char asciistuff[ASCII_LINELENGTH+1], *asp;
|
||||
|
||||
caplength = (ndo->ndo_snapend > cp) ? ND_BYTES_AVAILABLE_AFTER(cp) : 0;
|
||||
caplength = ND_BYTES_AVAILABLE_AFTER(cp);
|
||||
if (length > caplength) {
|
||||
length = caplength;
|
||||
truncated = TRUE;
|
||||
@ -181,7 +179,7 @@ hex_print_with_offset(netdissect_options *ndo,
|
||||
u_int nshorts;
|
||||
int truncated = FALSE;
|
||||
|
||||
caplength = (ndo->ndo_snapend > cp) ? ND_BYTES_AVAILABLE_AFTER(cp) : 0;
|
||||
caplength = ND_BYTES_AVAILABLE_AFTER(cp);
|
||||
if (length > caplength) {
|
||||
length = caplength;
|
||||
truncated = TRUE;
|
||||
|
@ -21,9 +21,7 @@
|
||||
|
||||
/* \summary: AppleTalk printer */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include "netdissect-stdinc.h"
|
||||
|
||||
|
@ -21,9 +21,7 @@
|
||||
|
||||
/* \summary: Asynchronous Transfer Mode (ATM) printer */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include "netdissect-stdinc.h"
|
||||
|
||||
@ -106,7 +104,7 @@
|
||||
#define B_BEARER 0x5e /* broadband bearer capability */
|
||||
#define B_LOWER 0x5f /* broadband lower information */
|
||||
#define CALLING_PARTY 0x6c /* calling party number */
|
||||
#define CALLED_PARTY 0x70 /* called party nmber */
|
||||
#define CALLED_PARTY 0x70 /* called party number */
|
||||
|
||||
#define Q2931 0x09
|
||||
|
||||
|
@ -37,9 +37,7 @@
|
||||
* draft-ietf-babel-source-specific-0
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include "netdissect-stdinc.h"
|
||||
|
||||
|
@ -21,9 +21,7 @@
|
||||
|
||||
/* \summary: Broadcom LI Printer */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include "netdissect-stdinc.h"
|
||||
|
||||
|
@ -11,9 +11,7 @@
|
||||
|
||||
/* \summary: Blocks Extensible Exchange Protocol (BEEP) printer */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include "netdissect-stdinc.h"
|
||||
|
||||
|
@ -20,9 +20,7 @@
|
||||
* RFC 5880 for version 1, and RFC 5881
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include "netdissect-stdinc.h"
|
||||
|
||||
@ -313,8 +311,7 @@ bfd_print(netdissect_options *ndo, const u_char *pptr,
|
||||
|
||||
/* BFDv0 */
|
||||
case 0:
|
||||
if (ndo->ndo_vflag < 1)
|
||||
{
|
||||
if (ndo->ndo_vflag < 1) {
|
||||
ND_PRINT("BFDv0, Control, Flags: [%s], length: %u",
|
||||
bittok2str(bfd_v0_flag_values, "none", flags),
|
||||
len);
|
||||
@ -351,8 +348,7 @@ bfd_print(netdissect_options *ndo, const u_char *pptr,
|
||||
|
||||
/* BFDv1 */
|
||||
case 1:
|
||||
if (ndo->ndo_vflag < 1)
|
||||
{
|
||||
if (ndo->ndo_vflag < 1) {
|
||||
ND_PRINT("BFDv1, %s, State %s, Flags: [%s], length: %u",
|
||||
tok2str(bfd_port_values, "unknown (%u)", port),
|
||||
tok2str(bfd_v1_state_values, "unknown (%u)", (flags & 0xc0) >> 6),
|
||||
|
@ -34,9 +34,7 @@
|
||||
|
||||
/* specification: RFC 4271 */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include "netdissect-stdinc.h"
|
||||
|
||||
@ -1161,6 +1159,8 @@ decode_multicast_vpn(netdissect_options *ndo,
|
||||
switch(route_type) {
|
||||
case BGP_MULTICAST_VPN_ROUTE_TYPE_INTRA_AS_I_PMSI:
|
||||
ND_TCHECK_LEN(pptr, BGP_VPN_RD_LEN);
|
||||
if (route_length < BGP_VPN_RD_LEN)
|
||||
goto trunc;
|
||||
offset = (u_int)strlen(buf);
|
||||
snprintf(buf + offset, buflen - offset, ", RD: %s, Originator %s",
|
||||
bgp_vpn_rd_print(ndo, pptr),
|
||||
@ -1575,7 +1575,7 @@ trunc:
|
||||
/*
|
||||
* We can come here, either we did not have enough data, or if we
|
||||
* try to decode 4 byte ASs in 2 byte format. Either way, return 4,
|
||||
* so that calller can try to decode each AS as of 4 bytes. If indeed
|
||||
* so that caller can try to decode each AS as of 4 bytes. If indeed
|
||||
* there was not enough data, it will crib and end the parse anyways.
|
||||
*/
|
||||
return 4;
|
||||
@ -1598,7 +1598,7 @@ check_add_path(netdissect_options *ndo, const u_char *pptr, u_int length,
|
||||
}
|
||||
|
||||
/*
|
||||
* Scan through the NLRI information under the assumpetion that
|
||||
* Scan through the NLRI information under the assumption that
|
||||
* it doesn't have path IDs.
|
||||
*/
|
||||
for (offset = 0; offset < length;) {
|
||||
@ -2231,8 +2231,10 @@ bgp_attr_print(netdissect_options *ndo,
|
||||
ND_PRINT(", no SNPA");
|
||||
}
|
||||
|
||||
add_path4 = check_add_path(ndo, tptr, (len-ND_BYTES_BETWEEN(tptr, pptr)), 32);
|
||||
add_path6 = check_add_path(ndo, tptr, (len-ND_BYTES_BETWEEN(tptr, pptr)), 128);
|
||||
add_path4 = check_add_path(ndo, tptr,
|
||||
(len-ND_BYTES_BETWEEN(pptr, tptr)), 32);
|
||||
add_path6 = check_add_path(ndo, tptr,
|
||||
(len-ND_BYTES_BETWEEN(pptr, tptr)), 128);
|
||||
|
||||
while (tptr < pptr + len) {
|
||||
advance = bgp_nlri_print(ndo, af, safi, tptr, len, buf, sizeof(buf),
|
||||
@ -2258,8 +2260,10 @@ bgp_attr_print(netdissect_options *ndo,
|
||||
|
||||
tptr += 3;
|
||||
|
||||
add_path4 = check_add_path(ndo, tptr, (len-ND_BYTES_BETWEEN(tptr, pptr)), 32);
|
||||
add_path6 = check_add_path(ndo, tptr, (len-ND_BYTES_BETWEEN(tptr, pptr)), 128);
|
||||
add_path4 = check_add_path(ndo, tptr,
|
||||
(len-ND_BYTES_BETWEEN(pptr, tptr)), 32);
|
||||
add_path6 = check_add_path(ndo, tptr,
|
||||
(len-ND_BYTES_BETWEEN(pptr, tptr)), 128);
|
||||
|
||||
while (tptr < pptr + len) {
|
||||
advance = bgp_nlri_print(ndo, af, safi, tptr, len, buf, sizeof(buf),
|
||||
@ -2986,8 +2990,7 @@ bgp_notification_print(netdissect_options *ndo,
|
||||
/* garbage, hexdump it all */
|
||||
if (shutdown_comm_length > length - (BGP_NOTIFICATION_SIZE + 1)) {
|
||||
ND_PRINT(", invalid Shutdown Communication length");
|
||||
}
|
||||
else if (shutdown_comm_length == 0) {
|
||||
} else if (shutdown_comm_length == 0) {
|
||||
ND_PRINT(", empty Shutdown Communication");
|
||||
remainder_offset += 1;
|
||||
}
|
||||
|
@ -21,9 +21,7 @@
|
||||
|
||||
/* \summary: BOOTP and IPv4 DHCP printer */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include "netdissect-stdinc.h"
|
||||
|
||||
@ -147,7 +145,7 @@ struct bootp {
|
||||
#define TAG_NIS_P_DOMAIN ((uint8_t) 64)
|
||||
#define TAG_NIS_P_SERVERS ((uint8_t) 65)
|
||||
#define TAG_MOBILE_HOME ((uint8_t) 68)
|
||||
#define TAG_SMPT_SERVER ((uint8_t) 69)
|
||||
#define TAG_SMTP_SERVER ((uint8_t) 69)
|
||||
#define TAG_POP3_SERVER ((uint8_t) 70)
|
||||
#define TAG_NNTP_SERVER ((uint8_t) 71)
|
||||
#define TAG_WWW_SERVER ((uint8_t) 72)
|
||||
@ -193,6 +191,8 @@ struct bootp {
|
||||
/* RFC 3442 */
|
||||
#define TAG_CLASSLESS_STATIC_RT ((uint8_t) 121)
|
||||
#define TAG_CLASSLESS_STA_RT_MS ((uint8_t) 249)
|
||||
/* RFC8572 */
|
||||
#define TAG_SZTP_REDIRECT ((uint8_t) 143)
|
||||
/* RFC 5859 - TFTP Server Address Option for DHCPv4 */
|
||||
#define TAG_TFTP_SERVER_ADDRESS ((uint8_t) 150)
|
||||
/* https://www.iana.org/assignments/bootp-dhcp-parameters/bootp-dhcp-parameters.xhtml */
|
||||
@ -461,7 +461,7 @@ static const struct tok tag2str[] = {
|
||||
{ TAG_NIS_P_DOMAIN, "sN+D" },
|
||||
{ TAG_NIS_P_SERVERS, "iN+S" },
|
||||
{ TAG_MOBILE_HOME, "iMH" },
|
||||
{ TAG_SMPT_SERVER, "iSMTP" },
|
||||
{ TAG_SMTP_SERVER, "iSMTP" },
|
||||
{ TAG_POP3_SERVER, "iPOP3" },
|
||||
{ TAG_NNTP_SERVER, "iNNTP" },
|
||||
{ TAG_WWW_SERVER, "iWWW" },
|
||||
@ -499,6 +499,8 @@ static const struct tok tag2str[] = {
|
||||
/* RFC 3442 */
|
||||
{ TAG_CLASSLESS_STATIC_RT, "$Classless-Static-Route" },
|
||||
{ TAG_CLASSLESS_STA_RT_MS, "$Classless-Static-Route-Microsoft" },
|
||||
/* RFC 8572 */
|
||||
{ TAG_SZTP_REDIRECT, "$SZTP-Redirect" },
|
||||
/* RFC 5859 - TFTP Server Address Option for DHCPv4 */
|
||||
{ TAG_TFTP_SERVER_ADDRESS, "iTFTP-Server-Address" },
|
||||
/* https://www.iana.org/assignments/bootp-dhcp-parameters/bootp-dhcp-parameters.xhtml#options */
|
||||
@ -999,6 +1001,39 @@ rfc1048_print(netdissect_options *ndo,
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
case TAG_SZTP_REDIRECT:
|
||||
/* as per https://datatracker.ietf.org/doc/html/rfc8572#section-8.3
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-...-+-+-+-+-+-+-+
|
||||
| uri-length | URI |
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-...-+-+-+-+-+-+-+
|
||||
|
||||
* uri-length: 2 octets long; specifies the length of the URI data.
|
||||
* URI: URI of the SZTP bootstrap server.
|
||||
*/
|
||||
while (len >= 2) {
|
||||
suboptlen = GET_BE_U_2(bp);
|
||||
bp += 2;
|
||||
len -= 2;
|
||||
ND_PRINT("\n\t ");
|
||||
ND_PRINT("length %u: ", suboptlen);
|
||||
if (len < suboptlen) {
|
||||
ND_PRINT("length goes past end of option");
|
||||
bp += len;
|
||||
len = 0;
|
||||
break;
|
||||
}
|
||||
ND_PRINT("\"");
|
||||
nd_printjn(ndo, bp, suboptlen);
|
||||
ND_PRINT("\"");
|
||||
len -= suboptlen;
|
||||
bp += suboptlen;
|
||||
}
|
||||
if (len != 0) {
|
||||
ND_PRINT("[ERROR: length < 2 bytes]");
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
ND_PRINT("[unknown special tag %u, size %u]",
|
||||
tag, len);
|
||||
|
@ -21,15 +21,12 @@
|
||||
|
||||
/* \summary: Broadcom Ethernet switches tag (4 bytes) printer */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include "netdissect-stdinc.h"
|
||||
|
||||
#define ND_LONGJMP_FROM_TCHECK
|
||||
#include "netdissect.h"
|
||||
#include "ethertype.h"
|
||||
#include "addrtoname.h"
|
||||
#include "extract.h"
|
||||
|
||||
|
@ -19,9 +19,7 @@
|
||||
|
||||
/* \summary: Bluetooth printer */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include "netdissect-stdinc.h"
|
||||
|
||||
|
@ -17,9 +17,7 @@
|
||||
|
||||
/* \summary: Communication access for land mobiles (CALM) printer */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include "netdissect-stdinc.h"
|
||||
|
||||
|
@ -36,9 +36,7 @@
|
||||
|
||||
/* \summary: Common Address Redundancy Protocol (CARP) printer */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include "netdissect-stdinc.h"
|
||||
|
||||
@ -52,13 +50,14 @@ carp_print(netdissect_options *ndo, const u_char *bp, u_int len, u_int ttl)
|
||||
const char *type_s;
|
||||
|
||||
ndo->ndo_protocol = "carp";
|
||||
nd_print_protocol_caps(ndo);
|
||||
version = (GET_U_1(bp) & 0xf0) >> 4;
|
||||
type = GET_U_1(bp) & 0x0f;
|
||||
if (type == 1)
|
||||
type_s = "advertise";
|
||||
else
|
||||
type_s = "unknown";
|
||||
ND_PRINT("CARPv%u-%s %u: ", version, type_s, len);
|
||||
ND_PRINT("v%u-%s %u: ", version, type_s, len);
|
||||
if (ttl != 255)
|
||||
ND_PRINT("[ttl=%u!] ", ttl);
|
||||
if (version != 2 || type != 1)
|
||||
|
@ -26,9 +26,7 @@
|
||||
|
||||
/* \summary: Cisco Discovery Protocol (CDP) printer */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include "netdissect-stdinc.h"
|
||||
|
||||
@ -309,7 +307,7 @@ cdp_print(netdissect_options *ndo,
|
||||
}
|
||||
}
|
||||
|
||||
if (!covered) {
|
||||
if (ndo->ndo_vflag && !covered) {
|
||||
ND_TCHECK_LEN(tptr, len);
|
||||
print_unknown_data(ndo, tptr, "\n\t ", len);
|
||||
}
|
||||
@ -389,8 +387,7 @@ cdp_print_addr(netdissect_options *ndo,
|
||||
ND_PRINT("IPv4 (%u) %s", num, GET_IPADDR_STRING(p));
|
||||
p += al;
|
||||
l -= al;
|
||||
}
|
||||
else if (pt == PT_IEEE_802_2 && pl == 8 &&
|
||||
} else if (pt == PT_IEEE_802_2 && pl == 8 &&
|
||||
memcmp(p, prot_ipv6, 8) == 0 && al == 16) {
|
||||
/*
|
||||
* IPv6: protocol type = IEEE 802.2 header,
|
||||
@ -408,8 +405,7 @@ cdp_print_addr(netdissect_options *ndo,
|
||||
ND_PRINT("IPv6 (%u) %s", num, GET_IP6ADDR_STRING(p));
|
||||
p += al;
|
||||
l -= al;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
/*
|
||||
* Generic case: just print raw data
|
||||
*/
|
||||
|
@ -17,9 +17,7 @@
|
||||
|
||||
/* \summary: IEEE 802.1ag Connectivity Fault Management (CFM) protocols printer */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include "netdissect-stdinc.h"
|
||||
|
||||
|
@ -21,9 +21,7 @@
|
||||
|
||||
/* \summary: Cisco HDLC printer */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include "netdissect-stdinc.h"
|
||||
|
||||
|
@ -22,9 +22,7 @@
|
||||
|
||||
/* \summary: Linux Classical IP over ATM printer */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
|
||||
|
@ -40,9 +40,7 @@
|
||||
* https://www.cisco.com/c/en/us/td/docs/net_mgmt/netflow_collection_engine/3-6/user/guide/format.html#wp1005892
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include "netdissect-stdinc.h"
|
||||
|
||||
|
@ -11,9 +11,7 @@
|
||||
|
||||
/* specification: RFC 4340 */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include "netdissect-stdinc.h"
|
||||
|
||||
|
@ -21,9 +21,7 @@
|
||||
|
||||
/* \summary: DECnet printer */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include "netdissect-stdinc.h"
|
||||
|
||||
|
@ -43,9 +43,7 @@
|
||||
* RFC6334: Dual-Stack Lite option,
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include "netdissect-stdinc.h"
|
||||
|
||||
@ -121,6 +119,10 @@ struct dhcp6_relay {
|
||||
/* options */
|
||||
#define DH6OPT_CLIENTID 1
|
||||
#define DH6OPT_SERVERID 2
|
||||
# define DUID_LLT 1 /* RFC8415 */
|
||||
# define DUID_EN 2 /* RFC8415 */
|
||||
# define DUID_LL 3 /* RFC8415 */
|
||||
# define DUID_UUID 4 /* RFC6355 */
|
||||
#define DH6OPT_IA_NA 3
|
||||
#define DH6OPT_IA_TA 4
|
||||
#define DH6OPT_IA_ADDR 5
|
||||
@ -188,8 +190,10 @@ struct dhcp6_relay {
|
||||
# define DH6OPT_NTP_SUBOPTION_SRV_ADDR 1
|
||||
# define DH6OPT_NTP_SUBOPTION_MC_ADDR 2
|
||||
# define DH6OPT_NTP_SUBOPTION_SRV_FQDN 3
|
||||
#define DH6OPT_BOOTFILE_URL 59 /* RFC5970 */
|
||||
#define DH6OPT_AFTR_NAME 64
|
||||
#define DH6OPT_MUDURL 112
|
||||
#define DH6OPT_SZTP_REDIRECT 136 /* RFC8572 */
|
||||
|
||||
static const struct tok dh6opt_str[] = {
|
||||
{ DH6OPT_CLIENTID, "client-ID" },
|
||||
@ -239,8 +243,10 @@ static const struct tok dh6opt_str[] = {
|
||||
{ DH6OPT_LQ_RELAY_DATA, "LQ-relay-data" },
|
||||
{ DH6OPT_LQ_CLIENT_LINK, "LQ-client-link" },
|
||||
{ DH6OPT_NTP_SERVER, "NTP-server" },
|
||||
{ DH6OPT_BOOTFILE_URL, "Bootfile-URL" },
|
||||
{ DH6OPT_AFTR_NAME, "AFTR-Name" },
|
||||
{ DH6OPT_MUDURL, "MUD-URL" },
|
||||
{ DH6OPT_SZTP_REDIRECT, "SZTP-redirect" },
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
@ -290,6 +296,8 @@ dhcp6opt_print(netdissect_options *ndo,
|
||||
uint16_t subopt_len;
|
||||
uint8_t dh6_reconf_type;
|
||||
uint8_t dh6_lq_query_type;
|
||||
u_int first_list_value;
|
||||
uint16_t remainder_len;
|
||||
|
||||
if (cp == ep)
|
||||
return;
|
||||
@ -314,7 +322,7 @@ dhcp6opt_print(netdissect_options *ndo,
|
||||
}
|
||||
tp = (const u_char *)(dh6o + 1);
|
||||
switch (GET_BE_U_2(tp)) {
|
||||
case 1:
|
||||
case DUID_LLT:
|
||||
if (optlen >= 2 + 6) {
|
||||
ND_PRINT(" hwaddr/time type %u time %u ",
|
||||
GET_BE_U_2(tp + 2),
|
||||
@ -329,10 +337,10 @@ dhcp6opt_print(netdissect_options *ndo,
|
||||
ND_PRINT(" ?)");
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (optlen >= 2 + 8) {
|
||||
ND_PRINT(" vid ");
|
||||
for (i = 2; i < 2 + 8; i++)
|
||||
case DUID_EN:
|
||||
if (optlen >= 2 + 4) {
|
||||
ND_PRINT(" enterprise %u ", GET_BE_U_4(tp + 2));
|
||||
for (i = 2 + 4; i < optlen; i++)
|
||||
ND_PRINT("%02x",
|
||||
GET_U_1(tp + i));
|
||||
/*(*/
|
||||
@ -342,7 +350,7 @@ dhcp6opt_print(netdissect_options *ndo,
|
||||
ND_PRINT(" ?)");
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
case DUID_LL:
|
||||
if (optlen >= 2 + 2) {
|
||||
ND_PRINT(" hwaddr type %u ",
|
||||
GET_BE_U_2(tp + 2));
|
||||
@ -356,6 +364,19 @@ dhcp6opt_print(netdissect_options *ndo,
|
||||
ND_PRINT(" ?)");
|
||||
}
|
||||
break;
|
||||
case DUID_UUID:
|
||||
ND_PRINT(" uuid ");
|
||||
if (optlen == 2 + 16) {
|
||||
for (i = 2; i < optlen; i++)
|
||||
ND_PRINT("%02x",
|
||||
GET_U_1(tp + i));
|
||||
/*(*/
|
||||
ND_PRINT(")");
|
||||
} else {
|
||||
/*(*/
|
||||
ND_PRINT(" ?)");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
ND_PRINT(" type %u)", GET_BE_U_2(tp));
|
||||
break;
|
||||
@ -784,6 +805,39 @@ dhcp6opt_print(netdissect_options *ndo,
|
||||
ND_PRINT(")");
|
||||
break;
|
||||
|
||||
case DH6OPT_BOOTFILE_URL:
|
||||
tp = (const u_char *)(dh6o + 1);
|
||||
ND_PRINT(" ");
|
||||
nd_printjn(ndo, tp, optlen);
|
||||
ND_PRINT(")");
|
||||
break;
|
||||
|
||||
case DH6OPT_SZTP_REDIRECT:
|
||||
case DH6OPT_USER_CLASS:
|
||||
ND_PRINT(" ");
|
||||
tp = (const u_char *)(dh6o + 1);
|
||||
first_list_value = TRUE;
|
||||
remainder_len = optlen;
|
||||
while (remainder_len >= 2) {
|
||||
if (first_list_value == FALSE) {
|
||||
ND_PRINT(",");
|
||||
}
|
||||
first_list_value = FALSE;
|
||||
subopt_len = GET_BE_U_2(tp);
|
||||
if (subopt_len > remainder_len-2) {
|
||||
break;
|
||||
}
|
||||
tp += 2;
|
||||
nd_printjn(ndo, tp, subopt_len);
|
||||
tp += subopt_len;
|
||||
remainder_len -= (subopt_len+2);
|
||||
}
|
||||
if (remainder_len != 0 ) {
|
||||
ND_PRINT(" ?");
|
||||
}
|
||||
ND_PRINT(")");
|
||||
break;
|
||||
|
||||
default:
|
||||
ND_PRINT(")");
|
||||
break;
|
||||
|
@ -21,9 +21,7 @@
|
||||
|
||||
/* \summary: Domain Name System (DNS) printer */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include "netdissect-stdinc.h"
|
||||
|
||||
@ -839,6 +837,10 @@ ns_rprint(netdissect_options *ndo,
|
||||
case T_URI:
|
||||
if (!ND_TTEST_LEN(cp, len))
|
||||
return(NULL);
|
||||
if (len < 4) {
|
||||
ND_PRINT(" len %u is too short (< 4)", len);
|
||||
break;
|
||||
}
|
||||
ND_PRINT(" %u %u ", GET_BE_U_2(cp), GET_BE_U_2(cp + 2));
|
||||
if (nd_printn(ndo, cp + 4, len - 4, ndo->ndo_snapend))
|
||||
return(NULL);
|
||||
@ -1070,8 +1072,7 @@ domain_print(netdissect_options *ndo,
|
||||
if (arcount)
|
||||
goto trunc;
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
/* this is a request */
|
||||
ND_PRINT("%u%s%s%s", GET_BE_U_2(np->id),
|
||||
ns_ops[DNS_OPCODE(flags)],
|
||||
@ -1088,8 +1089,7 @@ domain_print(netdissect_options *ndo,
|
||||
ND_PRINT(" [%uq]", qdcount);
|
||||
if (ancount != 1)
|
||||
ND_PRINT(" [%ua]", ancount);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
if (ancount)
|
||||
ND_PRINT(" [%ua]", ancount);
|
||||
if (qdcount != 1)
|
||||
|
@ -21,9 +21,7 @@
|
||||
|
||||
/* \summary: Marvell (Ethertype) Distributed Switch Architecture printer */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include "netdissect-stdinc.h"
|
||||
|
||||
|
@ -17,9 +17,7 @@
|
||||
|
||||
/* \summary: Dynamic Trunking Protocol (DTP) printer */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include "netdissect-stdinc.h"
|
||||
|
||||
@ -84,7 +82,7 @@ dtp_print(netdissect_options *ndo, const u_char *tptr, u_int length)
|
||||
|
||||
/* infinite loop check */
|
||||
if (len < 4 || len > length) {
|
||||
ND_PRINT("[invalid TLV length %u]", len);
|
||||
ND_PRINT("[TLV length %u]", len);
|
||||
goto invalid;
|
||||
}
|
||||
|
||||
|
@ -21,9 +21,7 @@
|
||||
|
||||
/* \summary: Distance Vector Multicast Routing Protocol printer */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include "netdissect-stdinc.h"
|
||||
|
||||
@ -321,7 +319,7 @@ print_neighbors2(netdissect_options *ndo,
|
||||
len -= 4;
|
||||
}
|
||||
if (ncount != -1) {
|
||||
ND_PRINT(" [invalid ncount]");
|
||||
ND_PRINT(" [ncount %d]", ncount);
|
||||
goto invalid;
|
||||
}
|
||||
}
|
||||
|
@ -20,9 +20,7 @@
|
||||
|
||||
/* \summary: Extensible Authentication Protocol (EAP) printer */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include "netdissect-stdinc.h"
|
||||
|
||||
@ -155,6 +153,7 @@ eap_print(netdissect_options *ndo,
|
||||
u_int count;
|
||||
const char *sep;
|
||||
|
||||
ndo->ndo_protocol = "eap";
|
||||
type = GET_U_1(cp);
|
||||
len = GET_BE_U_2(cp + 2);
|
||||
if (len != length) {
|
||||
|
@ -22,9 +22,7 @@
|
||||
|
||||
/* specification: RFC 827 */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include "netdissect-stdinc.h"
|
||||
|
||||
|
@ -23,9 +23,7 @@
|
||||
* RFC 7868
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include "netdissect-stdinc.h"
|
||||
|
||||
|
@ -23,9 +23,7 @@
|
||||
|
||||
/* \summary: OpenBSD IPsec encapsulation BPF layer printer */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include "netdissect-stdinc.h"
|
||||
|
||||
|
@ -23,25 +23,15 @@
|
||||
|
||||
/* \summary: IPSEC Encapsulating Security Payload (ESP) printer */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include "netdissect-stdinc.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
/* Any code in this file that depends on HAVE_LIBCRYPTO depends on
|
||||
* HAVE_OPENSSL_EVP_H too. Undefining the former when the latter isn't defined
|
||||
* is the simplest way of handling the dependency.
|
||||
*/
|
||||
#ifdef HAVE_LIBCRYPTO
|
||||
#ifdef HAVE_OPENSSL_EVP_H
|
||||
#include <openssl/evp.h>
|
||||
#else
|
||||
#undef HAVE_LIBCRYPTO
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "netdissect.h"
|
||||
@ -424,6 +414,7 @@ espprint_decode_encalgo(netdissect_options *ndo,
|
||||
const EVP_CIPHER *evp;
|
||||
int authlen = 0;
|
||||
char *colon, *p;
|
||||
const char *real_decode;
|
||||
|
||||
colon = strchr(decode, ':');
|
||||
if (colon == NULL) {
|
||||
@ -444,10 +435,23 @@ espprint_decode_encalgo(netdissect_options *ndo,
|
||||
p = strstr(decode, "-cbc");
|
||||
*p = '\0';
|
||||
}
|
||||
evp = EVP_get_cipherbyname(decode);
|
||||
/*
|
||||
* Not all versions of libcrypto support calls to add aliases
|
||||
* to ciphers - newer versions of libressl don't - so, instead
|
||||
* of making "3des" an alias for "des_ede3_cbc", if attempting
|
||||
* to get the cipher fails and the name is "3des", we try
|
||||
* "des_ede3_cbc".
|
||||
*/
|
||||
real_decode = decode;
|
||||
if (strcmp(real_decode, "3des") == 0)
|
||||
real_decode = "des-ede3-cbc";
|
||||
evp = EVP_get_cipherbyname(real_decode);
|
||||
|
||||
if (!evp) {
|
||||
(*ndo->ndo_warning)(ndo, "failed to find cipher algo %s\n", decode);
|
||||
if (decode != real_decode)
|
||||
(*ndo->ndo_warning)(ndo, "failed to find cipher algo %s (%s)\n", real_decode, decode);
|
||||
else
|
||||
(*ndo->ndo_warning)(ndo, "failed to find cipher algo %s\n", decode);
|
||||
sa->evp = NULL;
|
||||
sa->authlen = 0;
|
||||
sa->ivlen = 0;
|
||||
@ -683,7 +687,6 @@ static void esp_init(netdissect_options *ndo _U_)
|
||||
#if !defined(OPENSSL_API_COMPAT) || OPENSSL_API_COMPAT < 0x10100000L
|
||||
OpenSSL_add_all_algorithms();
|
||||
#endif
|
||||
EVP_add_cipher_alias(SN_des_ede3_cbc, "3des");
|
||||
}
|
||||
DIAG_ON_DEPRECATION
|
||||
|
||||
|
@ -21,9 +21,7 @@
|
||||
|
||||
/* \summary: Ethernet printer */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include "netdissect-stdinc.h"
|
||||
|
||||
@ -238,7 +236,7 @@ recurse:
|
||||
*/
|
||||
length_type = GET_BE_U_2(p);
|
||||
|
||||
ND_LCHECK_U(caplen, 2);
|
||||
ND_ICHECK_U(caplen, <, 2);
|
||||
length -= 2;
|
||||
caplen -= 2;
|
||||
p += 2;
|
||||
@ -412,7 +410,7 @@ invalid:
|
||||
}
|
||||
|
||||
/*
|
||||
* Print an Ethernet frame while specyfing a non-standard Ethernet header
|
||||
* Print an Ethernet frame while specifying a non-standard Ethernet header
|
||||
* length.
|
||||
* This might be encapsulated within another frame; we might be passed
|
||||
* a pointer to a function that can print header information for that
|
||||
|
@ -21,9 +21,7 @@
|
||||
|
||||
/* \summary: Fiber Distributed Data Interface (FDDI) printer */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include "netdissect-stdinc.h"
|
||||
|
||||
@ -240,8 +238,7 @@ extract_fddi_addrs(const struct fddi_header *fddip, char *fsrc, char *fdst)
|
||||
fdst[i] = fddi_bit_swap[fddip->fddi_dhost[i]];
|
||||
for (i = 0; i < 6; ++i)
|
||||
fsrc[i] = fddi_bit_swap[fddip->fddi_shost[i]];
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
memcpy(fdst, (const char *)fddip->fddi_dhost, 6);
|
||||
memcpy(fsrc, (const char *)fddip->fddi_shost, 6);
|
||||
}
|
||||
|
@ -18,9 +18,7 @@
|
||||
|
||||
/* specification: RFC 5810 */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include "netdissect-stdinc.h"
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user