pax_global_header00006660000000000000000000000064144140605420014512gustar00rootroot0000000000000052 comment=55bc126b0216cfe409b8d6bd378f65679d136ddf tcpdump-4.99.4/000077500000000000000000000000001441406054200132755ustar00rootroot00000000000000tcpdump-4.99.4/CHANGES000066400000000000000000002155601441406054200143010ustar00rootroot00000000000000Friday, April 7, 2023 / The Tcpdump Group Summary for 4.99.4 tcpdump release Source code: Fix spaces before tabs in indentation. Updated printers: LSP ping: Fix "Unused value" warnings from Coverity. CVE-2023-1801: Fix an out-of-bounds write in the SMB printer. DNS: sync resource types with IANA. ICMPv6: Update the output to show a RPL DAO field name. Geneve: Fix the Geneve UDP port test. Building and testing: Require at least autoconf 2.69. Don't check for strftime(), as it's in C90 and beyond. Update config.{guess,sub}, timestamps 2023-01-01,2023-01-21. Documentation: man: Document TCP flag names better. Thursday, January 12, 2023 / The Tcpdump Group Summary for 4.99.3 tcpdump release Updated printers: PTP: Use the proper values for the control field and print un-allocated values for the message field as "Reserved" instead of "none". Source code: smbutil.c: Replace obsolete function call (asctime) Building and testing: cmake: Update the minimum required version to 2.8.12 (except Windows). CI: Introduce and use TCPDUMP_CMAKE_TAINTED. Makefile.in: Add the releasecheck target. Makefile.in: Add "make -s install" in the releasecheck target. Cirrus CI: Run the "make releasecheck" command in the Linux task. Makefile.in: Add the whitespacecheck target. Cirrus CI: Run the "make whitespacecheck" command in the Linux task. Address all shellcheck warnings in update-test.sh. Makefile.in: Get rid of a remain of gnuc.h. Documentation: Reformat the installation notes (INSTALL.txt) in Markdown. Convert CONTRIBUTING to Markdown. CONTRIBUTING.md: Document the use of "protocol: " in a commit summary. Add a README file for NetBSD. Fix CMake build to set man page section numbers in tcpdump.1 Saturday, December 31, 2022 / The Tcpdump Group Summary for 4.99.2 tcpdump release Updated printers: BGP: Update cease notification decoding to RFC 9003. BGP: decode BGP link-bandwidth extended community properly. BGP: Fix parsing the AIGP attribute BGP: make sure the path attributes don't go past the end of the packet. BGP: Shutdown message can be up to 255 bytes length according to rfc9003 DSA: correctly determine VID. EAP: fix some length checks and output issues. 802.11: Fix the misleading comment regarding "From DS", "To DS" Frame Control Flags. 802.11: Fetch the CF and TIM IEs a field at a time. 802.15.4, BGP, LISP: fix some length checks, compiler warnings, and undefined behavior warnings. PFLOG: handle LINKTYPE_PFLOG/DLT_PFLOG files from all OSes on all OSes. RRCP: support more Realtek protocols than just RRCP. MPLS: show the EXP field as TC, as per RFC 5462. ICMP: redo MPLS Extension code as general ICMP Extension code. VQP: Do not print unknown error codes twice. Juniper: Add some bounds checks. Juniper: Don't treat known DLT_ types as "Unknown". lwres: Fix a length check, update a variable type. EAP: Fix some undefined behaviors at runtime. Ethernet: Rework the length checks, add a length check. IPX: Add two length checks. Zephyr: Avoid printing non-ASCII characters. VRRP: Print the protocol name before any GET_(). DCCP: Get rid of trailing commas in lists. Juniper: Report invalid packets as invalid, not truncated. IPv6: Remove an obsolete code in an always-false #if wrapper. ISAKMP: Use GET_U_1() to replace a direct dereference. RADIUS: Use GET_U_1() to replace a direct dereference. TCP: Fix an invalid check. RESP: Fix an invalid check. RESP: Remove an unnecessary test. Arista: Refine the output format and print HwInfo. sFlow: add support for IPv6 agent, add a length check. VRRP: add support for IPv6. OSPF: Update to match the Router Properties registry. OSPF: Remove two unnecessary dereferences. OSPF: Add support bit Nt RFC3101. OSPFv3: Remove two unnecessary dereferences. ICMPv6: Fix output for Router Renumbering messages. ICMPv6: Fix the Node Information flags. ICMPv6: Remove an unused macro and extra blank lines. ICMPv6: Add a length check in the rpl_dio_print() function. ICMPv6: Use GET_IP6ADDR_STRING() in the rpl_dio_print() function. IPv6: Add some checks for the Hop-by-Hop Options header IPv6: Add a check for the Jumbo Payload Hop-by-Hop option. NFS: Fix the format for printing an unsigned int PTP: fix printing of the correction fields PTP: Use ND_LCHECK_U for checking invalid length. WHOIS: Add its own printer source file and printer function MPTCP: print length before subtype inside MPTCP options ESP: Add a workaround to a "use-of-uninitialized-value". PPP: Add tests to avoid incorrectly re-entering ppp_hdlc(). PPP: Don't process further if protocol is unknown (-e option). PPP: Change the pointer to packet data. ZEP: Add three length checks. Add some const qualifiers. Building and testing: Update config.guess and config.sub. Use AS_HELP_STRING macro instead of AC_HELP_STRING. Handle some Autoconf/make errors better. Fix an error when cross-compiling. Use "git archive" for the "make releasetar" process. Remove the release candidate rcX targets. Mend "make check" on Solaris 9 with Autoconf. Address assorted compiler warnings. Fix auto-enabling of Capsicum on FreeBSD with Autoconf. Treat "msys" as Windows for test exit statuses. Clean up some help messages in configure. Use unified diff by default. Remove awk code from mkdep. Fix configure test errors with Clang 15 CMake: Prevent stripping of the RPATH on installation. AppVeyor CI: update Npcap site, update to 1.12 SDK. Cirrus CI: Use the same configuration as for the main branch. CI: Add back running tcpdump -J/-L and capture, now with Cirrus VMs. Remove four test files (They are now in the libpcap tests directory). On Solaris, for 64-bit builds, use the 64-bit pcap-config. Tell CMake not to check for a C++ compiler. CMake: Add a way to request -Werror and equivalents. configure: Special-case macOS /usr/bin/pcap-config as we do in CMake. configure: Use pcap-config --static-pcap-only if available. configure: Use ac_c_werror_flag to force unknown compiler flags to fail. configure: Use AC_COMPILE_IFELSE() and AC_LANG_SOURCE() for testing flags. Run the test that fails on OpenBSD only if we're not on OpenBSD. Source code: Fix some snapend-changing routines to protect against pointer underflow. Use __func__ from C99 in some function calls. Memory allocator: Update nd_add_alloc_list() to a static function. addrtoname.c: Fix two invalid tests. Use more S_SUCCESS and S_ERR_HOST_PROGRAM in main(). Add some comments about "don't use GET_IP6ADDR_STRING()". Assign ndo->ndo_packetp in pretty_print_packet(). Add ND_LCHECKMSG_U, ND_LCHECK_U, ND_LCHECKMSG_ZU and ND_LCHECK_ZU macros. Update tok2strbuf() to a static function. netdissect.h: Keep the link-layer dissectors names sorted. setsignal(): Set SA_RESTART on non-lethal signals (REQ_INFO, FLUSH_PCAP) to avoid corrupting binary pcap output. Use __builtin_unreachable(). Fail if nd_push_buffer() or nd_push_snaplen() fails. Improve code style and fix many typos. Documentation: Some man page cleanups. Update the print interface for the packet count to stdout. Note that we require compilers to support at least some of C99. Update AIX and Solaris-related specifics. INSTALL.txt: Add doc/README.*, delete the deleted win32 directory. Update README.md and README.Win32.md. Update some comments with new RFC numbers. Wednesday, June 9, 2021 by gharris Summary for 4.99.1 tcpdump release Source code: Squelch some compiler warnings ICMP: Update the snapend for some nested IP packets. MACsec: Update the snapend thus the ICV field is not payload for the caller. EIGRP: Fix packet header fields SMB: Disable printer by default in CMake builds OLSR: Print the protocol name even if the packet is invalid MSDP: Print ": " before the protocol name ESP: Remove padding, padding length and next header from the buffer DHCPv6: Update the snapend for nested DHCPv6 packets OpenFlow 1.0: Get snapend right for nested frames. TCP: Update the snapend before decoding a MPTCP option Ethernet, IEEE 802.15.4, IP, L2TP, TCP, ZEP: Add bounds checks ForCES: Refine SPARSEDATA-TLV length check. ASCII/hex: Use nd_trunc_longjmp() in truncation cases GeoNet: Add a ND_TCHECK_LEN() call Replace ND_TCHECK_/memcpy() pairs with GET_CPY_BYTES(). BGP: Fix overwrites of global 'astostr' temporary buffer ARP: fix overwrites of static buffer in q922_string(). Frame Relay: have q922_string() handle errors better. Building and testing: Rebuild configure script when building release 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 DNS sections Solaris: Fix a compile error with Sun C Wednesday, December 30, 2020, by mcr@sandelman.ca, denis and fxl. Summary for 4.99.0 tcpdump release CVE-2018-16301: For the -F option handle large input files safely. Improve the contents, wording and formatting of the man page. Print unsupported link-layer protocol packets in hex. Add support for new network protocols and DLTs: Arista, Autosar SOME/IP, Broadcom LI and Ethernet switches tag, IEEE 802.15.9, IP-over-InfiniBand (IPoIB), Linux SLL2, Linux vsockmon, MACsec, Marvell Distributed Switch Architecture, OpenFlow 1.3, Precision Time Protocol (PTP), SSH, WHOIS, ZigBee Encapsulation Protocol (ZEP). Make protocol-specific updates for: AH, DHCP, DNS, ESP, FRF.16, HNCP, ICMP6, IEEE 802.15.4, IPv6, IS-IS, Linux SLL, LLDP, LSP ping, MPTCP, NFS, NSH, NTP, OSPF, OSPF6, PGM, PIM, PPTP, RADIUS, RSVP, Rx, SMB, UDLD, VXLAN-GPE. User interface: Make SLL2 the default for Linux "any" pseudo-device. Add --micro and --nano shorthands. Add --count to print a counter only instead of decoding. Add --print, to cause packet printing even with -w. Add support for remote capture if libpcap supports it. Display the "wireless" flag and connection status. Flush the output packet buffer on a SIGUSR2. Add the snapshot length to the "reading from file ..." message. Fix local time printing (DST offset in timestamps). Allow -C arguments > 2^31-1 GB if they can fit into a long. Handle very large -f files by rejecting them. Report periodic stats only when safe to do so. Print the number of packets captured only as often as necessary. With no -s, or with -s 0, don't specify the snapshot length with newer versions of libpcap. Improve version and usage message printing. Building and testing: Install into bindir, not sbindir. autoconf: replace --with-system-libpcap with --disable-local-libpcap. Require the compiler to support C99. Better detect and use various C compilers and their features. Add CMake as the second build system. Make out-of-tree builds more reliable. Use pkg-config to detect libpcap if available. Improve Windows support. Add more tests and improve the scripts that run them. Test both with "normal" and "x87" floating-point. Eliminate dependency on libdnet. FreeBSD: Print a proper error message about monitor mode VAP. Use libcasper if available. Fix failure to capture on RDMA device. Include the correct capsicum header. Source code: Start the transition to longjmp() for packet truncation handling. Introduce new helper functions, including GET_*(), nd_print_protocol(), nd_print_invalid(), nd_print_trunc(), nd_trunc_longjmp() and others. Put integer signedness right in many cases. Introduce nd_uint*, nd_mac_addr, nd_ipv4 and nd_ipv6 types to fix alignment issues, especially on SPARC. Fix many C compiler, Coverity, UBSan and cppcheck warnings. Fix issues detected with AddressSanitizer. Remove many workarounds for older compilers and OSes. Add a sanity check on packet header length. Add and remove plenty of bounds checks. Clean up pcap_findalldevs() call to find the first interface. Use a short timeout, rather than immediate mode, for text output. Handle DLT_ENC files *not* written on the same OS and byte-order host. Add, and use, macros to do locale-independent case mapping. Use a table instead of getprotobynumber(). Get rid of ND_UNALIGNED and ND_TCHECK(). Make roundup2() generally available. Resync SMI list against Wireshark. Fix many typos. Friday, September 20, 2019, by mcr@sandelman.ca A huge thank you to Denis, Francois-Xavier and Guy who did much of the heavy lifting. Summary for 4.9.3 tcpdump release Fix buffer overflow/overread vulnerabilities: CVE-2017-16808 (AoE) CVE-2018-14468 (FrameRelay) CVE-2018-14469 (IKEv1) CVE-2018-14470 (BABEL) CVE-2018-14466 (AFS/RX) CVE-2018-14461 (LDP) CVE-2018-14462 (ICMP) CVE-2018-14465 (RSVP) CVE-2018-14881 (BGP) CVE-2018-14464 (LMP) CVE-2018-14463 (VRRP) CVE-2018-14467 (BGP) CVE-2018-10103 (SMB - partially fixed, but SMB printing disabled) CVE-2018-10105 (SMB - too unreliably reproduced, SMB printing disabled) CVE-2018-14880 (OSPF6) CVE-2018-16451 (SMB) CVE-2018-14882 (RPL) CVE-2018-16227 (802.11) CVE-2018-16229 (DCCP) CVE-2018-16230 (BGP) CVE-2018-16452 (SMB) CVE-2018-16300 (BGP) CVE-2018-16228 (HNCP) CVE-2019-15166 (LMP) CVE-2019-15167 (VRRP) Fix for cmdline argument/local issues: CVE-2018-14879 (tcpdump -V) Sunday September 3, 2017 denis@ovsienko.info Summary for 4.9.2 tcpdump release Do not use getprotobynumber() for protocol name resolution. Do not do any protocol name resolution if -n is specified. Improve errors detection in the test scripts. Fix a segfault with OpenSSL 1.1 and improve OpenSSL usage. Clean up IS-IS printing. Fix buffer overflow vulnerabilities: CVE-2017-11543 (SLIP) CVE-2017-13011 (bittok2str_internal) Fix infinite loop vulnerabilities: CVE-2017-12989 (RESP) CVE-2017-12990 (ISAKMP) CVE-2017-12995 (DNS) CVE-2017-12997 (LLDP) Fix buffer over-read vulnerabilities: CVE-2017-11541 (safeputs) CVE-2017-11542 (PIMv1) CVE-2017-12893 (SMB/CIFS) CVE-2017-12894 (lookup_bytestring) CVE-2017-12895 (ICMP) CVE-2017-12896 (ISAKMP) CVE-2017-12897 (ISO CLNS) CVE-2017-12898 (NFS) CVE-2017-12899 (DECnet) CVE-2017-12900 (tok2strbuf) CVE-2017-12901 (EIGRP) CVE-2017-12902 (Zephyr) CVE-2017-12985 (IPv6) CVE-2017-12986 (IPv6 routing headers) CVE-2017-12987 (IEEE 802.11) CVE-2017-12988 (telnet) CVE-2017-12991 (BGP) CVE-2017-12992 (RIPng) CVE-2017-12993 (Juniper) CVE-2017-12994 (BGP) CVE-2017-12996 (PIMv2) CVE-2017-12998 (ISO IS-IS) CVE-2017-12999 (ISO IS-IS) CVE-2017-13000 (IEEE 802.15.4) CVE-2017-13001 (NFS) CVE-2017-13002 (AODV) CVE-2017-13003 (LMP) CVE-2017-13004 (Juniper) CVE-2017-13005 (NFS) CVE-2017-13006 (L2TP) CVE-2017-13007 (Apple PKTAP) CVE-2017-13008 (IEEE 802.11) CVE-2017-13009 (IPv6 mobility) CVE-2017-13010 (BEEP) CVE-2017-13012 (ICMP) CVE-2017-13013 (ARP) CVE-2017-13014 (White Board) CVE-2017-13015 (EAP) CVE-2017-11543 (SLIP) CVE-2017-13016 (ISO ES-IS) CVE-2017-13017 (DHCPv6) CVE-2017-13018 (PGM) CVE-2017-13019 (PGM) CVE-2017-13020 (VTP) CVE-2017-13021 (ICMPv6) CVE-2017-13022 (IP) CVE-2017-13023 (IPv6 mobility) CVE-2017-13024 (IPv6 mobility) CVE-2017-13025 (IPv6 mobility) CVE-2017-13026 (ISO IS-IS) CVE-2017-13027 (LLDP) CVE-2017-13028 (BOOTP) CVE-2017-13029 (PPP) CVE-2017-13030 (PIM) CVE-2017-13031 (IPv6 fragmentation header) CVE-2017-13032 (RADIUS) CVE-2017-13033 (VTP) CVE-2017-13034 (PGM) CVE-2017-13035 (ISO IS-IS) CVE-2017-13036 (OSPFv3) CVE-2017-13037 (IP) CVE-2017-13038 (PPP) CVE-2017-13039 (ISAKMP) CVE-2017-13040 (MPTCP) CVE-2017-13041 (ICMPv6) CVE-2017-13042 (HNCP) CVE-2017-13043 (BGP) CVE-2017-13044 (HNCP) CVE-2017-13045 (VQP) CVE-2017-13046 (BGP) CVE-2017-13047 (ISO ES-IS) CVE-2017-13048 (RSVP) CVE-2017-13049 (Rx) CVE-2017-13050 (RPKI-Router) CVE-2017-13051 (RSVP) CVE-2017-13052 (CFM) CVE-2017-13053 (BGP) CVE-2017-13054 (LLDP) CVE-2017-13055 (ISO IS-IS) CVE-2017-13687 (Cisco HDLC) CVE-2017-13688 (OLSR) CVE-2017-13689 (IKEv1) CVE-2017-13690 (IKEv2) CVE-2017-13725 (IPv6 routing headers) Sunday July 23, 2017 denis@ovsienko.info Summary for 4.9.1 tcpdump release CVE-2017-11108/Fix bounds checking for STP. Make assorted documentation updates and fix a few typos in tcpdump output. Fixup -C for file size >2GB (GH #488). Show AddressSanitizer presence in version output. Fix a bug in test scripts (exposed in GH #613). On FreeBSD adjust Capsicum capabilities for netmap. On Linux fix a use-after-free when the requested interface does not exist. Wednesday January 18, 2017 devel.fx.lebail@orange.fr Summary for 4.9.0 tcpdump release General updates: Fix some heap overflows found with American Fuzzy Lop by Hanno Boeck and others (More information in the log with CVE-2016-* and CVE-2017-*) Change the way protocols print link-layer addresses (Fix heap overflows in CALM-FAST and GeoNetworking printers) Pass correct caplen value to ether_print() and some other functions Fix lookup_nsap() to match what isonsap_string() expects Clean up relative time stamp printing (Fix an array overflow) Fix some alignment issues with GCC on Solaris 10 SPARC Add some ND_TTEST_/ND_TCHECK_ macros to simplify writing bounds checks Add a fn_printztn() which returns the number of bytes processed Add nd_init() and nd_cleanup() functions. Improve libsmi support Add CONTRIBUTING file Add a summary comment in all printers Compile with more warning options in devel mode if supported (-Wcast-qual, ...) Fix some leaks found by Valgrind/Memcheck Fix a bunch of de-constifications Squelch some Coverity warnings and some compiler warnings Update Coverity and Travis-CI setup Update Visual Studio files Frontend: Fix capsicum support to work with zerocopy buffers in bpf Try opening interfaces by name first, then by name-as-index Work around pcap_create() failures fetching time stamp type lists Fix a segmentation fault with 'tcpdump -J' Improve addrtostr6() bounds checking Add exit_tcpdump() function Don't drop CAP_SYS_CHROOT before chrooting Fixes issue where statistics not reported when -G and -W options used Updated printers: 802.11: Beginnings of 11ac radiotap support 802.11: Check the Protected bit for management frames 802.11: Do bounds checking on last_presentp before dereferencing it (Fix a heap overflow) 802.11: Fix the radiotap printer to handle the special bits correctly 802.11: If we have the MCS field, it's 11n 802.11: Only print unknown frame type or subtype messages once 802.11: Radiotap dBm values get printed as dB; Update a test output accordingly 802.11: Source and destination addresses were backwards AH: Add a bounds check AH: Report to our caller that dissection failed if a bounds check fails AP1394: Print src > dst, not dst > src ARP: Don't assume the target hardware address is <= 6 octets long (Fix a heap overflow) ATALK: Add bounds and length checks (Fix heap overflows) ATM: Add some bounds checks (Fix a heap overflow) ATM: Fix an incorrect bounds check BFD: Update specification from draft to RFC 5880 BFD: Update to print optional authentication field BGP: Add support for the AIGP attribute (RFC7311) BGP: Print LARGE_COMMUNITY Path Attribute BGP: Update BGP numbers from IANA; Print minor values for FSM notification BOOTP: Add a bounds check Babel: Add decoder for source-specific extension CDP: Filter out non-printable characters CFM: Fixes to match the IEEE standard, additional bounds and length checks CSLIP: Add more bounds checks (Fix a heap overflow) ClassicalIPoATM: Add a bounds check on LLC+SNAP header (Fix a heap overflow) DHCP: Fix MUDURL and TZ options DHCPv6: Process MUDURL and TZ options DHCPv6: Update Status Codes with RFCs/IANA names DNS: Represent the "DNSSEC OK" bit as "DO" instead of "OK". Add a test case DTP: Improve packet integrity checks EGP: Fix bounds checks ESP: Don't use OpenSSL_add_all_algorithms() in OpenSSL 1.1.0 or later Ethernet: Add some bounds checking before calling isoclns_print (Fix a heap overflow) Ethernet: Print the Length/Type field as length when needed FDDI: Fix -e output for FDDI FR: Add some packet-length checks and improve Q.933 printing (Fix heap overflows) GRE: Add some bounds checks (Fix heap overflows) Geneve: Fix error message with invalid option length; Update list option classes HNCP: Fix incorrect time interval format. Fix handling of IPv4 prefixes ICMP6: Fetch a 32-bit big-endian quantity with EXTRACT_32BITS() IGMP: Add a length check IP: Add a bounds check (Fix a heap overflow) IP: Check before fetching the protocol version (Fix a heap overflow) IP: Don't try to dissect if IP version != 4 (Fix a heap overflow) IP: Stop processing IPPROTO_ values once we hit IPPROTO_IPCOMP IPComp: Check whether we have the CPI before we fetch it (Fix a heap overflow) IPoFC: Fix -e output (IP-over-Fibre Channel) IPv6: Don't overwrite the destination IPv6 address for routing headers IPv6: Fix header printing IPv6: Stop processing IPPROTO_ values once we hit IPPROTO_IPCOMP ISAKMP: Clean up parsing of IKEv2 Security Associations ISOCLNS/IS-IS: Add support for Purge Originator Identifier (RFC6232) and test cases ISOCLNS/IS-IS: Don't overwrite packet data when checking the signature ISOCLNS/IS-IS: Filter out non-printable characters ISOCLNS/IS-IS: Fix segmentation faults ISOCLNS/IS-IS: Have signature_verify() do the copying and clearing ISOCLNS: Add some bounds checks Juniper: Make sure a Juniper header TLV isn't bigger than what's left in the packet (Fix a heap overflow) LLC/SNAP: With -e, print the LLC header before the SNAP header; without it, cut the SNAP header LLC: Add a bounds check (Fix a heap overflow) LLC: Clean up printing of LLC packets LLC: Fix the printing of RFC 948-style IP packets LLC: Skip the LLC and SNAP headers with -x for 802.11 and some other protocols LLDP: Implement IANA OUI and LLDP MUD option MPLS LSP ping: Update printing for RFC 4379, bug fixes, more bounds checks MPLS: "length" is now the *remaining* packet length MPLS: Add bounds and length checks (Fix a heap overflow) NFS: Don't assume the ONC RPC header is nicely aligned NFS: Don't overflow the Opaque_Handle buffer (Fix a segmentation fault) NFS: Don't run past the end of an NFSv3 file handle OLSR: Add a test to cover a HNA sgw case OLSR: Fix 'Advertised networks' count OLSR: Fix printing of smart-gateway HNAs in IPv4 OSPF: Add a bounds check for the Hello packet options OSPF: Do more bounds checking OSPF: Fix a segmentation fault OSPF: Fix printing 'ospf_topology_values' default OTV: Add missing bounds checks PGM: Print the formatted IP address, not the raw binary address, as a string PIM: Add some bounds checking (Fix a heap overflow) PIMv2: Fix checksumming of Register messages PPP: Add some bounds checks (Fix a heap overflow) PPP: Report invalid PAP AACK/ANAK packets Q.933: Add a missing bounds check RADIUS: Add Value 13 "VLAN" to Tunnel-Type attribute RADIUS: Filter out non-printable characters RADIUS: Translate UDP/1700 as RADIUS RESP: Do better checking of RESP packets RPKI-RTR: Add a return value check for "fn_printn" call RPKI-RTR: Remove printing when truncated condition already detected RPL: Fix 'Consistency Check' control code RPL: Fix suboption print RSVP: An INTEGRITY object in a submessage covers only the submessage RSVP: Fix an infinite loop; Add bounds and length checks RSVP: Fix some if statements missing brackets RSVP: Have signature_verify() do the copying and clearing RTCP: Add some bounds checks RTP: Add some bounds checks, fix two segmentation faults SCTP: Do more bounds checking SFLOW: Fix bounds checking SLOW: Fix bugs, add checks SMB: Before fetching the flags2 field, make sure we have it SMB: Do bounds checks on NBNS resource types and resource data lengths SNMP: Clean up the "have libsmi but no modules loaded" case SNMP: Clean up the object abbreviation list and fix the code to match them SNMP: Do bounds checks when printing character and octet strings SNMP: Improve ASN.1 bounds checks SNMP: More bounds and length checks STP: Add a bunch of bounds checks, and fix some printing (Fix heap overflows) STP: Filter out non-printable characters TCP: Add bounds and length checks for packets with TCP option 20 TCP: Correct TCP option Kind value for TCP Auth and add SCPS-TP TCP: Fix two bounds checks (Fix heap overflows) TCP: Make sure we have the data offset field before fetching it (Fix a heap overflow) TCP: Put TCP-AO option decoding right TFTP: Don't use strchr() to scan packet data (Fix a heap overflow) Telnet: Add some bounds checks TokenRing: Fix -e output UDLD: Fix an infinite loop UDP: Add a bounds check (Fix a heap overflow) UDP: Check against the packet length first VAT: Add some bounds checks VTP: Add a test on Mgmt Domain Name length VTP: Add bounds checks and filter out non-printable characters VXLAN: Add a bound check and a test case ZeroMQ: Fix an infinite loop Tuesday October 25, 2016 mcr@sandelman.ca Summary for 4.8.1 tcpdump release Fix "-x" for Apple PKTAP and PPI packets Improve separation frontend/backend (tcpdump/libnetdissect) Fix display of timestamps with -tt, -ttt and -ttttt options Add support for the Marvell Extended Distributed Switch Architecture header Use PRIx64 to print a 64-bit number in hex. Printer for HNCP (RFCs 7787 and 7788). dagid is always an IPv6 address, not an opaque 128-bit string, and other fixes to RPL printer. RSVP: Add bounds and length checks OSPF: Do more bounds checking Handle OpenSSL 1.1.x. Initial support for the REdis Serialization Protocol known as RESP. Add printing function for Generic Protocol Extension for VXLAN draft-ietf-nvo3-vxlan-gpe-01 Network Service Header: draft-ietf-sfc-nsh-01 Don't recompile the filter if the new file has the same DLT. Pass an adjusted struct pcap_pkthdr to the sub-printer. Add three test cases for already fixed CVEs CVE-2014-8767: OLSR CVE-2014-8768: Geonet CVE-2014-8769: AODV Don't do the DDP-over-UDP heuristic first: GitHub issue #499. Use the new debugging routines in libpcap. Harmonize TCP source or destination ports tests with UDP ones Introduce data types to use for integral values in packet structures. RSVP: Fix an infinite loop Support of Type 3 and Type 4 LISP packets. Don't require IPv6 library support in order to support IPv6 addresses. Many many changes to support libnetdissect usage. Add a test that makes unaligned accesses: GitHub issue #478. add a DNSSEC test case: GH #445 and GH #467. BGP: add decoding of ADD-PATH capability fixes to LLC header printing, and RFC948-style IP packets Friday April 10, 2015 guy@alum.mit.edu Summary for 4.7.4 tcpdump release RPKI to Router Protocol: Fix Segmentation Faults and other problems RPKI to Router Protocol: print strings with fn_printn() wb: fix some bounds checks Wednesday March 11, 2015 mcr@sandelman.ca Summary for 4.7.3 tcpdump release Capsicum fixes for FreeBSD 10 Tuesday March 10, 2015 mcr@sandelman.ca Summary for 4.7.2 tcpdump release DCCP: update Packet Types with RFC4340/IANA names fixes for CVE-2015-0261: IPv6 mobility header check issue fixes for CVE-2015-2153, 2154, 2155: kday packets Friday Nov. 12, 2014 guy@alum.mit.edu Summary for 4.7.0 tcpdump release changes to hex printing of CDP packets Fix PPI printing Radius: update Packet Type Codes and Attribute Types with RFC/IANA names Add a routine to print "text protocols", and add FTP/HTTP/SMTP/RTSP support. improvements to telnet printer, even if not -v omit length for bcp, print-tcp uses it formatting fixes for a bunch of protocols new bounds checks for a number of protocols split netflow 1,6, and 6 dissector up. added geneve dissector CVE-2014-9140 PPP dissector fixed. Tuesday Sep. 2, 2014 mcr@sandelman.ca Summary for 4.6.2 tcpdump release fix out-of-source-tree builds: find libpcap that is out of source better configure check for libsmi Saturday Jul. 19, 2014 mcr@sandelman.ca Summary for 4.6.1 tcpdump release added FreeBSD capsicum add a short option '#', same as long option '--number' Wednesday Jul. 2, 2014 mcr@sandelman.ca Summary for 4.6.0 tcpdump release all of tcpdump is now using the new "NDO" code base (Thanks Denis!) nflog, mobile, forces, pptp, AODV, AHCP, IPv6, OSPFv4, RPL, DHCPv6 enhancements/fixes M3UA decode added. many new test cases: 82 in 4.5.1 to 133 in 4.6.0 many improvements to travis continuous integration system: OSX, and Coverity options cleaned up some unnecessary header files Added bittok2str(). a number of unaligned access faults fixed -A flag does not consider CR to be printable anymore fx.lebail took over coverity baby sitting default snapshot size increased to 256K for accommodate USB captures WARNING: this release contains a lot of very worthwhile code churn. Wednesday Jan. 15, 2014 guy@alum.mit.edu Summary for 4.5.2 tcpdump release Man page fix Fix crashes on SPARC Monday Nov. 11, 2013 mcr@sandelman.ca Summary for 4.5.1 tcpdump release CREDITS file fixes Thursday Nov. 7, 2013 mcr@sandelman.ca and guy@alum.mit.edu. Summary for 4.5.0 tcpdump release some NFSv4 fixes for printing fix printing of unknown TCP options, and tcp fast-open fixes for syslog parser some gcc-version-specific flag tuning adopt MacOS deprecation workarounds for openssl improvements to babel printing add OpenFlow 1.0 (no SSL) and test cases GeoNet printer. added STBC Rx support improvements to DHCPv6 decoder clarify which autoconf is needed Point users to the the-tcpdump-group repository on GitHub rather than the mcr repository Add MSDP printer. Fixed IPv6 check on Solaris and other OSes requiring extra networking libraries. Add support for VXLAN (draft-mahalingam-dutt-dcops-vxlan-03), and add "vxlan" as an option for -T. Add support for OTV (draft-hasmit-otv-04). fixes for DLT_IEEE802_11_RADIO datalink types added MPTCP decoder Saturday April 6, 2013 guy@alum.mit.edu. Summary for 4.4.0 tcpdump release RPKI-RTR (RFC6810) is now official (TCP Port 323) Fix detection of OpenSSL libcrypto. Add DNSSL (RFC6106) support. Add "radius" as an option for -T. Update Action codes for handle_action function according to 802.11s amendment. Decode DHCPv6 AFTR-Name option (RFC6334). Updates for Babel. Fix printing of infinite lifetime in ICMPv6. Added support for SPB, SPBM Service Identifier, and Unicast Address sub-TLV in ISIS. Decode RIPv2 authentication up to RFC4822. Fix RIP Request/full table decoding issues. On Linux systems with cap-ng.h, drop root privileges using Linux Capabilities. Add support for reading multiple files. Add MS NLB heartbeat printer. Separate multiple nexthops in BGP. Wednesday November 28, 2012 guy@alum.mit.edu. Summary for 4.3.1 tcpdump release Print "LLDP, length N" for LLDP packets even when not in verbose mode, so something is printed even if only the timestamp is present Document "-T carp" Print NTP poll interval correctly (it's an exponent, so print both its raw value and 2^value) Document that "-e" is used to get MAC addresses More clearly document that you need to escape or quote backslashes in filter expressions on the command line Fix some "the the" in the man page Use the right maximum path length Don't treat 192_1_2, when passed to -i, as an interface number Friday April 3, 2012. mcr@sandelman.ca. Summary for 4.3.0 tcpdump release fixes for forces: SPARSE data (per RFC 5810) some more test cases added updates to documentation on -l, -U and -w flags. Fix printing of BGP optional headers. Tried to include DLT_PFSYNC support, failed due to headers required. added TIPC support. Fix LLDP Network Policy bit definitions. fixes for IGMPv3's Max Response Time: it is in units of 0.1 second. SIGUSR1 can be used rather than SIGINFO for stats permit -n flag to affect print-ip for protocol numbers ND_OPT_ADVINTERVAL is in milliseconds, not seconds Teach PPPoE parser about RFC 4638 Friday December 9, 2011. guy@alum.mit.edu. Summary for 4.2.1 tcpdump release Only build the Babel printer if IPv6 is enabled. Support Babel on port 6696 as well as 6697. Include ppi.h in release tarball. Include all the test files in the release tarball, and don't "include" test files that no longer exist. Don't assume we have - check for it. Support "-T carp" as a way of dissecting IP protocol 112 as CARP rather than VRRP. Support Hilscher NetAnalyzer link-layer header format. Constify some pointers and fix compiler warnings. Get rid of never-true test. Fix an unintended fall-through in a case statement in the ARP printer. Fix several cases where sizeof(sizeof(XXX)) was used when just sizeof(XXX) was intended. Make stricter sanity checks in the ES-IS printer. Get rid of some GCCisms that caused builds to fai with compilers that don't support them. Fix typo in man page. Added length checks to Babel printer. Sunday July 24, 2011. mcr@sandelman.ca. Summary for 4.2.+ merged 802.15.4 decoder from Dmitry Eremin-Solenikov updates to forces for new port numbers Use "-H", not "-h", for the 802.11s option. (-h always help) Better ICMPv6 checksum handling. add support for the RPKI/Router Protocol, per -ietf-sidr-rpki-rtr-12 get rid of uuencoded pcap test files, git can do binary. sFlow changes for 64-bit counters. fixes for PPI packet header handling and printing. Add DCB Exchange protocol (DCBX) version 1.01. Babel dissector, from Juliusz Chroboczek and Grégoire Henry. improvements to radiotap for rate values > 127. Many improvements to ForCES decode, including fix SCTP TML port updated RPL type code to RPL-17 draft Improve printout of DHCPv6 options. added support and test case for QinQ (802.1q VLAN) packets Handle DLT_IEEE802_15_4_NOFCS like DLT_IEEE802_15_4. Build fixes for Sparc and other machines with alignment restrictions. Merged changes from Debian package. PGM: Add ACK decoding and add PGMCC DATA and FEEDBACK options. Build fixes for OSX (Snow Leopard and others) Add support for IEEE 802.15.4 packets Tue. July 20, 2010. guy@alum.mit.edu. Summary for 4.1.2 tcpdump release If -U is specified, flush the file after creating it, so it's not zero-length Fix TCP flags output description, and some typos, in the man page Add a -h flag, and only attempt to recognize 802.11s mesh headers if it's set When printing the link-layer type list, send *all* output to stderr Include the CFLAGS setting when configure was run in the compiler flags Thu. April 1, 2010. guy@alum.mit.edu. Summary for 4.1.1 tcpdump release Fix build on systems with PF, such as FreeBSD and OpenBSD. Don't blow up if a zero-length link-layer address is passed to linkaddr_string(). Thu. March 11, 2010. ken@netfunctional.ca/guy@alum.mit.edu. Summary for 4.1.0 tcpdump release Fix printing of MAC addresses for VLAN frames with a length field Add some additional bounds checks and use the EXTRACT_ macros more Add a -b flag to print the AS number in BGP packets in ASDOT notation rather than ASPLAIN notation Add ICMPv6 RFC 5006 support Decode the access flags in NFS access requests Handle the new DLT_ for memory-mapped USB captures on Linux Make the default snapshot (-s) the maximum Print name of device (when -L is used) Support for OpenSolaris (and SXCE build 125 and later) Print new TCP flags Add support for RPL DIO Add support for TCP User Timeout (UTO) Add support for non-standard Ethertypes used by 3com PPPoE gear Add support for 802.11n and 802.11s Add support for Transparent Ethernet Bridge ethertype in GRE Add 4 byte AS support for BGP printer Add support for the MDT SAFI 66 BG printer Add basic IPv6 support to print-olsr Add USB printer Add printer for ForCES Handle frames with an FCS Handle 802.11n Control Wrapper, Block Acq Req and Block Ack frames Fix TCP sequence number printing Report 802.2 packets as 802.2 instead of 802.3 Don't include -L/usr/lib in LDFLAGS On x86_64 Linux, look in lib64 directory too Lots of code clean ups Autoconf clean ups Update testcases to make output changes Fix compiling with/out smi (--with{,out}-smi) Fix compiling without IPv6 support (--disable-ipv6) Mon. October 27, 2008. ken@netfunctional.ca. Summary for 4.0.0 tcpdump release Add support for Bluetooth Sniffing Add support for Realtek Remote Control Protocol (openrrcp.org.ru) Add support for 802.11 AVS Add support for SMB over TCP Add support for 4 byte BGP AS printing Add support for compiling on case-insensitive file systems Add support for ikev2 printing Update support for decoding AFS Update DHCPv6 printer Use newer libpcap API's (allows -B option on all platforms) Add -I to turn on monitor mode Bugfixes in lldp, lspping, dccp, ESP, NFS printers Cleanup unused files and various cruft Mon. September 10, 2007. ken@xelerance.com. Summary for 3.9.8 tcpdump release Rework ARP printer Rework OSPFv3 printer Add support for Frame-Relay ARP Decode DHCP Option 121 (RFC 3442 Classless Static Route) Decode DHCP Option 249 (MS Classless Static Route) the same as Option 121 TLV: Add support for Juniper .pcap extensions Print EGP header in new-world-order style Converted print-isakmp.c to NETDISSECT Moved AF specific stuff into af.h Test subsystem now table driven, and saves outputs and diffs to one place Require for pf definitions - allows reading of pflog formatted libpcap files on an OS other than where the file was generated Wed. July 23, 2007. mcr@xelerance.com. Summary for 3.9.7 libpcap release NFS: Print unsigned values as such. RX: parse safely. BGP: fixes for IPv6-less builds. 801.1ag: use standard codepoint. use /dev/bpf on systems with such a device. 802.11: print QoS data, avoid dissect of no-data frame, ignore padding. smb: make sure that we haven't gone past the end of the captured data. smb: squelch an uninitialized complaint from coverity. NFS: from NetBSD; don't interpret the reply as a possible NFS reply if it got MSG_DENIED. BGP: don't print TLV values that didn't fit, from www.digit-labs.org. revised INSTALL.txt about libpcap dependency. Wed. April 25, 2007. ken@xelerance.com. Summary for 3.9.6 tcpdump release Update man page to reflect changes to libpcap Changes to both TCP and IP Printer Output Fix a potential buffer overflow in the 802.11 printer Print basic info about a few more Cisco LAN protocols. mDNS cleanup ICMP MPLS rework of the extension code bugfix: use the correct codepoint for the OSPF simple text auth token entry, and use safeputs to print the password. Add support in pflog for additional values Add support for OIF RSVP Extensions UNI 1.0 Rev. 2 and additional RSVP objects Add support for the Message-id NACK c-type. Add support for 802.3ah loopback ctrl msg Add support for Multiple-STP as per 802.1s Add support for rapid-SPT as per 802.1w Add support for CFM Link-trace msg, Link-trace-Reply msg, Sender-ID tlv, private tlv, port, interface status Add support for unidirectional link detection as per https://tools.ietf.org/id/draft-foschiano-udld-02.txt Add support for the olsr protocol as per RFC 3626 plus the LQ extensions from olsr.org Add support for variable-length checksum in DCCP, as per section 9 of 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 VTP protocol Update dhcp6 options table as per IETF standardization activities Tue. September 19, 2006. ken@xelerance.com. Summary for 3.9.5 tcpdump release Fix compiling on AIX (, at end of ENUM) Updated list of DNS RR typecodes Use local Ethernet defs on WIN32 Add support for Frame-Relay ARP Fixes for compiling under MSVC++ Add support for parsing Juniper .pcap files Add support for FRF.16 Multilink Frame-Relay (DLT_MFR) Rework the OSPFv3 printer Fix printing for 4.4BSD/NetBSD NFS Filehandles Add support for Cisco style NLPID encapsulation Add cisco prop. eigrp related, extended communities Add support for BGP signaled VPLS Cleanup the bootp printer Add support for PPP over Frame-Relay Add some bounds checking to the IP options code, and clean up the options output a bit. Add additional modp groups to ISAKMP printer Add support for Address-Withdraw and Label-Withdraw Msgs Add support for the BFD Discriminator TLV Fixes for 64bit compiling Add support for PIMv2 checksum verification Add support for further dissection of the IPCP Compression Option Add support for Cisco's proposed VQP protocol Add basic support for keyed authentication TCP option Lots of minor cosmetic changes to output printers Mon. September 19, 2005. ken@xelerance.com. Summary for 3.9.4 tcpdump release Decoder support for more Juniper link-layer types Fix a potential buffer overflow (although it can't occur in practice). Fix the handling of unknown management frame types in the 802.11 printer. Add FRF.16 support, fix various Frame Relay bugs. Add support for RSVP integrity objects, update fast-reroute object printer to latest spec. Clean up documentation of vlan filter expression, document mpls filter expression. Document new pppoed and pppoes filter expressions. Update diffserver-TE codepoints as per RFC 4124. Spelling fixes in ICMPv6. Don't require any fields other than flags to be present in IS-IS restart signaling TLVs, and only print the system ID in those TLVs as system IDs, not as node IDs. Support for DCCP. Tue. July 5, 2005. ken@xelerance.com. Summary for 3.9.3 tcpdump release Option to chroot() when dropping privs Fixes for compiling on nearly every platform, including improved 64bit support Many new testcases Support for sending packets Many compilation fixes on most platforms Fixes for recent version of GCC to eliminate warnings Improved Unicode support Decoders & DLT Changes, Updates and New: AES ESP support Juniper ATM, FRF.15, FRF.16, PPPoE, ML-FR, ML-PIC, ML-PPP, PL-PPP, LS-PIC GGSN,ES,MONITOR,SERVICES L2VPN Axent Raptor/Symantec Firewall TCP-MD5 (RFC 2385) ESP-in-UDP (RFC 3948) ATM OAM LMP, LMP Service Discovery IP over FC IP over IEEE 1394 BACnet MS/TP SS7 LDP over TCP LACP, MARKER as per 802.3ad PGM (RFC 3208) LSP-PING G.7041/Y.1303 Generic Framing Procedure EIGRP-IP, EIGRP-IPX ICMP6 Radio - via radiotap DHCPv6 HDLC over PPP Tue. March 30, 2004. mcr@sandelman.ottawa.on.ca. Summary for 3.8.3 release No changes from 3.8.2. Version bumped only to maintain consistency with libpcap 0.8.3. Mon. March 29, 2004. mcr@sandelman.ottawa.on.ca. Summary for 3.8.2 release Fixes for print-isakmp.c CVE: CAN-2004-0183, CAN-2004-0184 https://web.archive.org/web/20160328035955/https://www.rapid7.com/resources/advisories/R7-0017.jsp IP-over-IEEE1394 printing. some MINGW32 changes. updates for autoconf 2.5 fixes for print-aodv.c - check for too short packets formatting changes to print-ascii for hex output. check for too short packets: print-bgp.c, print-bootp.c, print-cdp.c, print-chdlc.c, print-domain.c, print-icmp.c, print-icmp6.c, print-ip.c, print-lwres.c, print-ospf.c, print-pim.c, print-ppp.c,print-pppoe.c, print-rsvp.c, print-wb.c print-ether.c - better handling of unknown types. print-isoclns.c - additional decoding of types. print-llc.c - strings for LLC names added. print-pfloc.c - various enhancements print-radius.c - better decoding to strings. Wed. November 12, 2003. mcr@sandelman.ottawa.on.ca. Summary for 3.8 release changed syntax of -E argument so that multiple SAs can be decrypted fixes for Digital Unix headers and Documentation __attribute__ fixes CDP changes from Terry Kennedy . IPv6 mobility updates from Kazushi Sugyo Fixes for ASN.1 decoder for 2.100.3 forms. Added a count of packets received and processed to clarify numbers. Incorporated WinDUMP patches for Win32 builds. PPPoE payload length headers. Fixes for HP C compiler builds. Use new pcap_breakloop() and pcap_findalldevs() if we can. BGP output split into multiple lines. Fixes to 802.11 decoding. Fixes to PIM decoder. SuperH is a CPU that can't handle unaligned access. Many fixes for unaligned access work. Fixes to Frame-Relay decoder for Q.933/922 frames. Clarified when Solaris can do captures as non-root. Added tests/ subdir for examples/regression tests. New -U flag. -flush stdout after every packet New -A flag -print ascii only support for decoding IS-IS inside Cisco HDLC Frames more verbosity for tftp decoder mDNS decoder new BFD decoder cross compilation patches RFC 3561 AODV support. UDP/TCP pseudo-checksum properly for source-route options. sanitized all files to modified BSD license Add support for RFC 2625 IP-over-Fibre Channel. fixes for DECnet support. Support RFC 2684 bridging of Ethernet, 802.5 Token Ring, and FDDI. RFC 2684 encapsulation of BPDUs. Tuesday, February 25, 2003. fenner@research.att.com. 3.7.2 release Fixed infinite loop when parsing invalid isakmp packets. (reported by iDefense; already fixed in CVS) Fixed infinite loop when parsing invalid BGP packets. Fixed buffer overflow with certain invalid NFS packets. Pretty-print unprintable network names in 802.11 printer. Handle truncated nbp (appletalk) packets. Updated DHCPv6 printer to match draft-ietf-dhc-dhcpv6-22.txt Print IP protocol name even if we don't have a printer for it. Print IP protocol name or number for fragments. Print the whole MPLS label stack, not just the top label. Print request header and file handle for NFS v3 FSINFO and PATHCONF requests. Fix NFS packet truncation checks. Handle "old" DR-Priority and Bidir-Capable PIM HELLO options. Handle unknown RADIUS attributes properly. Fix an ASN.1 parsing error that would cause e.g. the OID 2.100.3 to be misrepresented as 4.20.3 . Monday, January 21, 2002. mcr@sandelman.ottawa.on.ca. Summary for 3.7 release keyword "ipx" added. Better OSI/802.2 support on Linux. IEEE 802.11 support, from clenahan@fortresstech.com, achirica@ttd.net. LLC SAP support for FDDI/token ring/RFC-1483 style ATM BXXP protocol was replaced by the BEEP protocol; improvements to SNAP demux. Changes to "any" interface documentation. Documentation on pcap_stats() counters. Fix a memory leak found by Miklos Szeredi - pcap_ether_aton(). Added MPLS encapsulation decoding per RFC3032. DNS dissector handles TKEY, TSIG and IXFR. adaptive SLIP interface patch from Igor Khristophorov SMB printing has much improved bounds checks OUI 0x0000f8 decoded as encapsulated ethernet for Cisco-custom bridging Zephyr support, from Nickolai Zeldovich . Solaris - devices with digits in them. Stefan Hudson IPX socket 0x85be is for Cisco EIGRP over IPX. Improvements to fragmented ESP handling. SCTP support from Armando L. Caro Jr. Linux ARPHDR_ATM support fixed. Added a "netbeui" keyword, which selects NetBEUI packets. IPv6 ND improvements, MobileIP dissector, 2292bis-02 for RA option. Handle ARPHDR_HDLC from Marcus Felipe Pereira . Handle IPX socket 0x553 -> NetBIOS-over-IPX socket, "nwlink-dgm" Better Linux libc5 compat. BIND9 lwres dissector added. MIPS and SPARC get strict alignment macros (affects print-bgp.c) Apple LocalTalk LINKTYPE_ reserved. New time stamp formats documented. DHCP6 updated to draft-22.txt spec. ICMP types/codes now accept symbolic names. Add SIGINFO handler from LBL encrypted CIPE tunnels in IRIX, from Franz Schaefer . now we are -Wstrict-prototype clean. NetBSD DLT_PPP_ETHER; adapted from Martin Husemann . PPPoE dissector cleaned up. Support for LocalTalk hardware, from Uns Lider . In dissector, now the caller prints the IP addresses rather than proto. cjclark@alum.mit.edu: print the IP proto for non-initial fragments. LLC frames with a DSAP and LSAP of 0xe0 are IPX frames. Linux cooked frames with a type value of LINUX_SLL_P_802_3 are IPX. captures on the "any" device won't be done in promiscuous mode Token Ring support on DLPI - Onno van der Linden ARCNet support, from NetBSD. HSRP dissector, from Julian Cowley . Handle (GRE-encapsulated) PPTP added -C option to rotate save file every optarg * 1,000,000 bytes. support for "vrrp" name - NetBSD, by Klaus Klein . PPTP support, from Motonori Shindo . IS-IS over PPP support, from Hannes Gredler . CNFP support for IPv6,format. Harry Raaymakers . ESP printing updated to RFC2406. HP-UX can now handle large number of PPAs. MSDP printer added. L2TP dissector improvements from Motonori Shindo. Tuesday January 9, 2001. mcr@sandelman.ottawa.on.ca. Summary for 3.6 release Cleaned up documentation. Promisc mode fixes for Linux IPsec changes/cleanups. Alignment fixes for picky architectures Removed dependency on native headers for packet dissectors. Removed Linux specific headers that were shipped libpcap changes provide for exchanging capture files between systems. Save files now have well known PACKET_ values instead of depending upon system dependent mappings of DLT_* types. Support for computing/checking IP and UDP/TCP checksums. Updated autoconf stock files. IPv6 improvements: dhcp (draft-15), mobile-ip6, ppp, ospf6, Added dissector support for: ISOCLNS, Token Ring, IGMPv3, bxxp, timed, vrrp, radius, chdlc, cnfp, cdp, IEEE802.1d, raw-AppleTalk Added filtering support for: VLANs, ESIS, ISIS Improvements to: print-telnet, IPTalk, bootp/dhcp, ECN, PPP, L2TP, PPPoE HP-UX 11.0 -- find the right dlpi device. Solaris 8 - IPv6 works Linux - Added support for an "any" device to capture on all interfaces Security fixes: buffer overrun audit done. Strcpy replaced with strlcpy, sprintf replaced with snprintf. Look for lex problems, and warn about them. v3.5 Fri Jan 28 18:00:00 PST 2000 Bill Fenner - switch to config.h for autoconf - unify RCSID strings - Updated PIMv1, PIMv2, DVMRP, IGMP parsers, add Cisco Auto-RP parser - Really fix the RIP printer - Fix MAC address -> name translation. - some -Wall -Wformat fixes - update makemib to parse much of SMIv2 - Print TCP sequence # with -vv even if you normally wouldn't - Print as much of IP/TCP/UDP headers as possible even if truncated. itojun@iijlab.net - -X will make a ascii dump. from netbsd. - telnet command sequence decoder (ff xx xx). from netbsd. - print-bgp.c: improve options printing. ugly code exists for unaligned option parsing (need some fix). - const poisoning in SMB decoder. - -Wall -Werror clean checks. - bring in KAME IPv6/IPsec decoding code. Assar Westerlund - SNMPv2 and SNMPv3 printer - If compiled with libsmi, tcpdump can load MIBs on the fly to decode SNMP packets. - Incorporate NFS parsing code from NetBSD. Adds support for nfsv3. - portability fixes - permit building in different directories. Ken Hornstein - bring in code at /afs/transarc.com/public/afs-contrib/tools/tcpdump for parsing AFS3 packets Andrew Tridgell - SMB printing code Love - print-rx.c: add code for printing MakeDir and StoreStatus. Also change date format to the right one. Michael C. Richardson - Created tcpdump.org repository v3.4 Sat Jul 25 12:40:55 PDT 1998 - Hardwire Linux slip support since it's too hard to detect. - Redo configuration of "network" libraries (-lsocket and -lnsl) to deal with IRIX. Thanks to John Hawkinson (jhawk@mit.edu) - Added -a which tries to translate network and broadcast addresses to names. Suggested by Rob van Nieuwkerk (robn@verdi.et.tudelft.nl) - Added a configure option to disable gcc. - Added a "raw" packet printer. - Not having an interface address is no longer fatal. Requested by John Hawkinson. - Rework signal setup to accommodate Linux. - OSPF truncation check fix. Also display the type of OSPF packets using MD5 authentication. Thanks to Brian Wellington (bwelling@tis.com) - Fix truncation check bugs in the Kerberos printer. Reported by Ezra Peisach (epeisach@mit.edu) - Don't catch SIGHUP when invoked with nohup(1). Thanks to Dave Plonka (plonka@mfa.com) - Specify full install target as a way of detecting if install directory does not exist. Thanks to Dave Plonka. - Bit-swap FDDI addresses for BSD/OS too. Thanks to Paul Vixie (paul@vix.com) - Fix off-by-one bug when testing size of ethernet packets. Thanks to Marty Leisner (leisner@sdsp.mc.xerox.com) - Add a local autoconf macro to check for routines in libraries; the autoconf version is broken (it only puts the library name in the cache variable name). Thanks to John Hawkinson. - Add a local autoconf macro to check for types; the autoconf version is broken (it uses grep instead of actually compiling a code fragment). - Modified to support the new BSD/OS 2.1 PPP and SLIP link layer header formats. - Extend OSF ip header workaround to versions 1 and 2. - Fix some signed problems in the nfs printer. As reported by David Sacerdote (davids@silence.secnet.com) - Detect group wheel and use it as the default since BSD/OS' install can't hack numeric groups. Reported by David Sacerdote. - AIX needs special loader options. Thanks to Jonathan I. Kamens (jik@cam.ov.com) - Fixed the nfs printer to print port numbers in decimal. Thanks to Kent Vander Velden (graphix@iastate.edu) - Find installed libpcap in /usr/local/lib when not using gcc. - Disallow network masks with non-network bits set. - Attempt to detect "egcs" versions of gcc. - Add missing closing double quotes when displaying bootp strings. Reported by Viet-Trung Luu (vluu@picard.math.uwaterloo.ca) v3.3 Sat Nov 30 20:56:27 PST 1996 - Added Linux support. - GRE encapsulated packet printer thanks to John Hawkinson (jhawk@mit.edu) - Rewrite gmt2local() to avoid problematic os dependencies. - Suppress nfs truncation message on errors. - Add missing m4 quoting in AC_LBL_UNALIGNED_ACCESS autoconf macro. Reported by Joachim Ott (ott@ardala.han.de) - Enable "ip_hl vs. ip_vhl" workaround for OSF4 too. - Print arp hardware type in host order. Thanks to Onno van der Linden (onno@simplex.nl) - Avoid solaris compiler warnings. Thanks to Bruce Barnett (barnett@grymoire.crd.ge.com) - Fix rip printer to not print one more route than is actually in the packet. Thanks to Jean-Luc Richier (Jean-Luc.Richier@imag.fr) and Bill Fenner (fenner@parc.xerox.com) - Use autoconf endian detection since BYTE_ORDER isn't defined on all systems. - Fix dvmrp printer truncation checks and add a dvmrp probe printer. Thanks to Danny J. Mitzel (mitzel@ipsilon.com) - Rewrite ospf printer to improve truncation checks. - Don't parse tcp options past the EOL. As noted by David Sacerdote (davids@secnet.com). Also, check tcp options to make sure they ar actually in the tcp header (in addition to the normal truncation checks). Fix the SACK code to print the N blocks (instead of the first block N times). - Don't say really small UDP packets are truncated just because they aren't big enough to be a RPC. As noted by David Sacerdote. v3.2.1 Sun Jul 14 03:02:26 PDT 1996 - Added rfc1716 icmp codes as suggested by Martin Fredriksson (martin@msp.se) - Print mtu for icmp unreach need frag packets. Thanks to John Hawkinson (jhawk@mit.edu) - Decode icmp router discovery messages. Thanks to Jeffrey Honig (jch@bsdi.com) - Added a printer entry for DLT_IEEE802 as suggested by Tak Kushida (kushida@trl.ibm.co.jp) - Check igmp checksum if possible. Thanks to John Hawkinson. - Made changes for SINIX. Thanks to Andrej Borsenkow (borsenkow.msk@sni.de) - Use autoconf's idea of the top level directory in install targets. Thanks to John Hawkinson. - Avoid infinite loop in tcp options printing code. Thanks to Jeffrey Mogul (mogul@pa.dec.com) - Avoid using -lsocket in IRIX 5.2 and earlier since it breaks snoop. Thanks to John Hawkinson. - Added some more packet truncation checks. - On systems that have it, use sigset() instead of signal() since signal() has different semantics on these systems. - Fixed some more alignment problems on the alpha. - Add code to massage unprintable characters in the domain and ipx printers. Thanks to John Hawkinson. - Added explicit netmask support. Thanks to Steve Nuchia (steve@research.oknet.com) - Add "sca" keyword (for DEC cluster services) as suggested by Terry Kennedy (terry@spcvxa.spc.edu) - Add "atalk" keyword as suggested by John Hawkinson. - Added an igrp printer. Thanks to Francis Dupont (francis.dupont@inria.fr) - Print IPX net numbers in hex a la Novell Netware. Thanks to Terry Kennedy (terry@spcvxa.spc.edu) - Fixed snmp extended tag field parsing bug. Thanks to Pascal Hennequin (pascal.hennequin@hugo.int-evry.fr) - Added some ETHERTYPEs missing on some systems. - Added truncated packet macros and various checks. - Fixed endian problems with the DECnet printer. - Use $CC when checking gcc version. Thanks to Carl Lindberg (carl_lindberg@blacksmith.com) - Fixes for AIX (although this system is not yet supported). Thanks to John Hawkinson. - Fix bugs in the autoconf misaligned accesses code fragment. - Include sys/param.h to get BYTE_ORDER in a few places. Thanks to Pavlin Ivanov Radoslavov (pavlin@cs.titech.ac.jp) v3.2 Sun Jun 23 02:28:10 PDT 1996 - Print new icmp unreachable codes as suggested by Martin Fredriksson (martin@msp.se). Also print code value when unknown for icmp redirect and time exceeded. - Fix an alignment endian bug in getname(). Thanks to John Hawkinson. - Define "new" domain record types if not found in arpa/nameserv.h. Resulted from a suggestion from John Hawkinson (jhawk@mit.edu). Also fixed an endian bug when printing mx record and added some new record types. - Added RIP V2 support. Thanks to Jeffrey Honig (jch@bsdi.com) - Added T/TCP options printing. As suggested by Richard Stevens (rstevens@noao.edu) - Use autoconf to detect architectures that can't handle misaligned accesses. v3.1 Thu Jun 13 20:59:32 PDT 1996 - Changed u_int32/int32 to u_int32_t/int32_t to be consistent with bsd and bind (as suggested by Charles Hannum). - Port to GNU autoconf. - Add support for printing DVMRP and PIM traffic thanks to Havard Eidnes (Havard.Eidnes@runit.sintef.no). - Fix AppleTalk, IPX and DECnet byte order problems due to wrong endian define being referenced. Reported by Terry Kennedy. - Minor fixes to the man page thanks to Mark Andrews. - Endian fixes to RTP and vat packet dumpers, thanks to Bruce Mah (bmah@cs.berkeley.edu). - Added support for new dns types, thanks to Rainer Orth. - Fixed tftp_print() to print the block number for ACKs. - Document -dd and -ddd. Resulted from a bug report from Charlie Slater (cslater@imatek.com). - Check return status from malloc/calloc/etc. - Check return status from pcap_loop() so we can print an error and exit with a bad status if there were problems. - Bail if ip option length is <= 0. Resulted from a bug report from Darren Reed (darrenr@vitruvius.arbld.unimelb.edu.au). - Print out a little more information for sun rpc packets. - Add support for Kerberos 4 thanks to John Hawkinson (jhawk@mit.edu). - Fixed the Fix EXTRACT_SHORT() and EXTRACT_LONG() macros (which were wrong on little endian machines). - Fixed alignment bug in ipx_decode(). Thanks to Matt Crawford (crawdad@fnal.gov). - Fix ntp_print() to not print garbage when the stratum is "unspecified." Thanks to Deus Ex Machina (root@belle.bork.com). - Rewrote tcp options printer code to check for truncation. Added selective acknowledgment case. - Fixed an endian bug in the ospf printer. Thanks to Jeffrey C Honig (jch@bsdi.com) - Fix rip printer to handle 4.4 BSD sockaddr struct which only uses one octet for the sa_family member. Thanks to Yoshitaka Tokugawa (toku@dit.co.jp) - Don't checksum ip header if we don't have all of it. Thanks to John Hawkinson (jhawk@mit.edu). - Print out hostnames if possible in egp printer. Thanks to Jeffrey Honig (jhc@bsdi.com) v3.1a1 Wed May 3 19:21:11 PDT 1995 - Include time.h when SVR4 is defined to avoid problems under Solaris 2.3. - Fix etheraddr_string() in the ETHER_SERVICE to return the saved strings, not the local buffer. Thanks to Stefan Petri (petri@ibr.cs.tu-bs.de). - Detect when pcap raises the snaplen (e.g. with snit). Print a warning that the selected value was not used. Thanks to Pascal Hennequin (Pascal.Hennequin@hugo.int-evry.fr). - Add a truncated packet test to print-nfs.c. Thanks to Pascal Hennequin. - BYTEORDER -> BYTE_ORDER Thanks to Terry Kennedy (terry@spcvxa.spc.edu). v3.0.3 Sun Oct 1 18:35:00 GMT 1995 - Although there never was a 3.0.3 release, the linux boys cleverly "released" one in late 1995. v3.0.2 Thu Apr 20 21:28:16 PDT 1995 - Change configuration to not use gcc v2 flags with gcc v1. - Redo gmt2local() so that it works under BSDI (which seems to return an empty timezone struct from gettimeofday()). Based on report from Terry Kennedy (terry@spcvxa.spc.edu). - Change configure to recognize IP[0-9]* as "mips" SGI hardware. Based on report from Mark Andrews (mandrews@alias.com). - Don't pass cc flags to gcc. Resulted from a bug report from Rainer Orth (ro@techfak.uni-bielefeld.de). - Fixed printout of connection id for uncompressed tcp slip packets. Resulted from a bug report from Richard Stevens (rstevens@noao.edu). - Hack around deficiency in Ultrix's make. - Add ETHERTYPE_TRAIL define which is missing from irix5. v3.0.1 Wed Aug 31 22:42:26 PDT 1994 - Fix problems with gcc2 vs. malloc() and read() prototypes under SunOS 4. v3.0 Mon Jun 20 19:23:27 PDT 1994 - Added support for printing tcp option timestamps thanks to Mark Andrews (mandrews@alias.com). - Reorganize protocol dumpers to take const pointers to packets so they never change the contents (i.e., they used to do endian conversions in place). Previously, whenever more than one pass was taken over the packet, the packet contents would be dumped incorrectly (i.e., the output form -x would be wrong on little endian machines because the protocol dumpers would modify the data). Thanks to Charles Hannum (mycroft@gnu.ai.mit.edu) for reporting this problem. - Added support for decnet protocol dumping thanks to Jeff Mogul (mogul@pa.dec.com). - Fix bug that caused length of packet to be incorrectly printed (off by ether header size) for unknown ethernet types thanks to Greg Miller (gmiller@kayak.mitre.org). - Added support for IPX protocol dumping thanks to Brad Parker (brad@fcr.com). - Added check to verify IP header checksum under -v thanks to Brad Parker (brad@fcr.com). - Move packet capture code to new libpcap library (which is packaged separately). - Prototype everything and assume an ansi compiler. - print-arp.c: Print hardware ethernet addresses if they're not what we expect. - print-bootp.c: Decode the cmu vendor field. Add RFC1497 tags. Many helpful suggestions from Gordon Ross (gwr@jericho.mc.com). - print-fddi.c: Improvements. Thanks to Jeffrey Mogul (mogul@pa.dec.com). - print-icmp.c: Byte swap netmask before printing. Thanks to Richard Stevens (rstevens@noao.edu). Print icmp type when unknown. - print-ip.c: Print the inner ip datagram of ip-in-ip encapsulated packets. By default, only the inner packet is dumped, appended with the token "(encap)". Under -v, both the inner and output packets are dumped (on the same line). Note that the filter applies to the original packet, not the encapsulated packet. So if you run tcpdump on a net with an IP Multicast tunnel, you cannot filter out the datagrams using the conventional syntax. (You can filter away all the ip-in-ip traffic with "not ip proto 4".) - print-nfs.c: Keep pending rpc's in circular table. Add generic nfs header and remove os dependences. Thanks to Jeffrey Mogul. - print-ospf.c: Improvements. Thanks to Jeffrey Mogul. - tcpdump.c: Add -T flag allows interpretation of "vat", "wb", "rpc" (sunrpc) and rtp packets. Added "inbound" and "outbound" keywords Add && and || operators v2.2.1 Tue Jun 6 17:57:22 PDT 1992 - Fix bug with -c flag. v2.2 Fri May 22 17:19:41 PDT 1992 - savefile.c: Remove hack that shouldn't have been exported. Add truncate checks. - Added the 'icmp' keyword. For example, 'icmp[0] != 8 and icmp[0] != 0' matches non-echo/reply ICMP packets. - Many improvements to filter code optimizer. - Added 'multicast' keyword and extended the 'broadcast' keyword can now be so that protocol qualifications are allowed. For example, "ip broadcast" and "ether multicast" are valid filters. - Added support for monitoring the loopback interface (i.e. 'tcpdump -i lo'). Jeffrey Honig (jch@MITCHELL.CIT.CORNELL.EDU) contributed the kernel patches to netinet/if_loop.c. - Added support for the Ungermann-Bass Ethernet on IBM/PC-RTs running AOS. Contact Jeffrey Honig (jch@MITCHELL.CIT.CORNELL.EDU) for the diffs. - Added EGP and OSPF printers, thanks to Jeffrey Honig. v2.1 Tue Jan 28 11:00:14 PST 1992 - Internal release (never publicly exported). v2.0.1 Sun Jan 26 21:10:10 PDT - Various byte ordering fixes. - Add truncation checks. - inet.c: Support BSD style SIOCGIFCONF. - nametoaddr.c: Handle multi addresses for single host. - optimize.c: Rewritten. - pcap-bpf.c: don't choke when we get ptraced. only set promiscuous for broadcast nets. - print-atal.c: Fix an alignment bug (thanks to stanonik@nprdc.navy.mil) Add missing printf() argument. - print-bootp.c: First attempt at decoding the vendor buffer. - print-domain.c: Fix truncation checks. - print-icmp.c: Calculate length of packets from the ip header. - print-ip.c: Print frag id in decimal (so it's easier to match up with non-frags). Add support for ospf, egp and igmp. - print-nfs.c: Lots of changes. - print-ntp.c: Make some verbose output depend on -v. - print-snmp.c: New version from John LoVerso. - print-tcp.c: Print rfc1072 tcp options. - tcpdump.c: Print "0x" prefix for %x formats. Always print 6 digits (microseconds) worth of precision. Fix uid bugs. - A packet dumper has been added (thanks to Jeff Mogul of DECWRL). With this option, you can create an architecture independent binary trace file in real time, without the overhead of the packet printer. At a later time, the packets can be filtered (again) and printed. - BSD is supported. You must have BPF in your kernel. Since the filtering is now done in the kernel, fewer packets are dropped. In fact, with BPF and the packet dumper option, a measly Sun 3/50 can keep up with a busy network. - Compressed SLIP packets can now be dumped, provided you use our SLIP software and BPF. These packets are dumped as any other IP packet; the compressed headers are dumped with the '-e' option. - Machines with little-endian byte ordering are supported (thanks to Jeff Mogul). - Ultrix 4.0 is supported (also thanks to Jeff Mogul). - IBM RT and Stanford Enetfilter support has been added by Rayan Zachariassen . 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. - TFTP packets are now printed (requests only). - BOOTP packets are now printed. - SNMP packets are now printed. (thanks to John LoVerso of Xylogics). - Sparc architectures, including the Sparcstation-1, are now supported thanks to Steve McCanne and Craig Leres. - SunOS 4 is now supported thanks to Micky Liu of Columbia University (micky@cunixc.cc.columbia.edu). - IP options are now printed. - RIP packets are now printed. - There's a -v flag that prints out more information than the default (e.g., it will enable printing of IP ttl, tos and id) and -q flag that prints out less (e.g., it will disable interpretation of AppleTalk-in-UDP). - The grammar has undergone substantial changes (if you have an earlier version of tcpdump, you should re-read the manual entry). The most useful change is the addition of an expression syntax that lets you filter on arbitrary fields or values in the packet. E.g., "ip[0] > 0x45" would print only packets with IP options, "tcp[13] & 3 != 0" would print only TCP SYN and FIN packets. The most painful change is that concatenation no longer means "and" -- e.g., you have to say "host foo and port bar" instead of "host foo port bar". The up side to this down is that repeated qualifiers can be omitted, making most filter expressions shorter. E.g., you can now say "ip host foo and (bar or baz)" to look at ip traffic between hosts foo and bar or between hosts foo and baz. [The old way of saying this was "ip host foo and (ip host bar or ip host baz)".] v2.0 Sun Jan 13 12:20:40 PST 1991 - Initial public release. tcpdump-4.99.4/CMakeLists.txt000066400000000000000000001322741441406054200160460ustar00rootroot00000000000000if(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. # # 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. # cmake_minimum_required(VERSION 2.8.12) endif(WIN32) # # We want find_path() and find_library() to honor {packagename}_ROOT, # as that appears to be the standard way to say "hey, look here for # this package" from the command line. # if(POLICY CMP0074) cmake_policy(SET CMP0074 NEW) endif() # # OK, this is a pain. # # When building on NetBSD, with a libpcap installed from pkgsrc, # a -Wl,-rpath,/usr/pkg/lib option is added to the options when # linking tcpdump. This puts /usr/pkg/lib into the run-time path. # # However, by default, CMake adds a rule to the install CMake script # a CMake command (using an undocumented subcommand of file()) that # strips /usr/pkg/lib *out* of the run-time path; the message in the # output for the "install" target is # # -- Set runtime path of "{target-directory}/tcpdump" to "" # # I am not certain what the rationale is for doing this, but a # *consequence* of this is that, when you run the installed tcpdump, # it fails to find libpcap.so: # # $ {target-directory}/tcpdump -h # {target-directory}/tcpdump: Shared object "libpcap.so.0" not found # # It also appears to be the case that, on Ubuntu 22.04, FreeBSD 12, # DragonFly BSD 5.8, OpenBSD 6.6, and Solaris 11.4, # # On Ubuntu and Solaris, even if you have a libpcap in /usr/local, you # have to provide not only -I/usr/local/include and -L/usr/local/lib, # you also must provide -Wl,-rpath,/usr/local/lib in order to have # the run-time linker look in /usr/local/lib for libpcap. If it's not # specified, then, if the shared library major version number of the # libpcap in /usr/lib is the same as the shared major version number # of the libpcap in /usr/local/lib, the run-time linker will find the # libpcap in /usr/lib; if the versions are different, the run-time # linker will fail to find the libpcap in /usr/lib, so the program will # fail to run. # # We suppress this by setting CMAKE_INSTALL_RPATH_USE_LINK_PATH to TRUE; # as the documentation for that variable says: # # Add paths to linker search and installed rpath. # # CMAKE_INSTALL_RPATH_USE_LINK_PATH is a boolean that if set to True # will append to the runtime search path (rpath) of installed # binaries any directories outside the project that are in the linker # search path or contain linked library files. The directories are # appended after the value of the INSTALL_RPATH target property. # # 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 # necessary in order to find the libraries at run time. # set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules) # # OK, this is a royal pain. # # CMake will try to determine the sizes of some data types, including # void *, early in the process of configuration; apparently, it's done # as part of processing the project() command. # # At least as of CMake 2.8.6, it does so by checking the size of # "void *" in C, setting CMAKE_C_SIZEOF_DATA_PTR based on that, # setting CMAKE_SIZEOF_VOID_P to that, and then checking the size # of "void *" in C++, setting CMAKE_CXX_SIZEOF_DATA_PTR based on # that, and then setting CMAKE_SIZEOF_VOID_P to *that*. # # The compile tests include whatever C flags may have been provided # to CMake in the CFLAGS and CXXFLAGS environment variables. # # If you set an architecture flag such as -m32 or -m64 in CFLAGS # but *not* in CXXFLAGS, the size for C++ will win, and hilarity # will ensue. # # Or if, at least on Solaris, you have a newer version of GCC # installed, but *not* a newer version of G++, and you have Oracle # Studio installed, it will find GCC, which will default to building # 64-bit, and Oracle Studio's C++ compiler, which will default to # 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) # # For checking if a compiler flag works and adding it if it does. # include(CheckCCompilerFlag) macro(check_and_add_compiler_option _option) message(STATUS "Checking C compiler flag ${_option}") string(REPLACE "=" "-" _temp_option_variable ${_option}) string(REGEX REPLACE "^-" "" _option_variable ${_temp_option_variable}) check_c_compiler_flag("${_option}" ${_option_variable}) if(${${_option_variable}}) set(C_ADDITIONAL_FLAGS "${C_ADDITIONAL_FLAGS} ${_option}") endif() endmacro() # # If we're building with Visual Studio, we require Visual Studio 2015, # in order to get sufficient C99 compatibility. Check for that. # # If not, try the appropriate flag for the compiler to enable C99 # features. # set(C_ADDITIONAL_FLAGS "") if(MSVC) if(MSVC_VERSION LESS 1900) message(FATAL_ERROR "Visual Studio 2015 or later is required") endif() # # Treat source files as being in UTF-8 with MSVC if it's not using # the Clang front end. # We assume that UTF-8 source is OK with other compilers and with # MSVC if it's using the Clang front end. # if(NOT ${CMAKE_C_COMPILER} MATCHES "clang*") set(C_ADDITIONAL_FLAGS "${C_ADDITIONAL_FLAGS} /utf-8") endif(NOT ${CMAKE_C_COMPILER} MATCHES "clang*") else(MSVC) # # Try to enable as many C99 features as we can. # At minimum, we want C++/C99-style // comments. # # Newer versions of compilers might default to supporting C99, but # older versions may require a special flag. # # Prior to CMake 3.1, setting CMAKE_C_STANDARD will not have any effect, # so, unless and until we require CMake 3.1 or later, we have to do it # ourselves on pre-3.1 CMake, so we just do it ourselves on all versions # of CMake. # # Note: with CMake 3.1 through 3.5, the only compilers for which CMake # handles CMAKE_C_STANDARD are GCC and Clang. 3.6 adds support only # for Intel C; 3.9 adds support for PGI C, Sun C, and IBM XL C, and # 3.10 adds support for Cray C and IAR C, but no version of CMake has # support for HP C. Therefore, even if we use CMAKE_C_STANDARD with # compilers for which CMake supports it, we may still have to do it # ourselves on other compilers. # # See the CMake documentation for the CMAKE__COMPILER_ID variables # for a list of compiler IDs. # # XXX - this just tests whether the option works and adds it if it does. # We don't test whether it's necessary in order to get the C99 features # that we use; if we ever have a user who tries to compile with a compiler # that can't be made to support those features, we can add a test to make # sure we actually *have* C99 support. # if(CMAKE_C_COMPILER_ID MATCHES "GNU" OR CMAKE_C_COMPILER_ID MATCHES "Clang") check_and_add_compiler_option("-std=gnu99") elseif(CMAKE_C_COMPILER_ID MATCHES "XL") # # We want support for extensions picked up for GNU C compatibility, # so we use -qlanglvl=extc99. # check_and_add_compiler_option("-qlanglvl=extc99") elseif(CMAKE_C_COMPILER_ID MATCHES "HP") check_and_add_compiler_option("-AC99") elseif(CMAKE_C_COMPILER_ID MATCHES "Sun") check_and_add_compiler_option("-xc99") elseif(CMAKE_C_COMPILER_ID MATCHES "Intel") check_and_add_compiler_option("-c99") endif() endif(MSVC) set(LIBRARY_NAME netdissect) ################################################################### # Parameters ################################################################### option(WITH_SMI "Build with libsmi, if available" ON) option(WITH_CRYPTO "Build with OpenSSL/libressl libcrypto, if available" ON) option(WITH_CAPSICUM "Build with Capsicum security functions, if available" ON) option(WITH_CAP_NG "Use libcap-ng, if available" ON) option(ENABLE_SMB "Build with the SMB dissector" OFF) # # String parameters. Neither of them are set, initially; only if the # user explicitly configures them are they set. # # WITH_CHROOT is STRING, not PATH, as the directory need not exist # when CMake is run. # set(WITH_CHROOT CACHE STRING "Directory to which to chroot when dropping privileges") set(WITH_USER CACHE STRING "User to whom to set the UID when dropping privileges") # # By default, build universal with the appropriate set of architectures # for the OS on which we're doing the build. # if(APPLE AND "${CMAKE_OSX_ARCHITECTURES}" STREQUAL "") # # Get the major version of Darwin. # string(REGEX MATCH "^([0-9]+)" SYSTEM_VERSION_MAJOR "${CMAKE_SYSTEM_VERSION}") if(SYSTEM_VERSION_MAJOR EQUAL 9) # # Leopard. Build for x86 and 32-bit PowerPC, with # x86 first. (That's what Apple does.) # set(CMAKE_OSX_ARCHITECTURES "i386;ppc") elseif(SYSTEM_VERSION_MAJOR EQUAL 10) # # Snow Leopard. Build for x86-64 and x86, with # x86-64 first. (That's what Apple does.) # set(CMAKE_OSX_ARCHITECTURES "x86_64;i386") endif() endif() ################################################################### # Versioning ################################################################### # Get, parse, format and set tcpdump's version string from # [tcpdump_root]/VERSION for later use. # Get MAJOR, MINOR, PATCH & SUFFIX file(STRINGS ${tcpdump_SOURCE_DIR}/VERSION PACKAGE_VERSION LIMIT_COUNT 1 # Read only the first line ) ###################################### # Project settings ###################################### add_definitions(-DHAVE_CONFIG_H) include_directories( ${CMAKE_CURRENT_BINARY_DIR} ${tcpdump_SOURCE_DIR} ) if(MSVC) add_definitions(-D__STDC__) add_definitions(-D_CRT_SECURE_NO_WARNINGS) endif(MSVC) if(MSVC) if (USE_STATIC_RT) MESSAGE(STATUS "Use STATIC runtime") set(NAME_RT MT) set (CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} /MT") set (CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /MT") set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MT") set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MTd") set (CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS_MINSIZEREL} /MT") set (CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} /MT") set (CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /MT") set (CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /MTd") else (USE_STATIC_RT) MESSAGE(STATUS "Use DYNAMIC runtime") set(NAME_RT MD) set (CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} /MD") set (CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /MD") set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MD") set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MDd") set (CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS_MINSIZEREL} /MD") set (CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} /MD") set (CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /MD") set (CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /MDd") endif (USE_STATIC_RT) endif(MSVC) ################################################################### # Detect available platform features ################################################################### include(CMakePushCheckState) include(CheckIncludeFile) include(CheckIncludeFiles) include(CheckFunctionExists) include(CheckLibraryExists) include(CheckSymbolExists) include(CheckStructHasMember) include(CheckVariableExists) include(CheckTypeSize) # # 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) check_include_files("rpc/rpc.h;rpc/rpcent.h" HAVE_RPC_RPCENT_H) endif(HAVE_RPC_RPC_H) # # Functions. # check_function_exists(strlcat HAVE_STRLCAT) check_function_exists(strlcpy HAVE_STRLCPY) check_function_exists(strdup HAVE_STRDUP) check_function_exists(strsep HAVE_STRSEP) # # Find library needed for gethostbyaddr. # NOTE: if you hand check_library_exists as its last argument a variable # that's been set, it skips the test, so we need different variables. # set(TCPDUMP_LINK_LIBRARIES "") if(WIN32) # # We need winsock2.h and ws2tcpip.h. # cmake_push_check_state() set(CMAKE_REQUIRED_LIBRARIES ws2_32) check_symbol_exists(gethostbyaddr "winsock2.h;ws2tcpip.h" LIBWS2_32_HAS_GETHOSTBYADDR) cmake_pop_check_state() if(LIBWS2_32_HAS_GETHOSTBYADDR) set(TCPDUMP_LINK_LIBRARIES ws2_32 ${TCPDUMP_LINK_LIBRARIES}) else(LIBWS2_32_HAS_GETHOSTBYADDR) message(FATAL_ERROR "gethostbyaddr is required, but wasn't found") endif(LIBWS2_32_HAS_GETHOSTBYADDR) else(WIN32) check_function_exists(gethostbyaddr STDLIBS_HAVE_GETHOSTBYADDR) if(NOT STDLIBS_HAVE_GETHOSTBYADDR) check_library_exists(socket gethostbyaddr "" LIBSOCKET_HAS_GETHOSTBYADDR) if(LIBSOCKET_HAS_GETHOSTBYADDR) set(TCPDUMP_LINK_LIBRARIES ${TCPDUMP_LINK_LIBRARIES} socket) else(LIBSOCKET_HAS_GETHOSTBYADDR) check_library_exists(nsl gethostbyaddr "" LIBNSL_HAS_GETHOSTBYADDR) 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") endif(LIBNSL_HAS_GETHOSTBYADDR) endif(LIBSOCKET_HAS_GETHOSTBYADDR) endif(NOT STDLIBS_HAVE_GETHOSTBYADDR) endif(WIN32) # # This may require additional libraries. # cmake_push_check_state() set(CMAKE_REQUIRED_LIBRARIES ${TCPDUMP_LINK_LIBRARIES}) check_function_exists(getservent STDLIBS_HAVE_GETSERVENT) if(STDLIBS_HAVE_GETSERVENT) set(HAVE_GETSERVENT TRUE) else(STDLIBS_HAVE_GETSERVENT) # # Some platforms may need -lsocket for getservent. # set(CMAKE_REQUIRED_LIBRARIES socket ${TCPDUMP_LINK_LIBRARIES}) check_function_exists(getservent LIBSOCKET_HAS_GETSERVENT) if(LIBSOCKET_HAS_GETSERVENT) set(HAVE_GETSERVENT TRUE) set(TCPDUMP_LINK_LIBRARIES socket ${TCPDUMP_LINK_LIBRARIES}) endif(LIBSOCKET_HAS_GETSERVENT) 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. # 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() check_function_exists(getopt_long HAVE_GETOPT_LONG) check_function_exists(setlinebuf HAVE_SETLINEBUF) # # For Windows, don't need to waste time checking for fork() or vfork(). # if(NOT WIN32) check_function_exists(fork HAVE_FORK) check_function_exists(vfork HAVE_VFORK) endif(NOT WIN32) # # Some platforms may need -lnsl for getrpcbynumber. # cmake_push_check_state() set(CMAKE_REQUIRED_LIBRARIES ${TCPDUMP_LINK_LIBRARIES}) check_function_exists(getrpcbynumber STDLIBS_HAVE_GETRPCBYNUMBER) if(STDLIBS_HAVE_GETRPCBYNUMBER) set(HAVE_GETRPCBYNUMBER TRUE) else(STDLIBS_HAVE_GETRPCBYNUMBER) set(CMAKE_REQUIRED_LIBRARIES ${TCPDUMP_LINK_LIBRARIES} nsl) check_function_exists(getrpcbynumber LIBNSL_HAS_GETRPCBYNUMBER) if(LIBNSL_HAS_GETRPCBYNUMBER) set(HAVE_GETRPCBYNUMBER TRUE) set(TCPDUMP_LINK_LIBRARIES ${TCPDUMP_LINK_LIBRARIES} nsl) endif(LIBNSL_HAS_GETRPCBYNUMBER) endif(STDLIBS_HAVE_GETRPCBYNUMBER) cmake_pop_check_state() # # This requires the libraries we require, as ether_ntohost might be # in one of those libraries. That means we have to do this after # we check for those libraries. # # You are in a twisty little maze of UN*Xes, all different. # Some might not have ether_ntohost(). # Some might have it and declare it in . # Some might have it and declare it in # Some might have it and declare it in . # Some might have it and declare it in . # Some might have it and declare it in . # Some might have it and not declare it in any header file. # # Before you is a C compiler. # cmake_push_check_state() set(CMAKE_REQUIRED_LIBRARIES ${TCPDUMP_LINK_LIBRARIES}) check_function_exists(ether_ntohost HAVE_ETHER_NTOHOST) if(HAVE_ETHER_NTOHOST) # # OK, we have ether_ntohost(). We don't check whether it's buggy, # as we assume any system that has CMake is likely to be new enough # that, if it has ether_ntohost(), whatever bug is checked for in # autotools is fixed; we just decide to use it. # set(USE_ETHER_NTOHOST TRUE) # # Is it declared in ? # # This test fails if we don't have or if we do # but it doesn't declare ether_ntohost(). # check_symbol_exists(ether_ntohost net/ethernet.h NET_ETHERNET_H_DECLARES_ETHER_NTOHOST) if(NET_ETHERNET_H_DECLARES_ETHER_NTOHOST) # # Yes - we have it declared. # set(HAVE_DECL_ETHER_NTOHOST TRUE) endif() # # Did that succeed? # if(NOT HAVE_DECL_ETHER_NTOHOST) # # No - how about , as on Linux? # # This test fails if we don't have # or if we do but it doesn't declare ether_ntohost(). # check_symbol_exists(ether_ntohost netinet/ether.h NETINET_ETHER_H_DECLARES_ETHER_NTOHOST) if(NETINET_ETHER_H_DECLARES_ETHER_NTOHOST) # # Yes - we have it declared. # set(HAVE_DECL_ETHER_NTOHOST TRUE) endif() endif() # # Did that succeed? # if(NOT HAVE_DECL_ETHER_NTOHOST) # # No - how about , as on Solaris 10 and later? # # This test fails if we don't have # or if we do but it doesn't declare ether_ntohost(). # check_symbol_exists(ether_ntohost sys/ethernet.h SYS_ETHERNET_H_DECLARES_ETHER_NTOHOST) if(SYS_ETHERNET_H_DECLARES_ETHER_NTOHOST) # # Yes - we have it declared. # set(HAVE_DECL_ETHER_NTOHOST TRUE) endif() endif() # # Did that succeed? # if(NOT HAVE_DECL_ETHER_NTOHOST) # # No, how about , as on AIX? # # This test fails if we don't have # or if we do but it doesn't declare ether_ntohost(). # check_symbol_exists(ether_ntohost arpa/inet.h ARPA_INET_H_DECLARES_ETHER_NTOHOST) if(ARPA_INET_H_DECLARES_ETHER_NTOHOST) # # Yes - we have it declared. # set(HAVE_DECL_ETHER_NTOHOST TRUE) endif() endif() # # Did that succeed? # if(NOT HAVE_DECL_ETHER_NTOHOST) # # No, how about ? # On some platforms, it requires and # , and we always include it with # both of them, so test it with both of them. # # This test fails if we don't have # and the headers we include before it, or if we do but # doesn't declare ether_ntohost(). # check_symbol_exists(ether_ntohost "sys/types.h;sys/socket.h;net/if.h;netinet/in.h;netinet/if_ether.h" NETINET_IF_ETHER_H_DECLARES_ETHER_NTOHOST) if(NETINET_IF_ETHER_H_DECLARES_ETHER_NTOHOST) # # Yes - we have it declared. # set(HAVE_DECL_ETHER_NTOHOST TRUE) endif() endif() # # After all that, is ether_ntohost() declared? # if(NOT HAVE_DECL_ETHER_NTOHOST) # # No, we'll have to declare it ourselves. # Do we have "struct ether_addr" if we include? # check_struct_has_member("struct ether_addr" octet "sys/types.h;sys/socket.h;net/if.h;netinet/in.h;netinet/if_ether.h" HAVE_STRUCT_ETHER_ADDR) endif() endif() cmake_pop_check_state() # # Data types. # # XXX - there's no check_struct() macro that's like check_struct_has_member() # except that it only checks for the existence of the structure type, # so we use check_struct_has_member() and look for ss_family. # # # Check for IPv6 support. # We just check for AF_INET6 and struct in6_addr. # cmake_push_check_state() if(WIN32) set(CMAKE_EXTRA_INCLUDE_FILES sys/types.h ws2tcpip.h) check_symbol_exists(AF_INET6 "sys/types.h;ws2tcpip.h" HAVE_AF_INET6) else(WIN32) set(CMAKE_EXTRA_INCLUDE_FILES sys/types.h sys/socket.h netinet/in.h) check_symbol_exists(AF_INET6 "sys/types.h;sys/socket.h;netinet/in.h" HAVE_AF_INET6) endif(WIN32) check_type_size("struct in6_addr" HAVE_STRUCT_IN6_ADDR) cmake_pop_check_state() if(HAVE_AF_INET6 AND HAVE_STRUCT_IN6_ADDR) set(HAVE_OS_IPV6_SUPPORT TRUE) endif(HAVE_AF_INET6 AND HAVE_STRUCT_IN6_ADDR) ###################################### # External dependencies ###################################### # # libpcap/WinPcap/Npcap. # First, find it. # find_package(PCAP REQUIRED) include_directories(${PCAP_INCLUDE_DIRS}) cmake_push_check_state() # # Now check headers. # set(CMAKE_REQUIRED_INCLUDES ${PCAP_INCLUDE_DIRS}) # # Check whether we have pcap/pcap-inttypes.h. # If we do, we use that to get the C99 types defined. # check_include_file(pcap/pcap-inttypes.h HAVE_PCAP_PCAP_INTTYPES_H) # # Check for various functions in libpcap/WinPcap/Npcap. # cmake_push_check_state() set(CMAKE_REQUIRED_LIBRARIES ${PCAP_LIBRARIES}) # # Check for "pcap_list_datalinks()" and use a substitute version if # it's not present. If it is present, check for "pcap_free_datalinks()"; # if it's not present, we don't replace it for now. (We could do so # on UN*X, but not on Windows, where hilarity ensues if a program # built with one version of the MSVC support library tries to free # something allocated by a library built with another version of # the MSVC support library.) # check_function_exists(pcap_list_datalinks HAVE_PCAP_LIST_DATALINKS) if(HAVE_PCAP_LIST_DATALINKS) check_function_exists(pcap_free_datalinks HAVE_PCAP_FREE_DATALINKS) endif(HAVE_PCAP_LIST_DATALINKS) # # Check for "pcap_datalink_name_to_val()", and use a substitute # version if it's not present. If it is present, check for # "pcap_datalink_val_to_description()", and if we don't have it, # use a substitute version. # check_function_exists(pcap_datalink_name_to_val HAVE_PCAP_DATALINK_NAME_TO_VAL) if(HAVE_PCAP_DATALINK_NAME_TO_VAL) check_function_exists(pcap_datalink_val_to_description HAVE_PCAP_DATALINK_VAL_TO_DESCRIPTION) endif(HAVE_PCAP_DATALINK_NAME_TO_VAL) # # Check for "pcap_set_datalink()"; you can't substitute for it if # it's absent (it has hooks into libpcap), so just define the # HAVE_ value if it's there. # check_function_exists(pcap_set_datalink HAVE_PCAP_SET_DATALINK) # # Check for "pcap_breakloop()"; you can't substitute for it if # it's absent (it has hooks into the live capture routines), # so just define the HAVE_ value if it's there. # check_function_exists(pcap_breakloop HAVE_PCAP_BREAKLOOP) # # Check for "pcap_dump_ftell()"; we use a substitute version # if it's not present. # check_function_exists(pcap_dump_ftell HAVE_PCAP_DUMP_FTELL) # # Do we have the new open API? Check for pcap_create() and for # pcap_statustostr(), and assume that, if we have both of them, # we also have pcap_activate() and the other new routines # introduced in libpcap 1.0.0. (We check for pcap_statustostr() # as well, because WinPcap 4.1.3 screwed up and exported pcap_create() # but not other routines such as pcap_statustostr(), even though it # defined them and even though you really want pcap_statustostr() to # get strings corresponding to some of the status returns from the # new routines.) # check_function_exists(pcap_statustostr HAVE_PCAP_STATUSTOSTR) # # If we don't have pcap_statustostr(), don't check for pcap_create(), # so we pretend we don't have it. # if(HAVE_PCAP_STATUSTOSTR) check_function_exists(pcap_create HAVE_PCAP_CREATE) endif(HAVE_PCAP_STATUSTOSTR) if(HAVE_PCAP_CREATE) # # OK, do we have pcap_set_tstamp_type? If so, assume we have # pcap_list_tstamp_types and pcap_free_tstamp_types as well. # check_function_exists(pcap_set_tstamp_type HAVE_PCAP_SET_TSTAMP_TYPE) # # And do we have pcap_set_tstamp_precision? If so, we assume # we also have pcap_open_offline_with_tstamp_precision. # check_function_exists(pcap_set_tstamp_precision HAVE_PCAP_SET_TSTAMP_PRECISION) endif(HAVE_PCAP_CREATE) # # Check for a miscellaneous collection of functions which we use # 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) # Check for the pcap_version string variable and set HAVE_PCAP_VERSION 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) # # On Windows, check for pcap_wsockinit(); if we don't have it, check for # wsockinit(). # if(WIN32) check_function_exists(pcap_wsockinit HAVE_PCAP_WSOCKINIT) if(NOT HAVE_PCAP_WSOCKINIT) check_function_exists(wsockinit HAVE_WSOCKINIT) endif(NOT HAVE_PCAP_WSOCKINIT) endif(WIN32) # # Check for special debugging functions # check_function_exists(pcap_set_parser_debug HAVE_PCAP_SET_PARSER_DEBUG) if(NOT HAVE_PCAP_SET_PARSER_DEBUG) # Check whether libpcap defines pcap_debug or yydebug check_variable_exists(pcap_debug HAVE_PCAP_DEBUG) if(NOT HAVE_PCAP_DEBUG) check_variable_exists(yydebug HAVE_YYDEBUG) endif(NOT HAVE_PCAP_DEBUG) endif(NOT HAVE_PCAP_SET_PARSER_DEBUG) check_function_exists(pcap_set_optimizer_debug HAVE_PCAP_SET_OPTIMIZER_DEBUG) check_function_exists(bpf_dump HAVE_BPF_DUMP) cmake_pop_check_state() # # We have libpcap. # include_directories(SYSTEM ${PCAP_INCLUDE_DIRS}) set(TCPDUMP_LINK_LIBRARIES ${PCAP_LIBRARIES} ${TCPDUMP_LINK_LIBRARIES}) # # Optional libraries. # # # libsmi. # if(WITH_SMI) find_package(SMI) if(SMI_FOUND) include_directories(SYSTEM ${SMI_INCLUDE_DIRS}) set(TCPDUMP_LINK_LIBRARIES ${TCPDUMP_LINK_LIBRARIES} ${SMI_LIBRARIES}) set(USE_LIBSMI ON) endif(SMI_FOUND) endif(WITH_SMI) # # OpenSSL/libressl libcrypto. # 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 # EVP_CIPHER_CTX may be opaque; otherwise, we allocate # it ourselves. # cmake_push_check_state() set(CMAKE_REQUIRED_LIBRARIES "${CRYPTO_LIBRARIES}") check_function_exists(EVP_CIPHER_CTX_new HAVE_EVP_CIPHER_CTX_NEW) # # 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. # check_function_exists(EVP_DecryptInit_ex HAVE_EVP_DECRYPTINIT_EX) cmake_pop_check_state() # # We have libcrypto. # include_directories(SYSTEM ${CRYPTO_INCLUDE_DIRS}) set(TCPDUMP_LINK_LIBRARIES ${TCPDUMP_LINK_LIBRARIES} ${CRYPTO_LIBRARIES}) set(HAVE_LIBCRYPTO ON) endif(CRYPTO_FOUND) endif(WITH_CRYPTO) # # Capsicum sandboxing. # Some of this is in the system library, some of it is in other libraries. # if(WITH_CAPSICUM) check_include_files("sys/capsicum.h" HAVE_SYS_CAPSICUM_H) if(HAVE_SYS_CAPSICUM_H) check_function_exists(cap_enter HAVE_CAP_ENTER) check_function_exists(cap_rights_limit HAVE_CAP_RIGHTS_LIMIT) check_function_exists(cap_ioctls_limit HAVE_CAP_IOCTLS_LIMIT) check_function_exists(openat HAVE_OPENAT) if(HAVE_CAP_ENTER AND HAVE_CAP_RIGHTS_LIMIT AND HAVE_CAP_IOCTLS_LIMIT AND HAVE_OPENAT) # # OK, we have the functions we need to support Capsicum. # set(HAVE_CAPSICUM TRUE) # # OK, can we use Casper? # check_library_exists(casper cap_init "" HAVE_CAP_INIT) if(HAVE_CAP_INIT) cmake_push_check_state() set(CMAKE_REQUIRED_LIBRARIES casper) check_library_exists(cap_dns cap_gethostbyaddr "" HAVE_CAP_GETHOSTBYADDR) cmake_pop_check_state() if(HAVE_CAP_GETHOSTBYADDR) set(HAVE_CASPER TRUE) set(TCPDUMP_LINK_LIBRARIES ${TCPDUMP_LINK_LIBRARIES} casper cap_dns) endif(HAVE_CAP_GETHOSTBYADDR) endif(HAVE_CAP_INIT) endif(HAVE_CAP_ENTER AND HAVE_CAP_RIGHTS_LIMIT AND HAVE_CAP_IOCTLS_LIMIT AND HAVE_OPENAT) endif(HAVE_SYS_CAPSICUM_H) endif(WITH_CAPSICUM) # # libcap-ng. # if(WITH_CAP_NG) check_include_file(cap-ng.h HAVE_CAP_NG_H) check_library_exists(cap-ng capng_change_id "" HAVE_LIBCAP_NG) if(HAVE_LIBCAP_NG) set(TCPDUMP_LINK_LIBRARIES ${TCPDUMP_LINK_LIBRARIES} cap-ng) endif(HAVE_LIBCAP_NG) endif(WITH_CAP_NG) ################################################################### # Warning options ################################################################### # # Check and add warning options if we have a .devel file. # if(EXISTS ${CMAKE_SOURCE_DIR}/.devel OR EXISTS ${CMAKE_BINARY_DIR}/.devel) # # Warning options. # if(MSVC AND NOT ${CMAKE_C_COMPILER} MATCHES "clang*") # # MSVC, with Microsoft's front end and code generator. # "MSVC" is also set for Microsoft's compiler with a Clang # front end and their code generator ("Clang/C2"), so we # check for clang.exe and treat that differently. # check_and_add_compiler_option(-Wall) # # Disable some pointless warnings that /Wall turns on. # # Unfortunately, MSVC does not appear to have an equivalent # to "__attribute__((unused))" to mark a particular function # parameter as being known to be unused, so that the compiler # won't warn about it (for example, the function might have # that parameter because a pointer to it is being used, and # the signature of that function includes that parameter). # C++ lets you give a parameter a type but no name, but C # doesn't have that. # check_and_add_compiler_option(-wd4100) # # In theory, we care whether somebody uses f() rather than # f(void) to declare a function with no arguments, but, in # practice, there are places in the Windows header files # that appear to do that, so we squelch that warning. # check_and_add_compiler_option(-wd4255) # # Windows FD_SET() generates this, so we suppress it. # check_and_add_compiler_option(-wd4548) # # Perhaps testing something #defined to be 0 with #ifdef is an # error, and it should be tested with #if, but perhaps it's # not, and Microsoft does that in its headers, so we squelch # that warning. # check_and_add_compiler_option(-wd4574) # # The Windows headers also test not-defined values in #if, so # we don't want warnings about that, either. # check_and_add_compiler_option(-wd4668) # # We do *not* care whether some function is, or isn't, going to be # expanded inline. # check_and_add_compiler_option(-wd4710) check_and_add_compiler_option(-wd4711) # # We do *not* care whether we're adding padding bytes after # structure members. # check_and_add_compiler_option(-wd4820) # # We do *not* care about every single place the compiler would # have inserted Spectre mitigation if only we had told it to # do so with /Qspectre. I guess the theory is that it's seeing # bounds checks that would prevent out-of-bounds loads and that # those out-of-bounds loads could be done speculatively and that # the Spectre attack could detect the value of the out-of-bounds # data *if* it's within our address space, but unless I'm # missing something I don't see that as being any form of # security hole. # # XXX - add /Qspectre if that is really worth doing. # check_and_add_compiler_option(-wd5045) # # 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 # data, and in those every element is an array of octets so # that we have full control over the size and aligmnet, 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. # check_and_add_compiler_option(-wd4324) else() # # Other compilers, including MSVC with a Clang front end and # Microsoft's code generator. We currently treat them as if # they might support GCC-style -W options. # check_and_add_compiler_option(-W) check_and_add_compiler_option(-Wall) check_and_add_compiler_option(-Wassign-enum) check_and_add_compiler_option(-Wcast-qual) 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) 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(-Wunreachable-code-return) check_and_add_compiler_option(-Wused-but-marked-unused) check_and_add_compiler_option(-Wwrite-strings) endif() endif() # # Extra compiler options for the build matrix scripts to request -Werror or # its equivalent if required. The CMake variable name cannot be CFLAGS # because that is already used for a different purpose in CMake. Example # 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) message(STATUS "Added extra compile options (${EXTRA_CFLAGS})") endif() ###################################### # Input files ###################################### if(ENABLE_SMB) # # We allow the SMB dissector to be omitted. # set(LOCALSRC ${LOCALSRC} print-smb.c smbutil.c) endif(ENABLE_SMB) set(NETDISSECT_SOURCE_LIST_C addrtoname.c addrtostr.c af.c ascii_strcasecmp.c checksum.c cpack.c gmpls.c in_cksum.c ipproto.c l2vpn.c machdep.c netdissect.c netdissect-alloc.c nlpid.c oui.c ntp.c parsenfsfh.c print.c print-802_11.c print-802_15_4.c print-ah.c print-ahcp.c print-aodv.c print-aoe.c print-ap1394.c print-arcnet.c print-arista.c print-arp.c print-ascii.c print-atalk.c print-atm.c print-babel.c print-bcm-li.c print-beep.c print-bfd.c print-bgp.c print-bootp.c print-brcmtag.c print-bt.c print-calm-fast.c print-carp.c print-cdp.c print-cfm.c print-chdlc.c print-cip.c print-cnfp.c print-dccp.c print-decnet.c print-dhcp6.c print-domain.c print-dsa.c print-dtp.c print-dvmrp.c print-eap.c print-egp.c print-eigrp.c print-enc.c print-esp.c print-ether.c print-fddi.c print-forces.c print-fr.c print-frag6.c print-ftp.c print-geneve.c print-geonet.c print-gre.c print-hncp.c print-hsrp.c print-http.c print-icmp.c print-icmp6.c print-igmp.c print-igrp.c print-ip-demux.c print-ip.c print-ip6.c print-ip6opts.c print-ipcomp.c print-ipfc.c print-ipnet.c print-ipoib.c print-ipx.c print-isakmp.c print-isoclns.c print-juniper.c print-krb.c print-l2tp.c print-lane.c print-ldp.c print-lisp.c print-llc.c print-lldp.c print-lmp.c print-loopback.c print-lspping.c print-lwapp.c print-lwres.c print-m3ua.c print-macsec.c print-mobile.c print-mobility.c print-mpcp.c print-mpls.c print-mptcp.c print-msdp.c print-msnlb.c print-nflog.c print-nfs.c print-nsh.c print-ntp.c print-null.c print-olsr.c print-openflow-1.0.c print-openflow-1.3.c print-openflow.c print-ospf.c print-ospf6.c print-otv.c print-pflog.c print-pgm.c print-pim.c print-pktap.c print-ppi.c print-ppp.c print-pppoe.c print-pptp.c print-ptp.c print-radius.c print-raw.c print-realtek.c print-resp.c print-rip.c print-ripng.c print-rpki-rtr.c print-rsvp.c print-rt6.c print-rtsp.c print-rx.c print-sctp.c print-sflow.c print-sip.c print-sl.c print-sll.c print-slow.c print-smtp.c print-snmp.c print-someip.c print-ssh.c print-stp.c print-sunatm.c print-sunrpc.c print-symantec.c print-syslog.c print-tcp.c print-telnet.c print-tftp.c print-timed.c print-tipc.c print-token.c print-udld.c print-udp.c print-unsupported.c print-usb.c print-vjc.c print-vqp.c print-vrrp.c print-vsock.c print-vtp.c print-vxlan-gpe.c print-vxlan.c print-wb.c print-whois.c print-zep.c print-zephyr.c print-zeromq.c ${LOCALSRC} signature.c strtoaddr.c util-print.c ) # # Replace missing functions # foreach(FUNC strlcat strlcpy strdup strsep getservent getopt_long) string(TOUPPER ${FUNC} FUNC_UPPERCASE) set(HAVE_FUNC_UPPERCASE HAVE_${FUNC_UPPERCASE}) if(NOT ${HAVE_FUNC_UPPERCASE}) set(NETDISSECT_SOURCE_LIST_C ${NETDISSECT_SOURCE_LIST_C} missing/${FUNC}.c) endif() endforeach() add_library(netdissect STATIC ${NETDISSECT_SOURCE_LIST_C} ) if(NOT C_ADDITIONAL_FLAGS STREQUAL "") set_target_properties(netdissect PROPERTIES COMPILE_FLAGS ${C_ADDITIONAL_FLAGS}) endif() set(TCPDUMP_SOURCE_LIST_C fptype.c tcpdump.c) if(NOT HAVE_BPF_DUMP) set(TCPDUMP_SOURCE_LIST_C ${TCPDUMP_SOURCE_LIST_C} bpf_dump.c) endif(NOT HAVE_BPF_DUMP) if(NOT HAVE_PCAP_DUMP_FTELL) set(TCPDUMP_SOURCE_LIST_C ${TCPDUMP_SOURCE_LIST_C} missing/pcap_dump_ftell.c) endif(NOT HAVE_PCAP_DUMP_FTELL) if(NOT HAVE_PCAP_LIST_DATALINKS) set(TCPDUMP_SOURCE_LIST_C ${TCPDUMP_SOURCE_LIST_C} missing/datalinks.c) endif(NOT HAVE_PCAP_LIST_DATALINKS) if((NOT HAVE_PCAP_DATALINK_NAME_TO_VAL) OR (NOT HAVE_PCAP_DATALINK_VAL_TO_DESCRIPTION)) set(TCPDUMP_SOURCE_LIST_C ${TCPDUMP_SOURCE_LIST_C} missing/dlnames.c) endif((NOT HAVE_PCAP_DATALINK_NAME_TO_VAL) OR (NOT HAVE_PCAP_DATALINK_VAL_TO_DESCRIPTION)) set(PROJECT_SOURCE_LIST_C ${NETDISSECT_SOURCE_LIST_C} ${TCPDUMP_SOURCE_LIST_C}) file(GLOB PROJECT_SOURCE_LIST_H *.h ) # # Assume, by default, no support for shared libraries and V7/BSD # convention for man pages (devices in section 4, file formats in # section 5, miscellaneous info in section 7, administrative commands # and daemons in section 8). Individual cases can override this. # Individual cases can override this. # set(MAN_FILE_FORMATS 5) set(MAN_MISC_INFO 7) if(CMAKE_SYSTEM_NAME STREQUAL "AIX") # Workaround to enable certain features set(_SUN TRUE) elseif(CMAKE_SYSTEM_NAME STREQUAL "HP-UX") # # Use System V conventions for man pages. # set(MAN_FILE_FORMATS 4) set(MAN_MISC_INFO 5) elseif(CMAKE_SYSTEM_NAME STREQUAL "IRIX" OR CMAKE_SYSTEM_NAME STREQUAL "IRIX64") # # Use IRIX conventions for man pages; they're the same as the # System V conventions, except that they use section 8 for # administrative commands and daemons. # set(MAN_FILE_FORMATS 4) set(MAN_MISC_INFO 5) elseif(CMAKE_SYSTEM_NAME STREQUAL "OSF1") # # DEC OSF/1, a/k/a Digital UNIX, a/k/a Tru64 UNIX. # Use Tru64 UNIX conventions for man pages; they're the same as the # System V conventions except that they use section 8 for # administrative commands and daemons. # set(MAN_FILE_FORMATS 4) set(MAN_MISC_INFO 5) elseif(CMAKE_SYSTEM_NAME STREQUAL "SunOS" AND CMAKE_SYSTEM_VERSION MATCHES "5[.][0-9.]*") # # SunOS 5.x. # if(CMAKE_SYSTEM_VERSION STREQUAL "5.12") else() # # Use System V conventions for man pages. # set(MAN_FILE_FORMATS 4) set(MAN_MISC_INFO 5) endif() endif() source_group("Source Files" FILES ${PROJECT_SOURCE_LIST_C}) source_group("Header Files" FILES ${PROJECT_SOURCE_LIST_H}) ###################################### # Register targets ###################################### add_executable(tcpdump ${TCPDUMP_SOURCE_LIST_C}) if(NOT C_ADDITIONAL_FLAGS STREQUAL "") set_target_properties(tcpdump PROPERTIES COMPILE_FLAGS ${C_ADDITIONAL_FLAGS}) endif() target_link_libraries(tcpdump netdissect ${TCPDUMP_LINK_LIBRARIES}) ###################################### # Write out the config.h file ###################################### configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmakeconfig.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h) ###################################### # Install tcpdump and man pages ###################################### # # "Define GNU standard installation directories", which actually # are also defined, to some degree, by autotools, and at least # some of which are general UN*X conventions. # include(GNUInstallDirs) set(MAN1_EXPAND tcpdump.1.in) if(WIN32) # XXX TODO where to install on Windows? else(WIN32) install(TARGETS tcpdump DESTINATION bin) endif(WIN32) # On UN*X, and on Windows when not using MSVC, process man pages and # arrange that they be installed. if(NOT MSVC) # # Man pages. # # For each section of the manual for which we have man pages # that require macro expansion, do the expansion. # set(MAN1 "") foreach(TEMPLATE_MANPAGE ${MAN1_EXPAND}) string(REPLACE ".in" "" MANPAGE ${TEMPLATE_MANPAGE}) configure_file(${CMAKE_SOURCE_DIR}/${TEMPLATE_MANPAGE} ${CMAKE_CURRENT_BINARY_DIR}/${MANPAGE} @ONLY) set(MAN1 ${MAN1} ${CMAKE_CURRENT_BINARY_DIR}/${MANPAGE}) endforeach(TEMPLATE_MANPAGE) install(FILES ${MAN1} DESTINATION ${CMAKE_INSTALL_MANDIR}/man1) endif(NOT MSVC) # uninstall target configure_file( "${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" IMMEDIATE @ONLY) add_custom_target(uninstall COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake) # # Tcpdump tests # We try to find the Perl interpreter and, if we do, we have the check # rule run tests/TESTrun with it, because just trying to run the TESTrun # script as a command won't work on Windows. # find_program(PERL perl) if(PERL) message(STATUS "Found perl at ${PERL}") add_custom_target(check COMMAND ${PERL} ${CMAKE_SOURCE_DIR}/tests/TESTrun) else() message(STATUS "Didn't find perl") endif() tcpdump-4.99.4/CONTRIBUTING.md000066400000000000000000000166711441406054200155410ustar00rootroot00000000000000# Some Information for Contributors Thank you for considering to make a contribution to tcpdump! Please use the guidelines below to achieve the best results and experience for everyone. ## How to report bugs and other problems **To report a security issue (segfault, buffer overflow, infinite loop, arbitrary code execution etc) please send an e-mail to security@tcpdump.org, do not use the bug tracker!** To report a non-security problem (failure to compile, incorrect output in the protocol printout, missing support for a particular protocol etc) please check first that it reproduces with the latest stable release of tcpdump and the latest stable release of libpcap. If it does, please check that the problem reproduces with the current git master branch of tcpdump and the current git master branch of libpcap. If it does (and it is not a security-related problem, otherwise see above), please navigate to the [bug tracker](https://github.com/the-tcpdump-group/tcpdump/issues) and check if the problem has already been reported. If it has not, please open a new issue and provide the following details: * tcpdump and libpcap version (`tcpdump --version`) * operating system name and version and any other details that may be relevant (`uname -a`, compiler name and version, CPU type etc.) * custom `configure`/`cmake` flags, if any * statement of the problem * steps to reproduce Please note that if you know exactly how to solve the problem and the solution would not be too intrusive, it would be best to contribute some development time and to open a pull request instead as discussed below. Still not sure how to do? Feel free to [subscribe to the mailing list](https://www.tcpdump.org/#mailing-lists) 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 intend to make. 1) [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 architectures is to let the upstream CI test your pull request (more on this below). 3) Setup your git working copy ``` git clone https://github.com//tcpdump.git cd tcpdump git remote add upstream https://github.com/the-tcpdump-group/tcpdump git fetch upstream ``` 4) 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 ``` ./configure && make -s && make check ``` 6) 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 and reproducible output; `-#` is used to indicate which particular packets have output that differs. The tests are run with the `TZ` environment variable set to `GMT0`, so that UTC, rather than the local time where the tests are being run, is used when "local time" values are printed. The actual test compares the current text output with the expected result (`sample.out`) saved from a previous version. Any new/updated fields in a dissector must be present in a `sample.pcap` file and the corresponding output file. Configuration is set in `tests/TESTLIST`. Each line in this file has the following format: ``` test-name sample.pcap sample.out tcpdump-options ``` The `sample.out` file can be produced as follows: ``` (cd tests && TZ=GMT0 ../tcpdump -# -n -r sample.pcap tcpdump-options > sample.out) ``` Or, for convenience, use `./update-test.sh test-name` 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` (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. ``` git fetch upstream git rebase upstream/master ``` (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) [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. * Put the normative reference if any as comments (RFC, etc.). * 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 random position, for example by capturing with `-s size` option. 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 } ``` 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: ``` ND_TCHECK_n(p), n in { 1, 2, 3, 4, 5, 6, 7, 8, 16 } ND_TCHECK_SIZE(p) ND_TCHECK_LEN(p, l) ``` For the `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, but at the same time their union covers all packet data in all cases. You can test the code via: ``` sudo ./tcpdump -s snaplen [-v][v][...] -i lo # in a terminal sudo tcpreplay -i lo sample.pcap # in another terminal ``` 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 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 `tok2str()` or `bittok2str()` (for flags). * Avoid empty lines in output of printers. * A commit message must have: ``` First line: Capitalized short summary in the imperative (50 chars or less) If the commit concerns a protocol, the summary line must start with "protocol: ". Body: Detailed explanatory text, if necessary. Fold it to approximately 72 characters. There must be an empty line separating the summary from the body. ``` * Avoid non-ASCII characters in code and commit messages. * Use the style of the modified sources. * Don't mix declarations and code. * Don't use `//` for comments. Not all C compilers accept C++/C99 comments by default. * Avoid trailing tabs/spaces tcpdump-4.99.4/CREDITS000066400000000000000000000547071441406054200143320ustar00rootroot00000000000000This file lists people who have contributed to tcpdump. The current maintainers (in alphabetical order): Denis Ovsienko Francois-Xavier Le Bail Guy Harris Michael Richardson Additional people who have contributed patches (in alphabetical order): Aaron Campbell A Costa ABHIMANYU Adam Sampson Ahmed Abdelsalam Ajith Adapa Albert Chin Alexandra Kossovsky Alexandr Nedvedicky Alexandre Ferrieux Alexis La Goutte Alfredo Andres Ali Abdulkadir Ananth Suryanarayana Andrea Bittau Andrea Ieri Andreas Jaggi Andrew Brown Andrew Church Andrew Darqui Andrew Hintz Andrew Lunn Andrew Nording Andrew Tridgell Andy Heffernan Angus Cameron Anton Bernal Antonin Décimo Aravind Prasad S Arkadiusz Miskiewicz Armando L. Caro Jr. Arnaldo Carvalho de Melo Atsushi Onoe Baptiste Jonglez Baruch Siach Ben Byer Ben Smithurst Bert Vermeulen Bill Fenner Bill Parker Bjoern A. Zeeb Bram Brent L. Bates Brian Carpenter Brian Ginsbach Brooks Davis Bruce M. Simpson Bryce Wood bugyo Carles Kishimoto Bisbe Casey Deccio Charles (Chas) Williams Charles M. Hannum Charlie Lenahan Chris Cogdon Chris G. Demetriou Chris Jepeway Chris Larson Christian Sievers Christophe Rhodes Cliff Frey Craig Leres Craig Rodrigues Crist J. Clark Dagobert Michelsen Daniel Hagerty Daniel Lee Daniel Miller Dario Lombardo Darren Reed David Binderman David Cronin Davide Caratti David Horn David Smith David Young Dion Bosschieter Dmitrij Tejblum Dmitry Eremin-Solenikov Don Ebright Donatas Abraitis d simonov Duane Wessels Eamon Doyle Eddie Kohler Ege Cetin Eliot Lear Elmar Kirchner Eric S. Raymond Etienne Marais Fang Wang Ferry Huberts Florent Drouin Florian Fainelli Florian Forster fra Francesco Fondelli Francisco Matias Cuenca-Acuna Francis Dupont Frank Volf Fulvio Risso George Bakos Gerald Combs Gerard Garcia George Neville-Neil Gerald Combs Gerrit Renker Gert Doering Gianluca Varenni Gilbert Ramirez Jr. Gisle Vanem Gleb Smirnoff Gokul Sivakumar Greg Minshall Grégoire Henry Gregory Detal Greg Stark Greg Steinbrecher Guy Lewin Hank Leininger Hannes Gredler Hannes Viertel Hanno Böck Harry Raaymakers Heinz-Ado Arnolds Hendrik Scholz Herwin Weststrate Ian McDonald Ilpo Järvinen ishaangandhi Jacek Tobiasz Jacob Davis Jakob Schlyter Jakub Zawadzki Jamal Hadi Salim James Ko Jamie Bainbridge Jan Oravec Jason L. Wright Jason R. Thorpe Jean-Raphaël Gaglione Jeff Chan Jefferson Ogata Jeffrey Hutzelman Jeremy Browne Jesper Peterson Jesse Gross Jim Hutchins João Medeiros Job Snijders Joerg Mayer Jonathan Heusser Jorge Boncompte [DTI2] Jørgen Thomsen Julian Cowley Juliusz Chroboczek Kaarthik Sivakumar Kaladhar Musunuru Kamil Frankowicz Karl Norby Kazushi Sugyo Kelly Carmichael Ken Bantoft Ken Hornstein Kenichi Maehashi Kevin Steves Klaus Klein Kovarththanan Rajaratnam Kris Kennaway Krzysztof Halasa Larry Lile Lennert Buytenhek Loganaden Velvindron Loris Degioanni Love Hörnquist-Åstrand Lucas C. Villa Real Luigi Rizzo Luis MartinGarcia Luiz Otavio O Souza Maciej W. Rozycki Manoharan Sundaramoorthy Manu Pathak Marc Abramowitz Marc A. Lehmann Marc Binderberger Mark Andrews Mark Ellzey Thomas Marko Kiiskila Markus Schöpflin Marshall Rose Martin Buck Martin Husemann Martin Sehnoutka Matt Eaton Matthew Luckie Matthieu Boutier Max Laier Michael A. Meffie III Michael Haardt Michael Kirkhart Michael Madore Michael Riepe Michael Shalayeff Michael Shields Michael T. Stolarchuk Michal Ruprich Michal Sekletar Michele "mydecay" Marchetto Mike Frysinger Mingrui <972931182 at qq dot com> Minto Jeyananth Miroslav Lichvar Mister X <3520734+Mister-X- at users dot noreply dot github dot com> Mitsunori Komatsu Monroe Williams Monthadar Al Jaberi Moses Devadason Motonori Shindo Nan Xiao Nathaniel Couper-Noles Nathan J. Williams Neelabh Neil T. Spring Nicholas Reilly Nickolai Zeldovich Nikolay Edigaryev Nicolas Ferrero niks3089 Niels Provos Nikhil AP Noritoshi Demizu Olaf Kirch Ola Martin Lykkja Oleksij Rempel Onno van der Linden Paolo Abeni Partha Ghosh Pascal Hennequin Pasvorn Boonmark Patrik Lundquist Paul Ferrell Paul Mundt Paul S. Traina Pavlin Radoslavov Pawel Worach Pedro Monreal Pekka Savola peppe Petar Alilovic Peter Fales Peter Jeremy Peter Krystad Peter Volkov Petr Vorel Phil Wood Pier Carlo Chiodi Quentin Armitage Rafal Maszkowski Randy Sofia Raphael Raimbault Renato Botelho Ricardo Nabinger Sanchez Richard Scheffenegger Rick Cheng Rick Jones Rick Watson Ritesh Ranjan Rob Braun Robert Edmonds Rocco Lucia Roderick Schertler Romain Francoise Romero Malaquias Ruben Kerkhof Rui Paulo Sabrina Dubroca Sagun Shakya Sam James Sami Farin Sascha Wildner Sawssen Hadded Scott Mcmillan Scott Rose Sebastian Krahmer Sebastien Raveau Sebastien Vincent Sepherosa Ziehau Seth Webster Shinsuke Suzuki Simon Nicolussi Simon Ruderich Slava Shwartsman Stefan Hajnoczi Steinar Haug Stephane Bortzmeyer Steve Kay Steve-o Steven H. Wang Swaathi Vetrivel Swaminathan Chandrasekaran Takashi Yamamoto Tatuya Jinmei Tero Kivinen Terry Kennedy test2 Thomas Jacob Tillmann Karras Timo Koskiahde Tobias Waldekranz Tom Jones Tommy Beadle Tony Li Tony Samuels Tony Xu Toshihiro Kanda Udayakumar Ulrich Windl Uns Lider Victor Oppleman Viral Mehta Vitaly Lavrov Vivien Didelot Vyacheslav Trushkin Wang Jian Weesan Lee Wesley Griffin Wesley Shields Wilbert de Graaf Will Drewry William J. Hulley Wim Torfs Wolfgang Karall Xin Li yekm Yen Yen Lim Yoshifumi Nishida zilog80a zolf The original LBL crew: Steve McCanne Craig Leres Van Jacobson Past maintainers (in alphabetical order): Bill Fenner Fulvio Risso Hannes Gredler Jun-ichiro itojun Hagino Also see: http://www.wide.ad.jp/itojun-award/ tcpdump-4.99.4/INSTALL.md000066400000000000000000000127511441406054200147330ustar00rootroot00000000000000# tcpdump installation notes 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 libpcap; see [this file](README.md) for the location. You will need a C99 compiler to build tcpdump. The build system will abort if your compiler is not C99 compliant. If this happens, use 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`. If everything builds ok, `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 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. 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 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 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. Please see [this file](README.md) for notes about tested platforms. ## Description of files ``` CHANGES - description of differences between releases CONTRIBUTING.md - guidelines for contributing CREDITS - people that have helped tcpdump along INSTALL.md - this file LICENSE - the license under which tcpdump is distributed Makefile.in - compilation rules (input to the configure script) README.md - description of distribution VERSION - version of this release aclocal.m4 - autoconf macros addrtoname.c - address to hostname routines addrtoname.h - address to hostname definitions addrtostr.c - address to printable string routines addrtostr.h - address to printable string definitions ah.h - IPSEC Authentication Header definitions appletalk.h - AppleTalk definitions ascii_strcasecmp.c - locale-independent case-independent string comparison routines atime.awk - TCP ack awk script atm.h - ATM traffic type definitions 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 extract.h - alignment definitions gmpls.c - GMPLS definitions gmpls.h - GMPLS declarations install-sh - BSD style install script interface.h - globals, prototypes and definitions ip.h - IP definitions ip6.h - IPv6 definitions ipproto.c - IP protocol type value-to-name table ipproto.h - IP protocol type value definitions l2vpn.c - L2VPN encapsulation value-to-name table l2vpn.h - L2VPN encapsulation definitions lbl/os-*.h - OS-dependent defines and prototypes llc.h - LLC definitions machdep.c - machine dependent routines machdep.h - machine dependent definitions makemib - mib to header script mib.h - mib definitions missing/* - replacements for missing library functions ntp.c - functions to handle ntp structs ntp.h - declarations of functions to handle ntp structs mkdep - construct Makefile dependency list mpls.h - MPLS definitions nameser.h - DNS definitions netdissect.h - definitions and declarations for tcpdump-as-library (under development) nfs.h - Network File System V2 definitions nfsfh.h - Network File System file handle definitions nlpid.c - OSI NLPID value-to-name table nlpid.h - OSI NLPID definitions ospf.h - Open Shortest Path First definitions packetdat.awk - TCP chunk summary awk script parsenfsfh.c - Network File System file parser routines pcap-missing.h - declarations of functions possibly missing from libpcap ppp.h - Point to Point Protocol definitions print.c - Top-level routines for protocol printing print-*.c - The netdissect printers rpc_auth.h - definitions for ONC RPC authentication rpc_msg.h - definitions for ONC RPC messages send-ack.awk - unidirectional tcp send/ack awk script slcompress.h - SLIP/PPP Van Jacobson compression (RFC1144) definitions smb.h - SMB/CIFS definitions smbutil.c - SMB/CIFS utility routines stime.awk - TCP send awk script tcp.h - TCP definitions tcpdump.1 - manual entry tcpdump.c - main program timeval-operations.h - timeval operations macros udp.h - UDP definitions util-print.c - utility routines for protocol printers ``` tcpdump-4.99.4/LICENSE000066400000000000000000000015441441406054200143060ustar00rootroot00000000000000License: BSD Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The names of the authors may not be used to endorse or promote products derived from this software without specific prior written permission. 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. tcpdump-4.99.4/Makefile-devel-adds000066400000000000000000000011461441406054200167450ustar00rootroot00000000000000# # Auto-regenerate configure script or Makefile when things change. # From autoconf.info . Works best with GNU Make. # ${srcdir}/configure: configure.ac aclocal.m4 cd ${srcdir} && autoconf # autoheader might not change config.h.in, so touch a stamp file. ${srcdir}/config.h.in: ${srcdir}/stamp-h.in ${srcdir}/stamp-h.in: configure.ac aclocal.m4 cd ${srcdir} && autoheader echo timestamp > ${srcdir}/stamp-h.in config.h: stamp-h stamp-h: ${srcdir}/config.h.in config.status ./config.status Makefile: Makefile.in config.status ./config.status config.status: ${srcdir}/configure ./config.status --recheck tcpdump-4.99.4/Makefile.in000066400000000000000000000302301441406054200153400ustar00rootroot00000000000000# Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997 # The Regents of the University of California. All rights reserved. # # 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, (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, and (3) all advertising materials mentioning # features or use of this software display the following acknowledgement: # ``This product includes software developed by the University of California, # Lawrence Berkeley Laboratory and its contributors.'' Neither the name of # the University nor the names of its contributors may be used to endorse # or promote products derived from this software without specific prior # written permission. # 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. # # Various configurable paths (remember to edit Makefile.in, not Makefile) # # Top level hierarchy prefix = @prefix@ exec_prefix = @exec_prefix@ datarootdir = @datarootdir@ # Pathname of directory to install the binary bindir = @bindir@ # Pathname of directory to install the man page mandir = @mandir@ # VPATH srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ # # You shouldn't need to edit anything below here. # CC = @CC@ AR = @AR@ MKDEP = @MKDEP@ PROG = tcpdump CCOPT = @V_CCOPT@ INCLS = -I. @V_INCLS@ DEFS = @DEFS@ @CPPFLAGS@ @V_DEFS@ # Standard CFLAGS CFLAGS = @CFLAGS@ FULL_CFLAGS = $(CCOPT) $(DEFS) $(INCLS) $(CFLAGS) # Standard LDFLAGS LDFLAGS = @LDFLAGS@ # Standard LIBS LIBS = @LIBS@ INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ RANLIB = @RANLIB@ DEPENDENCY_CFLAG = @DEPENDENCY_CFLAG@ # Explicitly define compilation rule since SunOS 4's make doesn't like gcc. # Also, gcc does not remove the .o before forking 'as', which can be a # problem if you don't own the file but can write to the directory. .c.o: @rm -f $@ $(CC) $(FULL_CFLAGS) -c $(srcdir)/$*.c CSRC = fptype.c tcpdump.c LIBNETDISSECT_SRC=\ addrtoname.c \ addrtostr.c \ af.c \ ascii_strcasecmp.c \ checksum.c \ cpack.c \ gmpls.c \ in_cksum.c \ ipproto.c \ l2vpn.c \ machdep.c \ netdissect.c \ netdissect-alloc.c \ nlpid.c \ ntp.c \ oui.c \ parsenfsfh.c \ print.c \ print-802_11.c \ print-802_15_4.c \ print-ah.c \ print-ahcp.c \ print-aodv.c \ print-aoe.c \ print-ap1394.c \ print-arcnet.c \ print-arista.c \ print-arp.c \ print-ascii.c \ print-atalk.c \ print-atm.c \ print-babel.c \ print-bcm-li.c \ print-beep.c \ print-bfd.c \ print-bgp.c \ print-bootp.c \ print-brcmtag.c \ print-bt.c \ print-calm-fast.c \ print-carp.c \ print-cdp.c \ print-cfm.c \ print-chdlc.c \ print-cip.c \ print-cnfp.c \ print-dccp.c \ print-decnet.c \ print-dhcp6.c \ print-domain.c \ print-dsa.c \ print-dtp.c \ print-dvmrp.c \ print-eap.c \ print-egp.c \ print-eigrp.c \ print-enc.c \ print-esp.c \ print-ether.c \ print-fddi.c \ print-forces.c \ print-fr.c \ print-frag6.c \ print-ftp.c \ print-geneve.c \ print-geonet.c \ print-gre.c \ print-hncp.c \ print-hsrp.c \ print-http.c \ print-icmp.c \ print-icmp6.c \ print-igmp.c \ print-igrp.c \ print-ip-demux.c \ print-ip.c \ print-ip6.c \ print-ip6opts.c \ print-ipcomp.c \ print-ipfc.c \ print-ipnet.c \ print-ipoib.c \ print-ipx.c \ print-isakmp.c \ print-isoclns.c \ print-juniper.c \ print-krb.c \ print-l2tp.c \ print-lane.c \ print-ldp.c \ print-lisp.c \ print-llc.c \ print-lldp.c \ print-lmp.c \ print-loopback.c \ print-lspping.c \ print-lwapp.c \ print-lwres.c \ print-m3ua.c \ print-macsec.c \ print-mobile.c \ print-mobility.c \ print-mpcp.c \ print-mpls.c \ print-mptcp.c \ print-msdp.c \ print-msnlb.c \ print-nflog.c \ print-nfs.c \ print-nsh.c \ print-ntp.c \ print-null.c \ print-olsr.c \ print-openflow-1.0.c \ print-openflow-1.3.c \ print-openflow.c \ print-ospf.c \ print-ospf6.c \ print-otv.c \ print-pflog.c \ print-pgm.c \ print-pim.c \ print-pktap.c \ print-ppi.c \ print-ppp.c \ print-pppoe.c \ print-pptp.c \ print-ptp.c \ print-radius.c \ print-raw.c \ print-realtek.c \ print-resp.c \ print-rip.c \ print-ripng.c \ print-rpki-rtr.c \ print-rsvp.c \ print-rt6.c \ print-rtsp.c \ print-rx.c \ print-sctp.c \ print-sflow.c \ print-sip.c \ print-sl.c \ print-sll.c \ print-slow.c \ print-smtp.c \ print-snmp.c \ print-someip.c \ print-ssh.c \ print-stp.c \ print-sunatm.c \ print-sunrpc.c \ print-symantec.c \ print-syslog.c \ print-tcp.c \ print-telnet.c \ print-tftp.c \ print-timed.c \ print-tipc.c \ print-token.c \ print-udld.c \ print-udp.c \ print-unsupported.c \ print-usb.c \ print-vjc.c \ print-vqp.c \ print-vrrp.c \ print-vsock.c \ print-vtp.c \ print-vxlan-gpe.c \ print-vxlan.c \ print-wb.c \ print-whois.c \ print-zep.c \ print-zephyr.c \ print-zeromq.c \ signature.c \ strtoaddr.c \ util-print.c LOCALSRC = @LOCALSRC@ LIBOBJS = @LIBOBJS@ LIBNETDISSECT_OBJ=$(LIBNETDISSECT_SRC:.c=.o) ${LOCALSRC:.c=.o} ${LIBOBJS} LIBNETDISSECT=libnetdissect.a SRC = $(CSRC) $(LOCALSRC) # We would like to say "OBJ = $(SRC:.c=.o)" but Ultrix's make cannot # hack the extra indirection OBJ = $(CSRC:.c=.o) HDR = \ addrtoname.h \ addrtostr.h \ af.h \ ah.h \ appletalk.h \ ascii_strcasecmp.h \ atm.h \ chdlc.h \ compiler-tests.h \ cpack.h \ diag-control.h \ ethertype.h \ extract.h \ fptype.h \ ftmacros.h \ funcattrs.h \ getservent.h \ gmpls.h \ interface.h \ ip.h \ ip6.h \ ipproto.h \ l2vpn.h \ llc.h \ machdep.h \ mib.h \ mpls.h \ nameser.h \ netdissect.h \ netdissect-alloc.h \ netdissect-ctype.h \ netdissect-stdinc.h \ nfs.h \ nfsfh.h \ nlpid.h \ ntp.h \ openflow.h \ ospf.h \ oui.h \ pcap-missing.h \ pflog.h \ ppp.h \ print.h \ rpc_auth.h \ rpc_msg.h \ signature.h \ slcompress.h \ smb.h \ status-exit-codes.h \ strtoaddr.h \ tcp.h \ timeval-operations.h \ udp.h \ varattrs.h TAGHDR = \ /usr/include/netinet/if_ether.h \ /usr/include/netinet/in.h TAGFILES = $(SRC) $(HDR) $(TAGHDR) $(LIBNETDISSECT_SRC) \ print-smb.c smbutil.c CLEANFILES = $(PROG) $(OBJ) $(LIBNETDISSECT_OBJ) print-smb.o smbutil.o EXTRA_DIST = \ CHANGES \ CMakeLists.txt \ CONTRIBUTING.md \ CREDITS \ INSTALL.md \ LICENSE \ Makefile-devel-adds \ Makefile.in \ README.md \ VERSION \ aclocal.m4 \ atime.awk \ bpf_dump.c \ cmake/Modules/FindCRYPTO.cmake \ cmake/Modules/FindPCAP.cmake \ cmake/Modules/FindSMI.cmake \ cmake_uninstall.cmake.in \ cmakeconfig.h.in \ config.guess \ config.h.in \ config.sub \ configure \ configure.ac \ doc/README.aix.md \ doc/README.NetBSD.md \ doc/README.solaris.md \ doc/README.Win32.md \ install-sh \ lbl/os-osf4.h \ lbl/os-solaris2.h \ lbl/os-sunos4.h \ lbl/os-ultrix4.h \ makemib \ missing/datalinks.c \ missing/dlnames.c \ missing/getopt_long.c \ missing/getopt_long.h \ missing/getservent.c \ missing/pcap_dump_ftell.c \ missing/snprintf.c \ missing/strdup.c \ missing/strlcat.c \ missing/strlcpy.c \ missing/strsep.c \ mkdep \ packetdat.awk \ print-smb.c \ send-ack.awk \ smbutil.c \ stime.awk \ tcpdump.1.in TEST_DIST= `git ls-files tests | grep -v 'tests/\..*'` RELEASE_FILES = $(CSRC) $(HDR) $(LIBNETDISSECT_SRC) $(EXTRA_DIST) $(TEST_DIST) all: $(PROG) $(PROG): $(OBJ) @V_PCAPDEP@ $(LIBNETDISSECT) @rm -f $@ $(CC) $(FULL_CFLAGS) $(LDFLAGS) -o $@ $(OBJ) $(LIBNETDISSECT) $(LIBS) $(LIBNETDISSECT): $(LIBNETDISSECT_OBJ) @rm -f $@ $(AR) cr $@ $(LIBNETDISSECT_OBJ) $(RANLIB) $@ datalinks.o: $(srcdir)/missing/datalinks.c $(CC) $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/datalinks.c dlnames.o: $(srcdir)/missing/dlnames.c $(CC) $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/dlnames.c getservent.o: $(srcdir)/missing/getservent.c $(CC) $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/getservent.c getopt_long.o: $(srcdir)/missing/getopt_long.c $(CC) $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/getopt_long.c snprintf.o: $(srcdir)/missing/snprintf.c $(CC) $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/snprintf.c strdup.o: $(srcdir)/missing/strdup.c $(CC) $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/strdup.c strlcat.o: $(srcdir)/missing/strlcat.c $(CC) $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/strlcat.c strlcpy.o: $(srcdir)/missing/strlcpy.c $(CC) $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/strlcpy.c strsep.o: $(srcdir)/missing/strsep.c $(CC) $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/strsep.c pcap_dump_ftell.o: $(srcdir)/missing/pcap_dump_ftell.c $(CC) $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/pcap_dump_ftell.c install: all [ -d $(DESTDIR)$(bindir) ] || \ (mkdir -p $(DESTDIR)$(bindir); chmod 755 $(DESTDIR)$(bindir)) $(INSTALL_PROGRAM) $(PROG) $(DESTDIR)$(bindir)/$(PROG) $(INSTALL_PROGRAM) $(PROG) $(DESTDIR)$(bindir)/$(PROG).`cat ${srcdir}/VERSION` [ -d $(DESTDIR)$(mandir)/man1 ] || \ (mkdir -p $(DESTDIR)$(mandir)/man1; chmod 755 $(DESTDIR)$(mandir)/man1) $(INSTALL_DATA) $(PROG).1 $(DESTDIR)$(mandir)/man1/$(PROG).1 uninstall: rm -f $(DESTDIR)$(bindir)/$(PROG) rm -f $(DESTDIR)$(bindir)/$(PROG).`cat ${srcdir}/VERSION` rm -f $(DESTDIR)$(mandir)/man1/$(PROG).1 lint: lint -hbxn $(SRC) $(LIBNETDISSECT_SRC) | \ grep -v 'struct/union .* never defined' | \ grep -v 'possible pointer alignment problem' clean: rm -f $(CLEANFILES) $(PROG)-`cat ${srcdir}/VERSION`.tar.gz distclean: rm -f $(CLEANFILES) 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 rm -rf autom4te.cache tests/DIFF tests/NEW check: tcpdump $(srcdir)/tests/TESTrun extags: $(TAGFILES) ctags $(TAGFILES) tags: $(TAGFILES) ctags -wtd $(TAGFILES) TAGS: $(TAGFILES) etags $(TAGFILES) 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) && \ echo "Archive build from tag $$TAG."; \ else \ git archive --prefix="$$TAG"/ -o "$$TAG".tar.gz HEAD \ $(RELEASE_FILES) && \ echo "No $$TAG tag. Archive build from HEAD."; \ fi releasecheck: releasetar @TAG=$(PROG)-`cat VERSION` && \ INSTALL_DIR=/tmp/install_"$$TAG"_$$$$ && \ DIR=`pwd` && \ cd /tmp && \ rm -rf "$$TAG" && \ 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 && \ cd .. && \ rm -rf "$$TAG" && \ rm -rf "$$INSTALL_DIR" && \ tar xf "$$DIR"/"$$TAG".tar.gz && \ cd "$$TAG" && \ mkdir build && \ cd build && \ echo '[$@] $$ cmake -DENABLE_SMB=yes [...] ..' && \ cmake -DENABLE_SMB=yes \ -DCMAKE_INSTALL_PREFIX="$$INSTALL_DIR" \ -DCMAKE_MESSAGE_LOG_LEVEL=NOTICE \ -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 && \ cd ../.. && \ rm -rf "$$TAG" && \ rm -rf "$$INSTALL_DIR" && \ echo '[$@] Done.' whitespacecheck: @# trailing space(s)? @if git grep -I -n ' $$' $$(git ls-files|grep -v '^tests/'); then \ echo 'Error: Trailing space(s).'; \ 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 \ echo 'Error: Trailing tabs(s).'; \ exit 1; \ fi @# space(s) before tab(s)? @if git grep -I -n '[ ][ ]' $$(git ls-files|grep -v '^tests/'); then \ echo 'Error: space(s) before tab(s).'; \ exit 1; \ fi testlist: echo $(TEST_DIST) depend: $(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 tcpdump-4.99.4/README.md000066400000000000000000000217171441406054200145640ustar00rootroot00000000000000# TCPDUMP 4.x.y by [The Tcpdump Group](https://www.tcpdump.org/) **To report a security issue please send an e-mail to security@tcpdump.org.** To report bugs and other problems, contribute patches, request a feature, provide generic feedback etc please see the [guidelines for contributing](CONTRIBUTING.md) in the tcpdump source tree root. Anonymous Git is available via https://github.com/the-tcpdump-group/tcpdump.git This directory contains source code for tcpdump, a tool for network monitoring and data acquisition. Over the past few years, tcpdump has been steadily improved by the excellent contributions from the Internet community (just browse through the [change log](CHANGES)). We are grateful for all the input. ### Supported platforms In many operating systems tcpdump is available as a native package or port, which simplifies installation of updates and long-term maintenance. However, the native packages are sometimes a few versions behind and to try a more recent snapshot it will take to compile tcpdump from the source code. tcpdump compiles and works on at least the following platforms: * AIX * DragonFly BSD * FreeBSD * Haiku * HP-UX 11i * illumos (OmniOS, OpenIndiana) * GNU/Linux * {Mac} OS X / macOS * NetBSD * OpenBSD * OpenWrt * Solaris * Windows (requires WinPcap or Npcap, and Visual Studio with CMake) ### Dependency on libpcap Tcpdump uses libpcap, a system-independent interface for user-level packet capture. Before building tcpdump, you must first retrieve and build libpcap. Once libpcap is built (either install it or make sure it's in `../libpcap`), you can build tcpdump using the procedure in the [installation notes](INSTALL.md). ### Origins of tcpdump The program is loosely based on SMI's "etherfind" although none of the etherfind code remains. It was originally written by Van Jacobson as part of an ongoing research project to investigate and improve TCP and Internet gateway performance. The parts of the program originally taken from Sun's etherfind were later re-written by Steven McCanne of LBL. To insure that there would be no vestige of proprietary code in tcpdump, Steve wrote these pieces from the specification given by the manual entry, with no access to the source of tcpdump or etherfind. ```text formerly from Lawrence Berkeley National Laboratory Network Research Group ftp://ftp.ee.lbl.gov/old/tcpdump.tar.Z (3.4) ``` ### See also Richard Stevens gives an excellent treatment of the Internet protocols in his book *"TCP/IP Illustrated, Volume 1"*. If you want to learn more about tcpdump and how to interpret its output, pick up this book. Another tool that tcpdump users might find useful is [tcpslice](https://github.com/the-tcpdump-group/tcpslice). It is a program that can be used to extract portions of tcpdump binary trace files. ### The original LBL README by Steve McCanne, Craig Leres and Van Jacobson ``` This directory also contains some short awk programs intended as examples of ways to reduce tcpdump data when you're tracking particular network problems: send-ack.awk Simplifies the tcpdump trace for an ftp (or other unidirectional tcp transfer). Since we assume that one host only sends and the other only acks, all address information is left off and we just note if the packet is a "send" or an "ack". There is one output line per line of the original trace. Field 1 is the packet time in decimal seconds, relative to the start of the conversation. Field 2 is delta-time from last packet. Field 3 is packet type/direction. "Send" means data going from sender to receiver, "ack" means an ack going from the receiver to the sender. A preceding "*" indicates that the data is a retransmission. A preceding "-" indicates a hole in the sequence space (i.e., missing packet(s)), a "#" means an odd-size (not max seg size) packet. Field 4 has the packet flags (same format as raw trace). Field 5 is the sequence number (start seq. num for sender, next expected seq number for acks). The number in parens following an ack is the delta-time from the first send of the packet to the ack. A number in parens following a send is the delta-time from the first send of the packet to the current send (on duplicate packets only). Duplicate sends or acks have a number in square brackets showing the number of duplicates so far. Here is a short sample from near the start of an ftp: 3.00 0.20 send . 512 3.20 0.20 ack . 1024 (0.20) 3.20 0.00 send P 1024 3.40 0.20 ack . 1536 (0.20) 3.80 0.40 * send . 0 (3.80) [2] 3.82 0.02 * ack . 1536 (0.62) [2] Three seconds into the conversation, bytes 512 through 1023 were sent. 200ms later they were acked. Shortly thereafter bytes 1024-1535 were sent and again acked after 200ms. Then, for no apparent reason, 0-511 is retransmitted, 3.8 seconds after its initial send (the round trip time for this ftp was 1sec, +-500ms). Since the receiver is expecting 1536, 1536 is re-acked when 0 arrives. packetdat.awk Computes chunk summary data for an ftp (or similar unidirectional tcp transfer). [A "chunk" refers to a chunk of the sequence space -- essentially the packet sequence number divided by the max segment size.] A summary line is printed showing the number of chunks, the number of packets it took to send that many chunks (if there are no lost or duplicated packets, the number of packets should equal the number of chunks) and the number of acks. Following the summary line is one line of information per chunk. The line contains eight fields: 1 - the chunk number 2 - the start sequence number for this chunk 3 - time of first send 4 - time of last send 5 - time of first ack 6 - time of last ack 7 - number of times chunk was sent 8 - number of times chunk was acked (all times are in decimal seconds, relative to the start of the conversation.) As an example, here is the first part of the output for an ftp trace: # 134 chunks. 536 packets sent. 508 acks. 1 1 0.00 5.80 0.20 0.20 4 1 2 513 0.28 6.20 0.40 0.40 4 1 3 1025 1.16 6.32 1.20 1.20 4 1 4 1561 1.86 15.00 2.00 2.00 6 1 5 2049 2.16 15.44 2.20 2.20 5 1 6 2585 2.64 16.44 2.80 2.80 5 1 7 3073 3.00 16.66 3.20 3.20 4 1 8 3609 3.20 17.24 3.40 5.82 4 11 9 4097 6.02 6.58 6.20 6.80 2 5 This says that 134 chunks were transferred (about 70K since the average packet size was 512 bytes). It took 536 packets to transfer the data (i.e., on the average each chunk was transmitted four times). Looking at, say, chunk 4, we see it represents the 512 bytes of sequence space from 1561 to 2048. It was first sent 1.86 seconds into the conversation. It was last sent 15 seconds into the conversation and was sent a total of 6 times (i.e., it was retransmitted every 2 seconds on the average). It was acked once, 140ms after it first arrived. stime.awk atime.awk Output one line per send or ack, respectively, in the form

See the Network Abuse Clearinghouse for how to do this.