aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoseph Mingrone <jrm@FreeBSD.org>2023-06-08 17:30:54 +0000
committerJoseph Mingrone <jrm@FreeBSD.org>2023-06-08 17:30:54 +0000
commitee67461e56828dd1f8de165947ba83f6d9148a87 (patch)
tree84372978fdb5efead69ae456f5e480a5872ec37b
parentf40cd16bfda4f4512033bb9e7212ee5d8b94b9a7 (diff)
parent51a183021fce3928d24b11c319d2787f5a15ae87 (diff)
downloadsrc-ee67461e5682.tar.gz
src-ee67461e5682.zip
tpcdump: Update to 4.99.4
Local changes: - Update some local modifications to fix build - Synch config.h with upstream as much as possible Changelog: https://git.tcpdump.org/tcpdump/blob/55bc126b0216cfe409b8d6bd378f65679d136ddf:/CHANGES Reviewed by: emaste Obtained from: https://www.tcpdump.org/release/tcpdump-4.99.4.tar.gz Sponsored by: The FreeBSD Foundation
-rw-r--r--contrib/tcpdump/CHANGES289
-rw-r--r--contrib/tcpdump/CMakeLists.txt1371
-rw-r--r--contrib/tcpdump/CONTRIBUTING151
-rw-r--r--contrib/tcpdump/CONTRIBUTING.md191
-rw-r--r--contrib/tcpdump/CREDITS149
-rw-r--r--contrib/tcpdump/INSTALL.md (renamed from contrib/tcpdump/INSTALL.txt)61
-rw-r--r--contrib/tcpdump/LICENSE6
-rw-r--r--contrib/tcpdump/Makefile.in230
-rw-r--r--contrib/tcpdump/PLATFORMS16
l---------contrib/tcpdump/README1
-rw-r--r--contrib/tcpdump/README.md100
-rw-r--r--contrib/tcpdump/VERSION2
-rw-r--r--contrib/tcpdump/addrtoname.c493
-rw-r--r--contrib/tcpdump/addrtoname.h86
-rw-r--r--contrib/tcpdump/addrtostr.c12
-rw-r--r--contrib/tcpdump/af.c4
-rw-r--r--contrib/tcpdump/af.h2
-rw-r--r--contrib/tcpdump/ah.h46
-rw-r--r--contrib/tcpdump/appletalk.h60
-rw-r--r--contrib/tcpdump/ascii_strcasecmp.c6
-rw-r--r--contrib/tcpdump/atime.awk2
-rw-r--r--contrib/tcpdump/bpf_dump.c5
-rw-r--r--contrib/tcpdump/chdlc.h2
-rw-r--r--contrib/tcpdump/checksum.c10
-rw-r--r--contrib/tcpdump/cmake/Modules/FindCRYPTO.cmake24
-rw-r--r--contrib/tcpdump/cmake/Modules/FindPCAP.cmake462
-rw-r--r--contrib/tcpdump/cmake/Modules/FindSMI.cmake24
-rw-r--r--contrib/tcpdump/cmake_uninstall.cmake.in21
-rw-r--r--contrib/tcpdump/cmakeconfig.h.in290
-rw-r--r--contrib/tcpdump/compiler-tests.h196
-rwxr-xr-xcontrib/tcpdump/config.guess1516
-rw-r--r--contrib/tcpdump/config.h.in170
-rwxr-xr-xcontrib/tcpdump/config.sub1705
-rwxr-xr-xcontrib/tcpdump/configure3690
-rw-r--r--contrib/tcpdump/configure.ac508
-rw-r--r--contrib/tcpdump/cpack.c103
-rw-r--r--contrib/tcpdump/cpack.h33
-rw-r--r--contrib/tcpdump/diag-control.h186
-rw-r--r--contrib/tcpdump/doc/README.NetBSD.md22
-rw-r--r--contrib/tcpdump/doc/README.Win32.md200
-rw-r--r--contrib/tcpdump/doc/README.aix.md17
-rw-r--r--contrib/tcpdump/doc/README.solaris.md41
-rw-r--r--contrib/tcpdump/ethertype.h32
-rw-r--r--contrib/tcpdump/extract.h754
-rw-r--r--contrib/tcpdump/fptype.c (renamed from contrib/tcpdump/ether.h)35
-rw-r--r--contrib/tcpdump/fptype.h34
-rw-r--r--contrib/tcpdump/ftmacros.h127
-rw-r--r--contrib/tcpdump/funcattrs.h110
-rw-r--r--contrib/tcpdump/getservent.h67
-rw-r--r--contrib/tcpdump/gmpls.c4
-rw-r--r--contrib/tcpdump/gmt2local.c66
-rw-r--r--contrib/tcpdump/gmt2local.h25
-rw-r--r--contrib/tcpdump/in_cksum.c12
-rw-r--r--contrib/tcpdump/interface.h18
-rw-r--r--contrib/tcpdump/ip.h6
-rw-r--r--contrib/tcpdump/ip6.h91
-rw-r--r--contrib/tcpdump/ipproto.c10
-rw-r--r--contrib/tcpdump/ipproto.h15
-rw-r--r--contrib/tcpdump/l2vpn.c8
-rw-r--r--contrib/tcpdump/machdep.c24
-rw-r--r--contrib/tcpdump/missing/datalinks.c2
-rw-r--r--contrib/tcpdump/missing/dlnames.c5
-rw-r--r--contrib/tcpdump/missing/getopt_long.c30
-rw-r--r--contrib/tcpdump/missing/getopt_long.h (renamed from contrib/tcpdump/getopt_long.h)6
-rw-r--r--contrib/tcpdump/missing/getservent.c143
-rw-r--r--contrib/tcpdump/missing/pcap_dump_ftell.c46
-rw-r--r--contrib/tcpdump/missing/snprintf.c119
-rw-r--r--contrib/tcpdump/missing/strlcat.c8
-rw-r--r--contrib/tcpdump/missing/strlcpy.c8
-rw-r--r--contrib/tcpdump/missing/strsep.c6
-rwxr-xr-xcontrib/tcpdump/mkdep50
-rw-r--r--contrib/tcpdump/mpls.h6
-rw-r--r--contrib/tcpdump/nameser.h187
-rw-r--r--contrib/tcpdump/netdissect-alloc.c64
-rw-r--r--contrib/tcpdump/netdissect-alloc.h32
-rw-r--r--contrib/tcpdump/netdissect-ctype.h56
-rw-r--r--contrib/tcpdump/netdissect-stdinc.h375
-rw-r--r--contrib/tcpdump/netdissect.c159
-rw-r--r--contrib/tcpdump/netdissect.h597
-rw-r--r--contrib/tcpdump/nfs.h169
-rw-r--r--contrib/tcpdump/nfsfh.h2
-rw-r--r--contrib/tcpdump/nlpid.c4
-rw-r--r--contrib/tcpdump/ntp.c74
-rw-r--r--contrib/tcpdump/ntp.h (renamed from contrib/tcpdump/vfprintf.c)58
-rw-r--r--contrib/tcpdump/openflow.h51
-rw-r--r--contrib/tcpdump/ospf.h154
-rw-r--r--contrib/tcpdump/oui.c33
-rw-r--r--contrib/tcpdump/oui.h32
-rw-r--r--contrib/tcpdump/parsenfsfh.c162
-rw-r--r--contrib/tcpdump/pcap_dump_ftell.c31
-rw-r--r--contrib/tcpdump/pflog.h152
-rw-r--r--contrib/tcpdump/ppp.h8
-rw-r--r--contrib/tcpdump/print-802_11.c1769
-rw-r--r--contrib/tcpdump/print-802_15_4.c2603
-rw-r--r--contrib/tcpdump/print-ah.c57
-rw-r--r--contrib/tcpdump/print-ahcp.c283
-rw-r--r--contrib/tcpdump/print-aodv.c388
-rw-r--r--contrib/tcpdump/print-aoe.c257
-rw-r--r--contrib/tcpdump/print-ap1394.c46
-rw-r--r--contrib/tcpdump/print-arcnet.c162
-rw-r--r--contrib/tcpdump/print-arista.c165
-rw-r--r--contrib/tcpdump/print-arp.c261
-rw-r--r--contrib/tcpdump/print-ascii.c126
-rw-r--r--contrib/tcpdump/print-atalk.c462
-rw-r--r--contrib/tcpdump/print-atm.c193
-rw-r--r--contrib/tcpdump/print-babel.c504
-rw-r--r--contrib/tcpdump/print-bcm-li.c130
-rw-r--r--contrib/tcpdump/print-beep.c23
-rw-r--r--contrib/tcpdump/print-bfd.c215
-rw-r--r--contrib/tcpdump/print-bgp.c4278
-rw-r--r--contrib/tcpdump/print-bootp.c569
-rw-r--r--contrib/tcpdump/print-brcmtag.c151
-rw-r--r--contrib/tcpdump/print-bt.c44
-rw-r--r--contrib/tcpdump/print-calm-fast.c52
-rw-r--r--contrib/tcpdump/print-carp.c37
-rw-r--r--contrib/tcpdump/print-cdp.c596
-rw-r--r--contrib/tcpdump/print-cfm.c310
-rw-r--r--contrib/tcpdump/print-chdlc.c94
-rw-r--r--contrib/tcpdump/print-cip.c47
-rw-r--r--contrib/tcpdump/print-cnfp.c456
-rw-r--r--contrib/tcpdump/print-dccp.c365
-rw-r--r--contrib/tcpdump/print-decnet.c680
-rw-r--r--contrib/tcpdump/print-dhcp6.c373
-rw-r--r--contrib/tcpdump/print-domain.c941
-rw-r--r--contrib/tcpdump/print-dsa.c219
-rw-r--r--contrib/tcpdump/print-dtp.c86
-rw-r--r--contrib/tcpdump/print-dvmrp.c341
-rw-r--r--contrib/tcpdump/print-eap.c277
-rw-r--r--contrib/tcpdump/print-egp.c224
-rw-r--r--contrib/tcpdump/print-eigrp.c472
-rw-r--r--contrib/tcpdump/print-enc.c94
-rw-r--r--contrib/tcpdump/print-esp.c544
-rw-r--r--contrib/tcpdump/print-ether.c496
-rw-r--r--contrib/tcpdump/print-fddi.c93
-rw-r--r--contrib/tcpdump/print-forces.c761
-rw-r--r--contrib/tcpdump/print-fr.c386
-rw-r--r--contrib/tcpdump/print-frag6.c38
-rw-r--r--contrib/tcpdump/print-ftp.c11
-rw-r--r--contrib/tcpdump/print-geneve.c81
-rw-r--r--contrib/tcpdump/print-geonet.c123
-rw-r--r--contrib/tcpdump/print-gre.c210
-rw-r--r--contrib/tcpdump/print-hncp.c331
-rw-r--r--contrib/tcpdump/print-hsrp.c88
-rw-r--r--contrib/tcpdump/print-http.c11
-rw-r--r--contrib/tcpdump/print-icmp.c523
-rw-r--r--contrib/tcpdump/print-icmp6.c1383
-rw-r--r--contrib/tcpdump/print-igmp.c232
-rw-r--r--contrib/tcpdump/print-igrp.c126
-rw-r--r--contrib/tcpdump/print-ip-demux.c231
-rw-r--r--contrib/tcpdump/print-ip.c575
-rw-r--r--contrib/tcpdump/print-ip6.c413
-rw-r--r--contrib/tcpdump/print-ip6opts.c188
-rw-r--r--contrib/tcpdump/print-ipcomp.c31
-rw-r--r--contrib/tcpdump/print-ipfc.c50
-rw-r--r--contrib/tcpdump/print-ipnet.c51
-rw-r--r--contrib/tcpdump/print-ipoib.c125
-rw-r--r--contrib/tcpdump/print-ipx.c193
-rw-r--r--contrib/tcpdump/print-isakmp.c1425
-rw-r--r--contrib/tcpdump/print-isoclns.c2757
-rw-r--r--contrib/tcpdump/print-juniper.c823
-rw-r--r--contrib/tcpdump/print-krb.c113
-rw-r--r--contrib/tcpdump/print-l2tp.c303
-rw-r--r--contrib/tcpdump/print-lane.c52
-rw-r--r--contrib/tcpdump/print-ldp.c304
-rw-r--r--contrib/tcpdump/print-lisp.c158
-rw-r--r--contrib/tcpdump/print-llc.c124
-rw-r--r--contrib/tcpdump/print-lldp.c651
-rw-r--r--contrib/tcpdump/print-lmp.c601
-rw-r--r--contrib/tcpdump/print-loopback.c81
-rw-r--r--contrib/tcpdump/print-lspping.c546
-rw-r--r--contrib/tcpdump/print-lwapp.c172
-rw-r--r--contrib/tcpdump/print-lwres.c428
-rw-r--r--contrib/tcpdump/print-m3ua.c96
-rw-r--r--contrib/tcpdump/print-macsec.c256
-rw-r--r--contrib/tcpdump/print-medsa.c196
-rw-r--r--contrib/tcpdump/print-mobile.c35
-rw-r--r--contrib/tcpdump/print-mobility.c170
-rw-r--r--contrib/tcpdump/print-mpcp.c146
-rw-r--r--contrib/tcpdump/print-mpls.c108
-rw-r--r--contrib/tcpdump/print-mptcp.c279
-rw-r--r--contrib/tcpdump/print-msdp.c64
-rw-r--r--contrib/tcpdump/print-msnlb.c27
-rw-r--r--contrib/tcpdump/print-nflog.c177
-rw-r--r--contrib/tcpdump/print-nfs.c1419
-rw-r--r--contrib/tcpdump/print-nsh.c233
-rw-r--r--contrib/tcpdump/print-ntp.c473
-rw-r--r--contrib/tcpdump/print-null.c45
-rw-r--r--contrib/tcpdump/print-olsr.c285
-rw-r--r--contrib/tcpdump/print-openflow-1.0.c2478
-rw-r--r--contrib/tcpdump/print-openflow-1.3.c1209
-rw-r--r--contrib/tcpdump/print-openflow.c214
-rw-r--r--contrib/tcpdump/print-ospf.c773
-rw-r--r--contrib/tcpdump/print-ospf6.c515
-rw-r--r--contrib/tcpdump/print-otv.c36
-rw-r--r--contrib/tcpdump/print-pflog.c188
-rw-r--r--contrib/tcpdump/print-pfsync.c136
-rw-r--r--contrib/tcpdump/print-pgm.c543
-rw-r--r--contrib/tcpdump/print-pim.c667
-rw-r--r--contrib/tcpdump/print-pktap.c94
-rw-r--r--contrib/tcpdump/print-ppi.c108
-rw-r--r--contrib/tcpdump/print-ppp.c869
-rw-r--r--contrib/tcpdump/print-pppoe.c81
-rw-r--r--contrib/tcpdump/print-pptp.c731
-rw-r--r--contrib/tcpdump/print-ptp.c634
-rw-r--r--contrib/tcpdump/print-radius.c881
-rw-r--r--contrib/tcpdump/print-raw.c12
-rw-r--r--contrib/tcpdump/print-realtek.c248
-rw-r--r--contrib/tcpdump/print-resp.c114
-rw-r--r--contrib/tcpdump/print-rip.c425
-rw-r--r--contrib/tcpdump/print-ripng.c125
-rw-r--r--contrib/tcpdump/print-rpki-rtr.c147
-rw-r--r--contrib/tcpdump/print-rrcp.c129
-rw-r--r--contrib/tcpdump/print-rsvp.c1179
-rw-r--r--contrib/tcpdump/print-rt6.c96
-rw-r--r--contrib/tcpdump/print-rtsp.c11
-rw-r--r--contrib/tcpdump/print-rx.c1411
-rw-r--r--contrib/tcpdump/print-sctp.c382
-rw-r--r--contrib/tcpdump/print-sflow.c725
-rw-r--r--contrib/tcpdump/print-sip.c8
-rw-r--r--contrib/tcpdump/print-sl.c161
-rw-r--r--contrib/tcpdump/print-sll.c316
-rw-r--r--contrib/tcpdump/print-slow.c363
-rw-r--r--contrib/tcpdump/print-smb.c759
-rw-r--r--contrib/tcpdump/print-smtp.c11
-rw-r--r--contrib/tcpdump/print-snmp.c399
-rw-r--r--contrib/tcpdump/print-someip.c142
-rw-r--r--contrib/tcpdump/print-ssh.c99
-rw-r--r--contrib/tcpdump/print-stp.c349
-rw-r--r--contrib/tcpdump/print-sunatm.c26
-rw-r--r--contrib/tcpdump/print-sunrpc.c85
-rw-r--r--contrib/tcpdump/print-symantec.c52
-rw-r--r--contrib/tcpdump/print-syslog.c72
-rw-r--r--contrib/tcpdump/print-tcp.c508
-rw-r--r--contrib/tcpdump/print-telnet.c81
-rw-r--r--contrib/tcpdump/print-tftp.c71
-rw-r--r--contrib/tcpdump/print-timed.c111
-rw-r--r--contrib/tcpdump/print-tipc.c181
-rw-r--r--contrib/tcpdump/print-token.c94
-rw-r--r--contrib/tcpdump/print-udld.c115
-rw-r--r--contrib/tcpdump/print-udp.c563
-rw-r--r--contrib/tcpdump/print-unsupported.c34
-rw-r--r--contrib/tcpdump/print-usb.c186
-rw-r--r--contrib/tcpdump/print-vjc.c34
-rw-r--r--contrib/tcpdump/print-vqp.c107
-rw-r--r--contrib/tcpdump/print-vrrp.c101
-rw-r--r--contrib/tcpdump/print-vsock.c262
-rw-r--r--contrib/tcpdump/print-vtp.c181
-rw-r--r--contrib/tcpdump/print-vxlan-gpe.c67
-rw-r--r--contrib/tcpdump/print-vxlan.c41
-rw-r--r--contrib/tcpdump/print-wb.c365
-rw-r--r--contrib/tcpdump/print-whois.c31
-rw-r--r--contrib/tcpdump/print-zep.c181
-rw-r--r--contrib/tcpdump/print-zephyr.c128
-rw-r--r--contrib/tcpdump/print-zeromq.c83
-rw-r--r--contrib/tcpdump/print.c411
-rw-r--r--contrib/tcpdump/print.h5
-rw-r--r--contrib/tcpdump/rpc_auth.h11
-rw-r--r--contrib/tcpdump/rpc_msg.h24
-rw-r--r--contrib/tcpdump/rpl.h174
-rw-r--r--contrib/tcpdump/setsignal.c90
-rw-r--r--contrib/tcpdump/setsignal.h25
-rw-r--r--contrib/tcpdump/signature.c26
-rw-r--r--contrib/tcpdump/slcompress.h4
-rw-r--r--contrib/tcpdump/smb.h6
-rw-r--r--contrib/tcpdump/smbutil.c535
-rw-r--r--contrib/tcpdump/status-exit-codes.h32
-rw-r--r--contrib/tcpdump/stime.awk2
-rw-r--r--contrib/tcpdump/strtoaddr.c20
-rw-r--r--contrib/tcpdump/tcp.h29
-rw-r--r--contrib/tcpdump/tcpdump.1.in364
-rw-r--r--contrib/tcpdump/tcpdump.c1232
-rw-r--r--contrib/tcpdump/timeval-operations.h23
-rw-r--r--contrib/tcpdump/udp.h118
-rw-r--r--contrib/tcpdump/util-print.c614
-rw-r--r--contrib/tcpdump/varattrs.h59
-rw-r--r--usr.sbin/tcpdump/tcpdump/Makefile25
-rw-r--r--usr.sbin/tcpdump/tcpdump/config.h208
277 files changed, 47612 insertions, 32914 deletions
diff --git a/contrib/tcpdump/CHANGES b/contrib/tcpdump/CHANGES
index f09be3446a62..33ced66dd826 100644
--- a/contrib/tcpdump/CHANGES
+++ b/contrib/tcpdump/CHANGES
@@ -1,3 +1,264 @@
+Friday, 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
@@ -21,7 +282,6 @@ Friday, September 20, 2019, by mcr@sandelman.ca
CVE-2018-14882 (RPL)
CVE-2018-16227 (802.11)
CVE-2018-16229 (DCCP)
- CVE-2018-16301 (was fixed in libpcap)
CVE-2018-16230 (BGP)
CVE-2018-16452 (SMB)
CVE-2018-16300 (BGP)
@@ -66,8 +326,6 @@ Sunday September 3, 2017 denis@ovsienko.info
CVE-2017-12991 (BGP)
CVE-2017-12992 (RIPng)
CVE-2017-12993 (Juniper)
- CVE-2017-11542 (PIMv1)
- CVE-2017-11541 (safeputs)
CVE-2017-12994 (BGP)
CVE-2017-12996 (PIMv2)
CVE-2017-12998 (ISO IS-IS)
@@ -393,7 +651,7 @@ Wednesday Jul. 2, 2014 mcr@sandelman.ca
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 accomodate USB captures
+ 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
@@ -533,7 +791,7 @@ 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 typoes, in the man
+ 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
@@ -617,7 +875,7 @@ Mon. September 10, 2007. ken@xelerance.com. Summary for 3.9.8 tcpdump relea
Wed. July 23, 2007. mcr@xelerance.com. Summary for 3.9.7 libpcap release
- NFS: Print unsigned values as such.
+ NFS: Print unsigned values as such.
RX: parse safely.
BGP: fixes for IPv6-less builds.
801.1ag: use standard codepoint.
@@ -628,7 +886,7 @@ Wed. July 23, 2007. mcr@xelerance.com. Summary for 3.9.7 libpcap release
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 dependancy.
+ 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
@@ -648,7 +906,7 @@ Wed. April 25, 2007. ken@xelerance.com. Summary for 3.9.6 tcpdump release
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
- http://www.ietf.org/internet-drafts/draft-foschiano-udld-02.txt
+ 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
@@ -689,7 +947,7 @@ Tue. September 19, 2006. ken@xelerance.com. Summary for 3.9.5 tcpdump release
Lots of minor cosmetic changes to output printers
-Mon. September 19, 2005. ken@xelerance.com. Summary for 3.9.4 tcpdump release
+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).
@@ -708,14 +966,14 @@ Mon. September 19, 2005. ken@xelerance.com. Summary for 3.9.4 tcpdump release
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
+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 compliation fixes on most platforms
+ Many compilation fixes on most platforms
Fixes for recent version of GCC to eliminate warnings
Improved Unicode support
@@ -753,7 +1011,7 @@ Tue. March 30, 2004. mcr@sandelman.ottawa.on.ca. Summary for 3.8.3 release
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
- http://www.rapid7.com/advisories/R7-0017.html
+ 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
@@ -826,7 +1084,6 @@ Tuesday, February 25, 2003. fenner@research.att.com. 3.7.2 release
2.100.3 to be misrepresented as 4.20.3 .
Monday, January 21, 2002. mcr@sandelman.ottawa.on.ca. Summary for 3.7 release
-see http://www.tcpdump.org/cvs-log/2002-01-21.10:16:48.html for commit log.
keyword "ipx" added.
Better OSI/802.2 support on Linux.
IEEE 802.11 support, from clenahan@fortresstech.com, achirica@ttd.net.
@@ -894,7 +1151,7 @@ Tuesday January 9, 2001. mcr@sandelman.ottawa.on.ca. Summary for 3.6 release
libpcap changes provide for exchanging capture files between
systems. Save files now have well known PACKET_ values instead of
- depending upon system dependant mappings of DLT_* types.
+ depending upon system dependent mappings of DLT_* types.
Support for computing/checking IP and UDP/TCP checksums.
@@ -1205,7 +1462,7 @@ v3.1 Thu Jun 13 20:59:32 PDT 1996
- Print out a little more information for sun rpc packets.
-- Add suport for Kerberos 4 thanks to John Hawkinson (jhawk@mit.edu).
+- 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).
@@ -1370,7 +1627,7 @@ v2.2 Fri May 22 17:19:41 PDT 1992
v2.1 Tue Jan 28 11:00:14 PST 1992
-- Internal release (never publically exported).
+- Internal release (never publicly exported).
v2.0.1 Sun Jan 26 21:10:10 PDT
diff --git a/contrib/tcpdump/CMakeLists.txt b/contrib/tcpdump/CMakeLists.txt
new file mode 100644
index 000000000000..9495b5d4c234
--- /dev/null
+++ b/contrib/tcpdump/CMakeLists.txt
@@ -0,0 +1,1371 @@
+if(WIN32)
+ #
+ # We need 3.12 or later, so that we can set policy CMP0074; see
+ # below.
+ cmake_minimum_required(VERSION 3.12)
+else(WIN32)
+ #
+ # For now, require only 2.8.6, just in case somebody is
+ # configuring with CMake on a "long-term support" version
+ # of some OS and that version supplies an older version of
+ # CMake.
+ #
+ # 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_<LANG>_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 <net/ethernet.h>.
+# Some might have it and declare it in <netinet/ether.h>
+# Some might have it and declare it in <sys/ethernet.h>.
+# Some might have it and declare it in <arpa/inet.h>.
+# Some might have it and declare it in <netinet/if_ether.h>.
+# 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 <net/ethernet.h>?
+ #
+ # This test fails if we don't have <net/ethernet.h> 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 <netinet/ether.h>, as on Linux?
+ #
+ # This test fails if we don't have <netinet/ether.h>
+ # 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 <sys/ethernet.h>, as on Solaris 10 and later?
+ #
+ # This test fails if we don't have <sys/ethernet.h>
+ # 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 <arpa/inet.h>, as on AIX?
+ #
+ # This test fails if we don't have <arpa/inet.h>
+ # 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 <netinet/if_ether.h>?
+ # On some platforms, it requires <net/if.h> and
+ # <netinet/in.h>, and we always include it with
+ # both of them, so test it with both of them.
+ #
+ # This test fails if we don't have <netinet/if_ether.h>
+ # and the headers we include before it, or if we do but
+ # <netinet/if_ether.h> 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<netinet/if_ether.h>?
+ #
+ 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()
diff --git a/contrib/tcpdump/CONTRIBUTING b/contrib/tcpdump/CONTRIBUTING
deleted file mode 100644
index 57462909b475..000000000000
--- a/contrib/tcpdump/CONTRIBUTING
+++ /dev/null
@@ -1,151 +0,0 @@
-Some Information for Contributors
----------------------------------
-You want to contribute to Tcpdump, Thanks!
-Please, read these lines.
-
-
-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 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.)
-* configure flags if any were used
-* 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 open a pull request instead as discussed below.
-
-Still not sure how to do? Feel free to [subscribe](https://www.tcpdump.org/#mailing-lists)
-to the mailing list tcpdump-workers@lists.tcpdump.org 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 the Tcpdump repository on GitHub from
- https://github.com/the-tcpdump-group/tcpdump
- (See https://help.github.com/articles/fork-a-repo/)
-
-2) Setup an optional Travis-CI build
- You can setup a travis build for your fork. So, you can test your changes
- on Linux and OSX before sending pull requests.
- (See http://docs.travis-ci.com/user/getting-started/)
-
-3) Setup your git working copy
- git clone https://github.com/<username>/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
- a) add (via configure, in Makefile) some warnings options ( -Wall
- -Wmissing-prototypes -Wstrict-prototypes, ...) to the compiler if it
- supports these options,
- b) have the Makefile support "make depend" and the configure script run it.
-
-5) Configure and build
- ./configure && make -s && make check
-
-6) Add/update sample.pcap files
- We use tests directory to do regression tests on the dissection of captured
- packets, by running tcpdump against a savefile sample.pcap, created with -w
- option and comparing the results with a text file sample.out giving the
- expected results.
-
- 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 build by:
- (cd tests && ../tcpdump -n -r sample.pcap tcpdump-options > sample.out)
-
- It is often useful to have test outputs with different verbosity levels
- (none, -v, -vv, -vvv, etc.) depending on the code.
-
-7) Test with 'make check'
- Don't send a pull request if 'make check' gives failed tests.
-
-8) Try to rebase your commits to keep the history simple.
- 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.
- git push
-
-10) Initiate and send a pull request
- (See https://help.github.com/articles/using-pull-requests/)
-
-
-Code style and generic remarks
-------------------------------
-a) A thorough reading of some other printers code is useful.
-
-b) Put the normative reference if any as comments (RFC, etc.).
-
-c) Put the format of packets/headers/options as comments if there is no
- published normative reference.
-
-d) The printer may receive incomplete packet in the buffer, truncated at any
- random position, for example by capturing with '-s size' option.
- Thus use ND_TTEST, ND_TTEST2, ND_TCHECK or ND_TCHECK2 for bound checking.
- For ND_TCHECK2:
- Define : static const char tstr[] = " [|protocol]";
- Define a label: trunc
- Print with: ND_PRINT((ndo, "%s", tstr));
- 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.
-
-e) 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).
- Print with: ND_PRINT((ndo, "%s", istr)); /* to print " (invalid)" */
-
-f) Use 'struct tok' for indexed strings and print them with
- tok2str() or bittok2str() (for flags).
-
-g) Avoid empty lines in output of printers.
-
-h) A commit message must have:
- First line: Capitalized short summary in the imperative (70 chars or less)
-
- Body: Detailed explanatory text, if necessary. Fold it to approximately
- 72 characters. There must be an empty line separating the summary from
- the body.
-
-i) Avoid non-ASCII characters in code and commit messages.
-
-j) Use the style of the modified sources.
-
-k) Don't mix declarations and code
-
-l) Don't use // for comments
- Not all C compilers accept C++/C99 comments by default.
-
-m) Avoid trailing tabs/spaces
diff --git a/contrib/tcpdump/CONTRIBUTING.md b/contrib/tcpdump/CONTRIBUTING.md
new file mode 100644
index 000000000000..26f226ebd973
--- /dev/null
+++ b/contrib/tcpdump/CONTRIBUTING.md
@@ -0,0 +1,191 @@
+# 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/<username>/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
diff --git a/contrib/tcpdump/CREDITS b/contrib/tcpdump/CREDITS
index 85ee5f44d385..b6862ccba5a8 100644
--- a/contrib/tcpdump/CREDITS
+++ b/contrib/tcpdump/CREDITS
@@ -1,48 +1,64 @@
-This file lists people who have contributed to tcpdump:
+This file lists people who have contributed to tcpdump.
-The current maintainers:
- Bill Fenner <fenner at research dot att dot com>
+The current maintainers (in alphabetical order):
Denis Ovsienko <denis at ovsienko dot info>
- Fulvio Risso <risso at polito dot it>
- Guy Harris <guy at alum dot mit dot edu>
- Hannes Gredler <hannes at gredler dot at>
+ Francois-Xavier Le Bail <devel dot fx dot lebail at orange dot fr>
+ Guy Harris <gharris at sonic dot net>
Michael Richardson <mcr at sandelman dot ottawa dot on dot ca>
- Francois-Xavier Le Bail <fx dot lebail at yahoo dot com>
-
-Additional people who have contributed patches:
+Additional people who have contributed patches (in alphabetical order):
Aaron Campbell <aaron at arbor dot net>
A Costa <agcosta at gis dot net>
+ ABHIMANYU <agupta07 at sourceforge dot net>
+ Adam Sampson <ats at offog dot org>
+ Ahmed Abdelsalam <ahabdels at gmail dot com>
+ Ajith Adapa <adapa dot ajith at gmail dot com>
Albert Chin <china at thewrittenword dot com>
Alexandra Kossovsky <alexandra1975 at sourceforge dot net>
+ Alexandr Nedvedicky <alexandr dot nedvedicky at oracle dot com>
+ Alexandre Ferrieux <alexandre dot ferrieux at orange dot com>
+ Alexis La Goutte <alexis dot lagoutte at gmail dot com>
Alfredo Andres <aandres at s21sec dot com>
+ Ali Abdulkadir <autostart dot ini at gmail dot com>
Ananth Suryanarayana <anantha at juniper dot net>
Andrea Bittau <a dot bittau at cs dot ucl dot ac dot uk>
+ Andrea Ieri <andrea dot ieri at canonical dot com>
+ Andreas Jaggi <andreas dot jaggi at waterwave dot ch>
Andrew Brown <atatat at atatdot dot net>
Andrew Church <andrew at users dot sourceforge dot net>
Andrew Darqui <andrew dot darqui at gmail dot com>
Andrew Hintz <adhintz at users dot sourceforge dot net>
+ Andrew Lunn <andrew at lunn dot ch>
Andrew Nording <andrew at nording dot ru>
Andrew Tridgell <tridge at linuxcare dot com>
Andy Heffernan <ahh at juniper dot net>
+ Angus Cameron <anguscc at yahoo dot com>
Anton Bernal <anton at juniper dot net>
Antonin Décimo <antonin dot decimo at gmail dot com>
+ Aravind Prasad S <raja dot avi at gmail dot com>
Arkadiusz Miskiewicz <misiek at pld dot org dot pl>
Armando L. Caro Jr. <acaro at mail dot eecis dot udel dot edu>
Arnaldo Carvalho de Melo <acme at ghostprotocols dot net>
Atsushi Onoe <onoe at netbsd dot org>
Baptiste Jonglez <baptiste dot jonglez at ens-lyon dot org>
+ Baruch Siach <baruch at tkos dot co dot il>
Ben Byer <bushing at sourceforge dot net>
Ben Smithurst <ben at scientia dot demon dot co dot uk>
Bert Vermeulen <bert at biot dot com>
+ Bill Fenner <fenner at gmail dot com>
Bill Parker <wp02855 at gmail dot com>
Bjoern A. Zeeb <bzeeb at Zabbadoz dot NeT>
Bram <tcpdump at mail dot wizbit dot be>
Brent L. Bates <blbates at vigyan dot com>
Brian Carpenter <brian dot carpenter at gmail dot com>
Brian Ginsbach <ginsbach at cray dot com>
+ Brooks Davis <brooks at one-eyed-alien dot net>
Bruce M. Simpson <bms at spc dot org>
+ Bryce Wood <woodbr at oregonstate dot edu>
+ bugyo <bugyo at users dot noreply dot github dot com>
Carles Kishimoto Bisbe <ckishimo at ac dot upc dot es>
+ Casey Deccio <casey at deccio dot net>
+ Charles (Chas) Williams <chwillia at ciena dot com>
Charles M. Hannum <mycroft at netbsd dot org>
Charlie Lenahan <clenahan at fortresstech dot com>
Chris Cogdon <chris at cogdon dot org>
@@ -52,22 +68,39 @@ Additional people who have contributed patches:
Christian Sievers <c_s at users dot sourceforge dot net>
Christophe Rhodes <csr21 at cantab dot net>
Cliff Frey <cliff at meraki dot com>
+ Craig Leres <leres at xse dot com>
Craig Rodrigues <rodrigc at mediaone dot net>
Crist J. Clark <cjclark at alum dot mit dot edu>
+ Dagobert Michelsen <dam at opencsw dot org>
Daniel Hagerty <hag at ai dot mit dot edu>
Daniel Lee <Longinus00 at gmail dot com>
+ Daniel Miller <dmiller at nmap dot org>
+ Dario Lombardo <lomato at gmail dot com>
Darren Reed <darrenr at reed dot wattle dot id dot au>
David Binderman <d dot binderman at virgin dot net>
+ David Cronin <davidcronin94 at gmail dot com>
+ Davide Caratti <dcaratti at redhat dot com>
David Horn <dhorn2000 at gmail dot com>
David Smith <dsmith at redhat dot com>
David Young <dyoung at ojctech dot com>
+ Dion Bosschieter <dbosschieter at transip dot nl>
Dmitrij Tejblum <tejblum at yandex-team dot ru>
Dmitry Eremin-Solenikov <dbaryshkov at gmail dot com>
Don Ebright <Don dot Ebright at compuware dot com>
+ Donatas Abraitis <donatas dot abraitis at gmail dot com>
+ d simonov <simonov-d at yandex-team dot ru>
+ Duane Wessels <dwessels at verisign dot com>
+ Eamon Doyle <eamonjd at arista dot com>
Eddie Kohler <xexd at sourceforge dot net>
+ Ege Cetin <egecetin at hotmail dot com dot tr>
+ Eliot Lear <lear at upstairs dot ofcourseimright dot com>
Elmar Kirchner <elmar at juniper dot net>
+ Eric S. Raymond <esr at thyrsus dot com>
+ Etienne Marais <etienne at marais dot green>
Fang Wang <fangwang at sourceforge dot net>
+ Ferry Huberts <ferry dot huberts at pelagic dot nl>
Florent Drouin <Florent dot Drouin at alcatel-lucent dot fr>
+ Florian Fainelli <f dot fainelli at gmail dot com>
Florian Forster <octo at verplant dot org>
fra <foo at bar dot baz>
Francesco Fondelli <francesco dot fondelli at gmail dot com>
@@ -77,15 +110,24 @@ Additional people who have contributed patches:
Fulvio Risso <risso at polito dot it>
George Bakos <gbakos at ists dot dartmouth dot edu>
Gerald Combs <gerald at ethereal dot com>
+ Gerard Garcia <ggarcia at deic dot uab dot cat>
+ George Neville-Neil <gnn at freebsd dot org>
+ Gerald Combs <gerald at wireshark dot org>
Gerrit Renker <gerrit at erg dot abdn dot ac dot uk>
Gert Doering <gert at greenie dot muc dot de>
+ Gianluca Varenni <gianluca dot varenni at gmail dot com>
Gilbert Ramirez Jr. <gram at xiexie dot org>
Gisle Vanem <gvanem at yahoo dot no>
+ Gleb Smirnoff <glebius at FreeBSD dot org>
+ Gokul Sivakumar <gokulkumar792 at gmail dot com>
Greg Minshall <minshall at acm dot org>
Grégoire Henry <henry at pps dot jussieu dot fr>
Gregory Detal <gregory dot detal at uclouvain dot be>
Greg Stark <gsstark at mit dot edu>
+ Greg Steinbrecher <steinbrecher at alum dot mit dot edu>
+ Guy Lewin <guy at lewin dot co dot il>
Hank Leininger <tcpdump-workers at progressive-comp dot com>
+ Hannes Gredler <hannes at gredler dot at>
Hannes Viertel <hviertel at juniper dot net>
Hanno Böck <hanno at hboeck dot de>
Harry Raaymakers <harryr at connect dot com dot au>
@@ -94,18 +136,27 @@ Additional people who have contributed patches:
Herwin Weststrate <herwin at quarantainenet dot nl>
Ian McDonald <imcdnzl at gmail dot com>
Ilpo Järvinen <ilpo dot jarvinen at helsinki dot fi>
+ ishaangandhi <ishaangandhi at gmail dot com>
Jacek Tobiasz <Jacek dot Tobiasz at atm dot com dot pl>
+ Jacob Davis <jacobgb24 at yahoo dot com>
Jakob Schlyter <jakob at openbsd dot org>
+ Jakub Zawadzki <darkjames at darkjames dot pl>
Jamal Hadi Salim <hadi at cyberus dot ca>
+ James Ko <jck at exegin dot com>
+ Jamie Bainbridge <jamie dot bainbridge at gmail dot com>
Jan Oravec <wsx at wsx6 dot net>
+ Jason L. Wright <jason at thought dot net>
Jason R. Thorpe <thorpej at netbsd dot org>
+ Jean-Raphaël Gaglione <jr dot gaglione at yahoo dot fr>
+ Jeff Chan <jchan at arista dot com>
Jefferson Ogata <jogata at nodc dot noaa dot gov>
Jeffrey Hutzelman <jhutz at cmu dot edu>
- Jean-Raphaël Gaglione <jr dot gaglione at yahoo dot fr>
+ Jeremy Browne <jer at ifni dot ca>
Jesper Peterson <jesper at endace dot com>
Jesse Gross <jesse at nicira dot com>
Jim Hutchins <jim at ca dot sandia dot gov>
João Medeiros <ignotus21 at sourceforge dot net>
+ Job Snijders <job at instituut dot net>
Joerg Mayer <jmayer at loplof dot de>
Jonathan Heusser <jonny at drugphish dot ch>
Jorge Boncompte [DTI2] <jorge at dti2 dot net>
@@ -118,55 +169,81 @@ Additional people who have contributed patches:
Karl Norby <karl-norby at sourceforge dot net>
Kazushi Sugyo <sugyo at pb dot jp dot nec dot com>
Kelly Carmichael <kcarmich at ipapp dot com>
+ Ken Bantoft <ken at xelerance dot com>
Ken Hornstein <kenh at cmf dot nrl dot navy dot mil>
Kenichi Maehashi <webmaster at kenichimaehashi dot com>
Kevin Steves <stevesk at pobox dot com>
Klaus Klein <kleink at reziprozitaet dot de>
+ Kovarththanan Rajaratnam <kovarththanan dot rajaratnam at gmail dot com>
Kris Kennaway <kris at freebsd dot org>
Krzysztof Halasa <khc at pm dot waw dot pl>
Larry Lile <lile at stdio dot com>
Lennert Buytenhek <buytenh at gnu dot org>
- Loganaden Velvindron <logan at elandsys dot com>
+ Loganaden Velvindron <logan at cyberstorm dot mu>
Loris Degioanni <loris at netgroup-serv dot polito dot it>
Love Hörnquist-Åstrand <lha at stacken dot kth dot se>
Lucas C. Villa Real <lucasvr at us dot ibm dot com>
+ Luigi Rizzo <luigi at freebsd dot org>
Luis MartinGarcia <luis dot mgarc at gmail dot com>
+ Luiz Otavio O Souza <loos at freebsd dot org>
Maciej W. Rozycki <macro at ds2 dot pg dot gda dot pl>
+ Manoharan Sundaramoorthy <manoharan at arista dot com>
Manu Pathak <mapathak at cisco dot com>
Marc Abramowitz <marc at marc-abramowitz dot com>
Marc A. Lehmann <pcg at goof dot com>
Marc Binderberger <mbind at sourceforge dot net>
+ Mark Andrews <marka at isc dot org>
Mark Ellzey Thomas <mark at ackers dot net>
Marko Kiiskila <carnil at cs dot tut dot fi>
Markus Schöpflin <schoepflin at sourceforge dot net>
Marshall Rose <mrose at dbc dot mtview dot ca dot us>
+ Martin Buck <mb-tmp-tvguho dot pbz at gromit dot dyndns dot org>
Martin Husemann <martin at netbsd dot org>
+ Martin Sehnoutka <msehnout at redhat dot com>
+ Matt Eaton <agnosticdev at gmail dot com>
+ Matthew Luckie <matthewluckie at sourceforge dot net>
Matthieu Boutier <boutier at pps dot univ-paris-diderot dot fr>
Max Laier <max at love2party dot net>
Michael A. Meffie III <meffie at sourceforge dot net>
+ Michael Haardt <michael at moria dot de>
+ Michael Kirkhart <michael dot kirkhart at att dot net>
Michael Madore <mmadore at turbolinux dot com>
Michael Riepe <too-tired at sourceforge dot net>
Michael Shalayeff <mickey at openbsd dot org>
Michael Shields <shields at msrl dot com>
Michael T. Stolarchuk <mts at off dot to>
+ Michal Ruprich <michalruprich at gmail dot com>
Michal Sekletar <msekleta at redhat dot com>
Michele "mydecay" Marchetto <smarchetto1 at tin dot it>
Mike Frysinger <vapier at gmail dot com>
+ Mingrui <972931182 at qq dot com>
Minto Jeyananth <minto at juniper dot net>
+ Miroslav Lichvar <mlichvar at redhat dot com>
+ Mister X <3520734+Mister-X- at users dot noreply dot github dot com>
+ Mitsunori Komatsu <komamitsu at gmail dot com>
Monroe Williams <monroe at pobox dot com>
+ Monthadar Al Jaberi <monthadar at gmail dot com>
+ Moses Devadason <mosesdevadason at gmail dot com>
Motonori Shindo <mshindo at mshindo dot net>
+ Nan Xiao <nan at chinadtrace dot org>
Nathaniel Couper-Noles <Nathaniel at isi1 dot tccisi dot com>
Nathan J. Williams <nathanw at MIT dot EDU>
+ Neelabh <neelabhsahay at gmail dot com>
Neil T. Spring <bluehal at users dot sourceforge dot net>
+ Nicholas Reilly <nreilly at blackberry dot com>
Nickolai Zeldovich <kolya at MIT dot EDU>
+ Nikolay Edigaryev <edigaryev at gmail dot com>
Nicolas Ferrero <toorop at babylo dot net>
+ niks3089 <niks3089 at gmail dot com>
Niels Provos <provos at openbsd dot org>
+ Nikhil AP <nikhilap at arista dot com>
Noritoshi Demizu <demizu at users dot sourceforge dot net>
Olaf Kirch <okir at caldera dot de>
Ola Martin Lykkja <ola dot lykkja at q-free dot com>
Oleksij Rempel <linux at rempel-privat dot de>
Onno van der Linden <onno at simplex dot nl>
Paolo Abeni <paolo dot abeni at email dot it>
+ Partha Ghosh <psg at cumulusnetworks dot com>
Pascal Hennequin <pascal dot hennequin at int-evry dot fr>
Pasvorn Boonmark <boonmark at juniper dot net>
Patrik Lundquist <patrik dot lundquist at gmail dot com>
@@ -175,26 +252,43 @@ Additional people who have contributed patches:
Paul S. Traina <pst at freebsd dot org>
Pavlin Radoslavov <pavlin at icir dot org>
Pawel Worach <pawel dot worach at gmail dot com>
+ Pedro Monreal <pmgdeb at gmail dot com>
Pekka Savola <pekkas at netcore dot fi>
+ peppe <g1pi at libero dot it>
Petar Alilovic <petar dot alilovic at gmail dot com>
Peter Fales <peter at fales-lorenz dot net>
Peter Jeremy <peter dot jeremy at alcatel dot com dot au>
+ Peter Krystad <peter dot krystad at linux dot intel dot com>
Peter Volkov <pva at gentoo dot org>
+ Petr Vorel <pvorel at suse dot cz>
<pfhunt at users dot sourceforge dot net>
Phil Wood <cpw at lanl dot gov>
+ Pier Carlo Chiodi <pierky at pierky dot com>
+ Quentin Armitage <quentin at armitage dot org dot uk>
Rafal Maszkowski <rzm at icm dot edu dot pl>
Randy Sofia <rsofia at users dot sourceforge dot net>
Raphael Raimbault <raphael dot raimbault at netasq dot com>
+ Renato Botelho <garga at FreeBSD dot org>
+ Ricardo Nabinger Sanchez <rnsanchez at taghos dot com dot br>
+ Richard Scheffenegger <srichard at netapp dot com>
Rick Cheng <rcheng at juniper dot net>
Rick Jones <rick dot jones2 at hp dot com>
Rick Watson <watsonrick at users dot sourceforge dot net>
+ Ritesh Ranjan <r dot ranjan789 at gmail dot com>
Rob Braun <bbraun at synack dot net>
Robert Edmonds <stu-42 at sourceforge dot net>
+ Rocco Lucia <rlucia at iscanet dot com>
Roderick Schertler <roderick at argon dot org>
Romain Francoise <rfrancoise at debian dot org>
+ Romero Malaquias <romero dot malaquias at gmail dot com>
Ruben Kerkhof <ruben at rubenkerkhof dot com>
+ Rui Paulo <rpaulo at FreeBSD dot org>
+ Sabrina Dubroca <sd at queasysnail dot net>
Sagun Shakya <sagun dot shakya at sun dot com>
+ Sam James <sam at gentoo dot org>
Sami Farin <safari at iki dot fi>
+ Sascha Wildner <swildner at sourceforge dot net>
+ Sawssen Hadded <saw dot hadded at gmail dot com>
Scott Mcmillan <scott dot a dot mcmillan at intel dot com>
Scott Rose <syberpunk at users dot sourceforge dot net>
Sebastian Krahmer <krahmer at cs dot uni-potsdam dot de>
@@ -203,22 +297,41 @@ Additional people who have contributed patches:
Sepherosa Ziehau <sepherosa at gmail dot com>
Seth Webster <swebster at sst dot ll dot mit dot edu>
Shinsuke Suzuki <suz at kame dot net>
+ Simon Nicolussi <sinic at sinic dot name>
Simon Ruderich <simon at ruderich dot org>
+ Slava Shwartsman <slavash at mellanox dot com>
+ Stefan Hajnoczi <stefanha at redhat dot com>
Steinar Haug <sthaug at nethelp dot no>
Stephane Bortzmeyer <stephane+github at bortzmeyer dot org>
- Swaminathan Chandrasekaran <chander at juniper dot net>
+ Steve Kay <stevekay at gmail dot com>
+ Steve-o <fnjordy at sourceforge dot net>
+ Steven H. Wang <wang dot steven dot h at gmail dot com>
Swaathi Vetrivel <swaathiv at juniper dot net>
+ Swaminathan Chandrasekaran <chander at juniper dot net>
Takashi Yamamoto <yamt at mwd dot biglobe dot ne dot jp>
Tatuya Jinmei <jinmei at kame dot net>
+ Tero Kivinen <kivinen at iki dot fi>
Terry Kennedy <terry at tmk dot com>
+ test2 <test2 at safs64 dot (none)>
Thomas Jacob <jacob at internet24 dot de>
+ Tillmann Karras <tilkax at gmail dot com>
Timo Koskiahde
+ Tobias Waldekranz <tobias at waldekranz dot com>
+ Tom Jones <thj at freebsd dot org>
+ Tommy Beadle <tbeadle at arbor dot net>
Tony Li <tli at procket dot com>
+ Tony Samuels <vegizombie at gmail dot com>
+ Tony Xu <hhktony at gmail dot com>
Toshihiro Kanda <candy at fct dot kgc dot co dot jp>
Udayakumar <udaya011 at gmail dot com>
+ Ulrich Windl <Ulrich dot Windl at RZ dot Uni-Regensburg dot DE>
Uns Lider <unslider at miranda dot org>
Victor Oppleman <oppleman at users dot sourceforge dot net>
+ Viral Mehta <viral dot mehta at dell dot com>
+ Vitaly Lavrov <vel21ripn at gmail dot com>
+ Vivien Didelot <vivien dot didelot at gmail dot com>
Vyacheslav Trushkin <dogonthesun at gmail dot com>
+ Wang Jian <larkwang at gmail dot com>
Weesan Lee <weesan at juniper dot net>
Wesley Griffin <wgriffin at users dot sourceforge dot net>
Wesley Shields <wxs at FreeBSD dot org>
@@ -226,13 +339,21 @@ Additional people who have contributed patches:
Will Drewry <will at alum dot bu dot edu>
William J. Hulley <bill dot hulley at gmail dot com>
Wim Torfs <wtorfs at gmail dot com>
+ Wolfgang Karall <office at karall-edv dot at>
+ Xin Li <delphij at FreeBSD dot org>
+ yekm <yekm at h0me>
Yen Yen Lim
Yoshifumi Nishida
+ zilog80a <zilog80a at sourceforge dot net>
+ zolf <flos at xs4all dot nl>
The original LBL crew:
Steve McCanne
Craig Leres
Van Jacobson
-Past maintainers:
- Jun-ichiro itojun Hagino <itojun at iijlab dot net> Also see: http://www.wide.ad.jp/itojun-award/
+Past maintainers (in alphabetical order):
+ Bill Fenner <fenner at gmail dot com>
+ Fulvio Risso <risso at polito dot it>
+ Hannes Gredler <hannes at gredler dot at>
+ Jun-ichiro itojun Hagino <itojun at iijlab dot net> Also see: http://www.wide.ad.jp/itojun-award/
diff --git a/contrib/tcpdump/INSTALL.txt b/contrib/tcpdump/INSTALL.md
index c8a8eb7da065..b3fbf42eaca8 100644
--- a/contrib/tcpdump/INSTALL.txt
+++ b/contrib/tcpdump/INSTALL.md
@@ -1,53 +1,61 @@
+# 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 the README file in this directory for the ftp location.
+libpcap; see [this file](README.md) for the location.
-You will need an ANSI C compiler to build tcpdump. The configure script
-will abort if your compiler is not ANSI compliant. If this happens, use
-the generally available GNU C compiler (GCC).
+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
+After libpcap has been built (either install it with `make install` or
make sure both the libpcap and tcpdump source trees are in the same
-directory), run ./configure (a shell script). "configure" will
-determine your system attributes and generate an appropriate Makefile
-from Makefile.in. Now build tcpdump by running "make".
+directory), 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
+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 for details. DO NOT give untrusted users the ability to
+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.
-Remember to remove or rename the installed binary when upgrading.
+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
+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 "PLATFORMS" for notes about tested platforms.
+Please see [this file](README.md) for notes about tested platforms.
-FILES
------
+## Description of files
+```
CHANGES - description of differences between releases
-CONTRIBUTING - guidelines for contributing
+CONTRIBUTING.md - guidelines for contributing
CREDITS - people that have helped tcpdump along
-INSTALL.txt - this file
+INSTALL.md - this file
LICENSE - the license under which tcpdump is distributed
Makefile.in - compilation rules (input to the configure script)
-README - description of distribution
-Readme.Win32 - notes on building tcpdump on Win32 systems (with WinPcap)
+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
@@ -64,13 +72,11 @@ config.h.in - autoconf input
config.sub - autoconf support
configure - configure script (run this first)
configure.ac - configure script source
-ether.h - Ethernet definitions
+doc/README.* - some building documentation
ethertype.h - Ethernet type value definitions
extract.h - alignment definitions
gmpls.c - GMPLS definitions
gmpls.h - GMPLS declarations
-gmt2local.c - time conversion routines
-gmt2local.h - time conversion prototypes
install-sh - BSD style install script
interface.h - globals, prototypes and definitions
ip.h - IP definitions
@@ -86,6 +92,8 @@ 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
@@ -98,8 +106,6 @@ 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_dump_ftell.c - pcap_dump_ftell() implementation, in case libpcap
- doesn't have it
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
@@ -107,8 +113,6 @@ 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
-setsignal.c - OS-independent signal routines
-setsignal.h - OS-independent signal prototypes
slcompress.h - SLIP/PPP Van Jacobson compression (RFC1144) definitions
smb.h - SMB/CIFS definitions
smbutil.c - SMB/CIFS utility routines
@@ -119,5 +123,4 @@ tcpdump.c - main program
timeval-operations.h - timeval operations macros
udp.h - UDP definitions
util-print.c - utility routines for protocol printers
-vfprintf.c - emulation routine
-win32 - headers and routines for building on Win32 systems
+```
diff --git a/contrib/tcpdump/LICENSE b/contrib/tcpdump/LICENSE
index dea5f7d54d6b..a10474d54aeb 100644
--- a/contrib/tcpdump/LICENSE
+++ b/contrib/tcpdump/LICENSE
@@ -1,9 +1,9 @@
License: 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
@@ -13,7 +13,7 @@ are met:
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.
diff --git a/contrib/tcpdump/Makefile.in b/contrib/tcpdump/Makefile.in
index 3b5891848952..1bdeb514fc33 100644
--- a/contrib/tcpdump/Makefile.in
+++ b/contrib/tcpdump/Makefile.in
@@ -1,5 +1,5 @@
# Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997
-# The Regents of the University of California. All rights reserved.
+# 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
@@ -26,12 +26,13 @@ prefix = @prefix@
exec_prefix = @exec_prefix@
datarootdir = @datarootdir@
# Pathname of directory to install the binary
-sbindir = @sbindir@
+bindir = @bindir@
# Pathname of directory to install the man page
mandir = @mandir@
# VPATH
srcdir = @srcdir@
+top_srcdir = @top_srcdir@
VPATH = @srcdir@
#
@@ -70,7 +71,7 @@ DEPENDENCY_CFLAG = @DEPENDENCY_CFLAG@
@rm -f $@
$(CC) $(FULL_CFLAGS) -c $(srcdir)/$*.c
-CSRC = setsignal.c tcpdump.c
+CSRC = fptype.c tcpdump.c
LIBNETDISSECT_SRC=\
addrtoname.c \
@@ -80,12 +81,14 @@ LIBNETDISSECT_SRC=\
checksum.c \
cpack.c \
gmpls.c \
- gmt2local.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 \
@@ -97,15 +100,18 @@ LIBNETDISSECT_SRC=\
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 \
@@ -118,6 +124,7 @@ LIBNETDISSECT_SRC=\
print-decnet.c \
print-dhcp6.c \
print-domain.c \
+ print-dsa.c \
print-dtp.c \
print-dvmrp.c \
print-eap.c \
@@ -141,12 +148,14 @@ LIBNETDISSECT_SRC=\
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 \
@@ -164,7 +173,7 @@ LIBNETDISSECT_SRC=\
print-lwapp.c \
print-lwres.c \
print-m3ua.c \
- print-medsa.c \
+ print-macsec.c \
print-mobile.c \
print-mobility.c \
print-mpcp.c \
@@ -179,10 +188,12 @@ LIBNETDISSECT_SRC=\
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 \
@@ -190,13 +201,14 @@ LIBNETDISSECT_SRC=\
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-rrcp.c \
print-rsvp.c \
print-rt6.c \
print-rtsp.c \
@@ -209,6 +221,8 @@ LIBNETDISSECT_SRC=\
print-slow.c \
print-smtp.c \
print-snmp.c \
+ print-someip.c \
+ print-ssh.c \
print-stp.c \
print-sunatm.c \
print-sunrpc.c \
@@ -222,34 +236,36 @@ LIBNETDISSECT_SRC=\
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.c \
print-vxlan-gpe.c \
+ print-vxlan.c \
print-wb.c \
+ print-whois.c \
+ print-zep.c \
print-zephyr.c \
print-zeromq.c \
- netdissect.c \
signature.c \
strtoaddr.c \
util-print.c
LOCALSRC = @LOCALSRC@
-GENSRC = version.c
LIBOBJS = @LIBOBJS@
LIBNETDISSECT_OBJ=$(LIBNETDISSECT_SRC:.c=.o) ${LOCALSRC:.c=.o} ${LIBOBJS}
LIBNETDISSECT=libnetdissect.a
-SRC = $(CSRC) $(GENSRC) $(LOCALSRC) $(LIBNETDISSECT_SRC)
+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) $(GENSRC:.c=.o) $(LIBNETDISSECT_OBJ)
+OBJ = $(CSRC:.c=.o)
HDR = \
addrtoname.h \
addrtostr.h \
@@ -259,14 +275,16 @@ HDR = \
ascii_strcasecmp.h \
atm.h \
chdlc.h \
+ compiler-tests.h \
cpack.h \
- ether.h \
+ diag-control.h \
ethertype.h \
extract.h \
+ fptype.h \
+ ftmacros.h \
funcattrs.h \
- getopt_long.h \
+ getservent.h \
gmpls.h \
- gmt2local.h \
interface.h \
ip.h \
ip6.h \
@@ -278,72 +296,81 @@ HDR = \
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 \
- rpl.h \
- setsignal.h \
signature.h \
slcompress.h \
smb.h \
+ status-exit-codes.h \
strtoaddr.h \
tcp.h \
- netdissect-stdinc.h \
timeval-operations.h \
- udp.h
+ udp.h \
+ varattrs.h
TAGHDR = \
- /usr/include/arpa/tftp.h \
- /usr/include/net/if_arp.h \
/usr/include/netinet/if_ether.h \
- /usr/include/netinet/in.h \
- /usr/include/netinet/ip_icmp.h \
- /usr/include/netinet/tcp.h \
- /usr/include/netinet/udp.h \
- /usr/include/protocols/routed.h
+ /usr/include/netinet/in.h
-TAGFILES = $(SRC) $(HDR) $(TAGHDR)
+TAGFILES = $(SRC) $(HDR) $(TAGHDR) $(LIBNETDISSECT_SRC) \
+ print-smb.c smbutil.c
-CLEANFILES = $(PROG) $(OBJ) $(GENSRC)
+CLEANFILES = $(PROG) $(OBJ) $(LIBNETDISSECT_OBJ) print-smb.o smbutil.o
EXTRA_DIST = \
CHANGES \
- CONTRIBUTING \
+ CMakeLists.txt \
+ CONTRIBUTING.md \
CREDITS \
- INSTALL.txt \
+ INSTALL.md \
LICENSE \
- Makefile.in \
Makefile-devel-adds \
- PLATFORMS \
- README \
+ Makefile.in \
README.md \
- Readme.Win32 \
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/dlnames.c \
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 \
@@ -351,28 +378,21 @@ EXTRA_DIST = \
missing/strsep.c \
mkdep \
packetdat.awk \
- pcap_dump_ftell.c \
- print-pflog.c \
print-smb.c \
send-ack.awk \
smbutil.c \
stime.awk \
- tcpdump.1.in \
- vfprintf.c \
- win32/prj/GNUmakefile \
- win32/prj/WinDump.dsp \
- win32/prj/WinDump.dsw \
- win32/prj/WinDump.sln \
- win32/prj/WinDump.vcproj \
- win32/src/ether_ntohost.c
+ tcpdump.1.in
TEST_DIST= `git ls-files tests | grep -v 'tests/\..*'`
-all: $(PROG) $(LIBNETDISSECT)
+RELEASE_FILES = $(CSRC) $(HDR) $(LIBNETDISSECT_SRC) $(EXTRA_DIST) $(TEST_DIST)
+
+all: $(PROG)
-$(PROG): $(OBJ) @V_PCAPDEP@
+$(PROG): $(OBJ) @V_PCAPDEP@ $(LIBNETDISSECT)
@rm -f $@
- $(CC) $(FULL_CFLAGS) $(LDFLAGS) -o $@ $(OBJ) $(LIBS)
+ $(CC) $(FULL_CFLAGS) $(LDFLAGS) -o $@ $(OBJ) $(LIBNETDISSECT) $(LIBS)
$(LIBNETDISSECT): $(LIBNETDISSECT_OBJ)
@rm -f $@
@@ -383,6 +403,8 @@ 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
@@ -395,50 +417,40 @@ 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
-
-version.o: version.c
- $(CC) $(FULL_CFLAGS) -c version.c
-
-version.c: $(srcdir)/VERSION
- @rm -f $@
- if grep GIT ${srcdir}/VERSION >/dev/null; then \
- read ver <${srcdir}/VERSION; \
- echo $$ver | tr -d '\012'; \
- date +_%Y_%m_%d; \
- else \
- cat ${srcdir}/VERSION; \
- fi | sed -e 's/.*/const char version[] = "&";/' > $@
+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)$(sbindir) ] || \
- (mkdir -p $(DESTDIR)$(sbindir); chmod 755 $(DESTDIR)$(sbindir))
- $(INSTALL_PROGRAM) $(PROG) $(DESTDIR)$(sbindir)/$(PROG)
- $(INSTALL_PROGRAM) $(PROG) $(DESTDIR)$(sbindir)/$(PROG).`cat ${srcdir}/VERSION`
+ [ -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)$(sbindir)/$(PROG)
+ rm -f $(DESTDIR)$(bindir)/$(PROG)
+ rm -f $(DESTDIR)$(bindir)/$(PROG).`cat ${srcdir}/VERSION`
rm -f $(DESTDIR)$(mandir)/man1/$(PROG).1
-lint: $(GENSRC)
- lint -hbxn $(SRC) | \
+lint:
+ lint -hbxn $(SRC) $(LIBNETDISSECT_SRC) | \
grep -v 'struct/union .* never defined' | \
grep -v 'possible pointer alignment problem'
clean:
- rm -f $(CLEANFILES) $(PROG)-`cat VERSION`.tar.gz
+ rm -f $(CLEANFILES) $(PROG)-`cat ${srcdir}/VERSION`.tar.gz
distclean:
rm -f $(CLEANFILES) Makefile config.cache config.log config.status \
- config.h gnuc.h os-proto.h stamp-h stamp-h.in $(PROG).1 \
+ 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
- (mkdir -p tests && SRCDIR=`cd ${srcdir}; pwd` && export SRCDIR && $$SRCDIR/tests/TESTrun.sh )
+ $(srcdir)/tests/TESTrun
extags: $(TAGFILES)
ctags $(TAGFILES)
@@ -450,14 +462,78 @@ TAGS: $(TAGFILES)
etags $(TAGFILES)
releasetar:
- @cwd=`pwd` ; dir=`basename $$cwd` ; name=$(PROG)-`cat VERSION` ; \
- mkdir $$name; \
- tar cf - $(CSRC) $(HDR) $(LIBNETDISSECT_SRC) $(EXTRA_DIST) $(TEST_DIST) | (cd $$name; tar xf -); \
- tar -c -z -f $$name.tar.gz $$name; \
- rm -rf $$name
+ @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: $(GENSRC)
- $(MKDEP) -c $(CC) -m $(DEPENDENCY_CFLAG) $(DEFS) $(INCLS) $(SRC)
+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
diff --git a/contrib/tcpdump/PLATFORMS b/contrib/tcpdump/PLATFORMS
deleted file mode 100644
index 4f11c5156416..000000000000
--- a/contrib/tcpdump/PLATFORMS
+++ /dev/null
@@ -1,16 +0,0 @@
-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
-* FreeBSD
-* HP-UX 11i
-* Linux (any) with glibc (usually just works)
-* Linux (any) with musl libc (sometimes fails to compile, please report any bugs)
-* Mac OS X / macOS
-* NetBSD
-* OpenWrt
-* Solaris
diff --git a/contrib/tcpdump/README b/contrib/tcpdump/README
deleted file mode 120000
index 42061c01a1c7..000000000000
--- a/contrib/tcpdump/README
+++ /dev/null
@@ -1 +0,0 @@
-README.md \ No newline at end of file
diff --git a/contrib/tcpdump/README.md b/contrib/tcpdump/README.md
index a1fba9bca6d4..566b7b7a874f 100644
--- a/contrib/tcpdump/README.md
+++ b/contrib/tcpdump/README.md
@@ -1,79 +1,79 @@
-# tcpdump
+# TCPDUMP 4.x.y by [The Tcpdump Group](https://www.tcpdump.org/)
-[![Build
-Status](https://travis-ci.org/the-tcpdump-group/tcpdump.png)](https://travis-ci.org/the-tcpdump-group/tcpdump)
-
-To report a security issue please send an e-mail to security@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 file
-CONTRIBUTING in the tcpdump source tree root.
-
-TCPDUMP 4.x.y
-Now maintained by "The Tcpdump Group"
-See www.tcpdump.org
+feature, provide generic feedback etc please see the
+[guidelines for contributing](CONTRIBUTING.md) in the tcpdump source tree root.
-Anonymous Git is available via:
+Anonymous Git is available via
- git clone git://bpf.tcpdump.org/tcpdump
-
-formerly from Lawrence Berkeley National Laboratory
- Network Research Group <tcpdump@ee.lbl.gov>
- ftp://ftp.ee.lbl.gov/old/tcpdump.tar.Z (3.4)
+ https://github.com/the-tcpdump-group/tcpdump.git
This directory contains source code for tcpdump, a tool for network
-monitoring and data acquisition. This software was originally
-developed by the Network Research Group at the Lawrence Berkeley
-National Laboratory. The original distribution is available via
-anonymous ftp to `ftp.ee.lbl.gov`, in `tcpdump.tar.Z`. More recent
-development is performed at tcpdump.org, http://www.tcpdump.org/
+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, also originally from LBL and now being maintained by
-tcpdump.org; see http://www.tcpdump.org/ .
+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 `INSTALL.txt`
-file.
+`../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
+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 <tcpdump@ee.lbl.gov>
+ ftp://ftp.ee.lbl.gov/old/tcpdump.tar.Z (3.4)
+```
-Over the past few years, tcpdump has been steadily improved by the
-excellent contributions from the Internet community (just browse
-through the `CHANGES` file). We are grateful for all the input.
-
+### 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.
-Some tools for viewing and analyzing tcpdump trace files are available
-from the Internet Traffic Archive:
-
-* http://www.sigcomm.org/ITA/
-
-Another tool that tcpdump users might find useful is tcpslice:
-
-* https://github.com/the-tcpdump-group/tcpslice
-
+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. See the above distribution for further details and
-documentation.
-
-Current versions can be found at www.tcpdump.org.
-
- - The TCPdump team
-
-original text by: Steve McCanne, Craig Leres, Van Jacobson
+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
diff --git a/contrib/tcpdump/VERSION b/contrib/tcpdump/VERSION
index c01c413359ff..9609202bb584 100644
--- a/contrib/tcpdump/VERSION
+++ b/contrib/tcpdump/VERSION
@@ -1 +1 @@
-4.9.3
+4.99.4
diff --git a/contrib/tcpdump/addrtoname.c b/contrib/tcpdump/addrtoname.c
index 25bad117425e..914665c2315a 100644
--- a/contrib/tcpdump/addrtoname.c
+++ b/contrib/tcpdump/addrtoname.c
@@ -23,7 +23,7 @@
*/
#ifdef HAVE_CONFIG_H
-#include "config.h"
+#include <config.h>
#endif
#ifdef HAVE_CASPER
@@ -31,32 +31,75 @@
#include <casper/cap_dns.h>
#endif /* HAVE_CASPER */
-#include <netdissect-stdinc.h>
+#include "netdissect-stdinc.h"
#ifdef USE_ETHER_NTOHOST
-#ifdef HAVE_NETINET_IF_ETHER_H
-struct mbuf; /* Squelch compiler warnings on some platforms for */
-struct rtentry; /* declarations in <net/if.h> */
-#include <net/if.h> /* for "struct ifnet" in "struct arpcom" on Solaris */
-#include <netinet/if_ether.h>
-#endif /* HAVE_NETINET_IF_ETHER_H */
-#ifdef NETINET_ETHER_H_DECLARES_ETHER_NTOHOST
-#include <netinet/ether.h>
-#endif /* NETINET_ETHER_H_DECLARES_ETHER_NTOHOST */
-
-#if !defined(HAVE_DECL_ETHER_NTOHOST) || !HAVE_DECL_ETHER_NTOHOST
-#ifndef HAVE_STRUCT_ETHER_ADDR
-struct ether_addr {
- unsigned char ether_addr_octet[6];
-};
-#endif
-extern int ether_ntohost(char *, const struct ether_addr *);
-#endif
-
+ #if defined(NET_ETHERNET_H_DECLARES_ETHER_NTOHOST)
+ /*
+ * OK, just include <net/ethernet.h>.
+ */
+ #include <net/ethernet.h>
+ #elif defined(NETINET_ETHER_H_DECLARES_ETHER_NTOHOST)
+ /*
+ * OK, just include <netinet/ether.h>
+ */
+ #include <netinet/ether.h>
+ #elif defined(SYS_ETHERNET_H_DECLARES_ETHER_NTOHOST)
+ /*
+ * OK, just include <sys/ethernet.h>
+ */
+ #include <sys/ethernet.h>
+ #elif defined(ARPA_INET_H_DECLARES_ETHER_NTOHOST)
+ /*
+ * OK, just include <arpa/inet.h>
+ */
+ #include <arpa/inet.h>
+ #elif defined(NETINET_IF_ETHER_H_DECLARES_ETHER_NTOHOST)
+ /*
+ * OK, include <netinet/if_ether.h>, after all the other stuff we
+ * need to include or define for its benefit.
+ */
+ #define NEED_NETINET_IF_ETHER_H
+ #else
+ /*
+ * We'll have to declare it ourselves.
+ * If <netinet/if_ether.h> defines struct ether_addr, include
+ * it. Otherwise, define it ourselves.
+ */
+ #ifdef HAVE_STRUCT_ETHER_ADDR
+ #define NEED_NETINET_IF_ETHER_H
+ #else /* HAVE_STRUCT_ETHER_ADDR */
+ struct ether_addr {
+ /* Beware FreeBSD calls this "octet". */
+ unsigned char ether_addr_octet[MAC_ADDR_LEN];
+ };
+ #endif /* HAVE_STRUCT_ETHER_ADDR */
+ #endif /* what declares ether_ntohost() */
+
+ #ifdef NEED_NETINET_IF_ETHER_H
+ /*
+ * Include diag-control.h before <net/if.h>, which too defines a macro
+ * named ND_UNREACHABLE.
+ */
+ #include "diag-control.h"
+ #include <net/if.h> /* Needed on some platforms */
+ #include <netinet/in.h> /* Needed on some platforms */
+ #include <netinet/if_ether.h>
+ #endif /* NEED_NETINET_IF_ETHER_H */
+
+ #ifndef HAVE_DECL_ETHER_NTOHOST
+ /*
+ * No header declares it, so declare it ourselves.
+ */
+ extern int ether_ntohost(char *, const struct ether_addr *);
+ #endif /* !defined(HAVE_DECL_ETHER_NTOHOST) */
#endif /* USE_ETHER_NTOHOST */
#include <pcap.h>
#include <pcap-namedb.h>
+#ifndef HAVE_GETSERVENT
+#include <getservent.h>
+#endif
#include <signal.h>
#include <stdio.h>
#include <string.h>
@@ -67,18 +110,13 @@ extern int ether_ntohost(char *, const struct ether_addr *);
#include "addrtostr.h"
#include "ethertype.h"
#include "llc.h"
-#include "setsignal.h"
#include "extract.h"
#include "oui.h"
-#ifndef ETHER_ADDR_LEN
-#define ETHER_ADDR_LEN 6
-#endif
-
/*
* hash tables for whatever-to-name translations
*
- * ndo_error() called on strdup(3) failure
+ * ndo_error() called on strdup(3) failure with S_ERR_ND_MEM_ALLOC status
*/
#define HASHNAMESIZE 4096
@@ -137,7 +175,7 @@ win32_gethostbyaddr(const char *addr, int len, int type)
#endif /* _WIN32 */
struct h6namemem {
- struct in6_addr addr;
+ nd_ipv6 addr;
char *name;
struct h6namemem *nxt;
};
@@ -183,25 +221,25 @@ static struct protoidmem protoidtable[HASHNAMESIZE];
const char *
intoa(uint32_t addr)
{
- register char *cp;
- register u_int byte;
- register int n;
+ char *cp;
+ u_int byte;
+ int n;
static char buf[sizeof(".xxx.xxx.xxx.xxx")];
- NTOHL(addr);
+ addr = ntohl(addr);
cp = buf + sizeof(buf);
*--cp = '\0';
n = 4;
do {
byte = addr & 0xff;
- *--cp = byte % 10 + '0';
+ *--cp = (char)(byte % 10) + '0';
byte /= 10;
if (byte > 0) {
- *--cp = byte % 10 + '0';
+ *--cp = (char)(byte % 10) + '0';
byte /= 10;
if (byte > 0)
- *--cp = byte + '0';
+ *--cp = (char)byte + '0';
}
*--cp = '.';
addr >>= 8;
@@ -213,16 +251,15 @@ intoa(uint32_t addr)
static uint32_t f_netmask;
static uint32_t f_localnet;
#ifdef HAVE_CASPER
-extern cap_channel_t *capdns;
+cap_channel_t *capdns;
#endif
/*
* Return a name for the IP address pointed to by ap. This address
* is assumed to be in network byte order.
*
- * NOTE: ap is *NOT* necessarily part of the packet data (not even if
- * this is being called with the "ipaddr_string()" macro), so you
- * *CANNOT* use the ND_TCHECK{2}/ND_TTEST{2} macros on it. Furthermore,
+ * NOTE: ap is *NOT* necessarily part of the packet data, so you
+ * *CANNOT* use the ND_TCHECK_* or ND_TTEST_* macros on it. Furthermore,
* even in cases where it *is* part of the packet data, the caller
* would still have to check for a null return value, even if it's
* just printing the return value with "%s" - not all versions of
@@ -236,9 +273,9 @@ extern cap_channel_t *capdns;
* also needs to check whether they're present in the packet buffer.
*/
const char *
-getname(netdissect_options *ndo, const u_char *ap)
+ipaddr_string(netdissect_options *ndo, const u_char *ap)
{
- register struct hostent *hp;
+ struct hostent *hp;
uint32_t addr;
struct hnamemem *p;
@@ -272,8 +309,8 @@ getname(netdissect_options *ndo, const u_char *ap)
p->name = strdup(hp->h_name);
if (p->name == NULL)
- (*ndo->ndo_error)(ndo,
- "getname: strdup(hp->h_name)");
+ (*ndo->ndo_error)(ndo, S_ERR_ND_MEM_ALLOC,
+ "%s: strdup(hp->h_name)", __func__);
if (ndo->ndo_Nflag) {
/* Remove domain qualifications */
dotp = strchr(p->name, '.');
@@ -285,7 +322,8 @@ getname(netdissect_options *ndo, const u_char *ap)
}
p->name = strdup(intoa(addr));
if (p->name == NULL)
- (*ndo->ndo_error)(ndo, "getname: strdup(intoa(addr))");
+ (*ndo->ndo_error)(ndo, S_ERR_ND_MEM_ALLOC,
+ "%s: strdup(intoa(addr))", __func__);
return (p->name);
}
@@ -294,18 +332,18 @@ getname(netdissect_options *ndo, const u_char *ap)
* is assumed to be in network byte order.
*/
const char *
-getname6(netdissect_options *ndo, const u_char *ap)
+ip6addr_string(netdissect_options *ndo, const u_char *ap)
{
- register struct hostent *hp;
+ struct hostent *hp;
union {
- struct in6_addr addr;
+ nd_ipv6 addr;
struct for_hash_addr {
char fill[14];
uint16_t d;
} addra;
} addr;
struct h6namemem *p;
- register const char *cp;
+ const char *cp;
char ntop_buf[INET6_ADDRSTRLEN];
memcpy(&addr, ap, sizeof(addr));
@@ -314,7 +352,7 @@ getname6(netdissect_options *ndo, const u_char *ap)
if (memcmp(&p->addr, &addr, sizeof(addr)) == 0)
return (p->name);
}
- p->addr = addr.addr;
+ memcpy(p->addr, addr.addr, sizeof(nd_ipv6));
p->nxt = newh6namemem(ndo);
/*
@@ -334,8 +372,8 @@ getname6(netdissect_options *ndo, const u_char *ap)
p->name = strdup(hp->h_name);
if (p->name == NULL)
- (*ndo->ndo_error)(ndo,
- "getname6: strdup(hp->h_name)");
+ (*ndo->ndo_error)(ndo, S_ERR_ND_MEM_ALLOC,
+ "%s: strdup(hp->h_name)", __func__);
if (ndo->ndo_Nflag) {
/* Remove domain qualifications */
dotp = strchr(p->name, '.');
@@ -348,19 +386,54 @@ getname6(netdissect_options *ndo, const u_char *ap)
cp = addrtostr6(ap, ntop_buf, sizeof(ntop_buf));
p->name = strdup(cp);
if (p->name == NULL)
- (*ndo->ndo_error)(ndo, "getname6: strdup(cp)");
+ (*ndo->ndo_error)(ndo, S_ERR_ND_MEM_ALLOC,
+ "%s: strdup(cp)", __func__);
return (p->name);
}
-static const char hex[16] = "0123456789abcdef";
+static const char hex[16] = {
+ '0', '1', '2', '3', '4', '5', '6', '7',
+ '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'
+};
+/*
+ * Convert an octet to two hex digits.
+ *
+ * Coverity appears either:
+ *
+ * not to believe the C standard when it asserts that a uint8_t is
+ * exactly 8 bits in size;
+ *
+ * not to believe that an unsigned type of exactly 8 bits has a value
+ * in the range of 0 to 255;
+ *
+ * not to believe that, for a range of unsigned values, if you shift
+ * one of those values right by 4 bits, the maximum result value is
+ * the maximum value shifted right by 4 bits, with no stray 1's shifted
+ * in;
+ *
+ * not to believe that 255 >> 4 is 15;
+ *
+ * so it gets upset that we're taking a "tainted" unsigned value, shifting
+ * it right 4 bits, and using it as an index into a 16-element array.
+ *
+ * So we do a stupid pointless masking of the result of the shift with
+ * 0xf, to hammer the point home to Coverity.
+ */
+static inline char *
+octet_to_hex(char *cp, uint8_t octet)
+{
+ *cp++ = hex[(octet >> 4) & 0xf];
+ *cp++ = hex[(octet >> 0) & 0xf];
+ return (cp);
+}
/* Find the hash node that corresponds the ether address 'ep' */
-static inline struct enamemem *
+static struct enamemem *
lookup_emem(netdissect_options *ndo, const u_char *ep)
{
- register u_int i, j, k;
+ u_int i, j, k;
struct enamemem *tp;
k = (ep[0] << 8) | ep[1];
@@ -375,12 +448,12 @@ lookup_emem(netdissect_options *ndo, const u_char *ep)
return tp;
else
tp = tp->e_nxt;
- tp->e_addr0 = i;
- tp->e_addr1 = j;
- tp->e_addr2 = k;
+ tp->e_addr0 = (u_short)i;
+ tp->e_addr1 = (u_short)j;
+ tp->e_addr2 = (u_short)k;
tp->e_nxt = (struct enamemem *)calloc(1, sizeof(*tp));
if (tp->e_nxt == NULL)
- (*ndo->ndo_error)(ndo, "lookup_emem: calloc");
+ (*ndo->ndo_error)(ndo, S_ERR_ND_MEM_ALLOC, "%s: calloc", __func__);
return tp;
}
@@ -390,12 +463,12 @@ lookup_emem(netdissect_options *ndo, const u_char *ep)
* with length 'nlen'
*/
-static inline struct bsnamemem *
-lookup_bytestring(netdissect_options *ndo, register const u_char *bs,
+static struct bsnamemem *
+lookup_bytestring(netdissect_options *ndo, const u_char *bs,
const unsigned int nlen)
{
struct bsnamemem *tp;
- register u_int i, j, k;
+ u_int i, j, k;
if (nlen >= 6) {
k = (bs[0] << 8) | bs[1];
@@ -419,30 +492,32 @@ lookup_bytestring(netdissect_options *ndo, register const u_char *bs,
else
tp = tp->bs_nxt;
- tp->bs_addr0 = i;
- tp->bs_addr1 = j;
- tp->bs_addr2 = k;
+ tp->bs_addr0 = (u_short)i;
+ tp->bs_addr1 = (u_short)j;
+ tp->bs_addr2 = (u_short)k;
tp->bs_bytes = (u_char *) calloc(1, nlen);
if (tp->bs_bytes == NULL)
- (*ndo->ndo_error)(ndo, "lookup_bytestring: calloc");
+ (*ndo->ndo_error)(ndo, S_ERR_ND_MEM_ALLOC,
+ "%s: calloc", __func__);
memcpy(tp->bs_bytes, bs, nlen);
tp->bs_nbytes = nlen;
tp->bs_nxt = (struct bsnamemem *)calloc(1, sizeof(*tp));
if (tp->bs_nxt == NULL)
- (*ndo->ndo_error)(ndo, "lookup_bytestring: calloc");
+ (*ndo->ndo_error)(ndo, S_ERR_ND_MEM_ALLOC,
+ "%s: calloc", __func__);
return tp;
}
/* Find the hash node that corresponds the NSAP 'nsap' */
-static inline struct enamemem *
-lookup_nsap(netdissect_options *ndo, register const u_char *nsap,
- register u_int nsap_length)
+static struct enamemem *
+lookup_nsap(netdissect_options *ndo, const u_char *nsap,
+ u_int nsap_length)
{
- register u_int i, j, k;
+ u_int i, j, k;
struct enamemem *tp;
const u_char *ensap;
@@ -466,27 +541,27 @@ lookup_nsap(netdissect_options *ndo, register const u_char *nsap,
return tp;
else
tp = tp->e_nxt;
- tp->e_addr0 = i;
- tp->e_addr1 = j;
- tp->e_addr2 = k;
+ tp->e_addr0 = (u_short)i;
+ tp->e_addr1 = (u_short)j;
+ tp->e_addr2 = (u_short)k;
tp->e_nsap = (u_char *)malloc(nsap_length + 1);
if (tp->e_nsap == NULL)
- (*ndo->ndo_error)(ndo, "lookup_nsap: malloc");
+ (*ndo->ndo_error)(ndo, S_ERR_ND_MEM_ALLOC, "%s: malloc", __func__);
tp->e_nsap[0] = (u_char)nsap_length; /* guaranteed < ISONSAP_MAX_LENGTH */
memcpy((char *)&tp->e_nsap[1], (const char *)nsap, nsap_length);
tp->e_nxt = (struct enamemem *)calloc(1, sizeof(*tp));
if (tp->e_nxt == NULL)
- (*ndo->ndo_error)(ndo, "lookup_nsap: calloc");
+ (*ndo->ndo_error)(ndo, S_ERR_ND_MEM_ALLOC, "%s: calloc", __func__);
return tp;
}
/* Find the hash node that corresponds the protoid 'pi'. */
-static inline struct protoidmem *
+static struct protoidmem *
lookup_protoid(netdissect_options *ndo, const u_char *pi)
{
- register u_int i, j;
+ u_int i, j;
struct protoidmem *tp;
/* 5 octets won't be aligned */
@@ -501,20 +576,20 @@ lookup_protoid(netdissect_options *ndo, const u_char *pi)
else
tp = tp->p_nxt;
tp->p_oui = i;
- tp->p_proto = j;
+ tp->p_proto = (u_short)j;
tp->p_nxt = (struct protoidmem *)calloc(1, sizeof(*tp));
if (tp->p_nxt == NULL)
- (*ndo->ndo_error)(ndo, "lookup_protoid: calloc");
+ (*ndo->ndo_error)(ndo, S_ERR_ND_MEM_ALLOC, "%s: calloc", __func__);
return tp;
}
const char *
-etheraddr_string(netdissect_options *ndo, register const u_char *ep)
+etheraddr_string(netdissect_options *ndo, const uint8_t *ep)
{
- register int i;
- register char *cp;
- register struct enamemem *tp;
+ int i;
+ char *cp;
+ struct enamemem *tp;
int oui;
char buf[BUFSIZE];
@@ -524,24 +599,29 @@ etheraddr_string(netdissect_options *ndo, register const u_char *ep)
#ifdef USE_ETHER_NTOHOST
if (!ndo->ndo_nflag) {
char buf2[BUFSIZE];
+ /*
+ * This is a non-const copy of ep for ether_ntohost(), which
+ * has its second argument non-const in OpenBSD. Also saves a
+ * type cast.
+ */
+ struct ether_addr ea;
- if (ether_ntohost(buf2, (const struct ether_addr *)ep) == 0) {
+ memcpy (&ea, ep, MAC_ADDR_LEN);
+ if (ether_ntohost(buf2, &ea) == 0) {
tp->e_name = strdup(buf2);
if (tp->e_name == NULL)
- (*ndo->ndo_error)(ndo,
- "etheraddr_string: strdup(buf2)");
+ (*ndo->ndo_error)(ndo, S_ERR_ND_MEM_ALLOC,
+ "%s: strdup(buf2)", __func__);
return (tp->e_name);
}
}
#endif
cp = buf;
- oui = EXTRACT_24BITS(ep);
- *cp++ = hex[*ep >> 4 ];
- *cp++ = hex[*ep++ & 0xf];
+ oui = EXTRACT_BE_U_3(ep);
+ cp = octet_to_hex(cp, *ep++);
for (i = 5; --i >= 0;) {
*cp++ = ':';
- *cp++ = hex[*ep >> 4 ];
- *cp++ = hex[*ep++ & 0xf];
+ cp = octet_to_hex(cp, *ep++);
}
if (!ndo->ndo_nflag) {
@@ -551,17 +631,18 @@ etheraddr_string(netdissect_options *ndo, register const u_char *ep)
*cp = '\0';
tp->e_name = strdup(buf);
if (tp->e_name == NULL)
- (*ndo->ndo_error)(ndo, "etheraddr_string: strdup(buf)");
+ (*ndo->ndo_error)(ndo, S_ERR_ND_MEM_ALLOC,
+ "%s: strdup(buf)", __func__);
return (tp->e_name);
}
const char *
-le64addr_string(netdissect_options *ndo, const u_char *ep)
+le64addr_string(netdissect_options *ndo, const uint8_t *ep)
{
const unsigned int len = 8;
- register u_int i;
- register char *cp;
- register struct bsnamemem *tp;
+ u_int i;
+ char *cp;
+ struct bsnamemem *tp;
char buf[BUFSIZE];
tp = lookup_bytestring(ndo, ep, len);
@@ -570,8 +651,7 @@ le64addr_string(netdissect_options *ndo, const u_char *ep)
cp = buf;
for (i = len; i > 0 ; --i) {
- *cp++ = hex[*(ep + i - 1) >> 4];
- *cp++ = hex[*(ep + i - 1) & 0xf];
+ cp = octet_to_hex(cp, *(ep + i - 1));
*cp++ = ':';
}
cp --;
@@ -580,23 +660,24 @@ le64addr_string(netdissect_options *ndo, const u_char *ep)
tp->bs_name = strdup(buf);
if (tp->bs_name == NULL)
- (*ndo->ndo_error)(ndo, "le64addr_string: strdup(buf)");
+ (*ndo->ndo_error)(ndo, S_ERR_ND_MEM_ALLOC,
+ "%s: strdup(buf)", __func__);
return (tp->bs_name);
}
const char *
-linkaddr_string(netdissect_options *ndo, const u_char *ep,
+linkaddr_string(netdissect_options *ndo, const uint8_t *ep,
const unsigned int type, const unsigned int len)
{
- register u_int i;
- register char *cp;
- register struct bsnamemem *tp;
+ u_int i;
+ char *cp;
+ struct bsnamemem *tp;
if (len == 0)
return ("<empty>");
- if (type == LINKADDR_ETHER && len == ETHER_ADDR_LEN)
+ if (type == LINKADDR_ETHER && len == MAC_ADDR_LEN)
return (etheraddr_string(ndo, ep));
if (type == LINKADDR_FRELAY)
@@ -608,83 +689,25 @@ linkaddr_string(netdissect_options *ndo, const u_char *ep,
tp->bs_name = cp = (char *)malloc(len*3);
if (tp->bs_name == NULL)
- (*ndo->ndo_error)(ndo, "linkaddr_string: malloc");
- *cp++ = hex[*ep >> 4];
- *cp++ = hex[*ep++ & 0xf];
+ (*ndo->ndo_error)(ndo, S_ERR_ND_MEM_ALLOC,
+ "%s: malloc", __func__);
+ cp = octet_to_hex(cp, *ep++);
for (i = len-1; i > 0 ; --i) {
*cp++ = ':';
- *cp++ = hex[*ep >> 4];
- *cp++ = hex[*ep++ & 0xf];
+ cp = octet_to_hex(cp, *ep++);
}
*cp = '\0';
return (tp->bs_name);
}
-const char *
-etherproto_string(netdissect_options *ndo, u_short port)
-{
- register char *cp;
- register struct hnamemem *tp;
- register uint32_t i = port;
- char buf[sizeof("0000")];
-
- for (tp = &eprototable[i & (HASHNAMESIZE-1)]; tp->nxt; tp = tp->nxt)
- if (tp->addr == i)
- return (tp->name);
-
- tp->addr = i;
- tp->nxt = newhnamemem(ndo);
-
- cp = buf;
- NTOHS(port);
- *cp++ = hex[port >> 12 & 0xf];
- *cp++ = hex[port >> 8 & 0xf];
- *cp++ = hex[port >> 4 & 0xf];
- *cp++ = hex[port & 0xf];
- *cp++ = '\0';
- tp->name = strdup(buf);
- if (tp->name == NULL)
- (*ndo->ndo_error)(ndo, "etherproto_string: strdup(buf)");
- return (tp->name);
-}
-
-const char *
-protoid_string(netdissect_options *ndo, register const u_char *pi)
-{
- register u_int i, j;
- register char *cp;
- register struct protoidmem *tp;
- char buf[sizeof("00:00:00:00:00")];
-
- tp = lookup_protoid(ndo, pi);
- if (tp->p_name)
- return tp->p_name;
-
- cp = buf;
- if ((j = *pi >> 4) != 0)
- *cp++ = hex[j];
- *cp++ = hex[*pi++ & 0xf];
- for (i = 4; (int)--i >= 0;) {
- *cp++ = ':';
- if ((j = *pi >> 4) != 0)
- *cp++ = hex[j];
- *cp++ = hex[*pi++ & 0xf];
- }
- *cp = '\0';
- tp->p_name = strdup(buf);
- if (tp->p_name == NULL)
- (*ndo->ndo_error)(ndo, "protoid_string: strdup(buf)");
- return (tp->p_name);
-}
-
#define ISONSAP_MAX_LENGTH 20
const char *
-isonsap_string(netdissect_options *ndo, const u_char *nsap,
- register u_int nsap_length)
+isonsap_string(netdissect_options *ndo, const uint8_t *nsap,
+ u_int nsap_length)
{
- register u_int nsap_idx;
- register char *cp;
- register struct enamemem *tp;
+ u_int nsap_idx;
+ char *cp;
+ struct enamemem *tp;
if (nsap_length < 1 || nsap_length > ISONSAP_MAX_LENGTH)
return ("isonsap_string: illegal length");
@@ -695,14 +718,14 @@ isonsap_string(netdissect_options *ndo, const u_char *nsap,
tp->e_name = cp = (char *)malloc(sizeof("xx.xxxx.xxxx.xxxx.xxxx.xxxx.xxxx.xxxx.xxxx.xxxx.xx"));
if (cp == NULL)
- (*ndo->ndo_error)(ndo, "isonsap_string: malloc");
+ (*ndo->ndo_error)(ndo, S_ERR_ND_MEM_ALLOC,
+ "%s: malloc", __func__);
for (nsap_idx = 0; nsap_idx < nsap_length; nsap_idx++) {
- *cp++ = hex[*nsap >> 4];
- *cp++ = hex[*nsap++ & 0xf];
+ cp = octet_to_hex(cp, *nsap++);
if (((nsap_idx & 1) == 0) &&
(nsap_idx + 1 < nsap_length)) {
- *cp++ = '.';
+ *cp++ = '.';
}
}
*cp = '\0';
@@ -712,8 +735,8 @@ isonsap_string(netdissect_options *ndo, const u_char *nsap,
const char *
tcpport_string(netdissect_options *ndo, u_short port)
{
- register struct hnamemem *tp;
- register uint32_t i = port;
+ struct hnamemem *tp;
+ uint32_t i = port;
char buf[sizeof("00000")];
for (tp = &tporttable[i & (HASHNAMESIZE-1)]; tp->nxt; tp = tp->nxt)
@@ -726,15 +749,16 @@ tcpport_string(netdissect_options *ndo, u_short port)
(void)snprintf(buf, sizeof(buf), "%u", i);
tp->name = strdup(buf);
if (tp->name == NULL)
- (*ndo->ndo_error)(ndo, "tcpport_string: strdup(buf)");
+ (*ndo->ndo_error)(ndo, S_ERR_ND_MEM_ALLOC,
+ "%s: strdup(buf)", __func__);
return (tp->name);
}
const char *
-udpport_string(netdissect_options *ndo, register u_short port)
+udpport_string(netdissect_options *ndo, u_short port)
{
- register struct hnamemem *tp;
- register uint32_t i = port;
+ struct hnamemem *tp;
+ uint32_t i = port;
char buf[sizeof("00000")];
for (tp = &uporttable[i & (HASHNAMESIZE-1)]; tp->nxt; tp = tp->nxt)
@@ -747,16 +771,17 @@ udpport_string(netdissect_options *ndo, register u_short port)
(void)snprintf(buf, sizeof(buf), "%u", i);
tp->name = strdup(buf);
if (tp->name == NULL)
- (*ndo->ndo_error)(ndo, "udpport_string: strdup(buf)");
+ (*ndo->ndo_error)(ndo, S_ERR_ND_MEM_ALLOC,
+ "%s: strdup(buf)", __func__);
return (tp->name);
}
const char *
ipxsap_string(netdissect_options *ndo, u_short port)
{
- register char *cp;
- register struct hnamemem *tp;
- register uint32_t i = port;
+ char *cp;
+ struct hnamemem *tp;
+ uint32_t i = port;
char buf[sizeof("0000")];
for (tp = &ipxsaptable[i & (HASHNAMESIZE-1)]; tp->nxt; tp = tp->nxt)
@@ -767,7 +792,7 @@ ipxsap_string(netdissect_options *ndo, u_short port)
tp->nxt = newhnamemem(ndo);
cp = buf;
- NTOHS(port);
+ port = ntohs(port);
*cp++ = hex[port >> 12 & 0xf];
*cp++ = hex[port >> 8 & 0xf];
*cp++ = hex[port >> 4 & 0xf];
@@ -775,7 +800,8 @@ ipxsap_string(netdissect_options *ndo, u_short port)
*cp++ = '\0';
tp->name = strdup(buf);
if (tp->name == NULL)
- (*ndo->ndo_error)(ndo, "ipxsap_string: strdup(buf)");
+ (*ndo->ndo_error)(ndo, S_ERR_ND_MEM_ALLOC,
+ "%s: strdup(buf)", __func__);
return (tp->name);
}
@@ -783,8 +809,8 @@ static void
init_servarray(netdissect_options *ndo)
{
struct servent *sv;
- register struct hnamemem *table;
- register int i;
+ struct hnamemem *table;
+ int i;
char buf[sizeof("0000000000")];
while ((sv = getservent()) != NULL) {
@@ -805,7 +831,8 @@ init_servarray(netdissect_options *ndo)
} else
table->name = strdup(sv->s_name);
if (table->name == NULL)
- (*ndo->ndo_error)(ndo, "init_servarray: strdup");
+ (*ndo->ndo_error)(ndo, S_ERR_ND_MEM_ALLOC,
+ "%s: strdup", __func__);
table->addr = port;
table->nxt = newhnamemem(ndo);
@@ -817,34 +844,26 @@ static const struct eproto {
const char *s;
u_short p;
} eproto_db[] = {
- { "pup", ETHERTYPE_PUP },
- { "xns", ETHERTYPE_NS },
+ { "aarp", ETHERTYPE_AARP },
+ { "arp", ETHERTYPE_ARP },
+ { "atalk", ETHERTYPE_ATALK },
+ { "decnet", ETHERTYPE_DN },
{ "ip", ETHERTYPE_IP },
{ "ip6", ETHERTYPE_IPV6 },
- { "arp", ETHERTYPE_ARP },
- { "rarp", ETHERTYPE_REVARP },
- { "sprite", ETHERTYPE_SPRITE },
+ { "lat", ETHERTYPE_LAT },
+ { "loopback", ETHERTYPE_LOOPBACK },
{ "mopdl", ETHERTYPE_MOPDL },
{ "moprc", ETHERTYPE_MOPRC },
- { "decnet", ETHERTYPE_DN },
- { "lat", ETHERTYPE_LAT },
+ { "rarp", ETHERTYPE_REVARP },
{ "sca", ETHERTYPE_SCA },
- { "lanbridge", ETHERTYPE_LANBRIDGE },
- { "vexp", ETHERTYPE_VEXP },
- { "vprod", ETHERTYPE_VPROD },
- { "atalk", ETHERTYPE_ATALK },
- { "atalkarp", ETHERTYPE_AARP },
- { "loopback", ETHERTYPE_LOOPBACK },
- { "decdts", ETHERTYPE_DECDTS },
- { "decdns", ETHERTYPE_DECDNS },
{ (char *)0, 0 }
};
static void
init_eprotoarray(netdissect_options *ndo)
{
- register int i;
- register struct hnamemem *table;
+ int i;
+ struct hnamemem *table;
for (i = 0; eproto_db[i].s; i++) {
int j = htons(eproto_db[i].p) & (HASHNAMESIZE-1);
@@ -876,8 +895,8 @@ static const struct protoidlist {
static void
init_protoidarray(netdissect_options *ndo)
{
- register int i;
- register struct protoidmem *tp;
+ int i;
+ struct protoidmem *tp;
const struct protoidlist *pl;
u_char protoid[5];
@@ -891,8 +910,8 @@ init_protoidarray(netdissect_options *ndo)
tp = lookup_protoid(ndo, protoid);
tp->p_name = strdup(eproto_db[i].s);
if (tp->p_name == NULL)
- (*ndo->ndo_error)(ndo,
- "init_protoidarray: strdup(eproto_db[i].s)");
+ (*ndo->ndo_error)(ndo, S_ERR_ND_MEM_ALLOC,
+ "%s: strdup(eproto_db[i].s)", __func__);
}
/* Hardwire some SNAP proto ID names */
for (pl = protoidlist; pl->name != NULL; ++pl) {
@@ -906,7 +925,7 @@ init_protoidarray(netdissect_options *ndo)
}
static const struct etherlist {
- const u_char addr[6];
+ const nd_mac_addr addr;
const char *name;
} etherlist[] = {
{{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }, "Broadcast" },
@@ -930,13 +949,13 @@ static const struct etherlist {
static void
init_etherarray(netdissect_options *ndo)
{
- register const struct etherlist *el;
- register struct enamemem *tp;
+ const struct etherlist *el;
+ struct enamemem *tp;
#ifdef USE_ETHER_NTOHOST
char name[256];
#else
- register struct pcap_etherent *ep;
- register FILE *fp;
+ struct pcap_etherent *ep;
+ FILE *fp;
/* Suck in entire ethers file */
fp = fopen(PCAP_ETHERS_FILE, "r");
@@ -945,8 +964,8 @@ init_etherarray(netdissect_options *ndo)
tp = lookup_emem(ndo, ep->addr);
tp->e_name = strdup(ep->name);
if (tp->e_name == NULL)
- (*ndo->ndo_error)(ndo,
- "init_etherarray: strdup(ep->addr)");
+ (*ndo->ndo_error)(ndo, S_ERR_ND_MEM_ALLOC,
+ "%s: strdup(ep->addr)", __func__);
}
(void)fclose(fp);
}
@@ -963,11 +982,14 @@ init_etherarray(netdissect_options *ndo)
/*
* Use YP/NIS version of name if available.
*/
- if (ether_ntohost(name, (const struct ether_addr *)el->addr) == 0) {
+ /* Same workaround as in etheraddr_string(). */
+ struct ether_addr ea;
+ memcpy (&ea, el->addr, MAC_ADDR_LEN);
+ if (ether_ntohost(name, &ea) == 0) {
tp->e_name = strdup(name);
if (tp->e_name == NULL)
- (*ndo->ndo_error)(ndo,
- "init_etherarray: strdup(name)");
+ (*ndo->ndo_error)(ndo, S_ERR_ND_MEM_ALLOC,
+ "%s: strdup(name)", __func__);
continue;
}
#endif
@@ -975,7 +997,10 @@ init_etherarray(netdissect_options *ndo)
}
}
-static const struct tok ipxsap_db[] = {
+static const struct ipxsap_ent {
+ uint16_t v;
+ const char *s;
+} ipxsap_db[] = {
{ 0x0000, "Unknown" },
{ 0x0001, "User" },
{ 0x0002, "User Group" },
@@ -1195,11 +1220,11 @@ static const struct tok ipxsap_db[] = {
static void
init_ipxsaparray(netdissect_options *ndo)
{
- register int i;
- register struct hnamemem *table;
+ int i;
+ struct hnamemem *table;
for (i = 0; ipxsap_db[i].s != NULL; i++) {
- int j = htons(ipxsap_db[i].v) & (HASHNAMESIZE-1);
+ u_int j = htons(ipxsap_db[i].v) & (HASHNAMESIZE-1);
table = &ipxsaptable[j];
while (table->name)
table = table->nxt;
@@ -1238,7 +1263,7 @@ init_addrtoname(netdissect_options *ndo, uint32_t localnet, uint32_t mask)
const char *
dnaddr_string(netdissect_options *ndo, u_short dnaddr)
{
- register struct hnamemem *tp;
+ struct hnamemem *tp;
for (tp = &dnaddrtable[dnaddr & (HASHNAMESIZE-1)]; tp->nxt != NULL;
tp = tp->nxt)
@@ -1256,15 +1281,16 @@ dnaddr_string(netdissect_options *ndo, u_short dnaddr)
struct hnamemem *
newhnamemem(netdissect_options *ndo)
{
- register struct hnamemem *p;
+ struct hnamemem *p;
static struct hnamemem *ptr = NULL;
static u_int num = 0;
- if (num <= 0) {
+ if (num == 0) {
num = 64;
ptr = (struct hnamemem *)calloc(num, sizeof (*ptr));
if (ptr == NULL)
- (*ndo->ndo_error)(ndo, "newhnamemem: calloc");
+ (*ndo->ndo_error)(ndo, S_ERR_ND_MEM_ALLOC,
+ "%s: calloc", __func__);
}
--num;
p = ptr++;
@@ -1275,15 +1301,16 @@ newhnamemem(netdissect_options *ndo)
struct h6namemem *
newh6namemem(netdissect_options *ndo)
{
- register struct h6namemem *p;
+ struct h6namemem *p;
static struct h6namemem *ptr = NULL;
static u_int num = 0;
- if (num <= 0) {
+ if (num == 0) {
num = 64;
ptr = (struct h6namemem *)calloc(num, sizeof (*ptr));
if (ptr == NULL)
- (*ndo->ndo_error)(ndo, "newh6namemem: calloc");
+ (*ndo->ndo_error)(ndo, S_ERR_ND_MEM_ALLOC,
+ "%s: calloc", __func__);
}
--num;
p = ptr++;
diff --git a/contrib/tcpdump/addrtoname.h b/contrib/tcpdump/addrtoname.h
index fe8b6bbe5451..597f4e1edcf0 100644
--- a/contrib/tcpdump/addrtoname.h
+++ b/contrib/tcpdump/addrtoname.h
@@ -19,8 +19,15 @@
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
+#include "extract.h"
+
+#ifdef HAVE_CASPER
+#include <libcasper.h>
+extern cap_channel_t *capdns;
+#endif
+
/*
- * Definitions to let us compile most of the IPv6 code even on systems
+ * Definition to let us compile most of the IPv6 code even on systems
* without IPv6 support.
*/
#ifndef INET6_ADDRSTRLEN
@@ -39,18 +46,16 @@ enum {
#define BUFSIZE 128
-extern const char *linkaddr_string(netdissect_options *, const u_char *, const unsigned int, const unsigned int);
-extern const char *etheraddr_string(netdissect_options *, const u_char *);
-extern const char *le64addr_string(netdissect_options *, const u_char *);
-extern const char *etherproto_string(netdissect_options *, u_short);
+extern const char *linkaddr_string(netdissect_options *, const uint8_t *, const unsigned int, const unsigned int);
+extern const char *etheraddr_string(netdissect_options *, const uint8_t *);
+extern const char *le64addr_string(netdissect_options *, const uint8_t *);
extern const char *tcpport_string(netdissect_options *, u_short);
extern const char *udpport_string(netdissect_options *, u_short);
-extern const char *isonsap_string(netdissect_options *, const u_char *, register u_int);
+extern const char *isonsap_string(netdissect_options *, const uint8_t *, u_int);
extern const char *dnaddr_string(netdissect_options *, u_short);
-extern const char *protoid_string(netdissect_options *, const u_char *);
extern const char *ipxsap_string(netdissect_options *, u_short);
-extern const char *getname(netdissect_options *, const u_char *);
-extern const char *getname6(netdissect_options *, const u_char *);
+extern const char *ipaddr_string(netdissect_options *, const u_char *);
+extern const char *ip6addr_string(netdissect_options *, const u_char *);
extern const char *intoa(uint32_t);
extern void init_addrtoname(netdissect_options *, uint32_t, uint32_t);
@@ -58,5 +63,64 @@ extern struct hnamemem *newhnamemem(netdissect_options *);
extern struct h6namemem *newh6namemem(netdissect_options *);
extern const char * ieee8021q_tci_string(const uint16_t);
-#define ipaddr_string(ndo, p) getname(ndo, (const u_char *)(p))
-#define ip6addr_string(ndo, p) getname6(ndo, (const u_char *)(p))
+/* macro(s) and inline function(s) with setjmp/longjmp logic to call
+ * the X_string() function(s) after bounds checking.
+ * The macro(s) must be used on a packet buffer pointer.
+ */
+
+static inline const char *
+get_linkaddr_string(netdissect_options *ndo, const uint8_t *p,
+ const unsigned int type, const unsigned int len)
+{
+ if (!ND_TTEST_LEN(p, len))
+ nd_trunc_longjmp(ndo);
+ return linkaddr_string(ndo, p, type, len);
+}
+
+static inline const char *
+get_etheraddr_string(netdissect_options *ndo, const uint8_t *p)
+{
+ if (!ND_TTEST_LEN(p, MAC_ADDR_LEN))
+ nd_trunc_longjmp(ndo);
+ return etheraddr_string(ndo, p);
+}
+
+static inline const char *
+get_le64addr_string(netdissect_options *ndo, const u_char *p)
+{
+ if (!ND_TTEST_8(p))
+ nd_trunc_longjmp(ndo);
+ return le64addr_string(ndo, p);
+}
+
+static inline const char *
+get_isonsap_string(netdissect_options *ndo, const uint8_t *nsap,
+ u_int nsap_length)
+{
+ if (!ND_TTEST_LEN(nsap, nsap_length))
+ nd_trunc_longjmp(ndo);
+ return isonsap_string(ndo, nsap, nsap_length);
+}
+
+static inline const char *
+get_ipaddr_string(netdissect_options *ndo, const u_char *p)
+{
+ if (!ND_TTEST_4(p))
+ nd_trunc_longjmp(ndo);
+ return ipaddr_string(ndo, p);
+}
+
+static inline const char *
+get_ip6addr_string(netdissect_options *ndo, const u_char *p)
+{
+ if (!ND_TTEST_16(p))
+ nd_trunc_longjmp(ndo);
+ return ip6addr_string(ndo, p);
+}
+
+#define GET_LINKADDR_STRING(p, type, len) get_linkaddr_string(ndo, (const u_char *)(p), type, len)
+#define GET_ETHERADDR_STRING(p) get_etheraddr_string(ndo, (const u_char *)(p))
+#define GET_LE64ADDR_STRING(p) get_le64addr_string(ndo, (const u_char *)(p))
+#define GET_ISONSAP_STRING(nsap, nsap_length) get_isonsap_string(ndo, (const u_char *)(nsap), nsap_length)
+#define GET_IPADDR_STRING(p) get_ipaddr_string(ndo, (const u_char *)(p))
+#define GET_IP6ADDR_STRING(p) get_ip6addr_string(ndo, (const u_char *)(p))
diff --git a/contrib/tcpdump/addrtostr.c b/contrib/tcpdump/addrtostr.c
index 6b067675944f..c3bdb8af342c 100644
--- a/contrib/tcpdump/addrtostr.c
+++ b/contrib/tcpdump/addrtostr.c
@@ -37,10 +37,10 @@
*/
#ifdef HAVE_CONFIG_H
-#include "config.h"
+#include <config.h>
#endif
-#include <netdissect-stdinc.h>
+#include "netdissect-stdinc.h"
#include "addrtostr.h"
#include <stdio.h>
@@ -71,7 +71,7 @@ addrtostr (const void *src, char *dst, size_t size)
return NULL;
}
for (i = 0; i < 4; ++i) {
- int n = *srcaddr++;
+ int n = *srcaddr++;
int non_zerop = 0;
if (non_zerop || n / 100 > 0) {
@@ -127,7 +127,7 @@ addrtostr6 (const void *src, char *dst, size_t size)
best.base = -1;
cur.len = 0;
cur.base = -1;
- for (i = 0; i < (int)(IN6ADDRSZ / INT16SZ); i++)
+ for (i = 0; i < (IN6ADDRSZ / INT16SZ); i++)
{
if (words[i] == 0)
{
@@ -160,14 +160,14 @@ addrtostr6 (const void *src, char *dst, size_t size)
*dp++ = c; \
space_left--; \
}
- for (i = 0; i < (int)(IN6ADDRSZ / INT16SZ); i++)
+ for (i = 0; i < (IN6ADDRSZ / INT16SZ); i++)
{
/* Are we inside the best run of 0x00's?
*/
if (best.base != -1 && i >= best.base && i < (best.base + best.len))
{
if (i == best.base)
- APPEND_CHAR(':');
+ APPEND_CHAR(':');
continue;
}
diff --git a/contrib/tcpdump/af.c b/contrib/tcpdump/af.c
index 704e2f0ace93..1153f102b407 100644
--- a/contrib/tcpdump/af.c
+++ b/contrib/tcpdump/af.c
@@ -16,10 +16,10 @@
*/
#ifdef HAVE_CONFIG_H
-#include "config.h"
+#include <config.h>
#endif
-#include <netdissect-stdinc.h>
+#include "netdissect-stdinc.h"
#include "netdissect.h"
#include "af.h"
diff --git a/contrib/tcpdump/af.h b/contrib/tcpdump/af.h
index 6365b1262073..b9fec8e635ad 100644
--- a/contrib/tcpdump/af.h
+++ b/contrib/tcpdump/af.h
@@ -52,4 +52,4 @@ extern const struct tok bsd_af_values[];
#define BSD_AFNUM_IPX 23
#define BSD_AFNUM_INET6_BSD 24 /* NetBSD, OpenBSD, BSD/OS, Npcap */
#define BSD_AFNUM_INET6_FREEBSD 28 /* FreeBSD */
-#define BSD_AFNUM_INET6_DARWIN 30 /* OS X, iOS, other Darwin-based OSes */
+#define BSD_AFNUM_INET6_DARWIN 30 /* macOS, iOS, other Darwin-based OSes */
diff --git a/contrib/tcpdump/ah.h b/contrib/tcpdump/ah.h
index d87a087e1a89..c60c56353f15 100644
--- a/contrib/tcpdump/ah.h
+++ b/contrib/tcpdump/ah.h
@@ -31,27 +31,37 @@
*/
/*
- * RFC1826/2402 authentication header.
+ * RFC4302 authentication header.
*/
-#ifndef _NETINET6_AH_H_
-#define _NETINET6_AH_H_
+#ifndef ND_AH_H_
+#define ND_AH_H_
-struct ah {
- uint8_t ah_nxt; /* Next Header */
- uint8_t ah_len; /* Length of data, in 32bit */
- uint16_t ah_reserve; /* Reserved for future use */
- uint32_t ah_spi; /* Security parameter index */
- /* variable size, 32bit bound*/ /* Authentication data */
-};
+/*
+ * 0 1 2 3
+ * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | Next Header | Payload Len | RESERVED |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | Security Parameters Index (SPI) |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | Sequence Number Field |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | |
+ * + Integrity Check Value-ICV (variable) |
+ * | |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ *
+ * Figure 1. AH Format
+ */
-struct newah {
- uint8_t ah_nxt; /* Next Header */
- uint8_t ah_len; /* Length of data + 1, in 32bit */
- uint16_t ah_reserve; /* Reserved for future use */
- uint32_t ah_spi; /* Security parameter index */
- uint32_t ah_seq; /* Sequence number field */
- /* variable size, 32bit bound*/ /* Authentication data */
+struct ah {
+ nd_uint8_t ah_nxt; /* Next Header */
+ nd_uint8_t ah_len; /* Payload Len in 32bit words minus 2 */
+ nd_uint16_t ah_reserved; /* Reserved for future use */
+ nd_uint32_t ah_spi; /* Security Parameters Index */
+ nd_uint32_t ah_seq; /* Sequence Number Field */
+ /* variable size, 32bit bound*/ /* Integrity Check Value-ICV */
};
-#endif /*_NETINET6_AH_H_*/
+#endif /* ND_AH_H_ */
diff --git a/contrib/tcpdump/appletalk.h b/contrib/tcpdump/appletalk.h
index 3fbcbce00e13..ef4013f13d34 100644
--- a/contrib/tcpdump/appletalk.h
+++ b/contrib/tcpdump/appletalk.h
@@ -22,9 +22,9 @@
*/
struct LAP {
- uint8_t dst;
- uint8_t src;
- uint8_t type;
+ nd_uint8_t dst;
+ nd_uint8_t src;
+ nd_uint8_t type;
};
#define lapShortDDP 1 /* short DDP type */
#define lapDDP 2 /* DDP type */
@@ -33,22 +33,22 @@ struct LAP {
/* Datagram Delivery Protocol */
struct atDDP {
- uint16_t length;
- uint16_t checksum;
- uint16_t dstNet;
- uint16_t srcNet;
- uint8_t dstNode;
- uint8_t srcNode;
- uint8_t dstSkt;
- uint8_t srcSkt;
- uint8_t type;
+ nd_uint16_t length;
+ nd_uint16_t checksum;
+ nd_uint16_t dstNet;
+ nd_uint16_t srcNet;
+ nd_uint8_t dstNode;
+ nd_uint8_t srcNode;
+ nd_uint8_t dstSkt;
+ nd_uint8_t srcSkt;
+ nd_uint8_t type;
};
struct atShortDDP {
- uint16_t length;
- uint8_t dstSkt;
- uint8_t srcSkt;
- uint8_t type;
+ nd_uint16_t length;
+ nd_uint8_t dstSkt;
+ nd_uint8_t srcSkt;
+ nd_uint8_t type;
};
#define ddpMaxWKS 0x7F
@@ -72,10 +72,10 @@ struct atShortDDP {
/* AppleTalk Transaction Protocol */
struct atATP {
- uint8_t control;
- uint8_t bitmap;
- uint16_t transID;
- int32_t userData;
+ nd_uint8_t control;
+ nd_uint8_t bitmap;
+ nd_uint16_t transID;
+ nd_uint32_t userData;
};
#define atpReqCode 0x40
@@ -93,8 +93,8 @@ struct atATP {
/* AppleTalk Echo Protocol */
struct atEcho {
- uint8_t echoFunction;
- uint8_t *echoData;
+ nd_uint8_t echoFunction;
+ nd_uint8_t echoData[1]; /* Should be [], C99-style */
};
#define echoSkt 4 /* the echoer socket */
@@ -106,15 +106,15 @@ struct atEcho {
/* Name Binding Protocol */
struct atNBP {
- uint8_t control;
- uint8_t id;
+ nd_uint8_t control;
+ nd_uint8_t id;
};
struct atNBPtuple {
- uint16_t net;
- uint8_t node;
- uint8_t skt;
- uint8_t enumerator;
+ nd_uint16_t net;
+ nd_uint8_t node;
+ nd_uint8_t skt;
+ nd_uint8_t enumerator;
};
#define nbpBrRq 0x10
@@ -140,8 +140,8 @@ struct atNBPtuple {
/* Zone Information Protocol */
struct zipHeader {
- uint8_t command;
- uint8_t netcount;
+ nd_uint8_t command;
+ nd_uint8_t netcount;
};
#define zipHeaderSize 2
diff --git a/contrib/tcpdump/ascii_strcasecmp.c b/contrib/tcpdump/ascii_strcasecmp.c
index b8decf141b05..090f75869ef8 100644
--- a/contrib/tcpdump/ascii_strcasecmp.c
+++ b/contrib/tcpdump/ascii_strcasecmp.c
@@ -58,7 +58,7 @@ static const unsigned char charmap[] = {
int
ascii_strcasecmp(const char *s1, const char *s2)
{
- register const unsigned char *cm = charmap,
+ const unsigned char *cm = charmap,
*us1 = (const unsigned char *)s1,
*us2 = (const unsigned char *)s2;
@@ -69,9 +69,9 @@ ascii_strcasecmp(const char *s1, const char *s2)
}
int
-ascii_strncasecmp(const char *s1, const char *s2, register size_t n)
+ascii_strncasecmp(const char *s1, const char *s2, size_t n)
{
- register const unsigned char *cm = charmap,
+ const unsigned char *cm = charmap,
*us1 = (const unsigned char *)s1,
*us2 = (const unsigned char *)s2;
diff --git a/contrib/tcpdump/atime.awk b/contrib/tcpdump/atime.awk
index b42dec240186..fa1c7a18715e 100644
--- a/contrib/tcpdump/atime.awk
+++ b/contrib/tcpdump/atime.awk
@@ -1,4 +1,4 @@
-$6 ~ /^ack/ && $5 !~ /[SFR]/ {
+$6 ~ /^ack/ && $5 !~ /[SFR]/ {
# given a tcpdump ftp trace, output one line for each ack
# in the form
# <ack time> <seq no>
diff --git a/contrib/tcpdump/bpf_dump.c b/contrib/tcpdump/bpf_dump.c
index 9bad38d387e0..1ac74a24127c 100644
--- a/contrib/tcpdump/bpf_dump.c
+++ b/contrib/tcpdump/bpf_dump.c
@@ -20,14 +20,15 @@
*/
#ifdef HAVE_CONFIG_H
-#include "config.h"
+#include <config.h>
#endif
-#include <netdissect-stdinc.h>
+#include "netdissect-stdinc.h"
#include <stdio.h>
#include "netdissect.h"
+#include "interface.h"
void
bpf_dump(const struct bpf_program *p, int option)
diff --git a/contrib/tcpdump/chdlc.h b/contrib/tcpdump/chdlc.h
index d5a2d915eada..14bdb258cf01 100644
--- a/contrib/tcpdump/chdlc.h
+++ b/contrib/tcpdump/chdlc.h
@@ -19,7 +19,7 @@
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
-#define CHDLC_HDRLEN 4
+#define CHDLC_HDRLEN 4
#define CHDLC_UNICAST 0x0f
#define CHDLC_BCAST 0x8f
#define CHDLC_TYPE_SLARP 0x8035
diff --git a/contrib/tcpdump/checksum.c b/contrib/tcpdump/checksum.c
index a48a147f35c2..e6e84a2510db 100644
--- a/contrib/tcpdump/checksum.c
+++ b/contrib/tcpdump/checksum.c
@@ -18,10 +18,10 @@
*/
#ifdef HAVE_CONFIG_H
-#include "config.h"
+#include <config.h>
#endif
-#include <netdissect-stdinc.h>
+#include "netdissect-stdinc.h"
#include <stdio.h>
#include <stdlib.h>
@@ -90,8 +90,8 @@ static void
init_crc10_table(void)
{
#define CRC10_POLYNOMIAL 0x633
- register int i, j;
- register uint16_t accum;
+ int i, j;
+ uint16_t accum;
uint16_t verify_crc10_table[256];
for ( i = 0; i < 256; i++ )
@@ -112,7 +112,7 @@ init_crc10_table(void)
uint16_t
verify_crc10_cksum(uint16_t accum, const u_char *p, int length)
{
- register int i;
+ int i;
for ( i = 0; i < length; i++ )
{
diff --git a/contrib/tcpdump/cmake/Modules/FindCRYPTO.cmake b/contrib/tcpdump/cmake/Modules/FindCRYPTO.cmake
new file mode 100644
index 000000000000..453c6516e071
--- /dev/null
+++ b/contrib/tcpdump/cmake/Modules/FindCRYPTO.cmake
@@ -0,0 +1,24 @@
+#
+# Try to find libcrypto.
+#
+
+# Try to find the header
+find_path(CRYPTO_INCLUDE_DIR openssl/crypto.h)
+
+# Try to find the library
+find_library(CRYPTO_LIBRARY crypto)
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(CRYPTO
+ DEFAULT_MSG
+ CRYPTO_INCLUDE_DIR
+ CRYPTO_LIBRARY
+)
+
+mark_as_advanced(
+ CRYPTO_INCLUDE_DIR
+ CRYPTO_LIBRARY
+)
+
+set(CRYPTO_INCLUDE_DIRS ${CRYPTO_INCLUDE_DIR})
+set(CRYPTO_LIBRARIES ${CRYPTO_LIBRARY})
diff --git a/contrib/tcpdump/cmake/Modules/FindPCAP.cmake b/contrib/tcpdump/cmake/Modules/FindPCAP.cmake
new file mode 100644
index 000000000000..11074655f457
--- /dev/null
+++ b/contrib/tcpdump/cmake/Modules/FindPCAP.cmake
@@ -0,0 +1,462 @@
+#
+# Try to find libpcap.
+#
+# To tell this module where to look, a user may set the environment variable
+# PCAP_ROOT to point cmake to the *root* of a directory with include and
+# lib subdirectories for pcap.dll (e.g WpdPack or npcap-sdk).
+# Alternatively, PCAP_ROOT may also be set from cmake command line or GUI
+# (e.g cmake -DPCAP_ROOT=C:\path\to\pcap [...])
+#
+
+if(WIN32)
+ #
+ # Building for Windows.
+ #
+ # libpcap isn't set up to install .pc files or pcap-config on Windows,
+ # and it's not clear that either of them would work without a lot
+ # of additional effort. WinPcap doesn't supply them, and neither
+ # does Npcap.
+ #
+ # So just search for them directly. Look for both pcap and wpcap.
+ # Don't bother looking for static libraries; unlike most UN*Xes
+ # (with the exception of AIX), where different extensions are used
+ # for shared and static, Windows uses .lib both for import libraries
+ # for DLLs and for static libraries.
+ #
+ # We don't directly set PCAP_INCLUDE_DIRS or PCAP_LIBRARIES, as
+ # they're not supposed to be cache entries, and find_path() and
+ # find_library() set cache entries.
+ #
+ find_path(PCAP_INCLUDE_DIR pcap.h)
+
+ # The 64-bit Packet.lib is located under /x64
+ if(CMAKE_SIZEOF_VOID_P EQUAL 8)
+ #
+ # For the WinPcap and Npcap SDKs, the Lib subdirectory of the top-level
+ # directory contains 32-bit libraries; the 64-bit libraries are in the
+ # Lib/x64 directory.
+ #
+ # The only way to *FORCE* CMake to look in the Lib/x64 directory
+ # without searching in the Lib directory first appears to be to set
+ # CMAKE_LIBRARY_ARCHITECTURE to "x64".
+ #
+ set(CMAKE_LIBRARY_ARCHITECTURE "x64")
+ endif()
+ find_library(PCAP_LIBRARY NAMES pcap wpcap)
+
+ #
+ # Do the standard arg processing, including failing if it's a
+ # required package.
+ #
+ include(FindPackageHandleStandardArgs)
+ find_package_handle_standard_args(PCAP
+ DEFAULT_MSG
+ PCAP_INCLUDE_DIR
+ PCAP_LIBRARY
+ )
+ mark_as_advanced(
+ PCAP_INCLUDE_DIR
+ PCAP_LIBRARY
+ )
+ if(PCAP_FOUND)
+ set(PCAP_LIBRARIES ${PCAP_LIBRARY})
+ set(PCAP_INCLUDE_DIRS ${PCAP_INCLUDE_DIR})
+ endif()
+else(WIN32)
+ #
+ # Building for UN*X.
+ #
+ # See whether we were handed a QUIET argument, so we can pass it on
+ # to pkg_search_module. Do *NOT* pass on the REQUIRED argument,
+ # because, if pkg-config isn't found, or it is but it has no .pc
+ # files for libpcap, that is *not* necessarily an indication that
+ # libpcap isn't available - not all systems ship pkg-config, and
+ # libpcap didn't have .pc files until libpcap 1.9.0.
+ #
+ if(PCAP_FIND_QUIETLY)
+ set(_quiet "QUIET")
+ endif()
+
+ #
+ # First, try pkg-config.
+ # Before doing so, set the PKG_CONFIG_PATH environment variable
+ # to include all the directories in CMAKE_PREFIX_PATH.
+ #
+ # *If* we were to require CMake 3.1 or later on UN*X,
+ # pkg_search_module() would do this for us, but, for now,
+ # we're not doing that, in case somebody's building with
+ # CMake on some "long-term support" version, predating
+ # CMake 3.1, of an OS that supplies an earlier
+ # version as a package.
+ #
+ # If we ever set a minimum of 3.1 or later on UN*X, we should
+ # remove the environment variable changes.
+ #
+ # This is based on code in the CMake 3.12.4 FindPkgConfig.cmake,
+ # which is "Distributed under the OSI-approved BSD 3-Clause License."
+ #
+ find_package(PkgConfig)
+
+ #
+ # Get the current PKG_CONFIG_PATH setting.
+ #
+ set(_pkg_config_path "$ENV{PKG_CONFIG_PATH}")
+
+ #
+ # Save it, so we can restore it after we run pkg-config.
+ #
+ set(_saved_pkg_config_path "${_pkg_config_path}")
+
+ if(NOT "${CMAKE_PREFIX_PATH}" STREQUAL "")
+ #
+ # Convert it to a CMake-style path, before we add additional
+ # values to it.
+ #
+ if(NOT "${_pkg_config_path}" STREQUAL "")
+ file(TO_CMAKE_PATH "${_pkg_config_path}" _pkg_config_path)
+ endif()
+
+ #
+ # Turn CMAKE_PREFIX_PATH into a list of extra paths to add
+ # to _pkg_config_path.
+ #
+ set(_extra_paths "")
+ list(APPEND _extra_paths ${CMAKE_PREFIX_PATH})
+
+ # Create a list of the possible pkgconfig subfolder (depending on
+ # the system
+ set(_lib_dirs)
+ if(NOT DEFINED CMAKE_SYSTEM_NAME
+ OR (CMAKE_SYSTEM_NAME MATCHES "^(Linux|kFreeBSD|GNU)$"
+ AND NOT CMAKE_CROSSCOMPILING))
+ if(EXISTS "/etc/debian_version") # is this a debian system ?
+ if(CMAKE_LIBRARY_ARCHITECTURE)
+ list(APPEND _lib_dirs "lib/${CMAKE_LIBRARY_ARCHITECTURE}/pkgconfig")
+ endif()
+ else()
+ # not debian, check the FIND_LIBRARY_USE_LIB32_PATHS and FIND_LIBRARY_USE_LIB64_PATHS properties
+ get_property(uselib32 GLOBAL PROPERTY FIND_LIBRARY_USE_LIB32_PATHS)
+ if(uselib32 AND CMAKE_SIZEOF_VOID_P EQUAL 4)
+ list(APPEND _lib_dirs "lib32/pkgconfig")
+ endif()
+ get_property(uselib64 GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS)
+ if(uselib64 AND CMAKE_SIZEOF_VOID_P EQUAL 8)
+ list(APPEND _lib_dirs "lib64/pkgconfig")
+ endif()
+ get_property(uselibx32 GLOBAL PROPERTY FIND_LIBRARY_USE_LIBX32_PATHS)
+ if(uselibx32 AND CMAKE_INTERNAL_PLATFORM_ABI STREQUAL "ELF X32")
+ list(APPEND _lib_dirs "libx32/pkgconfig")
+ endif()
+ endif()
+ endif()
+ if(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD" AND NOT CMAKE_CROSSCOMPILING)
+ list(APPEND _lib_dirs "libdata/pkgconfig")
+ endif()
+ list(APPEND _lib_dirs "lib/pkgconfig")
+ list(APPEND _lib_dirs "share/pkgconfig")
+
+ # Check if directories exist and eventually append them to the
+ # pkgconfig path list
+ foreach(_prefix_dir ${_extra_paths})
+ foreach(_lib_dir ${_lib_dirs})
+ if(EXISTS "${_prefix_dir}/${_lib_dir}")
+ list(APPEND _pkg_config_path "${_prefix_dir}/${_lib_dir}")
+ list(REMOVE_DUPLICATES _pkg_config_path)
+ endif()
+ endforeach()
+ endforeach()
+
+ if(NOT "${_pkg_config_path}" STREQUAL "")
+ # remove empty values from the list
+ list(REMOVE_ITEM _pkg_config_path "")
+ file(TO_NATIVE_PATH "${_pkg_config_path}" _pkg_config_path)
+ if(UNIX)
+ string(REPLACE ";" ":" _pkg_config_path "${_pkg_config_path}")
+ string(REPLACE "\\ " " " _pkg_config_path "${_pkg_config_path}")
+ endif()
+ set(ENV{PKG_CONFIG_PATH} "${_pkg_config_path}")
+ endif()
+ endif()
+ pkg_search_module(CONFIG_PCAP ${_quiet} libpcap)
+ set(ENV{PKG_CONFIG_PATH} "${_saved_pkg_config_path}")
+
+ if(NOT CONFIG_PCAP_FOUND)
+ #
+ # That didn't work. Try pcap-config.
+ #
+ find_program(PCAP_CONFIG pcap-config)
+ if(PCAP_CONFIG)
+ #
+ # We have pcap-config; use it.
+ #
+ if(NOT "${_quiet}" STREQUAL "QUIET")
+ message(STATUS "Found pcap-config")
+ endif()
+
+ #
+ # If this is a vendor-supplied pcap-config, which we define as
+ # being "a pcap-config in /usr/bin or /usr/ccs/bin" (the latter
+ # is for Solaris and Sun/Oracle Studio), there are some issues.
+ # Work around them.
+ #
+ if("${PCAP_CONFIG}" STREQUAL /usr/bin/pcap-config OR
+ "${PCAP_CONFIG}" STREQUAL /usr/ccs/bin/pcap-config)
+ #
+ # It's vendor-supplied.
+ #
+ if(APPLE)
+ #
+ # This is macOS or another Darwin-based OS.
+ #
+ # That means that /usr/bin/pcap-config it may provide
+ # -I/usr/local/include with --cflags and -L/usr/local/lib
+ # with --libs; if there's no pcap installed under /usr/local,
+ # that will cause the build to fail, and if there is a pcap
+ # installed there, you'll get that pcap even if you don't
+ # want it. Remember that, so we ignore those values.
+ #
+ set(_broken_apple_pcap_config TRUE)
+ elseif(CMAKE_SYSTEM_NAME STREQUAL "SunOS" AND CMAKE_SYSTEM_VERSION MATCHES "5[.][0-9.]*")
+ #
+ # This is Solaris 2 or later, i.e. SunOS 5.x.
+ #
+ # At least on Solaris 11; there's /usr/bin/pcap-config, which
+ # reports -L/usr/lib with --libs, causing the 32-bit libraries
+ # to be found, and there's /usr/bin/{64bitarch}/pcap-config,
+ # where {64bitarch} is a name for the 64-bit version of the
+ # instruction set, which reports -L /usr/lib/{64bitarch},
+ # causing the 64-bit libraries to be found.
+ #
+ # So if we're building 64-bit targets, we replace PCAP_CONFIG
+ # with /usr/bin/{64bitarch}; we get {64bitarch} as the
+ # output of "isainfo -n".
+ #
+ if(CMAKE_SIZEOF_VOID_P EQUAL 8)
+ execute_process(COMMAND "isainfo" "-n"
+ RESULT_VARIABLE ISAINFO_RESULT
+ OUTPUT_VARIABLE ISAINFO_OUTPUT
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ )
+ if(ISAINFO_RESULT EQUAL 0)
+ #
+ # Success - change PCAP_CONFIG.
+ #
+ string(REPLACE "/bin/" "/bin/${ISAINFO_OUTPUT}/" PCAP_CONFIG "${PCAP_CONFIG}")
+ endif()
+ endif()
+ endif()
+ endif()
+
+ #
+ # Now get the include directories.
+ #
+ execute_process(COMMAND "${PCAP_CONFIG}" "--cflags"
+ RESULT_VARIABLE PCAP_CONFIG_RESULT
+ OUTPUT_VARIABLE PCAP_CONFIG_OUTPUT
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ )
+ if(NOT PCAP_CONFIG_RESULT EQUAL 0)
+ message(FATAL_ERROR "pcap-config --cflags failed")
+ endif()
+ separate_arguments(CFLAGS_LIST UNIX_COMMAND ${PCAP_CONFIG_OUTPUT})
+ set(CONFIG_PCAP_INCLUDE_DIRS "")
+ foreach(_arg IN LISTS CFLAGS_LIST)
+ if(_arg MATCHES "^-I")
+ #
+ # Extract the directory by removing the -I.
+ #
+ string(REGEX REPLACE "-I" "" _dir ${_arg})
+ #
+ # Work around macOS (and probably other Darwin) brokenness,
+ # by not adding /usr/local/include if it's from the broken
+ # Apple pcap-config.
+ #
+ if(NOT _broken_apple_pcap_config OR
+ NOT "${_dir}" STREQUAL /usr/local/include)
+ # Add it to CONFIG_PCAP_INCLUDE_DIRS
+ list(APPEND CONFIG_PCAP_INCLUDE_DIRS ${_dir})
+ endif()
+ endif()
+ endforeach()
+
+ #
+ # Now, get the library directories and libraries for dynamic linking.
+ #
+ execute_process(COMMAND "${PCAP_CONFIG}" "--libs"
+ RESULT_VARIABLE PCAP_CONFIG_RESULT
+ OUTPUT_VARIABLE PCAP_CONFIG_OUTPUT
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ )
+ if(NOT PCAP_CONFIG_RESULT EQUAL 0)
+ message(FATAL_ERROR "pcap-config --libs failed")
+ endif()
+ separate_arguments(LIBS_LIST UNIX_COMMAND ${PCAP_CONFIG_OUTPUT})
+ set(CONFIG_PCAP_LIBRARY_DIRS "")
+ set(CONFIG_PCAP_LIBRARIES "")
+ foreach(_arg IN LISTS LIBS_LIST)
+ if(_arg MATCHES "^-L")
+ #
+ # Extract the directory by removing the -L.
+ #
+ string(REGEX REPLACE "-L" "" _dir ${_arg})
+ #
+ # Work around macOS (and probably other Darwin) brokenness,
+ # by not adding /usr/local/lib if it's from the broken
+ # Apple pcap-config.
+ #
+ if(NOT _broken_apple_pcap_config OR
+ NOT "${_dir}" STREQUAL /usr/local/lib)
+ # Add this directory to CONFIG_PCAP_LIBRARY_DIRS
+ list(APPEND CONFIG_PCAP_LIBRARY_DIRS ${_dir})
+ endif()
+ elseif(_arg MATCHES "^-l")
+ string(REGEX REPLACE "-l" "" _lib ${_arg})
+ list(APPEND CONFIG_PCAP_LIBRARIES ${_lib})
+ endif()
+ endforeach()
+
+ #
+ # Now, get the library directories and libraries for static linking.
+ #
+ execute_process(COMMAND "${PCAP_CONFIG}" "--libs" "--static"
+ RESULT_VARIABLE PCAP_CONFIG_RESULT
+ OUTPUT_VARIABLE PCAP_CONFIG_OUTPUT
+ )
+ if(NOT PCAP_CONFIG_RESULT EQUAL 0)
+ message(FATAL_ERROR "pcap-config --libs --static failed")
+ endif()
+ separate_arguments(LIBS_LIST UNIX_COMMAND ${PCAP_CONFIG_OUTPUT})
+ set(CONFIG_PCAP_STATIC_LIBRARY_DIRS "")
+ set(CONFIG_PCAP_STATIC_LIBRARIES "")
+ foreach(_arg IN LISTS LIBS_LIST)
+ if(_arg MATCHES "^-L")
+ #
+ # Extract the directory by removing the -L.
+ #
+ string(REGEX REPLACE "-L" "" _dir ${_arg})
+ #
+ # Work around macOS (and probably other Darwin) brokenness,
+ # by not adding /usr/local/lib if it's from the broken
+ # Apple pcap-config.
+ #
+ if(NOT _broken_apple_pcap_config OR
+ NOT "${_dir}" STREQUAL /usr/local/lib)
+ # Add this directory to CONFIG_PCAP_STATIC_LIBRARY_DIRS
+ list(APPEND CONFIG_PCAP_STATIC_LIBRARY_DIRS ${_dir})
+ endif()
+ elseif(_arg MATCHES "^-l")
+ string(REGEX REPLACE "-l" "" _lib ${_arg})
+ #
+ # Try to find that library, so we get its full path, as
+ # we do with dynamic libraries.
+ #
+ list(APPEND CONFIG_PCAP_STATIC_LIBRARIES ${_lib})
+ endif()
+ endforeach()
+
+ #
+ # We've set CONFIG_PCAP_INCLUDE_DIRS, CONFIG_PCAP_LIBRARIES, and
+ # CONFIG_PCAP_STATIC_LIBRARIES above; set CONFIG_PCAP_FOUND.
+ #
+ set(CONFIG_PCAP_FOUND YES)
+ endif()
+ endif()
+
+ #
+ # If CONFIG_PCAP_FOUND is set, we have information from pkg-config and
+ # pcap-config; we need to convert library names to library full paths.
+ #
+ # If it's not set, we have to look for the libpcap headers and library
+ # ourselves.
+ #
+ if(CONFIG_PCAP_FOUND)
+ #
+ # Use CONFIG_PCAP_INCLUDE_DIRS as the value for PCAP_INCLUDE_DIRS.
+ #
+ set(PCAP_INCLUDE_DIRS "${CONFIG_PCAP_INCLUDE_DIRS}")
+
+ #
+ # CMake *really* doesn't like the notion of specifying
+ # "here are the directories in which to look for libraries"
+ # except in find_library() calls; it *really* prefers using
+ # full paths to library files, rather than library names.
+ #
+ foreach(_lib IN LISTS CONFIG_PCAP_LIBRARIES)
+ find_library(_libfullpath ${_lib} HINTS ${CONFIG_PCAP_LIBRARY_DIRS})
+ list(APPEND PCAP_LIBRARIES ${_libfullpath})
+ #
+ # Remove that from the cache; we're using it as a local variable,
+ # but find_library insists on making it a cache variable.
+ #
+ unset(_libfullpath CACHE)
+ endforeach()
+
+ #
+ # Now do the same for the static libraries.
+ #
+ set(SAVED_CMAKE_FIND_LIBRARY_SUFFIXES "${CMAKE_FIND_LIBRARY_SUFFIXES}")
+ set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
+ foreach(_lib IN LISTS CONFIG_PCAP_STATIC_LIBRARIES)
+ find_library(_libfullpath ${_lib} HINTS ${CONFIG_PCAP_LIBRARY_DIRS})
+ list(APPEND PCAP_STATIC_LIBRARIES ${_libfullpath})
+ #
+ # Remove that from the cache; we're using it as a local variable,
+ # but find_library insists on making it a cache variable.
+ #
+ unset(_libfullpath CACHE)
+ endforeach()
+ set(CMAKE_FIND_LIBRARY_SUFFIXES "${SAVED_CMAKE_FIND_LIBRARY_SUFFIXES}")
+
+ #
+ # We found libpcap using pkg-config or pcap-config.
+ #
+ set(PCAP_FOUND YES)
+ else(CONFIG_PCAP_FOUND)
+ #
+ # We didn't have pkg-config, or we did but it didn't have .pc files
+ # for libpcap, and we don't have pkg-config, so we have to look for
+ # the headers and libraries ourself.
+ #
+ # We don't directly set PCAP_INCLUDE_DIRS or PCAP_LIBRARIES, as
+ # they're not supposed to be cache entries, and find_path() and
+ # find_library() set cache entries.
+ #
+ # Try to find the header file.
+ #
+ find_path(PCAP_INCLUDE_DIR pcap.h)
+
+ #
+ # Try to find the library
+ #
+ find_library(PCAP_LIBRARY pcap)
+
+ # Try to find the static library (XXX - what about AIX?)
+ set(SAVED_CMAKE_FIND_LIBRARY_SUFFIXES "${CMAKE_FIND_LIBRARY_SUFFIXES}")
+ set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
+ find_library(PCAP_STATIC_LIBRARY pcap)
+ set(CMAKE_FIND_LIBRARY_SUFFIXES "${SAVED_CMAKE_FIND_LIBRARY_SUFFIXES}")
+
+ #
+ # This will fail if REQUIRED is set and PCAP_INCLUDE_DIR or
+ # PCAP_LIBRARY aren't set.
+ #
+ include(FindPackageHandleStandardArgs)
+ find_package_handle_standard_args(PCAP
+ DEFAULT_MSG
+ PCAP_INCLUDE_DIR
+ PCAP_LIBRARY
+ )
+
+ mark_as_advanced(
+ PCAP_INCLUDE_DIR
+ PCAP_LIBRARY
+ PCAP_STATIC_LIBRARY
+ )
+
+ if(PCAP_FOUND)
+ set(PCAP_INCLUDE_DIRS ${PCAP_INCLUDE_DIR})
+ set(PCAP_LIBRARIES ${PCAP_LIBRARY})
+ set(PCAP_STATIC_LIBRARIES ${PCAP_STATIC_LIBRARY})
+ endif(PCAP_FOUND)
+ endif(CONFIG_PCAP_FOUND)
+endif(WIN32)
diff --git a/contrib/tcpdump/cmake/Modules/FindSMI.cmake b/contrib/tcpdump/cmake/Modules/FindSMI.cmake
new file mode 100644
index 000000000000..98c107126722
--- /dev/null
+++ b/contrib/tcpdump/cmake/Modules/FindSMI.cmake
@@ -0,0 +1,24 @@
+#
+# Try to find libsmi.
+#
+
+# Try to find the header
+find_path(SMI_INCLUDE_DIR smi.h)
+
+# Try to find the library
+find_library(SMI_LIBRARY smi)
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(SMI
+ DEFAULT_MSG
+ SMI_INCLUDE_DIR
+ SMI_LIBRARY
+)
+
+mark_as_advanced(
+ SMI_INCLUDE_DIR
+ SMI_LIBRARY
+)
+
+set(SMI_INCLUDE_DIRS ${SMI_INCLUDE_DIR})
+set(SMI_LIBRARIES ${SMI_LIBRARY})
diff --git a/contrib/tcpdump/cmake_uninstall.cmake.in b/contrib/tcpdump/cmake_uninstall.cmake.in
new file mode 100644
index 000000000000..2037e365393a
--- /dev/null
+++ b/contrib/tcpdump/cmake_uninstall.cmake.in
@@ -0,0 +1,21 @@
+if(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
+ message(FATAL_ERROR "Cannot find install manifest: @CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
+endif(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
+
+file(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files)
+string(REGEX REPLACE "\n" ";" files "${files}")
+foreach(file ${files})
+ message(STATUS "Uninstalling $ENV{DESTDIR}${file}")
+ if(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
+ exec_program(
+ "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\""
+ OUTPUT_VARIABLE rm_out
+ RETURN_VALUE rm_retval
+ )
+ if(NOT "${rm_retval}" STREQUAL 0)
+ message(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file}")
+ endif(NOT "${rm_retval}" STREQUAL 0)
+ else(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
+ message(STATUS "File $ENV{DESTDIR}${file} does not exist.")
+ endif(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
+endforeach(file)
diff --git a/contrib/tcpdump/cmakeconfig.h.in b/contrib/tcpdump/cmakeconfig.h.in
new file mode 100644
index 000000000000..02a4a352e42a
--- /dev/null
+++ b/contrib/tcpdump/cmakeconfig.h.in
@@ -0,0 +1,290 @@
+/* cmakeconfig.h.in */
+
+/* Define to 1 if arpa/inet.h declares `ether_ntohost' */
+#cmakedefine ARPA_INET_H_DECLARES_ETHER_NTOHOST 1
+
+/* define if you want to build the possibly-buggy SMB printer */
+#cmakedefine ENABLE_SMB 1
+
+/* Define to 1 if you have the `bpf_dump' function. */
+#cmakedefine HAVE_BPF_DUMP 1
+
+/* capsicum support available */
+#cmakedefine HAVE_CAPSICUM 1
+
+/* Define to 1 if you have the `cap_enter' function. */
+#cmakedefine HAVE_CAP_ENTER 1
+
+/* Define to 1 if you have the `cap_ioctls_limit' function. */
+#cmakedefine HAVE_CAP_IOCTLS_LIMIT 1
+
+/* Define to 1 if you have the <cap-ng.h> header file. */
+#cmakedefine HAVE_CAP_NG_H 1
+
+/* Define to 1 if you have the `cap_rights_limit' function. */
+#cmakedefine HAVE_CAP_RIGHTS_LIMIT 1
+
+/* Casper support available */
+#cmakedefine HAVE_CASPER 1
+
+/* Define to 1 if you have the declaration of `ether_ntohost' */
+#cmakedefine HAVE_DECL_ETHER_NTOHOST 1
+
+/* Define to 1 if you have the `ether_ntohost' function. */
+#cmakedefine HAVE_ETHER_NTOHOST 1
+
+/* Define to 1 if you have the `EVP_CIPHER_CTX_new' function. */
+#cmakedefine HAVE_EVP_CIPHER_CTX_NEW 1
+
+/* Define to 1 if you have the `EVP_DecryptInit_ex' function. */
+#cmakedefine HAVE_EVP_DECRYPTINIT_EX 1
+
+/* Define to 1 if you have the <fcntl.h> header file. */
+#cmakedefine HAVE_FCNTL_H 1
+
+/* Define to 1 if you have the `fork' function. */
+#cmakedefine HAVE_FORK 1
+
+/* Define to 1 if you have the `getopt_long' function. */
+#cmakedefine HAVE_GETOPT_LONG 1
+
+/* define if you have getrpcbynumber() */
+#cmakedefine HAVE_GETRPCBYNUMBER 1
+
+/* Define to 1 if you have the `getservent' function. */
+#cmakedefine HAVE_GETSERVENT 1
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#cmakedefine HAVE_INTTYPES_H 1
+
+/* Define to 1 if you have the `cap-ng' library (-lcap-ng). */
+#cmakedefine HAVE_LIBCAP_NG 1
+
+/* Define to 1 if you have the `crypto' library (-lcrypto). */
+#cmakedefine HAVE_LIBCRYPTO 1
+
+/* Define to 1 if you have the `rpc' library (-lrpc). */
+#cmakedefine HAVE_LIBRPC 1
+
+/* Define to 1 if you have the <memory.h> header file. */
+#cmakedefine HAVE_MEMORY_H 1
+
+/* Define to 1 if you have the <net/if.h> header file. */
+#cmakedefine HAVE_NET_IF_H 1
+
+/* Define to 1 if you have the `openat' function. */
+#cmakedefine HAVE_OPENAT 1
+
+/* Define to 1 if you have the <openssl/evp.h> header file. */
+#cmakedefine HAVE_OPENSSL_EVP_H 1
+
+/* define if the OS provides AF_INET6 and struct in6_addr */
+#cmakedefine HAVE_OS_IPV6_SUPPORT 1
+
+/* if there's an os_proto.h for this platform, to use additional prototypes */
+#cmakedefine HAVE_OS_PROTO_H 1
+
+/* Define to 1 if you have the `pcap_breakloop' function. */
+#cmakedefine HAVE_PCAP_BREAKLOOP 1
+
+/* Define to 1 if you have the `pcap_create' function. */
+#cmakedefine HAVE_PCAP_CREATE 1
+
+/* define if libpcap has pcap_datalink_name_to_val() */
+#cmakedefine HAVE_PCAP_DATALINK_NAME_TO_VAL 1
+
+/* define if libpcap has pcap_datalink_val_to_description() */
+#cmakedefine HAVE_PCAP_DATALINK_VAL_TO_DESCRIPTION 1
+
+/* define if libpcap has pcap_debug */
+#cmakedefine HAVE_PCAP_DEBUG 1
+
+/* Define to 1 if you have the `pcap_dump_flush' function. */
+#cmakedefine HAVE_PCAP_DUMP_FLUSH 1
+
+/* Define to 1 if you have the `pcap_dump_ftell' function. */
+#cmakedefine HAVE_PCAP_DUMP_FTELL 1
+
+/* Define to 1 if you have the `pcap_dump_ftell64' function. */
+#cmakedefine HAVE_PCAP_DUMP_FTELL64 1
+
+/* Define to 1 if you have the `pcap_findalldevs' function. */
+#cmakedefine HAVE_PCAP_FINDALLDEVS 1
+
+/* Define to 1 if you have the `pcap_findalldevs_ex' function. */
+#cmakedefine HAVE_PCAP_FINDALLDEVS_EX 1
+
+/* Define to 1 if you have the `pcap_free_datalinks' function. */
+#cmakedefine HAVE_PCAP_FREE_DATALINKS 1
+
+/* Define to 1 if the system has the type `pcap_if_t'. */
+#cmakedefine HAVE_PCAP_IF_T 1
+
+/* Define to 1 if you have the `pcap_lib_version' function. */
+#cmakedefine HAVE_PCAP_LIB_VERSION 1
+
+/* define if libpcap has pcap_list_datalinks() */
+#cmakedefine HAVE_PCAP_LIST_DATALINKS 1
+
+/* Define to 1 if you have the `pcap_open' function. */
+#cmakedefine HAVE_PCAP_OPEN 1
+
+/* Define to 1 if you have the <pcap/pcap-inttypes.h> header file. */
+#cmakedefine HAVE_PCAP_PCAP_INTTYPES_H 1
+
+/* Define to 1 if you have the `pcap_setdirection' function. */
+#cmakedefine HAVE_PCAP_SETDIRECTION 1
+
+/* Define to 1 if you have the `pcap_set_datalink' function. */
+#cmakedefine HAVE_PCAP_SET_DATALINK 1
+
+/* Define to 1 if you have the `pcap_set_immediate_mode' function. */
+#cmakedefine HAVE_PCAP_SET_IMMEDIATE_MODE 1
+
+/* Define to 1 if you have the `pcap_set_optimizer_debug' function. */
+#cmakedefine HAVE_PCAP_SET_OPTIMIZER_DEBUG 1
+
+/* Define to 1 if you have the `pcap_set_parser_debug' function. */
+#cmakedefine HAVE_PCAP_SET_PARSER_DEBUG 1
+
+/* Define to 1 if you have the `pcap_set_tstamp_precision' function. */
+#cmakedefine HAVE_PCAP_SET_TSTAMP_PRECISION 1
+
+/* Define to 1 if you have the `pcap_set_tstamp_type' function. */
+#cmakedefine HAVE_PCAP_SET_TSTAMP_TYPE 1
+
+/* define if libpcap has pcap_version */
+#cmakedefine HAVE_PCAP_VERSION 1
+
+/* Define to 1 if you have the `pcap_wsockinit' function. */
+#cmakedefine HAVE_PCAP_WSOCKINIT 1
+
+/* Define to 1 if you have the `pfopen' function. */
+#cmakedefine HAVE_PFOPEN 1
+
+/* Define to 1 if you have the <rpc/rpcent.h> header file. */
+#cmakedefine HAVE_RPC_RPCENT_H 1
+
+/* Define to 1 if you have the <rpc/rpc.h> header file. */
+#cmakedefine HAVE_RPC_RPC_H 1
+
+/* Define to 1 if you have the `setlinebuf' function. */
+#cmakedefine HAVE_SETLINEBUF 1
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#cmakedefine HAVE_STDINT_H 1
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#cmakedefine HAVE_STDLIB_H 1
+
+/* Define to 1 if you have the `strdup' function. */
+#cmakedefine HAVE_STRDUP 1
+
+/* Define to 1 if you have the <strings.h> header file. */
+#cmakedefine HAVE_STRINGS_H 1
+
+/* Define to 1 if you have the <string.h> header file. */
+#cmakedefine HAVE_STRING_H 1
+
+/* Define to 1 if you have the `strlcat' function. */
+#cmakedefine HAVE_STRLCAT 1
+
+/* Define to 1 if you have the `strlcpy' function. */
+#cmakedefine HAVE_STRLCPY 1
+
+/* Define to 1 if you have the `strsep' function. */
+#cmakedefine HAVE_STRSEP 1
+
+/* Define to 1 if the system has the type `struct ether_addr'. */
+#cmakedefine HAVE_STRUCT_ETHER_ADDR 1
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#cmakedefine HAVE_SYS_STAT_H 1
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#cmakedefine HAVE_SYS_TYPES_H 1
+
+/* Define to 1 if the system has the type `uintptr_t'. */
+#cmakedefine HAVE_UINTPTR_T 1
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#cmakedefine HAVE_UNISTD_H 1
+
+/* Define to 1 if you have the `vfork' function. */
+#cmakedefine HAVE_VFORK 1
+
+/* Define to 1 if you have the `wsockinit' function. */
+#cmakedefine HAVE_WSOCKINIT 1
+
+/* define if libpcap has yydebug */
+#cmakedefine HAVE_YYDEBUG 1
+
+/* Define to 1 if netinet/ether.h declares `ether_ntohost' */
+#cmakedefine NETINET_ETHER_H_DECLARES_ETHER_NTOHOST 1
+
+/* Define to 1 if netinet/if_ether.h declares `ether_ntohost' */
+#cmakedefine NETINET_IF_ETHER_H_DECLARES_ETHER_NTOHOST 1
+
+/* Define to 1 if net/ethernet.h declares `ether_ntohost' */
+#cmakedefine NET_ETHERNET_H_DECLARES_ETHER_NTOHOST 1
+
+/* Define to the address where bug reports for this package should be sent. */
+#cmakedefine PACKAGE_BUGREPORT ""
+
+/* Define to the full name of this package. */
+#cmakedefine PACKAGE_NAME "@PACKAGE_NAME@"
+
+/* Define to the full name and version of this package. */
+#cmakedefine PACKAGE_STRING "@PACKAGE_STRING@"
+
+/* Define to the one symbol short name of this package. */
+#cmakedefine PACKAGE_TARNAME ""
+
+/* Define to the home page for this package. */
+#cmakedefine PACKAGE_URL ""
+
+/* Define to the version of this package. */
+#cmakedefine PACKAGE_VERSION "@PACKAGE_VERSION@"
+
+/* Define to 1 if you have the ANSI C header files. */
+#cmakedefine STDC_HEADERS 1
+
+/* Define to 1 if sys/ethernet.h declares `ether_ntohost' */
+#cmakedefine SYS_ETHERNET_H_DECLARES_ETHER_NTOHOST 1
+
+/* define if you have ether_ntohost() and it works */
+#cmakedefine USE_ETHER_NTOHOST 1
+
+/* Define if you enable support for libsmi */
+#cmakedefine USE_LIBSMI 1
+
+/* define if should chroot when dropping privileges */
+#cmakedefine WITH_CHROOT "@WITH_CHROOT@"
+
+/* define if should drop privileges by default */
+#cmakedefine WITH_USER "@WITH_USER@"
+
+/* define on AIX to get certain functions */
+#cmakedefine _SUN 1
+
+/* to handle Ultrix compilers that don't support const in prototypes */
+#cmakedefine const 1
+
+/* Define as token for inline if inlining supported */
+#cmakedefine inline 1
+
+/* Define to `uint16_t' if u_int16_t not defined. */
+#cmakedefine u_int16_t 1
+
+/* Define to `uint32_t' if u_int32_t not defined. */
+#cmakedefine u_int32_t 1
+
+/* Define to `uint64_t' if u_int64_t not defined. */
+#cmakedefine u_int64_t 1
+
+/* Define to `uint8_t' if u_int8_t not defined. */
+#cmakedefine u_int8_t 1
+
+/* Define to the type of an unsigned integer type wide enough to hold a
+ pointer, if such a type exists, and if the system does not define it. */
+#cmakedefine uintptr_t 1
diff --git a/contrib/tcpdump/compiler-tests.h b/contrib/tcpdump/compiler-tests.h
new file mode 100644
index 000000000000..d4fe177bc247
--- /dev/null
+++ b/contrib/tcpdump/compiler-tests.h
@@ -0,0 +1,196 @@
+/* -*- Mode: c; tab-width: 8; indent-tabs-mode: 1; c-basic-offset: 8; -*- */
+/*
+ * Copyright (c) 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 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. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the Computer Systems
+ * Engineering Group at Lawrence Berkeley Laboratory.
+ * 4. Neither the name of the University nor of the Laboratory may be used
+ * to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef nd_compiler_tests_h
+#define nd_compiler_tests_h
+
+/*
+ * This was introduced by Clang:
+ *
+ * https://clang.llvm.org/docs/LanguageExtensions.html#has-attribute
+ *
+ * in some version (which version?); it has been picked up by GCC 5.0.
+ */
+#ifndef __has_attribute
+ /*
+ * It's a macro, so you can check whether it's defined to check
+ * whether it's supported.
+ *
+ * If it's not, define it to always return 0, so that we move on to
+ * the fallback checks.
+ */
+ #define __has_attribute(x) 0
+#endif
+
+/*
+ * Note that the C90 spec's "6.8.1 Conditional inclusion" and the
+ * C99 spec's and C11 spec's "6.10.1 Conditional inclusion" say:
+ *
+ * Prior to evaluation, macro invocations in the list of preprocessing
+ * tokens that will become the controlling constant expression are
+ * replaced (except for those macro names modified by the defined unary
+ * operator), just as in normal text. If the token "defined" is
+ * generated as a result of this replacement process or use of the
+ * "defined" unary operator does not match one of the two specified
+ * forms prior to macro replacement, the behavior is undefined.
+ *
+ * so you shouldn't use defined() in a #define that's used in #if or
+ * #elif. Some versions of Clang, for example, will warn about this.
+ *
+ * Instead, we check whether the pre-defined macros for particular
+ * compilers are defined and, if not, define the "is this version XXX
+ * or a later version of this compiler" macros as 0.
+ */
+
+/*
+ * Check whether this is GCC major.minor or a later release, or some
+ * compiler that claims to be "just like GCC" of that version or a
+ * later release.
+ */
+
+#if ! defined(__GNUC__)
+ /* Not GCC and not "just like GCC" */
+ #define ND_IS_AT_LEAST_GNUC_VERSION(major, minor) 0
+#else
+ /* GCC or "just like GCC" */
+ #define ND_IS_AT_LEAST_GNUC_VERSION(major, minor) \
+ (__GNUC__ > (major) || \
+ (__GNUC__ == (major) && __GNUC_MINOR__ >= (minor)))
+#endif
+
+/*
+ * Check whether this is Clang major.minor or a later release.
+ */
+
+#if !defined(__clang__)
+ /* Not Clang */
+ #define ND_IS_AT_LEAST_CLANG_VERSION(major, minor) 0
+#else
+ /* Clang */
+ #define ND_IS_AT_LEAST_CLANG_VERSION(major, minor) \
+ (__clang_major__ > (major) || \
+ (__clang_major__ == (major) && __clang_minor__ >= (minor)))
+#endif
+
+/*
+ * Check whether this is Sun C/SunPro C/Oracle Studio major.minor
+ * or a later release.
+ *
+ * The version number in __SUNPRO_C is encoded in hex BCD, with the
+ * uppermost hex digit being the major version number, the next
+ * one or two hex digits being the minor version number, and
+ * the last digit being the patch version.
+ *
+ * It represents the *compiler* version, not the product version;
+ * see
+ *
+ * https://sourceforge.net/p/predef/wiki/Compilers/
+ *
+ * for a partial mapping, which we assume continues for later
+ * 12.x product releases.
+ */
+
+#if ! defined(__SUNPRO_C)
+ /* Not Sun/Oracle C */
+ #define ND_IS_AT_LEAST_SUNC_VERSION(major,minor) 0
+#else
+ /* Sun/Oracle C */
+ #define ND_SUNPRO_VERSION_TO_BCD(major, minor) \
+ (((minor) >= 10) ? \
+ (((major) << 12) | (((minor)/10) << 8) | (((minor)%10) << 4)) : \
+ (((major) << 8) | ((minor) << 4)))
+ #define ND_IS_AT_LEAST_SUNC_VERSION(major,minor) \
+ (__SUNPRO_C >= ND_SUNPRO_VERSION_TO_BCD((major), (minor)))
+#endif
+
+/*
+ * Check whether this is IBM XL C major.minor or a later release.
+ *
+ * The version number in __xlC__ has the major version in the
+ * upper 8 bits and the minor version in the lower 8 bits.
+ * On AIX __xlC__ is always defined, __ibmxl__ becomes defined in XL C 16.1.
+ * On Linux since XL C 13.1.6 __xlC__ is not defined by default anymore, but
+ * __ibmxl__ is defined since at least XL C 13.1.1.
+ */
+
+#if ! defined(__xlC__) && ! defined(__ibmxl__)
+ /* Not XL C */
+ #define ND_IS_AT_LEAST_XL_C_VERSION(major,minor) 0
+ #define ND_IS_AT_LEAST_XL_C_MODFIX(modification, fixlevel) 0
+#else
+ /* XL C */
+ #if defined(__ibmxl__)
+ /*
+ * Later Linux version of XL C; use __ibmxl_version__ to test
+ * the version.
+ */
+ #define ND_IS_AT_LEAST_XL_C_VERSION(major, minor) \
+ (__ibmxl_version__ > (major) || \
+ (__ibmxl_version__ == (major) && __ibmxl_release__ >= (minor)))
+ #define ND_IS_AT_LEAST_XL_C_MODFIX(modification, fixlevel) \
+ (__ibmxl_modification__ > (modification) || \
+ (__ibmxl_modification__ == (modification) && \
+ __ibmxl_ptf_fix_level__ >= (fixlevel)))
+ #else /* __ibmxl__ */
+ /*
+ * __ibmxl__ not defined; use __xlC__ to test the version.
+ */
+ #define ND_IS_AT_LEAST_XL_C_VERSION(major, minor) \
+ (__xlC__ >= (((major) << 8) | (minor)))
+ #define ND_IS_AT_LEAST_XL_C_MODFIX(modification, fixlevel) \
+ ((((modification) << 8) | (fixlevel)) >= __xlC_ver__)
+ #endif /* __ibmxl__ */
+#endif
+
+/*
+ * Check whether this is HP aC++/HP C major.minor or a later release.
+ *
+ * The version number in __HP_aCC is encoded in zero-padded decimal BCD,
+ * with the "A." stripped off, the uppermost two decimal digits being
+ * the major version number, the next two decimal digits being the minor
+ * version number, and the last two decimal digits being the patch version.
+ * (Strip off the A., remove the . between the major and minor version
+ * number, and add two digits of patch.)
+ */
+
+#if ! defined(__HP_aCC)
+ /* Not HP C */
+ #define ND_IS_AT_LEAST_HP_C_VERSION(major,minor) 0
+#else
+ /* HP C */
+ #define ND_IS_AT_LEAST_HP_C_VERSION(major,minor) \
+ (__HP_aCC >= ((major)*10000 + (minor)*100))
+#endif
+
+#endif /* nd_funcattrs_h */
diff --git a/contrib/tcpdump/config.guess b/contrib/tcpdump/config.guess
index 2b79f6d837b9..69188da73d74 100755
--- a/contrib/tcpdump/config.guess
+++ b/contrib/tcpdump/config.guess
@@ -1,12 +1,14 @@
#! /bin/sh
# Attempt to guess a canonical system name.
-# Copyright 1992-2018 Free Software Foundation, Inc.
+# Copyright 1992-2023 Free Software Foundation, Inc.
-timestamp='2018-07-06'
+# shellcheck disable=SC2006,SC2268 # see below for rationale
+
+timestamp='2023-01-01'
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3 of the License, or
+# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
@@ -27,11 +29,19 @@ timestamp='2018-07-06'
# Originally written by Per Bothner; maintained since 2000 by Ben Elliston.
#
# You can get the latest version of this script from:
-# https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess
+# https://git.savannah.gnu.org/cgit/config.git/plain/config.guess
#
# Please send patches to <config-patches@gnu.org>.
+# The "shellcheck disable" line above the timestamp inhibits complaints
+# about features and limitations of the classic Bourne shell that were
+# superseded or lifted in POSIX. However, this script identifies a wide
+# variety of pre-POSIX systems that do not have POSIX shells at all, and
+# even some reasonably current systems (Solaris 10 as case-in-point) still
+# have a pre-POSIX /bin/sh.
+
+
me=`echo "$0" | sed -e 's,.*/,,'`
usage="\
@@ -50,7 +60,7 @@ version="\
GNU config.guess ($timestamp)
Originally written by Per Bothner.
-Copyright 1992-2018 Free Software Foundation, Inc.
+Copyright 1992-2023 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -84,7 +94,8 @@ if test $# != 0; then
exit 1
fi
-trap 'exit 1' 1 2 15
+# Just in case it came from the environment.
+GUESS=
# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
# compiler to aid in system detection is discouraged as it requires
@@ -96,73 +107,90 @@ trap 'exit 1' 1 2 15
# Portable tmp directory creation inspired by the Autoconf team.
-set_cc_for_build='
-trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
-trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
-: ${TMPDIR=/tmp} ;
- { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
- { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp 2>/dev/null) ; } ||
- { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp 2>/dev/null) && echo "Warning: creating insecure temp directory" >&2 ; } ||
- { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
-dummy=$tmp/dummy ;
-tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
-case ${CC_FOR_BUILD-},${HOST_CC-},${CC-} in
- ,,) echo "int x;" > "$dummy.c" ;
- for c in cc gcc c89 c99 ; do
- if ($c -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then
- CC_FOR_BUILD="$c"; break ;
- fi ;
- done ;
- if test x"$CC_FOR_BUILD" = x ; then
- CC_FOR_BUILD=no_compiler_found ;
- fi
- ;;
- ,,*) CC_FOR_BUILD=$CC ;;
- ,*,*) CC_FOR_BUILD=$HOST_CC ;;
-esac ; set_cc_for_build= ;'
+tmp=
+# shellcheck disable=SC2172
+trap 'test -z "$tmp" || rm -fr "$tmp"' 0 1 2 13 15
+
+set_cc_for_build() {
+ # prevent multiple calls if $tmp is already set
+ test "$tmp" && return 0
+ : "${TMPDIR=/tmp}"
+ # shellcheck disable=SC2039,SC3028
+ { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
+ { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir "$tmp" 2>/dev/null) ; } ||
+ { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir "$tmp" 2>/dev/null) && echo "Warning: creating insecure temp directory" >&2 ; } ||
+ { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; }
+ dummy=$tmp/dummy
+ case ${CC_FOR_BUILD-},${HOST_CC-},${CC-} in
+ ,,) echo "int x;" > "$dummy.c"
+ for driver in cc gcc c89 c99 ; do
+ if ($driver -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then
+ CC_FOR_BUILD=$driver
+ break
+ fi
+ done
+ if test x"$CC_FOR_BUILD" = x ; then
+ CC_FOR_BUILD=no_compiler_found
+ fi
+ ;;
+ ,,*) CC_FOR_BUILD=$CC ;;
+ ,*,*) CC_FOR_BUILD=$HOST_CC ;;
+ esac
+}
# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
# (ghazi@noc.rutgers.edu 1994-08-24)
-if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
+if test -f /.attbin/uname ; then
PATH=$PATH:/.attbin ; export PATH
fi
UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
-UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
+UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
-case "$UNAME_SYSTEM" in
+case $UNAME_SYSTEM in
Linux|GNU|GNU/*)
- # If the system lacks a compiler, then just pick glibc.
- # We could probably try harder.
- LIBC=gnu
+ LIBC=unknown
- eval "$set_cc_for_build"
+ set_cc_for_build
cat <<-EOF > "$dummy.c"
#include <features.h>
#if defined(__UCLIBC__)
LIBC=uclibc
#elif defined(__dietlibc__)
LIBC=dietlibc
- #else
+ #elif defined(__GLIBC__)
LIBC=gnu
+ #else
+ #include <stdarg.h>
+ /* First heuristic to detect musl libc. */
+ #ifdef __DEFINED_va_list
+ LIBC=musl
+ #endif
#endif
EOF
- eval "`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`"
+ cc_set_libc=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`
+ eval "$cc_set_libc"
- # If ldd exists, use it to detect musl libc.
- if command -v ldd >/dev/null && \
- ldd --version 2>&1 | grep -q ^musl
- then
- LIBC=musl
+ # Second heuristic to detect musl libc.
+ if [ "$LIBC" = unknown ] &&
+ command -v ldd >/dev/null &&
+ ldd --version 2>&1 | grep -q ^musl; then
+ LIBC=musl
+ fi
+
+ # If the system lacks a compiler, then just pick glibc.
+ # We could probably try harder.
+ if [ "$LIBC" = unknown ]; then
+ LIBC=gnu
fi
;;
esac
# Note: order is significant - the case branches are not exclusive.
-case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in
+case $UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION in
*:NetBSD:*:*)
# NetBSD (nbsd) targets should (where applicable) match one or
# more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,
@@ -174,12 +202,12 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in
#
# Note: NetBSD doesn't particularly care about the vendor
# portion of the name. We always set it to "unknown".
- sysctl="sysctl -n hw.machine_arch"
UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \
- "/sbin/$sysctl" 2>/dev/null || \
- "/usr/sbin/$sysctl" 2>/dev/null || \
+ /sbin/sysctl -n hw.machine_arch 2>/dev/null || \
+ /usr/sbin/sysctl -n hw.machine_arch 2>/dev/null || \
echo unknown)`
- case "$UNAME_MACHINE_ARCH" in
+ case $UNAME_MACHINE_ARCH in
+ aarch64eb) machine=aarch64_be-unknown ;;
armeb) machine=armeb-unknown ;;
arm*) machine=arm-unknown ;;
sh3el) machine=shl-unknown ;;
@@ -188,18 +216,18 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in
earmv*)
arch=`echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,'`
endian=`echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p'`
- machine="${arch}${endian}"-unknown
+ machine=${arch}${endian}-unknown
;;
- *) machine="$UNAME_MACHINE_ARCH"-unknown ;;
+ *) machine=$UNAME_MACHINE_ARCH-unknown ;;
esac
# The Operating System including object format, if it has switched
# to ELF recently (or will in the future) and ABI.
- case "$UNAME_MACHINE_ARCH" in
+ case $UNAME_MACHINE_ARCH in
earm*)
os=netbsdelf
;;
arm*|i386|m68k|ns32k|sh3*|sparc|vax)
- eval "$set_cc_for_build"
+ set_cc_for_build
if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
| grep -q __ELF__
then
@@ -215,7 +243,7 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in
;;
esac
# Determine ABI tags.
- case "$UNAME_MACHINE_ARCH" in
+ case $UNAME_MACHINE_ARCH in
earm*)
expr='s/^earmv[0-9]/-eabi/;s/eb$//'
abi=`echo "$UNAME_MACHINE_ARCH" | sed -e "$expr"`
@@ -226,7 +254,7 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in
# thus, need a distinct triplet. However, they do not need
# kernel version information, so it can be replaced with a
# suitable tag, in the style of linux-gnu.
- case "$UNAME_VERSION" in
+ case $UNAME_VERSION in
Debian*)
release='-gnu'
;;
@@ -237,45 +265,57 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in
# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
# contains redundant information, the shorter form:
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
- echo "$machine-${os}${release}${abi-}"
- exit ;;
+ GUESS=$machine-${os}${release}${abi-}
+ ;;
*:Bitrig:*:*)
UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
- echo "$UNAME_MACHINE_ARCH"-unknown-bitrig"$UNAME_RELEASE"
- exit ;;
+ GUESS=$UNAME_MACHINE_ARCH-unknown-bitrig$UNAME_RELEASE
+ ;;
*:OpenBSD:*:*)
UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
- echo "$UNAME_MACHINE_ARCH"-unknown-openbsd"$UNAME_RELEASE"
- exit ;;
+ GUESS=$UNAME_MACHINE_ARCH-unknown-openbsd$UNAME_RELEASE
+ ;;
+ *:SecBSD:*:*)
+ UNAME_MACHINE_ARCH=`arch | sed 's/SecBSD.//'`
+ GUESS=$UNAME_MACHINE_ARCH-unknown-secbsd$UNAME_RELEASE
+ ;;
*:LibertyBSD:*:*)
UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'`
- echo "$UNAME_MACHINE_ARCH"-unknown-libertybsd"$UNAME_RELEASE"
- exit ;;
+ GUESS=$UNAME_MACHINE_ARCH-unknown-libertybsd$UNAME_RELEASE
+ ;;
*:MidnightBSD:*:*)
- echo "$UNAME_MACHINE"-unknown-midnightbsd"$UNAME_RELEASE"
- exit ;;
+ GUESS=$UNAME_MACHINE-unknown-midnightbsd$UNAME_RELEASE
+ ;;
*:ekkoBSD:*:*)
- echo "$UNAME_MACHINE"-unknown-ekkobsd"$UNAME_RELEASE"
- exit ;;
+ GUESS=$UNAME_MACHINE-unknown-ekkobsd$UNAME_RELEASE
+ ;;
*:SolidBSD:*:*)
- echo "$UNAME_MACHINE"-unknown-solidbsd"$UNAME_RELEASE"
- exit ;;
+ GUESS=$UNAME_MACHINE-unknown-solidbsd$UNAME_RELEASE
+ ;;
+ *:OS108:*:*)
+ GUESS=$UNAME_MACHINE-unknown-os108_$UNAME_RELEASE
+ ;;
macppc:MirBSD:*:*)
- echo powerpc-unknown-mirbsd"$UNAME_RELEASE"
- exit ;;
+ GUESS=powerpc-unknown-mirbsd$UNAME_RELEASE
+ ;;
*:MirBSD:*:*)
- echo "$UNAME_MACHINE"-unknown-mirbsd"$UNAME_RELEASE"
- exit ;;
+ GUESS=$UNAME_MACHINE-unknown-mirbsd$UNAME_RELEASE
+ ;;
*:Sortix:*:*)
- echo "$UNAME_MACHINE"-unknown-sortix
- exit ;;
+ GUESS=$UNAME_MACHINE-unknown-sortix
+ ;;
+ *:Twizzler:*:*)
+ GUESS=$UNAME_MACHINE-unknown-twizzler
+ ;;
*:Redox:*:*)
- echo "$UNAME_MACHINE"-unknown-redox
- exit ;;
+ GUESS=$UNAME_MACHINE-unknown-redox
+ ;;
mips:OSF1:*.*)
- echo mips-dec-osf1
- exit ;;
+ GUESS=mips-dec-osf1
+ ;;
alpha:OSF1:*:*)
+ # Reset EXIT trap before exiting to avoid spurious non-zero exit code.
+ trap '' 0
case $UNAME_RELEASE in
*4.0)
UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
@@ -289,7 +329,7 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in
# covers most systems running today. This code pipes the CPU
# types through head -n 1, so we only detect the type of CPU 0.
ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1`
- case "$ALPHA_CPU_TYPE" in
+ case $ALPHA_CPU_TYPE in
"EV4 (21064)")
UNAME_MACHINE=alpha ;;
"EV4.5 (21064)")
@@ -326,117 +366,121 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in
# A Tn.n version is a released field test version.
# A Xn.n version is an unreleased experimental baselevel.
# 1.2 uses "1.2" for uname -r.
- echo "$UNAME_MACHINE"-dec-osf"`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`"
- # Reset EXIT trap before exiting to avoid spurious non-zero exit code.
- exitcode=$?
- trap '' 0
- exit $exitcode ;;
+ OSF_REL=`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
+ GUESS=$UNAME_MACHINE-dec-osf$OSF_REL
+ ;;
Amiga*:UNIX_System_V:4.0:*)
- echo m68k-unknown-sysv4
- exit ;;
+ GUESS=m68k-unknown-sysv4
+ ;;
*:[Aa]miga[Oo][Ss]:*:*)
- echo "$UNAME_MACHINE"-unknown-amigaos
- exit ;;
+ GUESS=$UNAME_MACHINE-unknown-amigaos
+ ;;
*:[Mm]orph[Oo][Ss]:*:*)
- echo "$UNAME_MACHINE"-unknown-morphos
- exit ;;
+ GUESS=$UNAME_MACHINE-unknown-morphos
+ ;;
*:OS/390:*:*)
- echo i370-ibm-openedition
- exit ;;
+ GUESS=i370-ibm-openedition
+ ;;
*:z/VM:*:*)
- echo s390-ibm-zvmoe
- exit ;;
+ GUESS=s390-ibm-zvmoe
+ ;;
*:OS400:*:*)
- echo powerpc-ibm-os400
- exit ;;
+ GUESS=powerpc-ibm-os400
+ ;;
arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
- echo arm-acorn-riscix"$UNAME_RELEASE"
- exit ;;
+ GUESS=arm-acorn-riscix$UNAME_RELEASE
+ ;;
arm*:riscos:*:*|arm*:RISCOS:*:*)
- echo arm-unknown-riscos
- exit ;;
+ GUESS=arm-unknown-riscos
+ ;;
SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
- echo hppa1.1-hitachi-hiuxmpp
- exit ;;
+ GUESS=hppa1.1-hitachi-hiuxmpp
+ ;;
Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
- if test "`(/bin/universe) 2>/dev/null`" = att ; then
- echo pyramid-pyramid-sysv3
- else
- echo pyramid-pyramid-bsd
- fi
- exit ;;
+ case `(/bin/universe) 2>/dev/null` in
+ att) GUESS=pyramid-pyramid-sysv3 ;;
+ *) GUESS=pyramid-pyramid-bsd ;;
+ esac
+ ;;
NILE*:*:*:dcosx)
- echo pyramid-pyramid-svr4
- exit ;;
+ GUESS=pyramid-pyramid-svr4
+ ;;
DRS?6000:unix:4.0:6*)
- echo sparc-icl-nx6
- exit ;;
+ GUESS=sparc-icl-nx6
+ ;;
DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
case `/usr/bin/uname -p` in
- sparc) echo sparc-icl-nx7; exit ;;
- esac ;;
+ sparc) GUESS=sparc-icl-nx7 ;;
+ esac
+ ;;
s390x:SunOS:*:*)
- echo "$UNAME_MACHINE"-ibm-solaris2"`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`"
- exit ;;
+ SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
+ GUESS=$UNAME_MACHINE-ibm-solaris2$SUN_REL
+ ;;
sun4H:SunOS:5.*:*)
- echo sparc-hal-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`"
- exit ;;
+ SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
+ GUESS=sparc-hal-solaris2$SUN_REL
+ ;;
sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
- echo sparc-sun-solaris2"`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`"
- exit ;;
+ SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
+ GUESS=sparc-sun-solaris2$SUN_REL
+ ;;
i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
- echo i386-pc-auroraux"$UNAME_RELEASE"
- exit ;;
+ GUESS=i386-pc-auroraux$UNAME_RELEASE
+ ;;
i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
- eval "$set_cc_for_build"
+ set_cc_for_build
SUN_ARCH=i386
# If there is a compiler, see if it is configured for 64-bit objects.
# Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
# This test works for both compilers.
- if [ "$CC_FOR_BUILD" != no_compiler_found ]; then
+ if test "$CC_FOR_BUILD" != no_compiler_found; then
if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
- (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
+ (CCOPTS="" $CC_FOR_BUILD -m64 -E - 2>/dev/null) | \
grep IS_64BIT_ARCH >/dev/null
then
SUN_ARCH=x86_64
fi
fi
- echo "$SUN_ARCH"-pc-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`"
- exit ;;
+ SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
+ GUESS=$SUN_ARCH-pc-solaris2$SUN_REL
+ ;;
sun4*:SunOS:6*:*)
# According to config.sub, this is the proper way to canonicalize
# SunOS6. Hard to guess exactly what SunOS6 will be like, but
# it's likely to be more like Solaris than SunOS4.
- echo sparc-sun-solaris3"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`"
- exit ;;
+ SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
+ GUESS=sparc-sun-solaris3$SUN_REL
+ ;;
sun4*:SunOS:*:*)
- case "`/usr/bin/arch -k`" in
+ case `/usr/bin/arch -k` in
Series*|S4*)
UNAME_RELEASE=`uname -v`
;;
esac
# Japanese Language versions have a version number like `4.1.3-JL'.
- echo sparc-sun-sunos"`echo "$UNAME_RELEASE"|sed -e 's/-/_/'`"
- exit ;;
+ SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/'`
+ GUESS=sparc-sun-sunos$SUN_REL
+ ;;
sun3*:SunOS:*:*)
- echo m68k-sun-sunos"$UNAME_RELEASE"
- exit ;;
+ GUESS=m68k-sun-sunos$UNAME_RELEASE
+ ;;
sun*:*:4.2BSD:*)
UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
test "x$UNAME_RELEASE" = x && UNAME_RELEASE=3
- case "`/bin/arch`" in
+ case `/bin/arch` in
sun3)
- echo m68k-sun-sunos"$UNAME_RELEASE"
+ GUESS=m68k-sun-sunos$UNAME_RELEASE
;;
sun4)
- echo sparc-sun-sunos"$UNAME_RELEASE"
+ GUESS=sparc-sun-sunos$UNAME_RELEASE
;;
esac
- exit ;;
+ ;;
aushp:SunOS:*:*)
- echo sparc-auspex-sunos"$UNAME_RELEASE"
- exit ;;
+ GUESS=sparc-auspex-sunos$UNAME_RELEASE
+ ;;
# The situation for MiNT is a little confusing. The machine name
# can be virtually everything (everything which is not
# "atarist" or "atariste" at least should have a processor
@@ -446,43 +490,43 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in
# MiNT. But MiNT is downward compatible to TOS, so this should
# be no problem.
atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
- echo m68k-atari-mint"$UNAME_RELEASE"
- exit ;;
+ GUESS=m68k-atari-mint$UNAME_RELEASE
+ ;;
atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
- echo m68k-atari-mint"$UNAME_RELEASE"
- exit ;;
+ GUESS=m68k-atari-mint$UNAME_RELEASE
+ ;;
*falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
- echo m68k-atari-mint"$UNAME_RELEASE"
- exit ;;
+ GUESS=m68k-atari-mint$UNAME_RELEASE
+ ;;
milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
- echo m68k-milan-mint"$UNAME_RELEASE"
- exit ;;
+ GUESS=m68k-milan-mint$UNAME_RELEASE
+ ;;
hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
- echo m68k-hades-mint"$UNAME_RELEASE"
- exit ;;
+ GUESS=m68k-hades-mint$UNAME_RELEASE
+ ;;
*:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
- echo m68k-unknown-mint"$UNAME_RELEASE"
- exit ;;
+ GUESS=m68k-unknown-mint$UNAME_RELEASE
+ ;;
m68k:machten:*:*)
- echo m68k-apple-machten"$UNAME_RELEASE"
- exit ;;
+ GUESS=m68k-apple-machten$UNAME_RELEASE
+ ;;
powerpc:machten:*:*)
- echo powerpc-apple-machten"$UNAME_RELEASE"
- exit ;;
+ GUESS=powerpc-apple-machten$UNAME_RELEASE
+ ;;
RISC*:Mach:*:*)
- echo mips-dec-mach_bsd4.3
- exit ;;
+ GUESS=mips-dec-mach_bsd4.3
+ ;;
RISC*:ULTRIX:*:*)
- echo mips-dec-ultrix"$UNAME_RELEASE"
- exit ;;
+ GUESS=mips-dec-ultrix$UNAME_RELEASE
+ ;;
VAX*:ULTRIX*:*:*)
- echo vax-dec-ultrix"$UNAME_RELEASE"
- exit ;;
+ GUESS=vax-dec-ultrix$UNAME_RELEASE
+ ;;
2020:CLIX:*:* | 2430:CLIX:*:*)
- echo clipper-intergraph-clix"$UNAME_RELEASE"
- exit ;;
+ GUESS=clipper-intergraph-clix$UNAME_RELEASE
+ ;;
mips:*:*:UMIPS | mips:*:*:RISCos)
- eval "$set_cc_for_build"
+ set_cc_for_build
sed 's/^ //' << EOF > "$dummy.c"
#ifdef __cplusplus
#include <stdio.h> /* for printf() prototype */
@@ -508,78 +552,79 @@ EOF
dummyarg=`echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p'` &&
SYSTEM_NAME=`"$dummy" "$dummyarg"` &&
{ echo "$SYSTEM_NAME"; exit; }
- echo mips-mips-riscos"$UNAME_RELEASE"
- exit ;;
+ GUESS=mips-mips-riscos$UNAME_RELEASE
+ ;;
Motorola:PowerMAX_OS:*:*)
- echo powerpc-motorola-powermax
- exit ;;
+ GUESS=powerpc-motorola-powermax
+ ;;
Motorola:*:4.3:PL8-*)
- echo powerpc-harris-powermax
- exit ;;
+ GUESS=powerpc-harris-powermax
+ ;;
Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
- echo powerpc-harris-powermax
- exit ;;
+ GUESS=powerpc-harris-powermax
+ ;;
Night_Hawk:Power_UNIX:*:*)
- echo powerpc-harris-powerunix
- exit ;;
+ GUESS=powerpc-harris-powerunix
+ ;;
m88k:CX/UX:7*:*)
- echo m88k-harris-cxux7
- exit ;;
+ GUESS=m88k-harris-cxux7
+ ;;
m88k:*:4*:R4*)
- echo m88k-motorola-sysv4
- exit ;;
+ GUESS=m88k-motorola-sysv4
+ ;;
m88k:*:3*:R3*)
- echo m88k-motorola-sysv3
- exit ;;
+ GUESS=m88k-motorola-sysv3
+ ;;
AViiON:dgux:*:*)
# DG/UX returns AViiON for all architectures
UNAME_PROCESSOR=`/usr/bin/uname -p`
- if [ "$UNAME_PROCESSOR" = mc88100 ] || [ "$UNAME_PROCESSOR" = mc88110 ]
+ if test "$UNAME_PROCESSOR" = mc88100 || test "$UNAME_PROCESSOR" = mc88110
then
- if [ "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx ] || \
- [ "$TARGET_BINARY_INTERFACE"x = x ]
+ if test "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx || \
+ test "$TARGET_BINARY_INTERFACE"x = x
then
- echo m88k-dg-dgux"$UNAME_RELEASE"
+ GUESS=m88k-dg-dgux$UNAME_RELEASE
else
- echo m88k-dg-dguxbcs"$UNAME_RELEASE"
+ GUESS=m88k-dg-dguxbcs$UNAME_RELEASE
fi
else
- echo i586-dg-dgux"$UNAME_RELEASE"
+ GUESS=i586-dg-dgux$UNAME_RELEASE
fi
- exit ;;
+ ;;
M88*:DolphinOS:*:*) # DolphinOS (SVR3)
- echo m88k-dolphin-sysv3
- exit ;;
+ GUESS=m88k-dolphin-sysv3
+ ;;
M88*:*:R3*:*)
# Delta 88k system running SVR3
- echo m88k-motorola-sysv3
- exit ;;
+ GUESS=m88k-motorola-sysv3
+ ;;
XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
- echo m88k-tektronix-sysv3
- exit ;;
+ GUESS=m88k-tektronix-sysv3
+ ;;
Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
- echo m68k-tektronix-bsd
- exit ;;
+ GUESS=m68k-tektronix-bsd
+ ;;
*:IRIX*:*:*)
- echo mips-sgi-irix"`echo "$UNAME_RELEASE"|sed -e 's/-/_/g'`"
- exit ;;
+ IRIX_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/g'`
+ GUESS=mips-sgi-irix$IRIX_REL
+ ;;
????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
- echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id
- exit ;; # Note that: echo "'`uname -s`'" gives 'AIX '
+ GUESS=romp-ibm-aix # uname -m gives an 8 hex-code CPU id
+ ;; # Note that: echo "'`uname -s`'" gives 'AIX '
i*86:AIX:*:*)
- echo i386-ibm-aix
- exit ;;
+ GUESS=i386-ibm-aix
+ ;;
ia64:AIX:*:*)
- if [ -x /usr/bin/oslevel ] ; then
+ if test -x /usr/bin/oslevel ; then
IBM_REV=`/usr/bin/oslevel`
else
- IBM_REV="$UNAME_VERSION.$UNAME_RELEASE"
+ IBM_REV=$UNAME_VERSION.$UNAME_RELEASE
fi
- echo "$UNAME_MACHINE"-ibm-aix"$IBM_REV"
- exit ;;
+ GUESS=$UNAME_MACHINE-ibm-aix$IBM_REV
+ ;;
*:AIX:2:3)
if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
- eval "$set_cc_for_build"
+ set_cc_for_build
sed 's/^ //' << EOF > "$dummy.c"
#include <sys/systemcfg.h>
@@ -593,16 +638,16 @@ EOF
EOF
if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"`
then
- echo "$SYSTEM_NAME"
+ GUESS=$SYSTEM_NAME
else
- echo rs6000-ibm-aix3.2.5
+ GUESS=rs6000-ibm-aix3.2.5
fi
elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
- echo rs6000-ibm-aix3.2.4
+ GUESS=rs6000-ibm-aix3.2.4
else
- echo rs6000-ibm-aix3.2
+ GUESS=rs6000-ibm-aix3.2
fi
- exit ;;
+ ;;
*:AIX:*:[4567])
IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
if /usr/sbin/lsattr -El "$IBM_CPU_ID" | grep ' POWER' >/dev/null 2>&1; then
@@ -610,57 +655,57 @@ EOF
else
IBM_ARCH=powerpc
fi
- if [ -x /usr/bin/lslpp ] ; then
- IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc |
+ if test -x /usr/bin/lslpp ; then
+ IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | \
awk -F: '{ print $3 }' | sed s/[0-9]*$/0/`
else
- IBM_REV="$UNAME_VERSION.$UNAME_RELEASE"
+ IBM_REV=$UNAME_VERSION.$UNAME_RELEASE
fi
- echo "$IBM_ARCH"-ibm-aix"$IBM_REV"
- exit ;;
+ GUESS=$IBM_ARCH-ibm-aix$IBM_REV
+ ;;
*:AIX:*:*)
- echo rs6000-ibm-aix
- exit ;;
+ GUESS=rs6000-ibm-aix
+ ;;
ibmrt:4.4BSD:*|romp-ibm:4.4BSD:*)
- echo romp-ibm-bsd4.4
- exit ;;
+ GUESS=romp-ibm-bsd4.4
+ ;;
ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and
- echo romp-ibm-bsd"$UNAME_RELEASE" # 4.3 with uname added to
- exit ;; # report: romp-ibm BSD 4.3
+ GUESS=romp-ibm-bsd$UNAME_RELEASE # 4.3 with uname added to
+ ;; # report: romp-ibm BSD 4.3
*:BOSX:*:*)
- echo rs6000-bull-bosx
- exit ;;
+ GUESS=rs6000-bull-bosx
+ ;;
DPX/2?00:B.O.S.:*:*)
- echo m68k-bull-sysv3
- exit ;;
+ GUESS=m68k-bull-sysv3
+ ;;
9000/[34]??:4.3bsd:1.*:*)
- echo m68k-hp-bsd
- exit ;;
+ GUESS=m68k-hp-bsd
+ ;;
hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
- echo m68k-hp-bsd4.4
- exit ;;
+ GUESS=m68k-hp-bsd4.4
+ ;;
9000/[34678]??:HP-UX:*:*)
- HPUX_REV=`echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//'`
- case "$UNAME_MACHINE" in
+ HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'`
+ case $UNAME_MACHINE in
9000/31?) HP_ARCH=m68000 ;;
9000/[34]??) HP_ARCH=m68k ;;
9000/[678][0-9][0-9])
- if [ -x /usr/bin/getconf ]; then
+ if test -x /usr/bin/getconf; then
sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
- case "$sc_cpu_version" in
+ case $sc_cpu_version in
523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0
528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1
532) # CPU_PA_RISC2_0
- case "$sc_kernel_bits" in
+ case $sc_kernel_bits in
32) HP_ARCH=hppa2.0n ;;
64) HP_ARCH=hppa2.0w ;;
'') HP_ARCH=hppa2.0 ;; # HP-UX 10.20
esac ;;
esac
fi
- if [ "$HP_ARCH" = "" ]; then
- eval "$set_cc_for_build"
+ if test "$HP_ARCH" = ""; then
+ set_cc_for_build
sed 's/^ //' << EOF > "$dummy.c"
#define _HPUX_SOURCE
@@ -698,9 +743,9 @@ EOF
test -z "$HP_ARCH" && HP_ARCH=hppa
fi ;;
esac
- if [ "$HP_ARCH" = hppa2.0w ]
+ if test "$HP_ARCH" = hppa2.0w
then
- eval "$set_cc_for_build"
+ set_cc_for_build
# hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
# 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler
@@ -719,14 +764,14 @@ EOF
HP_ARCH=hppa64
fi
fi
- echo "$HP_ARCH"-hp-hpux"$HPUX_REV"
- exit ;;
+ GUESS=$HP_ARCH-hp-hpux$HPUX_REV
+ ;;
ia64:HP-UX:*:*)
- HPUX_REV=`echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//'`
- echo ia64-hp-hpux"$HPUX_REV"
- exit ;;
+ HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'`
+ GUESS=ia64-hp-hpux$HPUX_REV
+ ;;
3050*:HI-UX:*:*)
- eval "$set_cc_for_build"
+ set_cc_for_build
sed 's/^ //' << EOF > "$dummy.c"
#include <unistd.h>
int
@@ -754,36 +799,36 @@ EOF
EOF
$CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` &&
{ echo "$SYSTEM_NAME"; exit; }
- echo unknown-hitachi-hiuxwe2
- exit ;;
+ GUESS=unknown-hitachi-hiuxwe2
+ ;;
9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:*)
- echo hppa1.1-hp-bsd
- exit ;;
+ GUESS=hppa1.1-hp-bsd
+ ;;
9000/8??:4.3bsd:*:*)
- echo hppa1.0-hp-bsd
- exit ;;
+ GUESS=hppa1.0-hp-bsd
+ ;;
*9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
- echo hppa1.0-hp-mpeix
- exit ;;
+ GUESS=hppa1.0-hp-mpeix
+ ;;
hp7??:OSF1:*:* | hp8?[79]:OSF1:*:*)
- echo hppa1.1-hp-osf
- exit ;;
+ GUESS=hppa1.1-hp-osf
+ ;;
hp8??:OSF1:*:*)
- echo hppa1.0-hp-osf
- exit ;;
+ GUESS=hppa1.0-hp-osf
+ ;;
i*86:OSF1:*:*)
- if [ -x /usr/sbin/sysversion ] ; then
- echo "$UNAME_MACHINE"-unknown-osf1mk
+ if test -x /usr/sbin/sysversion ; then
+ GUESS=$UNAME_MACHINE-unknown-osf1mk
else
- echo "$UNAME_MACHINE"-unknown-osf1
+ GUESS=$UNAME_MACHINE-unknown-osf1
fi
- exit ;;
+ ;;
parisc*:Lites*:*:*)
- echo hppa1.1-hp-lites
- exit ;;
+ GUESS=hppa1.1-hp-lites
+ ;;
C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
- echo c1-convex-bsd
- exit ;;
+ GUESS=c1-convex-bsd
+ ;;
C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
if getsysinfo -f scalar_acc
then echo c32-convex-bsd
@@ -791,17 +836,18 @@ EOF
fi
exit ;;
C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
- echo c34-convex-bsd
- exit ;;
+ GUESS=c34-convex-bsd
+ ;;
C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
- echo c38-convex-bsd
- exit ;;
+ GUESS=c38-convex-bsd
+ ;;
C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
- echo c4-convex-bsd
- exit ;;
+ GUESS=c4-convex-bsd
+ ;;
CRAY*Y-MP:*:*:*)
- echo ymp-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'
- exit ;;
+ CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
+ GUESS=ymp-cray-unicos$CRAY_REL
+ ;;
CRAY*[A-Z]90:*:*:*)
echo "$UNAME_MACHINE"-cray-unicos"$UNAME_RELEASE" \
| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
@@ -809,103 +855,135 @@ EOF
-e 's/\.[^.]*$/.X/'
exit ;;
CRAY*TS:*:*:*)
- echo t90-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'
- exit ;;
+ CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
+ GUESS=t90-cray-unicos$CRAY_REL
+ ;;
CRAY*T3E:*:*:*)
- echo alphaev5-cray-unicosmk"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'
- exit ;;
+ CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
+ GUESS=alphaev5-cray-unicosmk$CRAY_REL
+ ;;
CRAY*SV1:*:*:*)
- echo sv1-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'
- exit ;;
+ CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
+ GUESS=sv1-cray-unicos$CRAY_REL
+ ;;
*:UNICOS/mp:*:*)
- echo craynv-cray-unicosmp"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'
- exit ;;
+ CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
+ GUESS=craynv-cray-unicosmp$CRAY_REL
+ ;;
F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
FUJITSU_REL=`echo "$UNAME_RELEASE" | sed -e 's/ /_/'`
- echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
- exit ;;
+ GUESS=${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}
+ ;;
5000:UNIX_System_V:4.*:*)
FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
FUJITSU_REL=`echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'`
- echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
- exit ;;
+ GUESS=sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}
+ ;;
i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
- echo "$UNAME_MACHINE"-pc-bsdi"$UNAME_RELEASE"
- exit ;;
+ GUESS=$UNAME_MACHINE-pc-bsdi$UNAME_RELEASE
+ ;;
sparc*:BSD/OS:*:*)
- echo sparc-unknown-bsdi"$UNAME_RELEASE"
- exit ;;
+ GUESS=sparc-unknown-bsdi$UNAME_RELEASE
+ ;;
*:BSD/OS:*:*)
- echo "$UNAME_MACHINE"-unknown-bsdi"$UNAME_RELEASE"
- exit ;;
+ GUESS=$UNAME_MACHINE-unknown-bsdi$UNAME_RELEASE
+ ;;
+ arm:FreeBSD:*:*)
+ UNAME_PROCESSOR=`uname -p`
+ set_cc_for_build
+ if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
+ | grep -q __ARM_PCS_VFP
+ then
+ FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
+ GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabi
+ else
+ FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
+ GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabihf
+ fi
+ ;;
*:FreeBSD:*:*)
UNAME_PROCESSOR=`/usr/bin/uname -p`
- case "$UNAME_PROCESSOR" in
+ case $UNAME_PROCESSOR in
amd64)
UNAME_PROCESSOR=x86_64 ;;
i386)
UNAME_PROCESSOR=i586 ;;
esac
- echo "$UNAME_PROCESSOR"-unknown-freebsd"`echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`"
- exit ;;
+ FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
+ GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL
+ ;;
i*:CYGWIN*:*)
- echo "$UNAME_MACHINE"-pc-cygwin
- exit ;;
+ GUESS=$UNAME_MACHINE-pc-cygwin
+ ;;
*:MINGW64*:*)
- echo "$UNAME_MACHINE"-pc-mingw64
- exit ;;
+ GUESS=$UNAME_MACHINE-pc-mingw64
+ ;;
*:MINGW*:*)
- echo "$UNAME_MACHINE"-pc-mingw32
- exit ;;
+ GUESS=$UNAME_MACHINE-pc-mingw32
+ ;;
*:MSYS*:*)
- echo "$UNAME_MACHINE"-pc-msys
- exit ;;
+ GUESS=$UNAME_MACHINE-pc-msys
+ ;;
i*:PW*:*)
- echo "$UNAME_MACHINE"-pc-pw32
- exit ;;
+ GUESS=$UNAME_MACHINE-pc-pw32
+ ;;
+ *:SerenityOS:*:*)
+ GUESS=$UNAME_MACHINE-pc-serenity
+ ;;
*:Interix*:*)
- case "$UNAME_MACHINE" in
+ case $UNAME_MACHINE in
x86)
- echo i586-pc-interix"$UNAME_RELEASE"
- exit ;;
+ GUESS=i586-pc-interix$UNAME_RELEASE
+ ;;
authenticamd | genuineintel | EM64T)
- echo x86_64-unknown-interix"$UNAME_RELEASE"
- exit ;;
+ GUESS=x86_64-unknown-interix$UNAME_RELEASE
+ ;;
IA64)
- echo ia64-unknown-interix"$UNAME_RELEASE"
- exit ;;
+ GUESS=ia64-unknown-interix$UNAME_RELEASE
+ ;;
esac ;;
i*:UWIN*:*)
- echo "$UNAME_MACHINE"-pc-uwin
- exit ;;
+ GUESS=$UNAME_MACHINE-pc-uwin
+ ;;
amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
- echo x86_64-unknown-cygwin
- exit ;;
+ GUESS=x86_64-pc-cygwin
+ ;;
prep*:SunOS:5.*:*)
- echo powerpcle-unknown-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`"
- exit ;;
+ SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
+ GUESS=powerpcle-unknown-solaris2$SUN_REL
+ ;;
*:GNU:*:*)
# the GNU system
- echo "`echo "$UNAME_MACHINE"|sed -e 's,[-/].*$,,'`-unknown-$LIBC`echo "$UNAME_RELEASE"|sed -e 's,/.*$,,'`"
- exit ;;
+ GNU_ARCH=`echo "$UNAME_MACHINE" | sed -e 's,[-/].*$,,'`
+ GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's,/.*$,,'`
+ GUESS=$GNU_ARCH-unknown-$LIBC$GNU_REL
+ ;;
*:GNU/*:*:*)
# other systems with GNU libc and userland
- echo "$UNAME_MACHINE-unknown-`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"``echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`-$LIBC"
- exit ;;
+ GNU_SYS=`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"`
+ GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
+ GUESS=$UNAME_MACHINE-unknown-$GNU_SYS$GNU_REL-$LIBC
+ ;;
+ x86_64:[Mm]anagarm:*:*|i?86:[Mm]anagarm:*:*)
+ GUESS="$UNAME_MACHINE-pc-managarm-mlibc"
+ ;;
+ *:[Mm]anagarm:*:*)
+ GUESS="$UNAME_MACHINE-unknown-managarm-mlibc"
+ ;;
*:Minix:*:*)
- echo "$UNAME_MACHINE"-unknown-minix
- exit ;;
+ GUESS=$UNAME_MACHINE-unknown-minix
+ ;;
aarch64:Linux:*:*)
- echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
- exit ;;
+ GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+ ;;
aarch64_be:Linux:*:*)
UNAME_MACHINE=aarch64_be
- echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
- exit ;;
+ GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+ ;;
alpha:Linux:*:*)
- case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
+ case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' /proc/cpuinfo 2>/dev/null` in
EV5) UNAME_MACHINE=alphaev5 ;;
EV56) UNAME_MACHINE=alphaev56 ;;
PCA56) UNAME_MACHINE=alphapca56 ;;
@@ -916,183 +994,236 @@ EOF
esac
objdump --private-headers /bin/sh | grep -q ld.so.1
if test "$?" = 0 ; then LIBC=gnulibc1 ; fi
- echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
- exit ;;
- arc:Linux:*:* | arceb:Linux:*:*)
- echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
- exit ;;
+ GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+ ;;
+ arc:Linux:*:* | arceb:Linux:*:* | arc32:Linux:*:* | arc64:Linux:*:*)
+ GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+ ;;
arm*:Linux:*:*)
- eval "$set_cc_for_build"
+ set_cc_for_build
if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
| grep -q __ARM_EABI__
then
- echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
+ GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
else
if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
| grep -q __ARM_PCS_VFP
then
- echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"eabi
+ GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabi
else
- echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"eabihf
+ GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabihf
fi
fi
- exit ;;
+ ;;
avr32*:Linux:*:*)
- echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
- exit ;;
+ GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+ ;;
cris:Linux:*:*)
- echo "$UNAME_MACHINE"-axis-linux-"$LIBC"
- exit ;;
+ GUESS=$UNAME_MACHINE-axis-linux-$LIBC
+ ;;
crisv32:Linux:*:*)
- echo "$UNAME_MACHINE"-axis-linux-"$LIBC"
- exit ;;
+ GUESS=$UNAME_MACHINE-axis-linux-$LIBC
+ ;;
e2k:Linux:*:*)
- echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
- exit ;;
+ GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+ ;;
frv:Linux:*:*)
- echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
- exit ;;
+ GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+ ;;
hexagon:Linux:*:*)
- echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
- exit ;;
+ GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+ ;;
i*86:Linux:*:*)
- echo "$UNAME_MACHINE"-pc-linux-"$LIBC"
- exit ;;
+ GUESS=$UNAME_MACHINE-pc-linux-$LIBC
+ ;;
ia64:Linux:*:*)
- echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
- exit ;;
+ GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+ ;;
k1om:Linux:*:*)
- echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
- exit ;;
+ GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+ ;;
+ loongarch32:Linux:*:* | loongarch64:Linux:*:*)
+ GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+ ;;
m32r*:Linux:*:*)
- echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
- exit ;;
+ GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+ ;;
m68*:Linux:*:*)
- echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
- exit ;;
+ GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+ ;;
mips:Linux:*:* | mips64:Linux:*:*)
- eval "$set_cc_for_build"
+ set_cc_for_build
+ IS_GLIBC=0
+ test x"${LIBC}" = xgnu && IS_GLIBC=1
sed 's/^ //' << EOF > "$dummy.c"
#undef CPU
- #undef ${UNAME_MACHINE}
- #undef ${UNAME_MACHINE}el
+ #undef mips
+ #undef mipsel
+ #undef mips64
+ #undef mips64el
+ #if ${IS_GLIBC} && defined(_ABI64)
+ LIBCABI=gnuabi64
+ #else
+ #if ${IS_GLIBC} && defined(_ABIN32)
+ LIBCABI=gnuabin32
+ #else
+ LIBCABI=${LIBC}
+ #endif
+ #endif
+
+ #if ${IS_GLIBC} && defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6
+ CPU=mipsisa64r6
+ #else
+ #if ${IS_GLIBC} && !defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6
+ CPU=mipsisa32r6
+ #else
+ #if defined(__mips64)
+ CPU=mips64
+ #else
+ CPU=mips
+ #endif
+ #endif
+ #endif
+
#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
- CPU=${UNAME_MACHINE}el
+ MIPS_ENDIAN=el
#else
#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
- CPU=${UNAME_MACHINE}
+ MIPS_ENDIAN=
#else
- CPU=
+ MIPS_ENDIAN=
#endif
#endif
EOF
- eval "`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU'`"
- test "x$CPU" != x && { echo "$CPU-unknown-linux-$LIBC"; exit; }
+ cc_set_vars=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU\|^MIPS_ENDIAN\|^LIBCABI'`
+ eval "$cc_set_vars"
+ test "x$CPU" != x && { echo "$CPU${MIPS_ENDIAN}-unknown-linux-$LIBCABI"; exit; }
;;
mips64el:Linux:*:*)
- echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
- exit ;;
+ GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+ ;;
openrisc*:Linux:*:*)
- echo or1k-unknown-linux-"$LIBC"
- exit ;;
+ GUESS=or1k-unknown-linux-$LIBC
+ ;;
or32:Linux:*:* | or1k*:Linux:*:*)
- echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
- exit ;;
+ GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+ ;;
padre:Linux:*:*)
- echo sparc-unknown-linux-"$LIBC"
- exit ;;
+ GUESS=sparc-unknown-linux-$LIBC
+ ;;
parisc64:Linux:*:* | hppa64:Linux:*:*)
- echo hppa64-unknown-linux-"$LIBC"
- exit ;;
+ GUESS=hppa64-unknown-linux-$LIBC
+ ;;
parisc:Linux:*:* | hppa:Linux:*:*)
# Look for CPU level
case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
- PA7*) echo hppa1.1-unknown-linux-"$LIBC" ;;
- PA8*) echo hppa2.0-unknown-linux-"$LIBC" ;;
- *) echo hppa-unknown-linux-"$LIBC" ;;
+ PA7*) GUESS=hppa1.1-unknown-linux-$LIBC ;;
+ PA8*) GUESS=hppa2.0-unknown-linux-$LIBC ;;
+ *) GUESS=hppa-unknown-linux-$LIBC ;;
esac
- exit ;;
+ ;;
ppc64:Linux:*:*)
- echo powerpc64-unknown-linux-"$LIBC"
- exit ;;
+ GUESS=powerpc64-unknown-linux-$LIBC
+ ;;
ppc:Linux:*:*)
- echo powerpc-unknown-linux-"$LIBC"
- exit ;;
+ GUESS=powerpc-unknown-linux-$LIBC
+ ;;
ppc64le:Linux:*:*)
- echo powerpc64le-unknown-linux-"$LIBC"
- exit ;;
+ GUESS=powerpc64le-unknown-linux-$LIBC
+ ;;
ppcle:Linux:*:*)
- echo powerpcle-unknown-linux-"$LIBC"
- exit ;;
- riscv32:Linux:*:* | riscv64:Linux:*:*)
- echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
- exit ;;
+ GUESS=powerpcle-unknown-linux-$LIBC
+ ;;
+ riscv32:Linux:*:* | riscv32be:Linux:*:* | riscv64:Linux:*:* | riscv64be:Linux:*:*)
+ GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+ ;;
s390:Linux:*:* | s390x:Linux:*:*)
- echo "$UNAME_MACHINE"-ibm-linux-"$LIBC"
- exit ;;
+ GUESS=$UNAME_MACHINE-ibm-linux-$LIBC
+ ;;
sh64*:Linux:*:*)
- echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
- exit ;;
+ GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+ ;;
sh*:Linux:*:*)
- echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
- exit ;;
+ GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+ ;;
sparc:Linux:*:* | sparc64:Linux:*:*)
- echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
- exit ;;
+ GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+ ;;
tile*:Linux:*:*)
- echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
- exit ;;
+ GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+ ;;
vax:Linux:*:*)
- echo "$UNAME_MACHINE"-dec-linux-"$LIBC"
- exit ;;
+ GUESS=$UNAME_MACHINE-dec-linux-$LIBC
+ ;;
x86_64:Linux:*:*)
- echo "$UNAME_MACHINE"-pc-linux-"$LIBC"
- exit ;;
+ set_cc_for_build
+ CPU=$UNAME_MACHINE
+ LIBCABI=$LIBC
+ if test "$CC_FOR_BUILD" != no_compiler_found; then
+ ABI=64
+ sed 's/^ //' << EOF > "$dummy.c"
+ #ifdef __i386__
+ ABI=x86
+ #else
+ #ifdef __ILP32__
+ ABI=x32
+ #endif
+ #endif
+EOF
+ cc_set_abi=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^ABI' | sed 's, ,,g'`
+ eval "$cc_set_abi"
+ case $ABI in
+ x86) CPU=i686 ;;
+ x32) LIBCABI=${LIBC}x32 ;;
+ esac
+ fi
+ GUESS=$CPU-pc-linux-$LIBCABI
+ ;;
xtensa*:Linux:*:*)
- echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
- exit ;;
+ GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+ ;;
i*86:DYNIX/ptx:4*:*)
# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
# earlier versions are messed up and put the nodename in both
# sysname and nodename.
- echo i386-sequent-sysv4
- exit ;;
+ GUESS=i386-sequent-sysv4
+ ;;
i*86:UNIX_SV:4.2MP:2.*)
# Unixware is an offshoot of SVR4, but it has its own version
# number series starting with 2...
# I am not positive that other SVR4 systems won't match this,
# I just have to hope. -- rms.
# Use sysv4.2uw... so that sysv4* matches it.
- echo "$UNAME_MACHINE"-pc-sysv4.2uw"$UNAME_VERSION"
- exit ;;
+ GUESS=$UNAME_MACHINE-pc-sysv4.2uw$UNAME_VERSION
+ ;;
i*86:OS/2:*:*)
# If we were able to find `uname', then EMX Unix compatibility
# is probably installed.
- echo "$UNAME_MACHINE"-pc-os2-emx
- exit ;;
+ GUESS=$UNAME_MACHINE-pc-os2-emx
+ ;;
i*86:XTS-300:*:STOP)
- echo "$UNAME_MACHINE"-unknown-stop
- exit ;;
+ GUESS=$UNAME_MACHINE-unknown-stop
+ ;;
i*86:atheos:*:*)
- echo "$UNAME_MACHINE"-unknown-atheos
- exit ;;
+ GUESS=$UNAME_MACHINE-unknown-atheos
+ ;;
i*86:syllable:*:*)
- echo "$UNAME_MACHINE"-pc-syllable
- exit ;;
+ GUESS=$UNAME_MACHINE-pc-syllable
+ ;;
i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
- echo i386-unknown-lynxos"$UNAME_RELEASE"
- exit ;;
+ GUESS=i386-unknown-lynxos$UNAME_RELEASE
+ ;;
i*86:*DOS:*:*)
- echo "$UNAME_MACHINE"-pc-msdosdjgpp
- exit ;;
+ GUESS=$UNAME_MACHINE-pc-msdosdjgpp
+ ;;
i*86:*:4.*:*)
UNAME_REL=`echo "$UNAME_RELEASE" | sed 's/\/MP$//'`
if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
- echo "$UNAME_MACHINE"-univel-sysv"$UNAME_REL"
+ GUESS=$UNAME_MACHINE-univel-sysv$UNAME_REL
else
- echo "$UNAME_MACHINE"-pc-sysv"$UNAME_REL"
+ GUESS=$UNAME_MACHINE-pc-sysv$UNAME_REL
fi
- exit ;;
+ ;;
i*86:*:5:[678]*)
# UnixWare 7.x, OpenUNIX and OpenServer 6.
case `/bin/uname -X | grep "^Machine"` in
@@ -1100,12 +1231,12 @@ EOF
*Pentium) UNAME_MACHINE=i586 ;;
*Pent*|*Celeron) UNAME_MACHINE=i686 ;;
esac
- echo "$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}{$UNAME_VERSION}"
- exit ;;
+ GUESS=$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
+ ;;
i*86:*:3.2:*)
if test -f /usr/options/cb.name; then
UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
- echo "$UNAME_MACHINE"-pc-isc"$UNAME_REL"
+ GUESS=$UNAME_MACHINE-pc-isc$UNAME_REL
elif /bin/uname -X 2>/dev/null >/dev/null ; then
UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
(/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
@@ -1115,11 +1246,11 @@ EOF
&& UNAME_MACHINE=i686
(/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
&& UNAME_MACHINE=i686
- echo "$UNAME_MACHINE"-pc-sco"$UNAME_REL"
+ GUESS=$UNAME_MACHINE-pc-sco$UNAME_REL
else
- echo "$UNAME_MACHINE"-pc-sysv32
+ GUESS=$UNAME_MACHINE-pc-sysv32
fi
- exit ;;
+ ;;
pc:*:*:*)
# Left here for compatibility:
# uname -m prints for DJGPP always 'pc', but it prints nothing about
@@ -1127,31 +1258,31 @@ EOF
# Note: whatever this is, it MUST be the same as what config.sub
# prints for the "djgpp" host, or else GDB configure will decide that
# this is a cross-build.
- echo i586-pc-msdosdjgpp
- exit ;;
+ GUESS=i586-pc-msdosdjgpp
+ ;;
Intel:Mach:3*:*)
- echo i386-pc-mach3
- exit ;;
+ GUESS=i386-pc-mach3
+ ;;
paragon:*:*:*)
- echo i860-intel-osf1
- exit ;;
+ GUESS=i860-intel-osf1
+ ;;
i860:*:4.*:*) # i860-SVR4
if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
- echo i860-stardent-sysv"$UNAME_RELEASE" # Stardent Vistra i860-SVR4
+ GUESS=i860-stardent-sysv$UNAME_RELEASE # Stardent Vistra i860-SVR4
else # Add other i860-SVR4 vendors below as they are discovered.
- echo i860-unknown-sysv"$UNAME_RELEASE" # Unknown i860-SVR4
+ GUESS=i860-unknown-sysv$UNAME_RELEASE # Unknown i860-SVR4
fi
- exit ;;
+ ;;
mini*:CTIX:SYS*5:*)
# "miniframe"
- echo m68010-convergent-sysv
- exit ;;
+ GUESS=m68010-convergent-sysv
+ ;;
mc68k:UNIX:SYSTEM5:3.51m)
- echo m68k-convergent-sysv
- exit ;;
+ GUESS=m68k-convergent-sysv
+ ;;
M680?0:D-NIX:5.3:*)
- echo m68k-diab-dnix
- exit ;;
+ GUESS=m68k-diab-dnix
+ ;;
M68*:*:R3V[5678]*:*)
test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0)
@@ -1176,249 +1307,407 @@ EOF
/bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
&& { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;;
m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
- echo m68k-unknown-lynxos"$UNAME_RELEASE"
- exit ;;
+ GUESS=m68k-unknown-lynxos$UNAME_RELEASE
+ ;;
mc68030:UNIX_System_V:4.*:*)
- echo m68k-atari-sysv4
- exit ;;
+ GUESS=m68k-atari-sysv4
+ ;;
TSUNAMI:LynxOS:2.*:*)
- echo sparc-unknown-lynxos"$UNAME_RELEASE"
- exit ;;
+ GUESS=sparc-unknown-lynxos$UNAME_RELEASE
+ ;;
rs6000:LynxOS:2.*:*)
- echo rs6000-unknown-lynxos"$UNAME_RELEASE"
- exit ;;
+ GUESS=rs6000-unknown-lynxos$UNAME_RELEASE
+ ;;
PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
- echo powerpc-unknown-lynxos"$UNAME_RELEASE"
- exit ;;
+ GUESS=powerpc-unknown-lynxos$UNAME_RELEASE
+ ;;
SM[BE]S:UNIX_SV:*:*)
- echo mips-dde-sysv"$UNAME_RELEASE"
- exit ;;
+ GUESS=mips-dde-sysv$UNAME_RELEASE
+ ;;
RM*:ReliantUNIX-*:*:*)
- echo mips-sni-sysv4
- exit ;;
+ GUESS=mips-sni-sysv4
+ ;;
RM*:SINIX-*:*:*)
- echo mips-sni-sysv4
- exit ;;
+ GUESS=mips-sni-sysv4
+ ;;
*:SINIX-*:*:*)
if uname -p 2>/dev/null >/dev/null ; then
UNAME_MACHINE=`(uname -p) 2>/dev/null`
- echo "$UNAME_MACHINE"-sni-sysv4
+ GUESS=$UNAME_MACHINE-sni-sysv4
else
- echo ns32k-sni-sysv
+ GUESS=ns32k-sni-sysv
fi
- exit ;;
+ ;;
PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
# says <Richard.M.Bartel@ccMail.Census.GOV>
- echo i586-unisys-sysv4
- exit ;;
+ GUESS=i586-unisys-sysv4
+ ;;
*:UNIX_System_V:4*:FTX*)
# From Gerald Hewes <hewes@openmarket.com>.
# How about differentiating between stratus architectures? -djm
- echo hppa1.1-stratus-sysv4
- exit ;;
+ GUESS=hppa1.1-stratus-sysv4
+ ;;
*:*:*:FTX*)
# From seanf@swdc.stratus.com.
- echo i860-stratus-sysv4
- exit ;;
+ GUESS=i860-stratus-sysv4
+ ;;
i*86:VOS:*:*)
# From Paul.Green@stratus.com.
- echo "$UNAME_MACHINE"-stratus-vos
- exit ;;
+ GUESS=$UNAME_MACHINE-stratus-vos
+ ;;
*:VOS:*:*)
# From Paul.Green@stratus.com.
- echo hppa1.1-stratus-vos
- exit ;;
+ GUESS=hppa1.1-stratus-vos
+ ;;
mc68*:A/UX:*:*)
- echo m68k-apple-aux"$UNAME_RELEASE"
- exit ;;
+ GUESS=m68k-apple-aux$UNAME_RELEASE
+ ;;
news*:NEWS-OS:6*:*)
- echo mips-sony-newsos6
- exit ;;
+ GUESS=mips-sony-newsos6
+ ;;
R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
- if [ -d /usr/nec ]; then
- echo mips-nec-sysv"$UNAME_RELEASE"
+ if test -d /usr/nec; then
+ GUESS=mips-nec-sysv$UNAME_RELEASE
else
- echo mips-unknown-sysv"$UNAME_RELEASE"
+ GUESS=mips-unknown-sysv$UNAME_RELEASE
fi
- exit ;;
+ ;;
BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only.
- echo powerpc-be-beos
- exit ;;
+ GUESS=powerpc-be-beos
+ ;;
BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only.
- echo powerpc-apple-beos
- exit ;;
+ GUESS=powerpc-apple-beos
+ ;;
BePC:BeOS:*:*) # BeOS running on Intel PC compatible.
- echo i586-pc-beos
- exit ;;
+ GUESS=i586-pc-beos
+ ;;
BePC:Haiku:*:*) # Haiku running on Intel PC compatible.
- echo i586-pc-haiku
- exit ;;
- x86_64:Haiku:*:*)
- echo x86_64-unknown-haiku
- exit ;;
+ GUESS=i586-pc-haiku
+ ;;
+ ppc:Haiku:*:*) # Haiku running on Apple PowerPC
+ GUESS=powerpc-apple-haiku
+ ;;
+ *:Haiku:*:*) # Haiku modern gcc (not bound by BeOS compat)
+ GUESS=$UNAME_MACHINE-unknown-haiku
+ ;;
SX-4:SUPER-UX:*:*)
- echo sx4-nec-superux"$UNAME_RELEASE"
- exit ;;
+ GUESS=sx4-nec-superux$UNAME_RELEASE
+ ;;
SX-5:SUPER-UX:*:*)
- echo sx5-nec-superux"$UNAME_RELEASE"
- exit ;;
+ GUESS=sx5-nec-superux$UNAME_RELEASE
+ ;;
SX-6:SUPER-UX:*:*)
- echo sx6-nec-superux"$UNAME_RELEASE"
- exit ;;
+ GUESS=sx6-nec-superux$UNAME_RELEASE
+ ;;
SX-7:SUPER-UX:*:*)
- echo sx7-nec-superux"$UNAME_RELEASE"
- exit ;;
+ GUESS=sx7-nec-superux$UNAME_RELEASE
+ ;;
SX-8:SUPER-UX:*:*)
- echo sx8-nec-superux"$UNAME_RELEASE"
- exit ;;
+ GUESS=sx8-nec-superux$UNAME_RELEASE
+ ;;
SX-8R:SUPER-UX:*:*)
- echo sx8r-nec-superux"$UNAME_RELEASE"
- exit ;;
+ GUESS=sx8r-nec-superux$UNAME_RELEASE
+ ;;
SX-ACE:SUPER-UX:*:*)
- echo sxace-nec-superux"$UNAME_RELEASE"
- exit ;;
+ GUESS=sxace-nec-superux$UNAME_RELEASE
+ ;;
Power*:Rhapsody:*:*)
- echo powerpc-apple-rhapsody"$UNAME_RELEASE"
- exit ;;
+ GUESS=powerpc-apple-rhapsody$UNAME_RELEASE
+ ;;
*:Rhapsody:*:*)
- echo "$UNAME_MACHINE"-apple-rhapsody"$UNAME_RELEASE"
- exit ;;
+ GUESS=$UNAME_MACHINE-apple-rhapsody$UNAME_RELEASE
+ ;;
+ arm64:Darwin:*:*)
+ GUESS=aarch64-apple-darwin$UNAME_RELEASE
+ ;;
*:Darwin:*:*)
- UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
- eval "$set_cc_for_build"
- if test "$UNAME_PROCESSOR" = unknown ; then
- UNAME_PROCESSOR=powerpc
+ UNAME_PROCESSOR=`uname -p`
+ case $UNAME_PROCESSOR in
+ unknown) UNAME_PROCESSOR=powerpc ;;
+ esac
+ if command -v xcode-select > /dev/null 2> /dev/null && \
+ ! xcode-select --print-path > /dev/null 2> /dev/null ; then
+ # Avoid executing cc if there is no toolchain installed as
+ # cc will be a stub that puts up a graphical alert
+ # prompting the user to install developer tools.
+ CC_FOR_BUILD=no_compiler_found
+ else
+ set_cc_for_build
fi
- if test "`echo "$UNAME_RELEASE" | sed -e 's/\..*//'`" -le 10 ; then
- if [ "$CC_FOR_BUILD" != no_compiler_found ]; then
- if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
- (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
- grep IS_64BIT_ARCH >/dev/null
- then
- case $UNAME_PROCESSOR in
- i386) UNAME_PROCESSOR=x86_64 ;;
- powerpc) UNAME_PROCESSOR=powerpc64 ;;
- esac
- fi
- # On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc
- if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \
- (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
- grep IS_PPC >/dev/null
- then
- UNAME_PROCESSOR=powerpc
- fi
+ if test "$CC_FOR_BUILD" != no_compiler_found; then
+ if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
+ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
+ grep IS_64BIT_ARCH >/dev/null
+ then
+ case $UNAME_PROCESSOR in
+ i386) UNAME_PROCESSOR=x86_64 ;;
+ powerpc) UNAME_PROCESSOR=powerpc64 ;;
+ esac
+ fi
+ # On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc
+ if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \
+ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
+ grep IS_PPC >/dev/null
+ then
+ UNAME_PROCESSOR=powerpc
fi
elif test "$UNAME_PROCESSOR" = i386 ; then
- # Avoid executing cc on OS X 10.9, as it ships with a stub
- # that puts up a graphical alert prompting to install
- # developer tools. Any system running Mac OS X 10.7 or
- # later (Darwin 11 and later) is required to have a 64-bit
- # processor. This is not true of the ARM version of Darwin
- # that Apple uses in portable devices.
- UNAME_PROCESSOR=x86_64
+ # uname -m returns i386 or x86_64
+ UNAME_PROCESSOR=$UNAME_MACHINE
fi
- echo "$UNAME_PROCESSOR"-apple-darwin"$UNAME_RELEASE"
- exit ;;
+ GUESS=$UNAME_PROCESSOR-apple-darwin$UNAME_RELEASE
+ ;;
*:procnto*:*:* | *:QNX:[0123456789]*:*)
UNAME_PROCESSOR=`uname -p`
if test "$UNAME_PROCESSOR" = x86; then
UNAME_PROCESSOR=i386
UNAME_MACHINE=pc
fi
- echo "$UNAME_PROCESSOR"-"$UNAME_MACHINE"-nto-qnx"$UNAME_RELEASE"
- exit ;;
+ GUESS=$UNAME_PROCESSOR-$UNAME_MACHINE-nto-qnx$UNAME_RELEASE
+ ;;
*:QNX:*:4*)
- echo i386-pc-qnx
- exit ;;
+ GUESS=i386-pc-qnx
+ ;;
NEO-*:NONSTOP_KERNEL:*:*)
- echo neo-tandem-nsk"$UNAME_RELEASE"
- exit ;;
+ GUESS=neo-tandem-nsk$UNAME_RELEASE
+ ;;
NSE-*:NONSTOP_KERNEL:*:*)
- echo nse-tandem-nsk"$UNAME_RELEASE"
- exit ;;
+ GUESS=nse-tandem-nsk$UNAME_RELEASE
+ ;;
NSR-*:NONSTOP_KERNEL:*:*)
- echo nsr-tandem-nsk"$UNAME_RELEASE"
- exit ;;
+ GUESS=nsr-tandem-nsk$UNAME_RELEASE
+ ;;
NSV-*:NONSTOP_KERNEL:*:*)
- echo nsv-tandem-nsk"$UNAME_RELEASE"
- exit ;;
+ GUESS=nsv-tandem-nsk$UNAME_RELEASE
+ ;;
NSX-*:NONSTOP_KERNEL:*:*)
- echo nsx-tandem-nsk"$UNAME_RELEASE"
- exit ;;
+ GUESS=nsx-tandem-nsk$UNAME_RELEASE
+ ;;
*:NonStop-UX:*:*)
- echo mips-compaq-nonstopux
- exit ;;
+ GUESS=mips-compaq-nonstopux
+ ;;
BS2000:POSIX*:*:*)
- echo bs2000-siemens-sysv
- exit ;;
+ GUESS=bs2000-siemens-sysv
+ ;;
DS/*:UNIX_System_V:*:*)
- echo "$UNAME_MACHINE"-"$UNAME_SYSTEM"-"$UNAME_RELEASE"
- exit ;;
+ GUESS=$UNAME_MACHINE-$UNAME_SYSTEM-$UNAME_RELEASE
+ ;;
*:Plan9:*:*)
# "uname -m" is not consistent, so use $cputype instead. 386
# is converted to i386 for consistency with other x86
# operating systems.
- if test "$cputype" = 386; then
+ if test "${cputype-}" = 386; then
UNAME_MACHINE=i386
- else
- UNAME_MACHINE="$cputype"
+ elif test "x${cputype-}" != x; then
+ UNAME_MACHINE=$cputype
fi
- echo "$UNAME_MACHINE"-unknown-plan9
- exit ;;
+ GUESS=$UNAME_MACHINE-unknown-plan9
+ ;;
*:TOPS-10:*:*)
- echo pdp10-unknown-tops10
- exit ;;
+ GUESS=pdp10-unknown-tops10
+ ;;
*:TENEX:*:*)
- echo pdp10-unknown-tenex
- exit ;;
+ GUESS=pdp10-unknown-tenex
+ ;;
KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
- echo pdp10-dec-tops20
- exit ;;
+ GUESS=pdp10-dec-tops20
+ ;;
XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
- echo pdp10-xkl-tops20
- exit ;;
+ GUESS=pdp10-xkl-tops20
+ ;;
*:TOPS-20:*:*)
- echo pdp10-unknown-tops20
- exit ;;
+ GUESS=pdp10-unknown-tops20
+ ;;
*:ITS:*:*)
- echo pdp10-unknown-its
- exit ;;
+ GUESS=pdp10-unknown-its
+ ;;
SEI:*:*:SEIUX)
- echo mips-sei-seiux"$UNAME_RELEASE"
- exit ;;
+ GUESS=mips-sei-seiux$UNAME_RELEASE
+ ;;
*:DragonFly:*:*)
- echo "$UNAME_MACHINE"-unknown-dragonfly"`echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`"
- exit ;;
+ DRAGONFLY_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
+ GUESS=$UNAME_MACHINE-unknown-dragonfly$DRAGONFLY_REL
+ ;;
*:*VMS:*:*)
UNAME_MACHINE=`(uname -p) 2>/dev/null`
- case "$UNAME_MACHINE" in
- A*) echo alpha-dec-vms ; exit ;;
- I*) echo ia64-dec-vms ; exit ;;
- V*) echo vax-dec-vms ; exit ;;
+ case $UNAME_MACHINE in
+ A*) GUESS=alpha-dec-vms ;;
+ I*) GUESS=ia64-dec-vms ;;
+ V*) GUESS=vax-dec-vms ;;
esac ;;
*:XENIX:*:SysV)
- echo i386-pc-xenix
- exit ;;
+ GUESS=i386-pc-xenix
+ ;;
i*86:skyos:*:*)
- echo "$UNAME_MACHINE"-pc-skyos"`echo "$UNAME_RELEASE" | sed -e 's/ .*$//'`"
- exit ;;
+ SKYOS_REL=`echo "$UNAME_RELEASE" | sed -e 's/ .*$//'`
+ GUESS=$UNAME_MACHINE-pc-skyos$SKYOS_REL
+ ;;
i*86:rdos:*:*)
- echo "$UNAME_MACHINE"-pc-rdos
- exit ;;
- i*86:AROS:*:*)
- echo "$UNAME_MACHINE"-pc-aros
- exit ;;
+ GUESS=$UNAME_MACHINE-pc-rdos
+ ;;
+ i*86:Fiwix:*:*)
+ GUESS=$UNAME_MACHINE-pc-fiwix
+ ;;
+ *:AROS:*:*)
+ GUESS=$UNAME_MACHINE-unknown-aros
+ ;;
x86_64:VMkernel:*:*)
- echo "$UNAME_MACHINE"-unknown-esx
- exit ;;
+ GUESS=$UNAME_MACHINE-unknown-esx
+ ;;
amd64:Isilon\ OneFS:*:*)
- echo x86_64-unknown-onefs
- exit ;;
+ GUESS=x86_64-unknown-onefs
+ ;;
+ *:Unleashed:*:*)
+ GUESS=$UNAME_MACHINE-unknown-unleashed$UNAME_RELEASE
+ ;;
esac
+# Do we have a guess based on uname results?
+if test "x$GUESS" != x; then
+ echo "$GUESS"
+ exit
+fi
+
+# No uname command or uname output not recognized.
+set_cc_for_build
+cat > "$dummy.c" <<EOF
+#ifdef _SEQUENT_
+#include <sys/types.h>
+#include <sys/utsname.h>
+#endif
+#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__)
+#if defined (vax) || defined (__vax) || defined (__vax__) || defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__)
+#include <signal.h>
+#if defined(_SIZE_T_) || defined(SIGLOST)
+#include <sys/utsname.h>
+#endif
+#endif
+#endif
+main ()
+{
+#if defined (sony)
+#if defined (MIPSEB)
+ /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed,
+ I don't know.... */
+ printf ("mips-sony-bsd\n"); exit (0);
+#else
+#include <sys/param.h>
+ printf ("m68k-sony-newsos%s\n",
+#ifdef NEWSOS4
+ "4"
+#else
+ ""
+#endif
+ ); exit (0);
+#endif
+#endif
+
+#if defined (NeXT)
+#if !defined (__ARCHITECTURE__)
+#define __ARCHITECTURE__ "m68k"
+#endif
+ int version;
+ version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
+ if (version < 4)
+ printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
+ else
+ printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
+ exit (0);
+#endif
+
+#if defined (MULTIMAX) || defined (n16)
+#if defined (UMAXV)
+ printf ("ns32k-encore-sysv\n"); exit (0);
+#else
+#if defined (CMU)
+ printf ("ns32k-encore-mach\n"); exit (0);
+#else
+ printf ("ns32k-encore-bsd\n"); exit (0);
+#endif
+#endif
+#endif
+
+#if defined (__386BSD__)
+ printf ("i386-pc-bsd\n"); exit (0);
+#endif
+
+#if defined (sequent)
+#if defined (i386)
+ printf ("i386-sequent-dynix\n"); exit (0);
+#endif
+#if defined (ns32000)
+ printf ("ns32k-sequent-dynix\n"); exit (0);
+#endif
+#endif
+
+#if defined (_SEQUENT_)
+ struct utsname un;
+
+ uname(&un);
+ if (strncmp(un.version, "V2", 2) == 0) {
+ printf ("i386-sequent-ptx2\n"); exit (0);
+ }
+ if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
+ printf ("i386-sequent-ptx1\n"); exit (0);
+ }
+ printf ("i386-sequent-ptx\n"); exit (0);
+#endif
+
+#if defined (vax)
+#if !defined (ultrix)
+#include <sys/param.h>
+#if defined (BSD)
+#if BSD == 43
+ printf ("vax-dec-bsd4.3\n"); exit (0);
+#else
+#if BSD == 199006
+ printf ("vax-dec-bsd4.3reno\n"); exit (0);
+#else
+ printf ("vax-dec-bsd\n"); exit (0);
+#endif
+#endif
+#else
+ printf ("vax-dec-bsd\n"); exit (0);
+#endif
+#else
+#if defined(_SIZE_T_) || defined(SIGLOST)
+ struct utsname un;
+ uname (&un);
+ printf ("vax-dec-ultrix%s\n", un.release); exit (0);
+#else
+ printf ("vax-dec-ultrix\n"); exit (0);
+#endif
+#endif
+#endif
+#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__)
+#if defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__)
+#if defined(_SIZE_T_) || defined(SIGLOST)
+ struct utsname *un;
+ uname (&un);
+ printf ("mips-dec-ultrix%s\n", un.release); exit (0);
+#else
+ printf ("mips-dec-ultrix\n"); exit (0);
+#endif
+#endif
+#endif
+
+#if defined (alliant) && defined (i860)
+ printf ("i860-alliant-bsd\n"); exit (0);
+#endif
+
+ exit (1);
+}
+EOF
+
+$CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null && SYSTEM_NAME=`"$dummy"` &&
+ { echo "$SYSTEM_NAME"; exit; }
+
+# Apollos put the system type in the environment.
+test -d /usr/apollo && { echo "$ISP-apollo-$SYSTYPE"; exit; }
+
echo "$0: unable to guess system type" >&2
-case "$UNAME_MACHINE:$UNAME_SYSTEM" in
+case $UNAME_MACHINE:$UNAME_SYSTEM in
mips:Linux | mips64:Linux)
# If we got here on MIPS GNU/Linux, output extra information.
cat >&2 <<EOF
@@ -1435,9 +1724,17 @@ This script (version $timestamp), has failed to recognize the
operating system you are using. If your script is old, overwrite *all*
copies of config.guess and config.sub with the latest versions from:
- https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess
+ https://git.savannah.gnu.org/cgit/config.git/plain/config.guess
and
- https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub
+ https://git.savannah.gnu.org/cgit/config.git/plain/config.sub
+EOF
+
+our_year=`echo $timestamp | sed 's,-.*,,'`
+thisyear=`date +%Y`
+# shellcheck disable=SC2003
+script_age=`expr "$thisyear" - "$our_year"`
+if test "$script_age" -lt 3 ; then
+ cat >&2 <<EOF
If $0 has already been updated, send the following data and any
information you think might be pertinent to config-patches@gnu.org to
@@ -1465,6 +1762,7 @@ UNAME_RELEASE = "$UNAME_RELEASE"
UNAME_SYSTEM = "$UNAME_SYSTEM"
UNAME_VERSION = "$UNAME_VERSION"
EOF
+fi
exit 1
diff --git a/contrib/tcpdump/config.h.in b/contrib/tcpdump/config.h.in
index f23a6f8e7f8d..59bc6120a5d9 100644
--- a/contrib/tcpdump/config.h.in
+++ b/contrib/tcpdump/config.h.in
@@ -1,11 +1,11 @@
/* config.h.in. Generated from configure.ac by autoheader. */
+/* Define to 1 if arpa/inet.h declares `ether_ntohost' */
+#undef ARPA_INET_H_DECLARES_ETHER_NTOHOST
+
/* define if you want to build the possibly-buggy SMB printer */
#undef ENABLE_SMB
-/* Define to 1 if you have the `alarm' function. */
-#undef HAVE_ALARM
-
/* Define to 1 if you have the `bpf_dump' function. */
#undef HAVE_BPF_DUMP
@@ -24,19 +24,21 @@
/* Define to 1 if you have the `cap_rights_limit' function. */
#undef HAVE_CAP_RIGHTS_LIMIT
-/* Define to 1 if you have the declaration of `ether_ntohost', and to 0 if you
- don't. */
+/* Casper support available */
+#undef HAVE_CASPER
+
+/* Define to 1 if you have the declaration of `ether_ntohost' */
#undef HAVE_DECL_ETHER_NTOHOST
/* Define to 1 if you have the `ether_ntohost' function. */
#undef HAVE_ETHER_NTOHOST
-/* Define to 1 if you have the `EVP_CipherInit_ex' function. */
-#undef HAVE_EVP_CIPHERINIT_EX
-
/* Define to 1 if you have the `EVP_CIPHER_CTX_new' function. */
#undef HAVE_EVP_CIPHER_CTX_NEW
+/* Define to 1 if you have the `EVP_DecryptInit_ex' function. */
+#undef HAVE_EVP_DECRYPTINIT_EX
+
/* Define to 1 if you have the <fcntl.h> header file. */
#undef HAVE_FCNTL_H
@@ -49,6 +51,9 @@
/* define if you have getrpcbynumber() */
#undef HAVE_GETRPCBYNUMBER
+/* Define to 1 if you have the `getservent' function. */
+#undef HAVE_GETSERVENT
+
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
@@ -64,17 +69,11 @@
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
-/* Define to 1 if you have the <netinet/ether.h> header file. */
-#undef HAVE_NETINET_ETHER_H
+/* Define to 1 if you have the <net/if.h> header file. */
+#undef HAVE_NET_IF_H
-/* Define to 1 if you have the <netinet/if_ether.h> header file. */
-#undef HAVE_NETINET_IF_ETHER_H
-
-/* Define to 1 if you have the <net/if_pflog.h> header file. */
-#undef HAVE_NET_IF_PFLOG_H
-
-/* Define to 1 if you have the <net/pfvar.h> header file. */
-#undef HAVE_NET_PFVAR_H
+/* Define to 1 if printf(3) does not support the z length modifier. */
+#undef HAVE_NO_PRINTF_Z
/* Define to 1 if you have the `openat' function. */
#undef HAVE_OPENAT
@@ -88,9 +87,6 @@
/* if there's an os_proto.h for this platform, to use additional prototypes */
#undef HAVE_OS_PROTO_H
-/* Define to 1 if you have the <pcap/bluetooth.h> header file. */
-#undef HAVE_PCAP_BLUETOOTH_H
-
/* Define to 1 if you have the `pcap_breakloop' function. */
#undef HAVE_PCAP_BREAKLOOP
@@ -109,12 +105,18 @@
/* Define to 1 if you have the `pcap_dump_flush' function. */
#undef HAVE_PCAP_DUMP_FLUSH
-/* define if libpcap has pcap_dump_ftell() */
+/* Define to 1 if you have the `pcap_dump_ftell' function. */
#undef HAVE_PCAP_DUMP_FTELL
+/* Define to 1 if you have the `pcap_dump_ftell64' function. */
+#undef HAVE_PCAP_DUMP_FTELL64
+
/* Define to 1 if you have the `pcap_findalldevs' function. */
#undef HAVE_PCAP_FINDALLDEVS
+/* Define to 1 if you have the `pcap_findalldevs_ex' function. */
+#undef HAVE_PCAP_FINDALLDEVS_EX
+
/* Define to 1 if you have the `pcap_free_datalinks' function. */
#undef HAVE_PCAP_FREE_DATALINKS
@@ -127,8 +129,11 @@
/* define if libpcap has pcap_list_datalinks() */
#undef HAVE_PCAP_LIST_DATALINKS
-/* Define to 1 if you have the <pcap/nflog.h> header file. */
-#undef HAVE_PCAP_NFLOG_H
+/* Define to 1 if you have the `pcap_open' function. */
+#undef HAVE_PCAP_OPEN
+
+/* Define to 1 if you have the <pcap/pcap-inttypes.h> header file. */
+#undef HAVE_PCAP_PCAP_INTTYPES_H
/* Define to 1 if you have the `pcap_setdirection' function. */
#undef HAVE_PCAP_SETDIRECTION
@@ -151,9 +156,6 @@
/* Define to 1 if you have the `pcap_set_tstamp_type' function. */
#undef HAVE_PCAP_SET_TSTAMP_TYPE
-/* Define to 1 if you have the <pcap/usb.h> header file. */
-#undef HAVE_PCAP_USB_H
-
/* define if libpcap has pcap_version */
#undef HAVE_PCAP_VERSION
@@ -169,18 +171,6 @@
/* Define to 1 if you have the `setlinebuf' function. */
#undef HAVE_SETLINEBUF
-/* Define to 1 if you have the `sigaction' function. */
-#undef HAVE_SIGACTION
-
-/* Define to 1 if you have the `sigset' function. */
-#undef HAVE_SIGSET
-
-/* Define to 1 if you have the `snprintf' function. */
-#undef HAVE_SNPRINTF
-
-/* if struct sockaddr has the sa_len member */
-#undef HAVE_SOCKADDR_SA_LEN
-
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
@@ -190,9 +180,6 @@
/* Define to 1 if you have the `strdup' function. */
#undef HAVE_STRDUP
-/* Define to 1 if you have the `strftime' function. */
-#undef HAVE_STRFTIME
-
/* Define to 1 if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H
@@ -226,27 +213,18 @@
/* Define to 1 if you have the `vfork' function. */
#undef HAVE_VFORK
-/* Define to 1 if you have the `vfprintf' function. */
-#undef HAVE_VFPRINTF
-
-/* Define to 1 if you have the `vsnprintf' function. */
-#undef HAVE_VSNPRINTF
-
/* define if libpcap has yydebug */
#undef HAVE_YYDEBUG
-/* define if your compiler has __attribute__ */
-#undef HAVE___ATTRIBUTE__
-
-/* if unaligned access fails */
-#undef LBL_ALIGN
-
/* Define to 1 if netinet/ether.h declares `ether_ntohost' */
#undef NETINET_ETHER_H_DECLARES_ETHER_NTOHOST
/* Define to 1 if netinet/if_ether.h declares `ether_ntohost' */
#undef NETINET_IF_ETHER_H_DECLARES_ETHER_NTOHOST
+/* Define to 1 if net/ethernet.h declares `ether_ntohost' */
+#undef NET_ETHERNET_H_DECLARES_ETHER_NTOHOST
+
/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT
@@ -265,29 +243,14 @@
/* Define to the version of this package. */
#undef PACKAGE_VERSION
-/* define if the platform doesn't define PRId64 */
-#undef PRId64
-
-/* define if the platform doesn't define PRIo64 */
-#undef PRIo64
-
-/* define if the platform doesn't define PRIx64 */
-#undef PRIu64
-
-/* define if the platform doesn't define PRIu64 */
-#undef PRIx64
-
-/* Define as the return type of signal handlers (`int' or `void'). */
-#undef RETSIGTYPE
-
-/* return value of signal handlers */
-#undef RETSIGVAL
+/* The size of `void *', as computed by sizeof. */
+#undef SIZEOF_VOID_P
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS
-/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
-#undef TIME_WITH_SYS_TIME
+/* Define to 1 if sys/ethernet.h declares `ether_ntohost' */
+#undef SYS_ETHERNET_H_DECLARES_ETHER_NTOHOST
/* define if you have ether_ntohost() and it works */
#undef USE_ETHER_NTOHOST
@@ -301,60 +264,15 @@
/* define if should drop privileges by default */
#undef WITH_USER
-/* get BSD semantics on Irix */
-#undef _BSD_SIGNALS
-
/* define on AIX to get certain functions */
#undef _SUN
-/* Define for Solaris 2.5.1 so the uint32_t typedef from <sys/synch.h>,
- <pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the
- #define below would cause a syntax error. */
-#undef _UINT32_T
-
-/* Define for Solaris 2.5.1 so the uint64_t typedef from <sys/synch.h>,
- <pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the
- #define below would cause a syntax error. */
-#undef _UINT64_T
-
-/* Define for Solaris 2.5.1 so the uint8_t typedef from <sys/synch.h>,
- <pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the
- #define below would cause a syntax error. */
-#undef _UINT8_T
-
-/* define if your compiler allows __attribute__((format)) without a warning */
-#undef __ATTRIBUTE___FORMAT_OK
-
-/* define if your compiler allows __attribute__((format)) to be applied to
- function pointers */
-#undef __ATTRIBUTE___FORMAT_OK_FOR_FUNCTION_POINTERS
-
-/* define if your compiler allows __attribute__((noreturn)) to be applied to
- function pointers */
-#undef __ATTRIBUTE___NORETURN_OK_FOR_FUNCTION_POINTERS
-
/* to handle Ultrix compilers that don't support const in prototypes */
#undef const
/* Define as token for inline if inlining supported */
#undef inline
-/* Define to the type of a signed integer type of width exactly 16 bits if
- such a type exists and the standard includes do not define it. */
-#undef int16_t
-
-/* Define to the type of a signed integer type of width exactly 32 bits if
- such a type exists and the standard includes do not define it. */
-#undef int32_t
-
-/* Define to the type of a signed integer type of width exactly 64 bits if
- such a type exists and the standard includes do not define it. */
-#undef int64_t
-
-/* Define to the type of a signed integer type of width exactly 8 bits if such
- a type exists and the standard includes do not define it. */
-#undef int8_t
-
/* Define to `uint16_t' if u_int16_t not defined. */
#undef u_int16_t
@@ -367,22 +285,6 @@
/* Define to `uint8_t' if u_int8_t not defined. */
#undef u_int8_t
-/* Define to the type of an unsigned integer type of width exactly 16 bits if
- such a type exists and the standard includes do not define it. */
-#undef uint16_t
-
-/* Define to the type of an unsigned integer type of width exactly 32 bits if
- such a type exists and the standard includes do not define it. */
-#undef uint32_t
-
-/* Define to the type of an unsigned integer type of width exactly 64 bits if
- such a type exists and the standard includes do not define it. */
-#undef uint64_t
-
-/* Define to the type of an unsigned integer type of width exactly 8 bits if
- such a type exists and the standard includes do not define it. */
-#undef uint8_t
-
/* Define to the type of an unsigned integer type wide enough to hold a
pointer, if such a type exists, and if the system does not define it. */
#undef uintptr_t
diff --git a/contrib/tcpdump/config.sub b/contrib/tcpdump/config.sub
index c95acc681d1b..de4259e40479 100755
--- a/contrib/tcpdump/config.sub
+++ b/contrib/tcpdump/config.sub
@@ -1,12 +1,14 @@
#! /bin/sh
# Configuration validation subroutine script.
-# Copyright 1992-2018 Free Software Foundation, Inc.
+# Copyright 1992-2023 Free Software Foundation, Inc.
-timestamp='2018-07-03'
+# shellcheck disable=SC2006,SC2268 # see below for rationale
+
+timestamp='2023-01-21'
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3 of the License, or
+# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
@@ -33,7 +35,7 @@ timestamp='2018-07-03'
# Otherwise, we print the canonical config type on stdout and succeed.
# You can get the latest version of this script from:
-# https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub
+# https://git.savannah.gnu.org/cgit/config.git/plain/config.sub
# This file is supposed to be the same for all GNU packages
# and recognize all the CPU types, system types and aliases
@@ -50,6 +52,13 @@ timestamp='2018-07-03'
# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
# It is wrong to echo any other type of specification.
+# The "shellcheck disable" line above the timestamp inhibits complaints
+# about features and limitations of the classic Bourne shell that were
+# superseded or lifted in POSIX. However, this script identifies a wide
+# variety of pre-POSIX systems that do not have POSIX shells at all, and
+# even some reasonably current systems (Solaris 10 as case-in-point) still
+# have a pre-POSIX /bin/sh.
+
me=`echo "$0" | sed -e 's,.*/,,'`
usage="\
@@ -67,7 +76,7 @@ Report bugs and patches to <config-patches@gnu.org>."
version="\
GNU config.sub ($timestamp)
-Copyright 1992-2018 Free Software Foundation, Inc.
+Copyright 1992-2023 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -89,7 +98,7 @@ while test $# -gt 0 ; do
- ) # Use stdin as input.
break ;;
-* )
- echo "$me: invalid option $1$help"
+ echo "$me: invalid option $1$help" >&2
exit 1 ;;
*local*)
@@ -111,9 +120,12 @@ case $# in
esac
# Split fields of configuration type
-IFS="-" read -r field1 field2 field3 field4 <<EOF
+# shellcheck disable=SC2162
+saved_IFS=$IFS
+IFS="-" read field1 field2 field3 field4 <<EOF
$1
EOF
+IFS=$saved_IFS
# Separate into logical components for further validation
case $1 in
@@ -123,55 +135,68 @@ case $1 in
;;
*-*-*-*)
basic_machine=$field1-$field2
- os=$field3-$field4
+ basic_os=$field3-$field4
;;
*-*-*)
# Ambiguous whether COMPANY is present, or skipped and KERNEL-OS is two
# parts
maybe_os=$field2-$field3
case $maybe_os in
- nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc \
- | linux-newlib* | linux-musl* | linux-uclibc* | uclinux-uclibc* \
+ nto-qnx* | linux-* | uclinux-uclibc* \
| uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* \
| netbsd*-eabi* | kopensolaris*-gnu* | cloudabi*-eabi* \
- | storm-chaos* | os2-emx* | rtmk-nova*)
+ | storm-chaos* | os2-emx* | rtmk-nova* | managarm-*)
basic_machine=$field1
- os=$maybe_os
+ basic_os=$maybe_os
;;
android-linux)
basic_machine=$field1-unknown
- os=linux-android
+ basic_os=linux-android
;;
*)
basic_machine=$field1-$field2
- os=$field3
+ basic_os=$field3
;;
esac
;;
*-*)
- # Second component is usually, but not always the OS
- case $field2 in
- # Prevent following clause from handling this valid os
- sun*os*)
- basic_machine=$field1
- os=$field2
- ;;
- # Manufacturers
- dec* | mips* | sequent* | encore* | pc532* | sgi* | sony* \
- | att* | 7300* | 3300* | delta* | motorola* | sun[234]* \
- | unicom* | ibm* | next | hp | isi* | apollo | altos* \
- | convergent* | ncr* | news | 32* | 3600* | 3100* | hitachi* \
- | c[123]* | convex* | sun | crds | omron* | dg | ultra | tti* \
- | harris | dolphin | highlevel | gould | cbm | ns | masscomp \
- | apple | axis | knuth | cray | microblaze* \
- | sim | cisco | oki | wec | wrs | winbond)
- basic_machine=$field1-$field2
- os=
- ;;
- *)
- basic_machine=$field1
- os=$field2
- ;;
+ # A lone config we happen to match not fitting any pattern
+ case $field1-$field2 in
+ decstation-3100)
+ basic_machine=mips-dec
+ basic_os=
+ ;;
+ *-*)
+ # Second component is usually, but not always the OS
+ case $field2 in
+ # Prevent following clause from handling this valid os
+ sun*os*)
+ basic_machine=$field1
+ basic_os=$field2
+ ;;
+ zephyr*)
+ basic_machine=$field1-unknown
+ basic_os=$field2
+ ;;
+ # Manufacturers
+ dec* | mips* | sequent* | encore* | pc533* | sgi* | sony* \
+ | att* | 7300* | 3300* | delta* | motorola* | sun[234]* \
+ | unicom* | ibm* | next | hp | isi* | apollo | altos* \
+ | convergent* | ncr* | news | 32* | 3600* | 3100* \
+ | hitachi* | c[123]* | convex* | sun | crds | omron* | dg \
+ | ultra | tti* | harris | dolphin | highlevel | gould \
+ | cbm | ns | masscomp | apple | axis | knuth | cray \
+ | microblaze* | sim | cisco \
+ | oki | wec | wrs | winbond)
+ basic_machine=$field1-$field2
+ basic_os=
+ ;;
+ *)
+ basic_machine=$field1
+ basic_os=$field2
+ ;;
+ esac
+ ;;
esac
;;
*)
@@ -180,1105 +205,1100 @@ case $1 in
case $field1 in
386bsd)
basic_machine=i386-pc
- os=bsd
+ basic_os=bsd
;;
a29khif)
basic_machine=a29k-amd
- os=udi
+ basic_os=udi
;;
adobe68k)
basic_machine=m68010-adobe
- os=scout
+ basic_os=scout
+ ;;
+ alliant)
+ basic_machine=fx80-alliant
+ basic_os=
+ ;;
+ altos | altos3068)
+ basic_machine=m68k-altos
+ basic_os=
;;
am29k)
basic_machine=a29k-none
- os=bsd
+ basic_os=bsd
;;
amdahl)
basic_machine=580-amdahl
- os=sysv
+ basic_os=sysv
+ ;;
+ amiga)
+ basic_machine=m68k-unknown
+ basic_os=
;;
amigaos | amigados)
basic_machine=m68k-unknown
- os=amigaos
+ basic_os=amigaos
;;
amigaunix | amix)
basic_machine=m68k-unknown
- os=sysv4
+ basic_os=sysv4
;;
apollo68)
basic_machine=m68k-apollo
- os=sysv
+ basic_os=sysv
;;
apollo68bsd)
basic_machine=m68k-apollo
- os=bsd
+ basic_os=bsd
;;
aros)
basic_machine=i386-pc
- os=aros
+ basic_os=aros
;;
aux)
basic_machine=m68k-apple
- os=aux
+ basic_os=aux
;;
balance)
basic_machine=ns32k-sequent
- os=dynix
+ basic_os=dynix
;;
blackfin)
basic_machine=bfin-unknown
- os=linux
+ basic_os=linux
;;
cegcc)
basic_machine=arm-unknown
- os=cegcc
+ basic_os=cegcc
+ ;;
+ convex-c1)
+ basic_machine=c1-convex
+ basic_os=bsd
+ ;;
+ convex-c2)
+ basic_machine=c2-convex
+ basic_os=bsd
+ ;;
+ convex-c32)
+ basic_machine=c32-convex
+ basic_os=bsd
+ ;;
+ convex-c34)
+ basic_machine=c34-convex
+ basic_os=bsd
+ ;;
+ convex-c38)
+ basic_machine=c38-convex
+ basic_os=bsd
;;
cray)
basic_machine=j90-cray
- os=unicos
+ basic_os=unicos
+ ;;
+ crds | unos)
+ basic_machine=m68k-crds
+ basic_os=
+ ;;
+ da30)
+ basic_machine=m68k-da30
+ basic_os=
;;
- craynv)
- basic_machine=craynv-cray
- os=unicosmp
+ decstation | pmax | pmin | dec3100 | decstatn)
+ basic_machine=mips-dec
+ basic_os=
;;
delta88)
basic_machine=m88k-motorola
- os=sysv3
+ basic_os=sysv3
;;
dicos)
basic_machine=i686-pc
- os=dicos
+ basic_os=dicos
;;
djgpp)
basic_machine=i586-pc
- os=msdosdjgpp
+ basic_os=msdosdjgpp
;;
ebmon29k)
basic_machine=a29k-amd
- os=ebmon
+ basic_os=ebmon
;;
es1800 | OSE68k | ose68k | ose | OSE)
basic_machine=m68k-ericsson
- os=ose
+ basic_os=ose
;;
gmicro)
basic_machine=tron-gmicro
- os=sysv
+ basic_os=sysv
;;
go32)
basic_machine=i386-pc
- os=go32
+ basic_os=go32
;;
h8300hms)
basic_machine=h8300-hitachi
- os=hms
+ basic_os=hms
;;
h8300xray)
basic_machine=h8300-hitachi
- os=xray
+ basic_os=xray
;;
h8500hms)
basic_machine=h8500-hitachi
- os=hms
+ basic_os=hms
;;
harris)
basic_machine=m88k-harris
- os=sysv3
+ basic_os=sysv3
;;
- hp300bsd)
+ hp300 | hp300hpux)
basic_machine=m68k-hp
- os=bsd
+ basic_os=hpux
;;
- hp300hpux)
+ hp300bsd)
basic_machine=m68k-hp
- os=hpux
+ basic_os=bsd
;;
hppaosf)
basic_machine=hppa1.1-hp
- os=osf
+ basic_os=osf
;;
hppro)
basic_machine=hppa1.1-hp
- os=proelf
+ basic_os=proelf
;;
i386mach)
basic_machine=i386-mach
- os=mach
- ;;
- vsta)
- basic_machine=i386-unknown
- os=vsta
+ basic_os=mach
;;
isi68 | isi)
basic_machine=m68k-isi
- os=sysv
+ basic_os=sysv
;;
m68knommu)
basic_machine=m68k-unknown
- os=linux
+ basic_os=linux
;;
magnum | m3230)
basic_machine=mips-mips
- os=sysv
+ basic_os=sysv
;;
merlin)
basic_machine=ns32k-utek
- os=sysv
+ basic_os=sysv
;;
mingw64)
basic_machine=x86_64-pc
- os=mingw64
+ basic_os=mingw64
;;
mingw32)
basic_machine=i686-pc
- os=mingw32
+ basic_os=mingw32
;;
mingw32ce)
basic_machine=arm-unknown
- os=mingw32ce
+ basic_os=mingw32ce
;;
monitor)
basic_machine=m68k-rom68k
- os=coff
+ basic_os=coff
;;
morphos)
basic_machine=powerpc-unknown
- os=morphos
+ basic_os=morphos
;;
moxiebox)
basic_machine=moxie-unknown
- os=moxiebox
+ basic_os=moxiebox
;;
msdos)
basic_machine=i386-pc
- os=msdos
+ basic_os=msdos
;;
msys)
basic_machine=i686-pc
- os=msys
+ basic_os=msys
;;
mvs)
basic_machine=i370-ibm
- os=mvs
+ basic_os=mvs
;;
nacl)
basic_machine=le32-unknown
- os=nacl
+ basic_os=nacl
;;
ncr3000)
basic_machine=i486-ncr
- os=sysv4
+ basic_os=sysv4
;;
netbsd386)
- basic_machine=i386-unknown
- os=netbsd
+ basic_machine=i386-pc
+ basic_os=netbsd
;;
netwinder)
basic_machine=armv4l-rebel
- os=linux
+ basic_os=linux
;;
news | news700 | news800 | news900)
basic_machine=m68k-sony
- os=newsos
+ basic_os=newsos
;;
news1000)
basic_machine=m68030-sony
- os=newsos
+ basic_os=newsos
;;
necv70)
basic_machine=v70-nec
- os=sysv
+ basic_os=sysv
;;
nh3000)
basic_machine=m68k-harris
- os=cxux
+ basic_os=cxux
;;
nh[45]000)
basic_machine=m88k-harris
- os=cxux
+ basic_os=cxux
;;
nindy960)
basic_machine=i960-intel
- os=nindy
+ basic_os=nindy
;;
mon960)
basic_machine=i960-intel
- os=mon960
+ basic_os=mon960
;;
nonstopux)
basic_machine=mips-compaq
- os=nonstopux
+ basic_os=nonstopux
;;
os400)
basic_machine=powerpc-ibm
- os=os400
+ basic_os=os400
;;
OSE68000 | ose68000)
basic_machine=m68000-ericsson
- os=ose
+ basic_os=ose
;;
os68k)
basic_machine=m68k-none
- os=os68k
+ basic_os=os68k
;;
paragon)
basic_machine=i860-intel
- os=osf
+ basic_os=osf
;;
parisc)
basic_machine=hppa-unknown
- os=linux
+ basic_os=linux
+ ;;
+ psp)
+ basic_machine=mipsallegrexel-sony
+ basic_os=psp
;;
pw32)
basic_machine=i586-unknown
- os=pw32
+ basic_os=pw32
;;
rdos | rdos64)
basic_machine=x86_64-pc
- os=rdos
+ basic_os=rdos
;;
rdos32)
basic_machine=i386-pc
- os=rdos
+ basic_os=rdos
;;
rom68k)
basic_machine=m68k-rom68k
- os=coff
+ basic_os=coff
;;
sa29200)
basic_machine=a29k-amd
- os=udi
+ basic_os=udi
;;
sei)
basic_machine=mips-sei
- os=seiux
+ basic_os=seiux
+ ;;
+ sequent)
+ basic_machine=i386-sequent
+ basic_os=
;;
sps7)
basic_machine=m68k-bull
- os=sysv2
+ basic_os=sysv2
+ ;;
+ st2000)
+ basic_machine=m68k-tandem
+ basic_os=
;;
stratus)
basic_machine=i860-stratus
- os=sysv4
+ basic_os=sysv4
+ ;;
+ sun2)
+ basic_machine=m68000-sun
+ basic_os=
;;
sun2os3)
basic_machine=m68000-sun
- os=sunos3
+ basic_os=sunos3
;;
sun2os4)
basic_machine=m68000-sun
- os=sunos4
+ basic_os=sunos4
+ ;;
+ sun3)
+ basic_machine=m68k-sun
+ basic_os=
;;
sun3os3)
basic_machine=m68k-sun
- os=sunos3
+ basic_os=sunos3
;;
sun3os4)
basic_machine=m68k-sun
- os=sunos4
+ basic_os=sunos4
+ ;;
+ sun4)
+ basic_machine=sparc-sun
+ basic_os=
;;
sun4os3)
basic_machine=sparc-sun
- os=sunos3
+ basic_os=sunos3
;;
sun4os4)
basic_machine=sparc-sun
- os=sunos4
+ basic_os=sunos4
;;
sun4sol2)
basic_machine=sparc-sun
- os=solaris2
+ basic_os=solaris2
+ ;;
+ sun386 | sun386i | roadrunner)
+ basic_machine=i386-sun
+ basic_os=
;;
sv1)
basic_machine=sv1-cray
- os=unicos
+ basic_os=unicos
;;
symmetry)
basic_machine=i386-sequent
- os=dynix
+ basic_os=dynix
;;
t3e)
basic_machine=alphaev5-cray
- os=unicos
+ basic_os=unicos
;;
t90)
basic_machine=t90-cray
- os=unicos
+ basic_os=unicos
;;
toad1)
basic_machine=pdp10-xkl
- os=tops20
+ basic_os=tops20
;;
tpf)
basic_machine=s390x-ibm
- os=tpf
+ basic_os=tpf
;;
udi29k)
basic_machine=a29k-amd
- os=udi
+ basic_os=udi
;;
ultra3)
basic_machine=a29k-nyu
- os=sym1
+ basic_os=sym1
;;
v810 | necv810)
basic_machine=v810-nec
- os=none
+ basic_os=none
;;
vaxv)
basic_machine=vax-dec
- os=sysv
+ basic_os=sysv
;;
vms)
basic_machine=vax-dec
- os=vms
+ basic_os=vms
+ ;;
+ vsta)
+ basic_machine=i386-pc
+ basic_os=vsta
;;
vxworks960)
basic_machine=i960-wrs
- os=vxworks
+ basic_os=vxworks
;;
vxworks68)
basic_machine=m68k-wrs
- os=vxworks
+ basic_os=vxworks
;;
vxworks29k)
basic_machine=a29k-wrs
- os=vxworks
+ basic_os=vxworks
;;
xbox)
basic_machine=i686-pc
- os=mingw32
+ basic_os=mingw32
;;
ymp)
basic_machine=ymp-cray
- os=unicos
+ basic_os=unicos
;;
*)
basic_machine=$1
- os=
+ basic_os=
;;
esac
;;
esac
-# Decode aliases for certain CPU-COMPANY combinations.
+# Decode 1-component or ad-hoc basic machines
case $basic_machine in
- # Recognize the basic CPU types without company name.
- # Some are omitted here because they have special meanings below.
- 1750a | 580 \
- | a29k \
- | aarch64 | aarch64_be \
- | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
- | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
- | am33_2.0 \
- | arc | arceb \
- | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv6m | armv[78][arm] \
- | avr | avr32 \
- | ba \
- | be32 | be64 \
- | bfin \
- | c4x | c8051 | clipper | csky \
- | d10v | d30v | dlx | dsp16xx \
- | e2k | epiphany \
- | fido | fr30 | frv | ft32 \
- | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
- | hexagon \
- | i370 | i860 | i960 | ia16 | ia64 \
- | ip2k | iq2000 \
- | k1om \
- | le32 | le64 \
- | lm32 \
- | m32c | m32r | m32rle | m68000 | m68k | m88k \
- | maxq | mb | microblaze | microblazeel | mcore | mep | metag \
- | mips | mipsbe | mipseb | mipsel | mipsle \
- | mips16 \
- | mips64 | mips64el \
- | mips64octeon | mips64octeonel \
- | mips64orion | mips64orionel \
- | mips64r5900 | mips64r5900el \
- | mips64vr | mips64vrel \
- | mips64vr4100 | mips64vr4100el \
- | mips64vr4300 | mips64vr4300el \
- | mips64vr5000 | mips64vr5000el \
- | mips64vr5900 | mips64vr5900el \
- | mipsisa32 | mipsisa32el \
- | mipsisa32r2 | mipsisa32r2el \
- | mipsisa32r6 | mipsisa32r6el \
- | mipsisa64 | mipsisa64el \
- | mipsisa64r2 | mipsisa64r2el \
- | mipsisa64r6 | mipsisa64r6el \
- | mipsisa64sb1 | mipsisa64sb1el \
- | mipsisa64sr71k | mipsisa64sr71kel \
- | mipsr5900 | mipsr5900el \
- | mipstx39 | mipstx39el \
- | mn10200 | mn10300 \
- | moxie \
- | mt \
- | msp430 \
- | nds32 | nds32le | nds32be \
- | nfp \
- | nios | nios2 | nios2eb | nios2el \
- | ns16k | ns32k \
- | open8 | or1k | or1knd | or32 \
- | pdp10 | pj | pjl \
- | powerpc | powerpc64 | powerpc64le | powerpcle \
- | pru \
- | pyramid \
- | riscv | riscv32 | riscv64 \
- | rl78 | rx \
- | score \
- | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[234]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
- | sh64 | sh64le \
- | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
- | sparcv8 | sparcv9 | sparcv9b | sparcv9v \
- | spu \
- | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \
- | ubicom32 \
- | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \
- | visium \
- | wasm32 \
- | x86 | xc16x | xstormy16 | xtensa \
- | z8k | z80)
- basic_machine=$basic_machine-unknown
- ;;
- c54x)
- basic_machine=tic54x-unknown
- ;;
- c55x)
- basic_machine=tic55x-unknown
- ;;
- c6x)
- basic_machine=tic6x-unknown
- ;;
- leon|leon[3-9])
- basic_machine=sparc-$basic_machine
- ;;
- m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip)
- basic_machine=$basic_machine-unknown
- os=${os:-none}
- ;;
- m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65)
+ # Here we handle the default manufacturer of certain CPU types. It is in
+ # some cases the only manufacturer, in others, it is the most popular.
+ w89k)
+ cpu=hppa1.1
+ vendor=winbond
;;
- m9s12z | m68hcs12z | hcs12z | s12z)
- basic_machine=s12z-unknown
- os=${os:-none}
+ op50n)
+ cpu=hppa1.1
+ vendor=oki
;;
- ms1)
- basic_machine=mt-unknown
+ op60c)
+ cpu=hppa1.1
+ vendor=oki
;;
- strongarm | thumb | xscale)
- basic_machine=arm-unknown
+ ibm*)
+ cpu=i370
+ vendor=ibm
;;
- xgate)
- basic_machine=$basic_machine-unknown
- os=${os:-none}
+ orion105)
+ cpu=clipper
+ vendor=highlevel
;;
- xscaleeb)
- basic_machine=armeb-unknown
+ mac | mpw | mac-mpw)
+ cpu=m68k
+ vendor=apple
;;
-
- xscaleel)
- basic_machine=armel-unknown
+ pmac | pmac-mpw)
+ cpu=powerpc
+ vendor=apple
;;
- # We use `pc' rather than `unknown'
- # because (1) that's what they normally are, and
- # (2) the word "unknown" tends to confuse beginning users.
- i*86 | x86_64)
- basic_machine=$basic_machine-pc
- ;;
- # Recognize the basic CPU types with company name.
- 580-* \
- | a29k-* \
- | aarch64-* | aarch64_be-* \
- | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
- | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
- | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \
- | arm-* | armbe-* | armle-* | armeb-* | armv*-* \
- | avr-* | avr32-* \
- | ba-* \
- | be32-* | be64-* \
- | bfin-* | bs2000-* \
- | c[123]* | c30-* | [cjt]90-* | c4x-* \
- | c8051-* | clipper-* | craynv-* | csky-* | cydra-* \
- | d10v-* | d30v-* | dlx-* \
- | e2k-* | elxsi-* \
- | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
- | h8300-* | h8500-* \
- | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
- | hexagon-* \
- | i*86-* | i860-* | i960-* | ia16-* | ia64-* \
- | ip2k-* | iq2000-* \
- | k1om-* \
- | le32-* | le64-* \
- | lm32-* \
- | m32c-* | m32r-* | m32rle-* \
- | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
- | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \
- | microblaze-* | microblazeel-* \
- | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
- | mips16-* \
- | mips64-* | mips64el-* \
- | mips64octeon-* | mips64octeonel-* \
- | mips64orion-* | mips64orionel-* \
- | mips64r5900-* | mips64r5900el-* \
- | mips64vr-* | mips64vrel-* \
- | mips64vr4100-* | mips64vr4100el-* \
- | mips64vr4300-* | mips64vr4300el-* \
- | mips64vr5000-* | mips64vr5000el-* \
- | mips64vr5900-* | mips64vr5900el-* \
- | mipsisa32-* | mipsisa32el-* \
- | mipsisa32r2-* | mipsisa32r2el-* \
- | mipsisa32r6-* | mipsisa32r6el-* \
- | mipsisa64-* | mipsisa64el-* \
- | mipsisa64r2-* | mipsisa64r2el-* \
- | mipsisa64r6-* | mipsisa64r6el-* \
- | mipsisa64sb1-* | mipsisa64sb1el-* \
- | mipsisa64sr71k-* | mipsisa64sr71kel-* \
- | mipsr5900-* | mipsr5900el-* \
- | mipstx39-* | mipstx39el-* \
- | mmix-* \
- | mt-* \
- | msp430-* \
- | nds32-* | nds32le-* | nds32be-* \
- | nfp-* \
- | nios-* | nios2-* | nios2eb-* | nios2el-* \
- | none-* | np1-* | ns16k-* | ns32k-* \
- | open8-* \
- | or1k*-* \
- | orion-* \
- | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
- | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \
- | pru-* \
- | pyramid-* \
- | riscv-* | riscv32-* | riscv64-* \
- | rl78-* | romp-* | rs6000-* | rx-* \
- | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
- | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
- | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
- | sparclite-* \
- | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx*-* \
- | tahoe-* \
- | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
- | tile*-* \
- | tron-* \
- | ubicom32-* \
- | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \
- | vax-* \
- | visium-* \
- | wasm32-* \
- | we32k-* \
- | x86-* | x86_64-* | xc16x-* | xps100-* \
- | xstormy16-* | xtensa*-* \
- | ymp-* \
- | z8k-* | z80-*)
- ;;
- # Recognize the basic CPU types without company name, with glob match.
- xtensa*)
- basic_machine=$basic_machine-unknown
- ;;
# Recognize the various machine names and aliases which stand
# for a CPU type and a company and sometimes even an OS.
3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
- basic_machine=m68000-att
+ cpu=m68000
+ vendor=att
;;
3b*)
- basic_machine=we32k-att
- ;;
- abacus)
- basic_machine=abacus-unknown
- ;;
- alliant | fx80)
- basic_machine=fx80-alliant
- ;;
- altos | altos3068)
- basic_machine=m68k-altos
- ;;
- amd64)
- basic_machine=x86_64-pc
- ;;
- amd64-*)
- basic_machine=x86_64-`echo "$basic_machine" | sed 's/^[^-]*-//'`
- ;;
- amiga | amiga-*)
- basic_machine=m68k-unknown
- ;;
- asmjs)
- basic_machine=asmjs-unknown
- ;;
- blackfin-*)
- basic_machine=bfin-`echo "$basic_machine" | sed 's/^[^-]*-//'`
- os=linux
+ cpu=we32k
+ vendor=att
;;
bluegene*)
- basic_machine=powerpc-ibm
- os=cnk
- ;;
- c54x-*)
- basic_machine=tic54x-`echo "$basic_machine" | sed 's/^[^-]*-//'`
- ;;
- c55x-*)
- basic_machine=tic55x-`echo "$basic_machine" | sed 's/^[^-]*-//'`
- ;;
- c6x-*)
- basic_machine=tic6x-`echo "$basic_machine" | sed 's/^[^-]*-//'`
- ;;
- c90)
- basic_machine=c90-cray
- os=${os:-unicos}
- ;;
- convex-c1)
- basic_machine=c1-convex
- os=bsd
- ;;
- convex-c2)
- basic_machine=c2-convex
- os=bsd
- ;;
- convex-c32)
- basic_machine=c32-convex
- os=bsd
- ;;
- convex-c34)
- basic_machine=c34-convex
- os=bsd
- ;;
- convex-c38)
- basic_machine=c38-convex
- os=bsd
- ;;
- cr16 | cr16-*)
- basic_machine=cr16-unknown
- os=${os:-elf}
- ;;
- crds | unos)
- basic_machine=m68k-crds
- ;;
- crisv32 | crisv32-* | etraxfs*)
- basic_machine=crisv32-axis
- ;;
- cris | cris-* | etrax*)
- basic_machine=cris-axis
- ;;
- crx)
- basic_machine=crx-unknown
- os=${os:-elf}
- ;;
- da30 | da30-*)
- basic_machine=m68k-da30
- ;;
- decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
- basic_machine=mips-dec
+ cpu=powerpc
+ vendor=ibm
+ basic_os=cnk
;;
decsystem10* | dec10*)
- basic_machine=pdp10-dec
- os=tops10
+ cpu=pdp10
+ vendor=dec
+ basic_os=tops10
;;
decsystem20* | dec20*)
- basic_machine=pdp10-dec
- os=tops20
+ cpu=pdp10
+ vendor=dec
+ basic_os=tops20
;;
delta | 3300 | motorola-3300 | motorola-delta \
| 3300-motorola | delta-motorola)
- basic_machine=m68k-motorola
- ;;
- dpx20 | dpx20-*)
- basic_machine=rs6000-bull
- os=${os:-bosx}
+ cpu=m68k
+ vendor=motorola
;;
dpx2*)
- basic_machine=m68k-bull
- os=sysv3
- ;;
- e500v[12])
- basic_machine=powerpc-unknown
- os=$os"spe"
- ;;
- e500v[12]-*)
- basic_machine=powerpc-`echo "$basic_machine" | sed 's/^[^-]*-//'`
- os=$os"spe"
+ cpu=m68k
+ vendor=bull
+ basic_os=sysv3
;;
encore | umax | mmax)
- basic_machine=ns32k-encore
+ cpu=ns32k
+ vendor=encore
;;
elxsi)
- basic_machine=elxsi-elxsi
- os=${os:-bsd}
+ cpu=elxsi
+ vendor=elxsi
+ basic_os=${basic_os:-bsd}
;;
fx2800)
- basic_machine=i860-alliant
+ cpu=i860
+ vendor=alliant
;;
genix)
- basic_machine=ns32k-ns
+ cpu=ns32k
+ vendor=ns
;;
h3050r* | hiux*)
- basic_machine=hppa1.1-hitachi
- os=hiuxwe2
- ;;
- hp300-*)
- basic_machine=m68k-hp
+ cpu=hppa1.1
+ vendor=hitachi
+ basic_os=hiuxwe2
;;
hp3k9[0-9][0-9] | hp9[0-9][0-9])
- basic_machine=hppa1.0-hp
+ cpu=hppa1.0
+ vendor=hp
;;
hp9k2[0-9][0-9] | hp9k31[0-9])
- basic_machine=m68000-hp
+ cpu=m68000
+ vendor=hp
;;
hp9k3[2-9][0-9])
- basic_machine=m68k-hp
+ cpu=m68k
+ vendor=hp
;;
hp9k6[0-9][0-9] | hp6[0-9][0-9])
- basic_machine=hppa1.0-hp
+ cpu=hppa1.0
+ vendor=hp
;;
hp9k7[0-79][0-9] | hp7[0-79][0-9])
- basic_machine=hppa1.1-hp
+ cpu=hppa1.1
+ vendor=hp
;;
hp9k78[0-9] | hp78[0-9])
# FIXME: really hppa2.0-hp
- basic_machine=hppa1.1-hp
+ cpu=hppa1.1
+ vendor=hp
;;
hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
# FIXME: really hppa2.0-hp
- basic_machine=hppa1.1-hp
+ cpu=hppa1.1
+ vendor=hp
;;
hp9k8[0-9][13679] | hp8[0-9][13679])
- basic_machine=hppa1.1-hp
+ cpu=hppa1.1
+ vendor=hp
;;
hp9k8[0-9][0-9] | hp8[0-9][0-9])
- basic_machine=hppa1.0-hp
- ;;
- i370-ibm* | ibm*)
- basic_machine=i370-ibm
+ cpu=hppa1.0
+ vendor=hp
;;
i*86v32)
- basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'`
- os=sysv32
+ cpu=`echo "$1" | sed -e 's/86.*/86/'`
+ vendor=pc
+ basic_os=sysv32
;;
i*86v4*)
- basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'`
- os=sysv4
+ cpu=`echo "$1" | sed -e 's/86.*/86/'`
+ vendor=pc
+ basic_os=sysv4
;;
i*86v)
- basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'`
- os=sysv
+ cpu=`echo "$1" | sed -e 's/86.*/86/'`
+ vendor=pc
+ basic_os=sysv
;;
i*86sol2)
- basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'`
- os=solaris2
+ cpu=`echo "$1" | sed -e 's/86.*/86/'`
+ vendor=pc
+ basic_os=solaris2
;;
j90 | j90-cray)
- basic_machine=j90-cray
- os=${os:-unicos}
+ cpu=j90
+ vendor=cray
+ basic_os=${basic_os:-unicos}
;;
iris | iris4d)
- basic_machine=mips-sgi
- case $os in
+ cpu=mips
+ vendor=sgi
+ case $basic_os in
irix*)
;;
*)
- os=irix4
+ basic_os=irix4
;;
esac
;;
- leon-*|leon[3-9]-*)
- basic_machine=sparc-`echo "$basic_machine" | sed 's/-.*//'`
- ;;
- m68knommu-*)
- basic_machine=m68k-`echo "$basic_machine" | sed 's/^[^-]*-//'`
- os=linux
- ;;
- microblaze*)
- basic_machine=microblaze-xilinx
- ;;
miniframe)
- basic_machine=m68000-convergent
+ cpu=m68000
+ vendor=convergent
;;
*mint | mint[0-9]* | *MiNT | *MiNT[0-9]*)
- basic_machine=m68k-atari
- os=mint
- ;;
- mips3*-*)
- basic_machine=`echo "$basic_machine" | sed -e 's/mips3/mips64/'`
- ;;
- mips3*)
- basic_machine=`echo "$basic_machine" | sed -e 's/mips3/mips64/'`-unknown
- ;;
- ms1-*)
- basic_machine=`echo "$basic_machine" | sed -e 's/ms1-/mt-/'`
+ cpu=m68k
+ vendor=atari
+ basic_os=mint
;;
news-3600 | risc-news)
- basic_machine=mips-sony
- os=newsos
+ cpu=mips
+ vendor=sony
+ basic_os=newsos
;;
next | m*-next)
- basic_machine=m68k-next
- case $os in
- nextstep* )
+ cpu=m68k
+ vendor=next
+ case $basic_os in
+ openstep*)
+ ;;
+ nextstep*)
;;
ns2*)
- os=nextstep2
+ basic_os=nextstep2
;;
*)
- os=nextstep3
+ basic_os=nextstep3
;;
esac
;;
np1)
- basic_machine=np1-gould
+ cpu=np1
+ vendor=gould
;;
- neo-tandem)
- basic_machine=neo-tandem
+ op50n-* | op60c-*)
+ cpu=hppa1.1
+ vendor=oki
+ basic_os=proelf
;;
- nse-tandem)
- basic_machine=nse-tandem
+ pa-hitachi)
+ cpu=hppa1.1
+ vendor=hitachi
+ basic_os=hiuxwe2
;;
- nsr-tandem)
- basic_machine=nsr-tandem
+ pbd)
+ cpu=sparc
+ vendor=tti
;;
- nsv-tandem)
- basic_machine=nsv-tandem
+ pbb)
+ cpu=m68k
+ vendor=tti
;;
- nsx-tandem)
- basic_machine=nsx-tandem
+ pc532)
+ cpu=ns32k
+ vendor=pc532
;;
- op50n-* | op60c-*)
- basic_machine=hppa1.1-oki
- os=proelf
+ pn)
+ cpu=pn
+ vendor=gould
;;
- openrisc | openrisc-*)
- basic_machine=or32-unknown
+ power)
+ cpu=power
+ vendor=ibm
;;
- pa-hitachi)
- basic_machine=hppa1.1-hitachi
- os=hiuxwe2
+ ps2)
+ cpu=i386
+ vendor=ibm
;;
- parisc-*)
- basic_machine=hppa-`echo "$basic_machine" | sed 's/^[^-]*-//'`
- os=linux
+ rm[46]00)
+ cpu=mips
+ vendor=siemens
;;
- pbd)
- basic_machine=sparc-tti
+ rtpc | rtpc-*)
+ cpu=romp
+ vendor=ibm
;;
- pbb)
- basic_machine=m68k-tti
+ sde)
+ cpu=mipsisa32
+ vendor=sde
+ basic_os=${basic_os:-elf}
;;
- pc532 | pc532-*)
- basic_machine=ns32k-pc532
+ simso-wrs)
+ cpu=sparclite
+ vendor=wrs
+ basic_os=vxworks
;;
- pc98)
- basic_machine=i386-pc
+ tower | tower-32)
+ cpu=m68k
+ vendor=ncr
;;
- pc98-*)
- basic_machine=i386-`echo "$basic_machine" | sed 's/^[^-]*-//'`
+ vpp*|vx|vx-*)
+ cpu=f301
+ vendor=fujitsu
;;
- pentium | p5 | k5 | k6 | nexgen | viac3)
- basic_machine=i586-pc
+ w65)
+ cpu=w65
+ vendor=wdc
;;
- pentiumpro | p6 | 6x86 | athlon | athlon_*)
- basic_machine=i686-pc
+ w89k-*)
+ cpu=hppa1.1
+ vendor=winbond
+ basic_os=proelf
;;
- pentiumii | pentium2 | pentiumiii | pentium3)
- basic_machine=i686-pc
+ none)
+ cpu=none
+ vendor=none
;;
- pentium4)
- basic_machine=i786-pc
+ leon|leon[3-9])
+ cpu=sparc
+ vendor=$basic_machine
;;
- pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
- basic_machine=i586-`echo "$basic_machine" | sed 's/^[^-]*-//'`
+ leon-*|leon[3-9]-*)
+ cpu=sparc
+ vendor=`echo "$basic_machine" | sed 's/-.*//'`
;;
- pentiumpro-* | p6-* | 6x86-* | athlon-*)
- basic_machine=i686-`echo "$basic_machine" | sed 's/^[^-]*-//'`
+
+ *-*)
+ # shellcheck disable=SC2162
+ saved_IFS=$IFS
+ IFS="-" read cpu vendor <<EOF
+$basic_machine
+EOF
+ IFS=$saved_IFS
;;
- pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
- basic_machine=i686-`echo "$basic_machine" | sed 's/^[^-]*-//'`
+ # We use `pc' rather than `unknown'
+ # because (1) that's what they normally are, and
+ # (2) the word "unknown" tends to confuse beginning users.
+ i*86 | x86_64)
+ cpu=$basic_machine
+ vendor=pc
;;
- pentium4-*)
- basic_machine=i786-`echo "$basic_machine" | sed 's/^[^-]*-//'`
+ # These rules are duplicated from below for sake of the special case above;
+ # i.e. things that normalized to x86 arches should also default to "pc"
+ pc98)
+ cpu=i386
+ vendor=pc
;;
- pn)
- basic_machine=pn-gould
+ x64 | amd64)
+ cpu=x86_64
+ vendor=pc
;;
- power) basic_machine=power-ibm
+ # Recognize the basic CPU types without company name.
+ *)
+ cpu=$basic_machine
+ vendor=unknown
;;
- ppc | ppcbe) basic_machine=powerpc-unknown
+esac
+
+unset -v basic_machine
+
+# Decode basic machines in the full and proper CPU-Company form.
+case $cpu-$vendor in
+ # Here we handle the default manufacturer of certain CPU types in canonical form. It is in
+ # some cases the only manufacturer, in others, it is the most popular.
+ craynv-unknown)
+ vendor=cray
+ basic_os=${basic_os:-unicosmp}
;;
- ppc-* | ppcbe-*)
- basic_machine=powerpc-`echo "$basic_machine" | sed 's/^[^-]*-//'`
+ c90-unknown | c90-cray)
+ vendor=cray
+ basic_os=${Basic_os:-unicos}
;;
- ppcle | powerpclittle)
- basic_machine=powerpcle-unknown
+ fx80-unknown)
+ vendor=alliant
;;
- ppcle-* | powerpclittle-*)
- basic_machine=powerpcle-`echo "$basic_machine" | sed 's/^[^-]*-//'`
+ romp-unknown)
+ vendor=ibm
;;
- ppc64) basic_machine=powerpc64-unknown
+ mmix-unknown)
+ vendor=knuth
;;
- ppc64-*) basic_machine=powerpc64-`echo "$basic_machine" | sed 's/^[^-]*-//'`
+ microblaze-unknown | microblazeel-unknown)
+ vendor=xilinx
;;
- ppc64le | powerpc64little)
- basic_machine=powerpc64le-unknown
+ rs6000-unknown)
+ vendor=ibm
;;
- ppc64le-* | powerpc64little-*)
- basic_machine=powerpc64le-`echo "$basic_machine" | sed 's/^[^-]*-//'`
+ vax-unknown)
+ vendor=dec
;;
- ps2)
- basic_machine=i386-ibm
+ pdp11-unknown)
+ vendor=dec
;;
- rm[46]00)
- basic_machine=mips-siemens
+ we32k-unknown)
+ vendor=att
;;
- rtpc | rtpc-*)
- basic_machine=romp-ibm
+ cydra-unknown)
+ vendor=cydrome
;;
- s390 | s390-*)
- basic_machine=s390-ibm
+ i370-ibm*)
+ vendor=ibm
;;
- s390x | s390x-*)
- basic_machine=s390x-ibm
+ orion-unknown)
+ vendor=highlevel
;;
- sb1)
- basic_machine=mipsisa64sb1-unknown
+ xps-unknown | xps100-unknown)
+ cpu=xps100
+ vendor=honeywell
;;
- sb1el)
- basic_machine=mipsisa64sb1el-unknown
+
+ # Here we normalize CPU types with a missing or matching vendor
+ armh-unknown | armh-alt)
+ cpu=armv7l
+ vendor=alt
+ basic_os=${basic_os:-linux-gnueabihf}
;;
- sde)
- basic_machine=mipsisa32-sde
- os=${os:-elf}
+ dpx20-unknown | dpx20-bull)
+ cpu=rs6000
+ vendor=bull
+ basic_os=${basic_os:-bosx}
+ ;;
+
+ # Here we normalize CPU types irrespective of the vendor
+ amd64-*)
+ cpu=x86_64
;;
- sequent)
- basic_machine=i386-sequent
+ blackfin-*)
+ cpu=bfin
+ basic_os=linux
;;
- sh5el)
- basic_machine=sh5le-unknown
+ c54x-*)
+ cpu=tic54x
;;
- simso-wrs)
- basic_machine=sparclite-wrs
- os=vxworks
+ c55x-*)
+ cpu=tic55x
;;
- spur)
- basic_machine=spur-unknown
+ c6x-*)
+ cpu=tic6x
;;
- st2000)
- basic_machine=m68k-tandem
+ e500v[12]-*)
+ cpu=powerpc
+ basic_os=${basic_os}"spe"
;;
- strongarm-* | thumb-*)
- basic_machine=arm-`echo "$basic_machine" | sed 's/^[^-]*-//'`
+ mips3*-*)
+ cpu=mips64
;;
- sun2)
- basic_machine=m68000-sun
+ ms1-*)
+ cpu=mt
;;
- sun3 | sun3-*)
- basic_machine=m68k-sun
+ m68knommu-*)
+ cpu=m68k
+ basic_os=linux
;;
- sun4)
- basic_machine=sparc-sun
+ m9s12z-* | m68hcs12z-* | hcs12z-* | s12z-*)
+ cpu=s12z
;;
- sun386 | sun386i | roadrunner)
- basic_machine=i386-sun
+ openrisc-*)
+ cpu=or32
;;
- tile*)
- basic_machine=$basic_machine-unknown
- os=linux-gnu
+ parisc-*)
+ cpu=hppa
+ basic_os=linux
;;
- tx39)
- basic_machine=mipstx39-unknown
+ pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
+ cpu=i586
;;
- tx39el)
- basic_machine=mipstx39el-unknown
+ pentiumpro-* | p6-* | 6x86-* | athlon-* | athlon_*-*)
+ cpu=i686
;;
- tower | tower-32)
- basic_machine=m68k-ncr
+ pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
+ cpu=i686
;;
- vpp*|vx|vx-*)
- basic_machine=f301-fujitsu
+ pentium4-*)
+ cpu=i786
;;
- w65*)
- basic_machine=w65-wdc
- os=none
+ pc98-*)
+ cpu=i386
;;
- w89k-*)
- basic_machine=hppa1.1-winbond
- os=proelf
+ ppc-* | ppcbe-*)
+ cpu=powerpc
;;
- x64)
- basic_machine=x86_64-pc
+ ppcle-* | powerpclittle-*)
+ cpu=powerpcle
;;
- xps | xps100)
- basic_machine=xps100-honeywell
+ ppc64-*)
+ cpu=powerpc64
;;
- xscale-* | xscalee[bl]-*)
- basic_machine=`echo "$basic_machine" | sed 's/^xscale/arm/'`
+ ppc64le-* | powerpc64little-*)
+ cpu=powerpc64le
;;
- none)
- basic_machine=none-none
- os=${os:-none}
+ sb1-*)
+ cpu=mipsisa64sb1
;;
-
-# Here we handle the default manufacturer of certain CPU types. It is in
-# some cases the only manufacturer, in others, it is the most popular.
- w89k)
- basic_machine=hppa1.1-winbond
+ sb1el-*)
+ cpu=mipsisa64sb1el
;;
- op50n)
- basic_machine=hppa1.1-oki
+ sh5e[lb]-*)
+ cpu=`echo "$cpu" | sed 's/^\(sh.\)e\(.\)$/\1\2e/'`
;;
- op60c)
- basic_machine=hppa1.1-oki
+ spur-*)
+ cpu=spur
;;
- romp)
- basic_machine=romp-ibm
+ strongarm-* | thumb-*)
+ cpu=arm
;;
- mmix)
- basic_machine=mmix-knuth
+ tx39-*)
+ cpu=mipstx39
;;
- rs6000)
- basic_machine=rs6000-ibm
+ tx39el-*)
+ cpu=mipstx39el
;;
- vax)
- basic_machine=vax-dec
+ x64-*)
+ cpu=x86_64
;;
- pdp11)
- basic_machine=pdp11-dec
+ xscale-* | xscalee[bl]-*)
+ cpu=`echo "$cpu" | sed 's/^xscale/arm/'`
;;
- we32k)
- basic_machine=we32k-att
+ arm64-* | aarch64le-*)
+ cpu=aarch64
;;
- sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele)
- basic_machine=sh-unknown
+
+ # Recognize the canonical CPU Types that limit and/or modify the
+ # company names they are paired with.
+ cr16-*)
+ basic_os=${basic_os:-elf}
;;
- cydra)
- basic_machine=cydra-cydrome
+ crisv32-* | etraxfs*-*)
+ cpu=crisv32
+ vendor=axis
;;
- orion)
- basic_machine=orion-highlevel
+ cris-* | etrax*-*)
+ cpu=cris
+ vendor=axis
;;
- orion105)
- basic_machine=clipper-highlevel
+ crx-*)
+ basic_os=${basic_os:-elf}
;;
- mac | mpw | mac-mpw)
- basic_machine=m68k-apple
+ neo-tandem)
+ cpu=neo
+ vendor=tandem
;;
- pmac | pmac-mpw)
- basic_machine=powerpc-apple
+ nse-tandem)
+ cpu=nse
+ vendor=tandem
+ ;;
+ nsr-tandem)
+ cpu=nsr
+ vendor=tandem
+ ;;
+ nsv-tandem)
+ cpu=nsv
+ vendor=tandem
+ ;;
+ nsx-tandem)
+ cpu=nsx
+ vendor=tandem
+ ;;
+ mipsallegrexel-sony)
+ cpu=mipsallegrexel
+ vendor=sony
;;
- *-unknown)
- # Make sure to match an already-canonicalized machine name.
+ tile*-*)
+ basic_os=${basic_os:-linux-gnu}
;;
+
*)
- echo Invalid configuration \`"$1"\': machine \`"$basic_machine"\' not recognized 1>&2
- exit 1
+ # Recognize the canonical CPU types that are allowed with any
+ # company name.
+ case $cpu in
+ 1750a | 580 \
+ | a29k \
+ | aarch64 | aarch64_be \
+ | abacus \
+ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] \
+ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] \
+ | alphapca5[67] | alpha64pca5[67] \
+ | am33_2.0 \
+ | amdgcn \
+ | arc | arceb | arc32 | arc64 \
+ | arm | arm[lb]e | arme[lb] | armv* \
+ | avr | avr32 \
+ | asmjs \
+ | ba \
+ | be32 | be64 \
+ | bfin | bpf | bs2000 \
+ | c[123]* | c30 | [cjt]90 | c4x \
+ | c8051 | clipper | craynv | csky | cydra \
+ | d10v | d30v | dlx | dsp16xx \
+ | e2k | elxsi | epiphany \
+ | f30[01] | f700 | fido | fr30 | frv | ft32 | fx80 \
+ | h8300 | h8500 \
+ | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
+ | hexagon \
+ | i370 | i*86 | i860 | i960 | ia16 | ia64 \
+ | ip2k | iq2000 \
+ | k1om \
+ | le32 | le64 \
+ | lm32 \
+ | loongarch32 | loongarch64 \
+ | m32c | m32r | m32rle \
+ | m5200 | m68000 | m680[012346]0 | m68360 | m683?2 | m68k \
+ | m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x \
+ | m88110 | m88k | maxq | mb | mcore | mep | metag \
+ | microblaze | microblazeel \
+ | mips | mipsbe | mipseb | mipsel | mipsle \
+ | mips16 \
+ | mips64 | mips64eb | mips64el \
+ | mips64octeon | mips64octeonel \
+ | mips64orion | mips64orionel \
+ | mips64r5900 | mips64r5900el \
+ | mips64vr | mips64vrel \
+ | mips64vr4100 | mips64vr4100el \
+ | mips64vr4300 | mips64vr4300el \
+ | mips64vr5000 | mips64vr5000el \
+ | mips64vr5900 | mips64vr5900el \
+ | mipsisa32 | mipsisa32el \
+ | mipsisa32r2 | mipsisa32r2el \
+ | mipsisa32r3 | mipsisa32r3el \
+ | mipsisa32r5 | mipsisa32r5el \
+ | mipsisa32r6 | mipsisa32r6el \
+ | mipsisa64 | mipsisa64el \
+ | mipsisa64r2 | mipsisa64r2el \
+ | mipsisa64r3 | mipsisa64r3el \
+ | mipsisa64r5 | mipsisa64r5el \
+ | mipsisa64r6 | mipsisa64r6el \
+ | mipsisa64sb1 | mipsisa64sb1el \
+ | mipsisa64sr71k | mipsisa64sr71kel \
+ | mipsr5900 | mipsr5900el \
+ | mipstx39 | mipstx39el \
+ | mmix \
+ | mn10200 | mn10300 \
+ | moxie \
+ | mt \
+ | msp430 \
+ | nds32 | nds32le | nds32be \
+ | nfp \
+ | nios | nios2 | nios2eb | nios2el \
+ | none | np1 | ns16k | ns32k | nvptx \
+ | open8 \
+ | or1k* \
+ | or32 \
+ | orion \
+ | picochip \
+ | pdp10 | pdp11 | pj | pjl | pn | power \
+ | powerpc | powerpc64 | powerpc64le | powerpcle | powerpcspe \
+ | pru \
+ | pyramid \
+ | riscv | riscv32 | riscv32be | riscv64 | riscv64be \
+ | rl78 | romp | rs6000 | rx \
+ | s390 | s390x \
+ | score \
+ | sh | shl \
+ | sh[1234] | sh[24]a | sh[24]ae[lb] | sh[23]e | she[lb] | sh[lb]e \
+ | sh[1234]e[lb] | sh[12345][lb]e | sh[23]ele | sh64 | sh64le \
+ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet \
+ | sparclite \
+ | sparcv8 | sparcv9 | sparcv9b | sparcv9v | sv1 | sx* \
+ | spu \
+ | tahoe \
+ | thumbv7* \
+ | tic30 | tic4x | tic54x | tic55x | tic6x | tic80 \
+ | tron \
+ | ubicom32 \
+ | v70 | v850 | v850e | v850e1 | v850es | v850e2 | v850e2v3 \
+ | vax \
+ | visium \
+ | w65 \
+ | wasm32 | wasm64 \
+ | we32k \
+ | x86 | x86_64 | xc16x | xgate | xps100 \
+ | xstormy16 | xtensa* \
+ | ymp \
+ | z8k | z80)
+ ;;
+
+ *)
+ echo Invalid configuration \`"$1"\': machine \`"$cpu-$vendor"\' not recognized 1>&2
+ exit 1
+ ;;
+ esac
;;
esac
# Here we canonicalize certain aliases for manufacturers.
-case $basic_machine in
- *-digital*)
- basic_machine=`echo "$basic_machine" | sed 's/digital.*/dec/'`
+case $vendor in
+ digital*)
+ vendor=dec
;;
- *-commodore*)
- basic_machine=`echo "$basic_machine" | sed 's/commodore.*/cbm/'`
+ commodore*)
+ vendor=cbm
;;
*)
;;
@@ -1286,8 +1306,53 @@ esac
# Decode manufacturer-specific aliases for certain operating systems.
-if [ x$os != x ]
+if test x$basic_os != x
then
+
+# First recognize some ad-hoc cases, or perhaps split kernel-os, or else just
+# set os.
+case $basic_os in
+ gnu/linux*)
+ kernel=linux
+ os=`echo "$basic_os" | sed -e 's|gnu/linux|gnu|'`
+ ;;
+ os2-emx)
+ kernel=os2
+ os=`echo "$basic_os" | sed -e 's|os2-emx|emx|'`
+ ;;
+ nto-qnx*)
+ kernel=nto
+ os=`echo "$basic_os" | sed -e 's|nto-qnx|qnx|'`
+ ;;
+ *-*)
+ # shellcheck disable=SC2162
+ saved_IFS=$IFS
+ IFS="-" read kernel os <<EOF
+$basic_os
+EOF
+ IFS=$saved_IFS
+ ;;
+ # Default OS when just kernel was specified
+ nto*)
+ kernel=nto
+ os=`echo "$basic_os" | sed -e 's|nto|qnx|'`
+ ;;
+ linux*)
+ kernel=linux
+ os=`echo "$basic_os" | sed -e 's|linux|gnu|'`
+ ;;
+ managarm*)
+ kernel=managarm
+ os=`echo "$basic_os" | sed -e 's|managarm|mlibc|'`
+ ;;
+ *)
+ kernel=
+ os=$basic_os
+ ;;
+esac
+
+# Now, normalize the OS (knowing we just have one component, it's not a kernel,
+# etc.)
case $os in
# First match some system type aliases that might get confused
# with valid system types.
@@ -1299,7 +1364,7 @@ case $os in
os=cnk
;;
solaris1 | solaris1.*)
- os=`echo $os | sed -e 's|solaris1|sunos4|'`
+ os=`echo "$os" | sed -e 's|solaris1|sunos4|'`
;;
solaris)
os=solaris2
@@ -1307,9 +1372,6 @@ case $os in
unixware*)
os=sysv4.2uw
;;
- gnu/linux*)
- os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
- ;;
# es1800 is here to avoid being matched by es* (a different OS)
es1800*)
os=ose
@@ -1331,12 +1393,9 @@ case $os in
os=sco3.2v4
;;
sco3.2.[4-9]*)
- os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
+ os=`echo "$os" | sed -e 's/sco3.2./sco3.2v/'`
;;
- sco3.2v[4-9]* | sco5v6*)
- # Don't forget version if it is 3.2v4 or newer.
- ;;
- scout)
+ sco*v* | scout)
# Don't match below
;;
sco*)
@@ -1345,77 +1404,25 @@ case $os in
psos*)
os=psos
;;
- # Now accept the basic system types.
- # The portable systems comes first.
- # Each alternative MUST end in a * to match a version number.
- # sysv* is not here because it comes later, after sysvr4.
- gnu* | bsd* | mach* | minix* | genix* | ultrix* | irix* \
- | *vms* | esix* | aix* | cnk* | sunos | sunos[34]*\
- | hpux* | unos* | osf* | luna* | dgux* | auroraux* | solaris* \
- | sym* | kopensolaris* | plan9* \
- | amigaos* | amigados* | msdos* | newsos* | unicos* | aof* \
- | aos* | aros* | cloudabi* | sortix* \
- | nindy* | vxsim* | vxworks* | ebmon* | hms* | mvs* \
- | clix* | riscos* | uniplus* | iris* | rtu* | xenix* \
- | knetbsd* | mirbsd* | netbsd* \
- | bitrig* | openbsd* | solidbsd* | libertybsd* \
- | ekkobsd* | kfreebsd* | freebsd* | riscix* | lynxos* \
- | bosx* | nextstep* | cxux* | aout* | elf* | oabi* \
- | ptx* | coff* | ecoff* | winnt* | domain* | vsta* \
- | udi* | eabi* | lites* | ieee* | go32* | aux* | hcos* \
- | chorusrdb* | cegcc* | glidix* \
- | cygwin* | msys* | pe* | moss* | proelf* | rtems* \
- | midipix* | mingw32* | mingw64* | linux-gnu* | linux-android* \
- | linux-newlib* | linux-musl* | linux-uclibc* \
- | uxpv* | beos* | mpeix* | udk* | moxiebox* \
- | interix* | uwin* | mks* | rhapsody* | darwin* \
- | openstep* | oskit* | conix* | pw32* | nonstopux* \
- | storm-chaos* | tops10* | tenex* | tops20* | its* \
- | os2* | vos* | palmos* | uclinux* | nucleus* \
- | morphos* | superux* | rtmk* | windiss* \
- | powermax* | dnix* | nx6 | nx7 | sei* | dragonfly* \
- | skyos* | haiku* | rdos* | toppers* | drops* | es* \
- | onefs* | tirtos* | phoenix* | fuchsia* | redox* | bme* \
- | midnightbsd*)
- # Remember, each alternative MUST END IN *, to match a version number.
- ;;
qnx*)
- case $basic_machine in
- x86-* | i*86-*)
- ;;
- *)
- os=nto-$os
- ;;
- esac
+ os=qnx
;;
hiux*)
os=hiuxwe2
;;
- nto-qnx*)
- ;;
- nto*)
- os=`echo $os | sed -e 's|nto|nto-qnx|'`
- ;;
- sim | xray | os68k* | v88r* \
- | windows* | osx | abug | netware* | os9* \
- | macos* | mpw* | magic* | mmixware* | mon960* | lnews*)
- ;;
- linux-dietlibc)
- os=linux-dietlibc
- ;;
- linux*)
- os=`echo $os | sed -e 's|linux|linux-gnu|'`
- ;;
lynx*178)
os=lynxos178
;;
lynx*5)
os=lynxos5
;;
+ lynxos*)
+ # don't get caught up in next wildcard
+ ;;
lynx*)
os=lynxos
;;
- mac*)
+ mac[0-9]*)
os=`echo "$os" | sed -e 's|mac|macos|'`
;;
opened*)
@@ -1460,12 +1467,9 @@ case $os in
ns2)
os=nextstep2
;;
- nsk*)
- os=nsk
- ;;
# Preserve the version number of sinix5.
sinix5.*)
- os=`echo $os | sed -e 's|sinix|sysv|'`
+ os=`echo "$os" | sed -e 's|sinix|sysv|'`
;;
sinix*)
os=sysv4
@@ -1488,18 +1492,12 @@ case $os in
sysvr4)
os=sysv4
;;
- # This must come after sysvr4.
- sysv*)
- ;;
ose*)
os=ose
;;
*mint | mint[0-9]* | *MiNT | MiNT[0-9]*)
os=mint
;;
- zvmoe)
- os=zvmoe
- ;;
dicos*)
os=dicos
;;
@@ -1507,7 +1505,7 @@ case $os in
# Until real need of OS specific support for
# particular features comes up, bare metal
# configurations are quite functional.
- case $basic_machine in
+ case $cpu in
arm*)
os=eabi
;;
@@ -1516,19 +1514,11 @@ case $os in
;;
esac
;;
- nacl*)
- ;;
- ios)
- ;;
- none)
- ;;
- *-eabi)
- ;;
*)
- echo Invalid configuration \`"$1"\': system \`"$os"\' not recognized 1>&2
- exit 1
+ # No normalization, but not necessarily accepted, that comes below.
;;
esac
+
else
# Here we handle the default operating systems that come with various machines.
@@ -1541,7 +1531,8 @@ else
# will signal an error saying that MANUFACTURER isn't an operating
# system, and we'll never get to this point.
-case $basic_machine in
+kernel=
+case $cpu-$vendor in
score-*)
os=elf
;;
@@ -1552,7 +1543,8 @@ case $basic_machine in
os=riscix1.2
;;
arm*-rebel)
- os=linux
+ kernel=linux
+ os=gnu
;;
arm*-semi)
os=aout
@@ -1718,86 +1710,193 @@ case $basic_machine in
os=none
;;
esac
+
fi
+# Now, validate our (potentially fixed-up) OS.
+case $os in
+ # Sometimes we do "kernel-libc", so those need to count as OSes.
+ musl* | newlib* | relibc* | uclibc*)
+ ;;
+ # Likewise for "kernel-abi"
+ eabi* | gnueabi*)
+ ;;
+ # VxWorks passes extra cpu info in the 4th filed.
+ simlinux | simwindows | spe)
+ ;;
+ # Now accept the basic system types.
+ # The portable systems comes first.
+ # Each alternative MUST end in a * to match a version number.
+ gnu* | android* | bsd* | mach* | minix* | genix* | ultrix* | irix* \
+ | *vms* | esix* | aix* | cnk* | sunos | sunos[34]* \
+ | hpux* | unos* | osf* | luna* | dgux* | auroraux* | solaris* \
+ | sym* | plan9* | psp* | sim* | xray* | os68k* | v88r* \
+ | hiux* | abug | nacl* | netware* | windows* \
+ | os9* | macos* | osx* | ios* \
+ | mpw* | magic* | mmixware* | mon960* | lnews* \
+ | amigaos* | amigados* | msdos* | newsos* | unicos* | aof* \
+ | aos* | aros* | cloudabi* | sortix* | twizzler* \
+ | nindy* | vxsim* | vxworks* | ebmon* | hms* | mvs* \
+ | clix* | riscos* | uniplus* | iris* | isc* | rtu* | xenix* \
+ | mirbsd* | netbsd* | dicos* | openedition* | ose* \
+ | bitrig* | openbsd* | secbsd* | solidbsd* | libertybsd* | os108* \
+ | ekkobsd* | freebsd* | riscix* | lynxos* | os400* \
+ | bosx* | nextstep* | cxux* | aout* | elf* | oabi* \
+ | ptx* | coff* | ecoff* | winnt* | domain* | vsta* \
+ | udi* | lites* | ieee* | go32* | aux* | hcos* \
+ | chorusrdb* | cegcc* | glidix* | serenity* \
+ | cygwin* | msys* | pe* | moss* | proelf* | rtems* \
+ | midipix* | mingw32* | mingw64* | mint* \
+ | uxpv* | beos* | mpeix* | udk* | moxiebox* \
+ | interix* | uwin* | mks* | rhapsody* | darwin* \
+ | openstep* | oskit* | conix* | pw32* | nonstopux* \
+ | storm-chaos* | tops10* | tenex* | tops20* | its* \
+ | os2* | vos* | palmos* | uclinux* | nucleus* | morphos* \
+ | scout* | superux* | sysv* | rtmk* | tpf* | windiss* \
+ | powermax* | dnix* | nx6 | nx7 | sei* | dragonfly* \
+ | skyos* | haiku* | rdos* | toppers* | drops* | es* \
+ | onefs* | tirtos* | phoenix* | fuchsia* | redox* | bme* \
+ | midnightbsd* | amdhsa* | unleashed* | emscripten* | wasi* \
+ | nsk* | powerunix* | genode* | zvmoe* | qnx* | emx* | zephyr* \
+ | fiwix* | mlibc* )
+ ;;
+ # This one is extra strict with allowed versions
+ sco3.2v2 | sco3.2v[4-9]* | sco5v6*)
+ # Don't forget version if it is 3.2v4 or newer.
+ ;;
+ none)
+ ;;
+ kernel* )
+ # Restricted further below
+ ;;
+ *)
+ echo Invalid configuration \`"$1"\': OS \`"$os"\' not recognized 1>&2
+ exit 1
+ ;;
+esac
+
+# As a final step for OS-related things, validate the OS-kernel combination
+# (given a valid OS), if there is a kernel.
+case $kernel-$os in
+ linux-gnu* | linux-dietlibc* | linux-android* | linux-newlib* \
+ | linux-musl* | linux-relibc* | linux-uclibc* | linux-mlibc* )
+ ;;
+ uclinux-uclibc* )
+ ;;
+ managarm-mlibc* | managarm-kernel* )
+ ;;
+ -dietlibc* | -newlib* | -musl* | -relibc* | -uclibc* | -mlibc* )
+ # These are just libc implementations, not actual OSes, and thus
+ # require a kernel.
+ echo "Invalid configuration \`$1': libc \`$os' needs explicit kernel." 1>&2
+ exit 1
+ ;;
+ -kernel* )
+ echo "Invalid configuration \`$1': \`$os' needs explicit kernel." 1>&2
+ exit 1
+ ;;
+ *-kernel* )
+ echo "Invalid configuration \`$1': \`$kernel' does not support \`$os'." 1>&2
+ exit 1
+ ;;
+ kfreebsd*-gnu* | kopensolaris*-gnu*)
+ ;;
+ vxworks-simlinux | vxworks-simwindows | vxworks-spe)
+ ;;
+ nto-qnx*)
+ ;;
+ os2-emx)
+ ;;
+ *-eabi* | *-gnueabi*)
+ ;;
+ -*)
+ # Blank kernel with real OS is always fine.
+ ;;
+ *-*)
+ echo "Invalid configuration \`$1': Kernel \`$kernel' not known to work with OS \`$os'." 1>&2
+ exit 1
+ ;;
+esac
+
# Here we handle the case where we know the os, and the CPU type, but not the
# manufacturer. We pick the logical manufacturer.
-vendor=unknown
-case $basic_machine in
- *-unknown)
- case $os in
- riscix*)
+case $vendor in
+ unknown)
+ case $cpu-$os in
+ *-riscix*)
vendor=acorn
;;
- sunos*)
+ *-sunos*)
vendor=sun
;;
- cnk*|-aix*)
+ *-cnk* | *-aix*)
vendor=ibm
;;
- beos*)
+ *-beos*)
vendor=be
;;
- hpux*)
+ *-hpux*)
vendor=hp
;;
- mpeix*)
+ *-mpeix*)
vendor=hp
;;
- hiux*)
+ *-hiux*)
vendor=hitachi
;;
- unos*)
+ *-unos*)
vendor=crds
;;
- dgux*)
+ *-dgux*)
vendor=dg
;;
- luna*)
+ *-luna*)
vendor=omron
;;
- genix*)
+ *-genix*)
vendor=ns
;;
- clix*)
+ *-clix*)
vendor=intergraph
;;
- mvs* | opened*)
+ *-mvs* | *-opened*)
+ vendor=ibm
+ ;;
+ *-os400*)
vendor=ibm
;;
- os400*)
+ s390-* | s390x-*)
vendor=ibm
;;
- ptx*)
+ *-ptx*)
vendor=sequent
;;
- tpf*)
+ *-tpf*)
vendor=ibm
;;
- vxsim* | vxworks* | windiss*)
+ *-vxsim* | *-vxworks* | *-windiss*)
vendor=wrs
;;
- aux*)
+ *-aux*)
vendor=apple
;;
- hms*)
+ *-hms*)
vendor=hitachi
;;
- mpw* | macos*)
+ *-mpw* | *-macos*)
vendor=apple
;;
- *mint | mint[0-9]* | *MiNT | MiNT[0-9]*)
+ *-*mint | *-mint[0-9]* | *-*MiNT | *-MiNT[0-9]*)
vendor=atari
;;
- vos*)
+ *-vos*)
vendor=stratus
;;
esac
- basic_machine=`echo "$basic_machine" | sed "s/unknown/$vendor/"`
;;
esac
-echo "$basic_machine-$os"
+echo "$cpu-$vendor-${kernel:+$kernel-}$os"
exit
# Local variables:
diff --git a/contrib/tcpdump/configure b/contrib/tcpdump/configure
index 5f055d2ef8dd..53c62d5e95a4 100755
--- a/contrib/tcpdump/configure
+++ b/contrib/tcpdump/configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69.
+# Generated by GNU Autoconf 2.69 for tcpdump 4.99.4.
#
#
# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
@@ -575,12 +575,12 @@ MFLAGS=
MAKEFLAGS=
# Identity of this package.
-PACKAGE_NAME=
-PACKAGE_TARNAME=
-PACKAGE_VERSION=
-PACKAGE_STRING=
-PACKAGE_BUGREPORT=
-PACKAGE_URL=
+PACKAGE_NAME='tcpdump'
+PACKAGE_TARNAME='tcpdump'
+PACKAGE_VERSION='4.99.4'
+PACKAGE_STRING='tcpdump 4.99.4'
+PACKAGE_BUGREPORT=''
+PACKAGE_URL=''
ac_unique_file="tcpdump.c"
# Factoring default headers for most tests.
@@ -636,6 +636,7 @@ DEPENDENCY_CFLAG
AR
RANLIB
PCAP_CONFIG
+PKG_CONFIG
LIBOBJS
EGREP
GREP
@@ -675,7 +676,6 @@ infodir
docdir
oldincludedir
includedir
-runstatedir
localstatedir
sharedstatedir
sysconfdir
@@ -705,7 +705,7 @@ enable_smb
with_user
with_chroot
with_sandbox_capsicum
-with_system_libpcap
+enable_local_libpcap
with_crypto
with_cap_ng
'
@@ -756,10 +756,9 @@ datadir='${datarootdir}'
sysconfdir='${prefix}/etc'
sharedstatedir='${prefix}/com'
localstatedir='${prefix}/var'
-runstatedir='${localstatedir}/run'
includedir='${prefix}/include'
oldincludedir='/usr/include'
-docdir='${datarootdir}/doc/${PACKAGE}'
+docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
infodir='${datarootdir}/info'
htmldir='${docdir}'
dvidir='${docdir}'
@@ -1009,15 +1008,6 @@ do
| -silent | --silent | --silen | --sile | --sil)
silent=yes ;;
- -runstatedir | --runstatedir | --runstatedi | --runstated \
- | --runstate | --runstat | --runsta | --runst | --runs \
- | --run | --ru | --r)
- ac_prev=runstatedir ;;
- -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
- | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
- | --run=* | --ru=* | --r=*)
- runstatedir=$ac_optarg ;;
-
-sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
ac_prev=sbindir ;;
-sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
@@ -1155,7 +1145,7 @@ fi
for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
datadir sysconfdir sharedstatedir localstatedir includedir \
oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
- libdir localedir mandir runstatedir
+ libdir localedir mandir
do
eval ac_val=\$$ac_var
# Remove trailing slashes.
@@ -1268,7 +1258,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures this package to adapt to many kinds of systems.
+\`configure' configures tcpdump 4.99.4 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1308,7 +1298,6 @@ Fine tuning of the installation directories:
--sysconfdir=DIR read-only single-machine data [PREFIX/etc]
--sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
--localstatedir=DIR modifiable single-machine data [PREFIX/var]
- --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run]
--libdir=DIR object code libraries [EPREFIX/lib]
--includedir=DIR C header files [PREFIX/include]
--oldincludedir=DIR C header files for non-gcc [/usr/include]
@@ -1317,7 +1306,7 @@ Fine tuning of the installation directories:
--infodir=DIR info documentation [DATAROOTDIR/info]
--localedir=DIR locale-dependent data [DATAROOTDIR/locale]
--mandir=DIR man documentation [DATAROOTDIR/man]
- --docdir=DIR documentation root [DATAROOTDIR/doc/PACKAGE]
+ --docdir=DIR documentation root [DATAROOTDIR/doc/tcpdump]
--htmldir=DIR html documentation [DOCDIR]
--dvidir=DIR dvi documentation [DOCDIR]
--pdfdir=DIR pdf documentation [DOCDIR]
@@ -1333,28 +1322,30 @@ _ACEOF
fi
if test -n "$ac_init_help"; then
-
+ case $ac_init_help in
+ short | recursive ) echo "Configuration of tcpdump 4.99.4:";;
+ esac
cat <<\_ACEOF
Optional Features:
--disable-option-checking ignore unrecognized --enable/--with options
--disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
- --disable-universal don't build universal on OS X
- --enable-smb enable possibly-buggy SMB printer default=no
- --disable-smb disable possibly-buggy SMB printer
+ --disable-universal don't build universal on macOS
+ --enable-smb enable possibly-buggy SMB printer [default=no]
+ --disable-local-libpcap don't look for a local libpcap [default=check for a
+ local libpcap]
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
--without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
--without-gcc don't use gcc
- --with-smi link with libsmi (allows to load MIBs on the fly to decode SNMP packets. default=yes
- --without-smi don't link with libsmi
+ --with-smi link with libsmi (allows to load MIBs on the fly to
+ decode SNMP packets) [default=yes, if available]
--with-user=USERNAME drop privileges by default to USERNAME
--with-chroot=DIRECTORY when dropping privileges, chroot to DIRECTORY
--with-sandbox-capsicum use Capsicum security functions [default=yes, if
available]
- --with-system-libpcap don't use local pcap library
--with-crypto[=DIR] use OpenSSL/libressl libcrypto (located in directory
DIR, if specified) [default=yes, if available]
--with-cap-ng use libcap-ng [default=yes, if available]
@@ -1435,7 +1426,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-configure
+tcpdump configure 4.99.4
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -1797,131 +1788,119 @@ $as_echo "$ac_res" >&6; }
} # ac_fn_c_check_func
-# ac_fn_c_check_decl LINENO SYMBOL VAR INCLUDES
-# ---------------------------------------------
-# Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR
-# accordingly.
-ac_fn_c_check_decl ()
+# ac_fn_c_compute_int LINENO EXPR VAR INCLUDES
+# --------------------------------------------
+# Tries to find the compile-time value of EXPR in a program that includes
+# INCLUDES, setting VAR accordingly. Returns whether the value could be
+# computed
+ac_fn_c_compute_int ()
{
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
- as_decl_name=`echo $2|sed 's/ *(.*//'`
- as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'`
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5
-$as_echo_n "checking whether $as_decl_name is declared... " >&6; }
-if eval \${$3+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ if test "$cross_compiling" = yes; then
+ # Depending upon the size, compute the lo and hi bounds.
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
$4
int
main ()
{
-#ifndef $as_decl_name
-#ifdef __cplusplus
- (void) $as_decl_use;
-#else
- (void) $as_decl_name;
-#endif
-#endif
+static int test_array [1 - 2 * !(($2) >= 0)];
+test_array [0] = 0;
+return test_array [0];
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
- eval "$3=yes"
+ ac_lo=0 ac_mid=0
+ while :; do
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+int
+main ()
+{
+static int test_array [1 - 2 * !(($2) <= $ac_mid)];
+test_array [0] = 0;
+return test_array [0];
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_hi=$ac_mid; break
else
- eval "$3=no"
+ as_fn_arith $ac_mid + 1 && ac_lo=$as_val
+ if test $ac_lo -le $ac_mid; then
+ ac_lo= ac_hi=
+ break
+ fi
+ as_fn_arith 2 '*' $ac_mid + 1 && ac_mid=$as_val
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-eval ac_res=\$$3
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
- eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
-
-} # ac_fn_c_check_decl
-
-# ac_fn_c_check_type LINENO TYPE VAR INCLUDES
-# -------------------------------------------
-# Tests whether TYPE exists after having included INCLUDES, setting cache
-# variable VAR accordingly.
-ac_fn_c_check_type ()
-{
- as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
-$as_echo_n "checking for $2... " >&6; }
-if eval \${$3+:} false; then :
- $as_echo_n "(cached) " >&6
+ done
else
- eval "$3=no"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
$4
int
main ()
{
-if (sizeof ($2))
- return 0;
+static int test_array [1 - 2 * !(($2) < 0)];
+test_array [0] = 0;
+return test_array [0];
+
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ ac_hi=-1 ac_mid=-1
+ while :; do
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
$4
int
main ()
{
-if (sizeof (($2)))
- return 0;
+static int test_array [1 - 2 * !(($2) >= $ac_mid)];
+test_array [0] = 0;
+return test_array [0];
+
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
-
+ ac_lo=$ac_mid; break
else
- eval "$3=yes"
+ as_fn_arith '(' $ac_mid ')' - 1 && ac_hi=$as_val
+ if test $ac_mid -le $ac_hi; then
+ ac_lo= ac_hi=
+ break
+ fi
+ as_fn_arith 2 '*' $ac_mid && ac_mid=$as_val
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ done
+else
+ ac_lo= ac_hi=
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
-eval ac_res=\$$3
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
- eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
-
-} # ac_fn_c_check_type
-
-# ac_fn_c_find_intX_t LINENO BITS VAR
-# -----------------------------------
-# Finds a signed integer type with width BITS, setting cache variable VAR
-# accordingly.
-ac_fn_c_find_intX_t ()
-{
- as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for int$2_t" >&5
-$as_echo_n "checking for int$2_t... " >&6; }
-if eval \${$3+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- eval "$3=no"
- # Order is important - never check a type that is potentially smaller
- # than half of the expected target width.
- for ac_type in int$2_t 'int' 'long int' \
- 'long long int' 'short int' 'signed char'; do
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+# Binary search between lo and hi bounds.
+while test "x$ac_lo" != "x$ac_hi"; do
+ as_fn_arith '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo && ac_mid=$as_val
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
-$ac_includes_default
- enum { N = $2 / 2 - 1 };
+$4
int
main ()
{
-static int test_array [1 - 2 * !(0 < ($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 1))];
+static int test_array [1 - 2 * !(($2) <= $ac_mid)];
test_array [0] = 0;
return test_array [0];
@@ -1930,107 +1909,172 @@ return test_array [0];
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ ac_hi=$ac_mid
+else
+ as_fn_arith '(' $ac_mid ')' + 1 && ac_lo=$as_val
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+done
+case $ac_lo in #((
+?*) eval "$3=\$ac_lo"; ac_retval=0 ;;
+'') ac_retval=1 ;;
+esac
+ else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
-$ac_includes_default
- enum { N = $2 / 2 - 1 };
+$4
+static long int longval () { return $2; }
+static unsigned long int ulongval () { return $2; }
+#include <stdio.h>
+#include <stdlib.h>
int
main ()
{
-static int test_array [1 - 2 * !(($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 1)
- < ($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 2))];
-test_array [0] = 0;
-return test_array [0];
+
+ FILE *f = fopen ("conftest.val", "w");
+ if (! f)
+ return 1;
+ if (($2) < 0)
+ {
+ long int i = longval ();
+ if (i != ($2))
+ return 1;
+ fprintf (f, "%ld", i);
+ }
+ else
+ {
+ unsigned long int i = ulongval ();
+ if (i != ($2))
+ return 1;
+ fprintf (f, "%lu", i);
+ }
+ /* Do not output a trailing newline, as this causes \r\n confusion
+ on some platforms. */
+ return ferror (f) || fclose (f) != 0;
;
return 0;
}
_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-
+if ac_fn_c_try_run "$LINENO"; then :
+ echo >>conftest.val; read $3 <conftest.val; ac_retval=0
else
- case $ac_type in #(
- int$2_t) :
- eval "$3=yes" ;; #(
- *) :
- eval "$3=\$ac_type" ;;
-esac
+ ac_retval=1
fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
- if eval test \"x\$"$3"\" = x"no"; then :
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+rm -f conftest.val
+ fi
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+ as_fn_set_status $ac_retval
+
+} # ac_fn_c_compute_int
+
+# ac_fn_c_check_decl LINENO SYMBOL VAR INCLUDES
+# ---------------------------------------------
+# Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR
+# accordingly.
+ac_fn_c_check_decl ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ as_decl_name=`echo $2|sed 's/ *(.*//'`
+ as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'`
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5
+$as_echo_n "checking whether $as_decl_name is declared... " >&6; }
+if eval \${$3+:} false; then :
+ $as_echo_n "(cached) " >&6
else
- break
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+int
+main ()
+{
+#ifndef $as_decl_name
+#ifdef __cplusplus
+ (void) $as_decl_use;
+#else
+ (void) $as_decl_name;
+#endif
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ eval "$3=yes"
+else
+ eval "$3=no"
fi
- done
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
eval ac_res=\$$3
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
-} # ac_fn_c_find_intX_t
+} # ac_fn_c_check_decl
-# ac_fn_c_find_uintX_t LINENO BITS VAR
-# ------------------------------------
-# Finds an unsigned integer type with width BITS, setting cache variable VAR
-# accordingly.
-ac_fn_c_find_uintX_t ()
+# ac_fn_c_check_type LINENO TYPE VAR INCLUDES
+# -------------------------------------------
+# Tests whether TYPE exists after having included INCLUDES, setting cache
+# variable VAR accordingly.
+ac_fn_c_check_type ()
{
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for uint$2_t" >&5
-$as_echo_n "checking for uint$2_t... " >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
if eval \${$3+:} false; then :
$as_echo_n "(cached) " >&6
else
eval "$3=no"
- # Order is important - never check a type that is potentially smaller
- # than half of the expected target width.
- for ac_type in uint$2_t 'unsigned int' 'unsigned long int' \
- 'unsigned long long int' 'unsigned short int' 'unsigned char'; do
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
-$ac_includes_default
+$4
int
main ()
{
-static int test_array [1 - 2 * !((($ac_type) -1 >> ($2 / 2 - 1)) >> ($2 / 2 - 1) == 3)];
-test_array [0] = 0;
-return test_array [0];
-
+if (sizeof ($2))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+int
+main ()
+{
+if (sizeof (($2)))
+ return 0;
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
- case $ac_type in #(
- uint$2_t) :
- eval "$3=yes" ;; #(
- *) :
- eval "$3=\$ac_type" ;;
-esac
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
- if eval test \"x\$"$3"\" = x"no"; then :
else
- break
+ eval "$3=yes"
fi
- done
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
eval ac_res=\$$3
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
-} # ac_fn_c_find_uintX_t
+} # ac_fn_c_check_type
cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by $as_me, which was
+It was created by tcpdump $as_me 4.99.4, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@@ -2379,6 +2423,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
ac_aux_dir=
for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do
if test -f "$ac_dir/install-sh"; then
@@ -2552,6 +2597,10 @@ fi
export CC
fi
+#
+# Try to enable as many C99 features as we can.
+# At minimum, we want C++/C99-style // comments.
+#
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
@@ -3341,66 +3390,196 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C99" >&5
+$as_echo_n "checking for $CC option to accept ISO C99... " >&6; }
+if ${ac_cv_prog_cc_c99+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_cv_prog_cc_c99=no
+ac_save_CC=$CC
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdlib.h>
+#include <wchar.h>
+#include <stdio.h>
+
+// Check varargs macros. These examples are taken from C99 6.10.3.5.
+#define debug(...) fprintf (stderr, __VA_ARGS__)
+#define showlist(...) puts (#__VA_ARGS__)
+#define report(test,...) ((test) ? puts (#test) : printf (__VA_ARGS__))
+static void
+test_varargs_macros (void)
+{
+ int x = 1234;
+ int y = 5678;
+ debug ("Flag");
+ debug ("X = %d\n", x);
+ showlist (The first, second, and third items.);
+ report (x>y, "x is %d but y is %d", x, y);
+}
+// Check long long types.
+#define BIG64 18446744073709551615ull
+#define BIG32 4294967295ul
+#define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0)
+#if !BIG_OK
+ your preprocessor is broken;
+#endif
+#if BIG_OK
+#else
+ your preprocessor is broken;
+#endif
+static long long int bignum = -9223372036854775807LL;
+static unsigned long long int ubignum = BIG64;
+struct incomplete_array
+{
+ int datasize;
+ double data[];
+};
+struct named_init {
+ int number;
+ const wchar_t *name;
+ double average;
+};
+typedef const char *ccp;
- if test "$GCC" = yes ; then
- #
- # -Werror forces warnings to be errors.
- #
- ac_lbl_cc_force_warning_errors=-Werror
+static inline int
+test_restrict (ccp restrict text)
+{
+ // See if C++-style comments work.
+ // Iterate through items via the restricted pointer.
+ // Also check for declarations in for loops.
+ for (unsigned int i = 0; *(text+i) != '\0'; ++i)
+ continue;
+ return 0;
+}
- #
- # Use -ffloat-store so that, on 32-bit x86, we don't
- # do 80-bit arithmetic with the FPU; that way we should
- # get the same results for floating-point calculations
- # on x86-32 and x86-64.
- #
+// Check varargs and va_copy.
+static void
+test_varargs (const char *format, ...)
+{
+ va_list args;
+ va_start (args, format);
+ va_list args_copy;
+ va_copy (args_copy, args);
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports the -ffloat-store option" >&5
-$as_echo_n "checking whether the compiler supports the -ffloat-store option... " >&6; }
- save_CFLAGS="$CFLAGS"
- if expr "x-ffloat-store" : "x-W.*" >/dev/null
- then
- CFLAGS="$CFLAGS $ac_lbl_unknown_warning_option_error -ffloat-store"
- elif expr "x-ffloat-store" : "x-f.*" >/dev/null
- then
- CFLAGS="$CFLAGS -Werror -ffloat-store"
- elif expr "x-ffloat-store" : "x-m.*" >/dev/null
- then
- CFLAGS="$CFLAGS -Werror -ffloat-store"
- else
- CFLAGS="$CFLAGS -ffloat-store"
- fi
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
+ const char *str;
+ int number;
+ float fnumber;
+
+ while (*format)
+ {
+ switch (*format++)
+ {
+ case 's': // string
+ str = va_arg (args_copy, const char *);
+ break;
+ case 'd': // int
+ number = va_arg (args_copy, int);
+ break;
+ case 'f': // float
+ fnumber = va_arg (args_copy, double);
+ break;
+ default:
+ break;
+ }
+ }
+ va_end (args_copy);
+ va_end (args);
+}
int
main ()
{
-return 0
+
+ // Check bool.
+ _Bool success = false;
+
+ // Check restrict.
+ if (test_restrict ("String literal") == 0)
+ success = true;
+ char *restrict newvar = "Another string";
+
+ // Check varargs.
+ test_varargs ("s, d' f .", "string", 65, 34.234);
+ test_varargs_macros ();
+
+ // Check flexible array members.
+ struct incomplete_array *ia =
+ malloc (sizeof (struct incomplete_array) + (sizeof (double) * 10));
+ ia->datasize = 10;
+ for (int i = 0; i < ia->datasize; ++i)
+ ia->data[i] = i * 1.234;
+
+ // Check named initializers.
+ struct named_init ni = {
+ .number = 34,
+ .name = L"Test wide string",
+ .average = 543.34343,
+ };
+
+ ni.number = 58;
+
+ int dynamic_array[ni.number];
+ dynamic_array[ni.number - 1] = 543;
+
+ // work around unused variable warnings
+ return (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == 'x'
+ || dynamic_array[ni.number - 1] != 543);
+
;
return 0;
}
_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
+for ac_arg in '' -std=gnu99 -std=c99 -c99 -AC99 -D_STDC_C99= -qlanglvl=extc99
+do
+ CC="$ac_save_CC $ac_arg"
+ if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_prog_cc_c99=$ac_arg
+fi
+rm -f core conftest.err conftest.$ac_objext
+ test "x$ac_cv_prog_cc_c99" != "xno" && break
+done
+rm -f conftest.$ac_ext
+CC=$ac_save_CC
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
- CFLAGS="$save_CFLAGS"
- V_CCOPT="$V_CCOPT -ffloat-store"
+fi
+# AC_CACHE_VAL
+case "x$ac_cv_prog_cc_c99" in
+ x)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5
+$as_echo "none needed" >&6; } ;;
+ xno)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5
+$as_echo "unsupported" >&6; } ;;
+ *)
+ CC="$CC $ac_cv_prog_cc_c99"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c99" >&5
+$as_echo "$ac_cv_prog_cc_c99" >&6; } ;;
+esac
+if test "x$ac_cv_prog_cc_c99" != xno; then :
-else
+fi
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
- CFLAGS="$save_CFLAGS"
+if test "$ac_cv_prog_cc_c99" = "no"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: The C compiler does not support C99; there may be compiler errors" >&5
+$as_echo "$as_me: WARNING: The C compiler does not support C99; there may be compiler errors" >&2;}
fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+
+
+ if test "$GCC" = yes ; then
+ #
+ # -Werror forces warnings to be errors.
+ #
+ ac_lbl_cc_force_warning_errors=-Werror
else
V_INCLS="$V_INCLS -I/usr/local/include"
LDFLAGS="$LDFLAGS -L/usr/local/lib"
@@ -3460,7 +3639,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
;;
osf*)
- #
+ #
# Presumed to be DEC OSF/1, Digital UNIX, or
# Tru64 UNIX.
#
@@ -3495,7 +3674,8 @@ $as_echo_n "checking that Ultrix $CC hacks const in prototypes... " >&6; }
if ${ac_cv_lbl_cc_const_proto+:} false; then :
$as_echo_n "(cached) " >&6
else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <sys/types.h>
int
@@ -3590,224 +3770,6 @@ cat >>confdefs.h <<_ACEOF
_ACEOF
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for __attribute__" >&5
-$as_echo_n "checking for __attribute__... " >&6; }
-if ${ac_cv___attribute__+:} false; then :
- $as_echo_n "(cached) " >&6
-else
-
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-
-#include <stdlib.h>
-
-static void foo(void) __attribute__ ((noreturn));
-
-static void
-foo(void)
-{
- exit(1);
-}
-
-int
-main(int argc, char **argv)
-{
- foo();
-}
-
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
- ac_cv___attribute__=yes
-else
- ac_cv___attribute__=no
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-
-if test "$ac_cv___attribute__" = "yes"; then
-
-$as_echo "#define HAVE___ATTRIBUTE__ 1" >>confdefs.h
-
-else
- #
- # We can't use __attribute__, so we can't use __attribute__((unused)),
- # so we define _U_ to an empty string.
- #
- V_DEFS="$V_DEFS -D_U_=\"\""
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv___attribute__" >&5
-$as_echo "$ac_cv___attribute__" >&6; }
-
-if test "$ac_cv___attribute__" = "yes"; then
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether __attribute__((unused)) can be used without warnings" >&5
-$as_echo_n "checking whether __attribute__((unused)) can be used without warnings... " >&6; }
-if ${ac_cv___attribute___unused+:} false; then :
- $as_echo_n "(cached) " >&6
-else
-
-save_CFLAGS="$CFLAGS"
-CFLAGS="$CFLAGS $ac_lbl_cc_force_warning_errors"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-
-#include <stdlib.h>
-#include <stdio.h>
-
-int
-main(int argc __attribute((unused)), char **argv __attribute((unused)))
-{
- printf("Hello, world!\n");
- return 0;
-}
-
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
- ac_cv___attribute___unused=yes
-else
- ac_cv___attribute___unused=no
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-
-CFLAGS="$save_CFLAGS"
-if test "$ac_cv___attribute___unused" = "yes"; then
- V_DEFS="$V_DEFS -D_U_=\"__attribute__((unused))\""
-else
- V_DEFS="$V_DEFS -D_U_=\"\""
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv___attribute___unused" >&5
-$as_echo "$ac_cv___attribute___unused" >&6; }
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether __attribute__((noreturn)) can be applied to function pointers without warnings" >&5
-$as_echo_n "checking whether __attribute__((noreturn)) can be applied to function pointers without warnings... " >&6; }
-if ${ac_cv___attribute___noreturn_function_pointer+:} false; then :
- $as_echo_n "(cached) " >&6
-else
-
-save_CFLAGS="$CFLAGS"
-CFLAGS="$CFLAGS $ac_lbl_cc_force_warning_errors"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-
-#include <stdlib.h>
-
-extern int (*foo)(int i)
- __attribute__ ((noreturn));
-
-int
-main(int argc, char **argv)
-{
- (*foo)(1);
-}
-
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
- ac_cv___attribute___noreturn_function_pointer=yes
-else
- ac_cv___attribute___noreturn_function_pointer=no
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-
-CFLAGS="$save_CFLAGS"
-if test "$ac_cv___attribute___noreturn_function_pointer" = "yes"; then
-
-$as_echo "#define __ATTRIBUTE___NORETURN_OK_FOR_FUNCTION_POINTERS 1" >>confdefs.h
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv___attribute___noreturn_function_pointer" >&5
-$as_echo "$ac_cv___attribute___noreturn_function_pointer" >&6; }
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether __attribute__((format)) can be used without warnings" >&5
-$as_echo_n "checking whether __attribute__((format)) can be used without warnings... " >&6; }
-if ${ac_cv___attribute___format+:} false; then :
- $as_echo_n "(cached) " >&6
-else
-
-save_CFLAGS="$CFLAGS"
-CFLAGS="$CFLAGS $ac_lbl_cc_force_warning_errors"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-
-#include <stdlib.h>
-
-extern int foo(const char *fmt, ...)
- __attribute__ ((format (printf, 1, 2)));
-
-int
-main(int argc, char **argv)
-{
- foo("%s", "test");
-}
-
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
- ac_cv___attribute___format=yes
-else
- ac_cv___attribute___format=no
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-
-CFLAGS="$save_CFLAGS"
-if test "$ac_cv___attribute___format" = "yes"; then
-
-$as_echo "#define __ATTRIBUTE___FORMAT_OK 1" >>confdefs.h
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv___attribute___format" >&5
-$as_echo "$ac_cv___attribute___format" >&6; }
-
- if test "$ac_cv___attribute___format" = "yes"; then
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether __attribute__((format)) can be applied to function pointers" >&5
-$as_echo_n "checking whether __attribute__((format)) can be applied to function pointers... " >&6; }
-if ${ac_cv___attribute___format_function_pointer+:} false; then :
- $as_echo_n "(cached) " >&6
-else
-
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-
-#include <stdlib.h>
-
-extern int (*foo)(const char *fmt, ...)
- __attribute__ ((format (printf, 1, 2)));
-
-int
-main(int argc, char **argv)
-{
- (*foo)("%s", "test");
-}
-
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
- ac_cv___attribute___format_function_pointer=yes
-else
- ac_cv___attribute___format_function_pointer=no
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-
-if test "$ac_cv___attribute___format_function_pointer" = "yes"; then
-
-$as_echo "#define __ATTRIBUTE___FORMAT_OK_FOR_FUNCTION_POINTERS 1" >>confdefs.h
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv___attribute___format_function_pointer" >&5
-$as_echo "$ac_cv___attribute___format_function_pointer" >&6; }
-
- fi
-fi
-
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
@@ -4205,7 +4167,7 @@ fi
done
-for ac_header in fcntl.h rpc/rpc.h rpc/rpcent.h
+for ac_header in fcntl.h rpc/rpc.h rpc/rpcent.h net/if.h
do :
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
@@ -4218,122 +4180,6 @@ fi
done
-for ac_header in net/pfvar.h
-do :
- ac_fn_c_check_header_compile "$LINENO" "net/pfvar.h" "ac_cv_header_net_pfvar_h" "#include <sys/types.h>
-#include <sys/socket.h>
-#include <net/if.h>
-"
-if test "x$ac_cv_header_net_pfvar_h" = xyes; then :
- cat >>confdefs.h <<_ACEOF
-#define HAVE_NET_PFVAR_H 1
-_ACEOF
-
-fi
-
-done
-
-if test "$ac_cv_header_net_pfvar_h" = yes; then
- for ac_header in net/if_pflog.h
-do :
- ac_fn_c_check_header_compile "$LINENO" "net/if_pflog.h" "ac_cv_header_net_if_pflog_h" "#include <sys/types.h>
- #include <sys/socket.h>
- #include <net/if.h>
- #include <net/pfvar.h>
-"
-if test "x$ac_cv_header_net_if_pflog_h" = xyes; then :
- cat >>confdefs.h <<_ACEOF
-#define HAVE_NET_IF_PFLOG_H 1
-_ACEOF
-
-fi
-
-done
-
- if test "$ac_cv_header_net_if_pflog_h" = yes; then
- LOCALSRC="print-pflog.c $LOCALSRC"
- fi
-fi
-for ac_header in netinet/if_ether.h
-do :
- ac_fn_c_check_header_compile "$LINENO" "netinet/if_ether.h" "ac_cv_header_netinet_if_ether_h" "#include <sys/types.h>
-#include <sys/socket.h>
-"
-if test "x$ac_cv_header_netinet_if_ether_h" = xyes; then :
- cat >>confdefs.h <<_ACEOF
-#define HAVE_NETINET_IF_ETHER_H 1
-_ACEOF
-
-fi
-
-done
-
-if test "$ac_cv_header_netinet_if_ether_h" != yes; then
- #
- # The simple test didn't work.
- # Do we need to include <net/if.h> first?
- # Unset ac_cv_header_netinet_if_ether_h so we don't
- # treat the previous failure as a cached value and
- # suppress the next test.
- #
- { $as_echo "$as_me:${as_lineno-$LINENO}: Rechecking with some additional includes" >&5
-$as_echo "$as_me: Rechecking with some additional includes" >&6;}
- unset ac_cv_header_netinet_if_ether_h
- for ac_header in netinet/if_ether.h
-do :
- ac_fn_c_check_header_compile "$LINENO" "netinet/if_ether.h" "ac_cv_header_netinet_if_ether_h" "#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-struct mbuf;
-struct rtentry;
-#include <net/if.h>
-"
-if test "x$ac_cv_header_netinet_if_ether_h" = xyes; then :
- cat >>confdefs.h <<_ACEOF
-#define HAVE_NETINET_IF_ETHER_H 1
-_ACEOF
-
-fi
-
-done
-
-fi
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether time.h and sys/time.h may both be included" >&5
-$as_echo_n "checking whether time.h and sys/time.h may both be included... " >&6; }
-if ${ac_cv_header_time+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-#include <sys/types.h>
-#include <sys/time.h>
-#include <time.h>
-
-int
-main ()
-{
-if ((struct tm *) 0)
-return 0;
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
- ac_cv_header_time=yes
-else
- ac_cv_header_time=no
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_time" >&5
-$as_echo "$ac_cv_header_time" >&6; }
-if test $ac_cv_header_time = yes; then
-
-$as_echo "#define TIME_WITH_SYS_TIME 1" >>confdefs.h
-
-fi
-
case "$host_os" in
@@ -4442,8 +4288,11 @@ else
/* end confdefs.h. */
/* libsmi available check */
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
#include <smi.h>
-main()
+int main()
{
int current, revision, age, n;
const int required = 2;
@@ -4583,8 +4432,17 @@ fi
# XXX - do we need to check for all of them, or are there some that, if
# present, imply others are present?
#
-if test ! -z "$with_sandbox-capsicum" && test "$with_sandbox-capsicum" != "no" ; then
- for ac_func in cap_enter cap_rights_limit cap_ioctls_limit openat
+if test -z "$with_sandbox_capsicum" || test "$with_sandbox_capsicum" != "no" ; then
+ #
+ # First, make sure we have the required header.
+ #
+ ac_fn_c_check_header_mongrel "$LINENO" "sys/capsicum.h" "ac_cv_header_sys_capsicum_h" "$ac_includes_default"
+if test "x$ac_cv_header_sys_capsicum_h" = xyes; then :
+
+ #
+ # We do; now make sure we have the required functions.
+ #
+ for ac_func in cap_enter cap_rights_limit cap_ioctls_limit openat
do :
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
@@ -4598,6 +4456,90 @@ else
fi
done
+
+fi
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for cap_init in -lcasper" >&5
+$as_echo_n "checking for cap_init in -lcasper... " >&6; }
+if ${ac_cv_lib_casper_cap_init+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lcasper $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char cap_init ();
+int
+main ()
+{
+return cap_init ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_casper_cap_init=yes
+else
+ ac_cv_lib_casper_cap_init=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_casper_cap_init" >&5
+$as_echo "$ac_cv_lib_casper_cap_init" >&6; }
+if test "x$ac_cv_lib_casper_cap_init" = xyes; then :
+ LIBS="$LIBS -lcasper"
+fi
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for cap_gethostbyaddr in -lcap_dns" >&5
+$as_echo_n "checking for cap_gethostbyaddr in -lcap_dns... " >&6; }
+if ${ac_cv_lib_cap_dns_cap_gethostbyaddr+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lcap_dns $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char cap_gethostbyaddr ();
+int
+main ()
+{
+return cap_gethostbyaddr ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_cap_dns_cap_gethostbyaddr=yes
+else
+ ac_cv_lib_cap_dns_cap_gethostbyaddr=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_cap_dns_cap_gethostbyaddr" >&5
+$as_echo "$ac_cv_lib_cap_dns_cap_gethostbyaddr" >&6; }
+if test "x$ac_cv_lib_cap_dns_cap_gethostbyaddr" = xyes; then :
+ LIBS="$LIBS -lcap_dns"
+fi
+
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to sandbox using capsicum" >&5
$as_echo_n "checking whether to sandbox using capsicum... " >&6; }
@@ -4611,6 +4553,18 @@ else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to sandbox using Casper library" >&5
+$as_echo_n "checking whether to sandbox using Casper library... " >&6; }
+if test "x$ac_cv_lib_casper_cap_init" = "xyes" -a "x$ac_cv_lib_cap_dns_cap_gethostbyaddr" = "xyes"; then
+
+$as_echo "#define HAVE_CASPER 1" >>confdefs.h
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
#
# We must check this before checking whether to check the OS's IPv6,
@@ -4891,10 +4845,15 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
+#include <string.h>
/* AF_INET6 available check */
#include <sys/types.h>
+#ifdef _WIN32
+#include <ws2tcpip.h>
+#else
#include <sys/socket.h>
#include <netinet/in.h>
+#endif
#ifdef AF_INET6
void
foo(struct in6_addr *addr)
@@ -5069,19 +5028,6 @@ if test "$ipv6" = "yes" -a "$ipv6lib" != "none"; then
fi
fi
-ac_fn_c_check_func "$LINENO" "vfprintf" "ac_cv_func_vfprintf"
-if test "x$ac_cv_func_vfprintf" = xyes; then :
- $as_echo "#define HAVE_VFPRINTF 1" >>confdefs.h
-
-else
- case " $LIBOBJS " in
- *" vfprintf.$ac_objext "* ) ;;
- *) LIBOBJS="$LIBOBJS vfprintf.$ac_objext"
- ;;
-esac
-
-fi
-
ac_fn_c_check_func "$LINENO" "strlcat" "ac_cv_func_strlcat"
if test "x$ac_cv_func_strlcat" = xyes; then :
$as_echo "#define HAVE_STRLCAT 1" >>confdefs.h
@@ -5134,6 +5080,19 @@ esac
fi
+ac_fn_c_check_func "$LINENO" "getservent" "ac_cv_func_getservent"
+if test "x$ac_cv_func_getservent" = xyes; then :
+ $as_echo "#define HAVE_GETSERVENT 1" >>confdefs.h
+
+else
+ case " $LIBOBJS " in
+ *" getservent.$ac_objext "* ) ;;
+ *) LIBOBJS="$LIBOBJS getservent.$ac_objext"
+ ;;
+esac
+
+fi
+
ac_fn_c_check_func "$LINENO" "getopt_long" "ac_cv_func_getopt_long"
if test "x$ac_cv_func_getopt_long" = xyes; then :
$as_echo "#define HAVE_GETOPT_LONG 1" >>confdefs.h
@@ -5148,7 +5107,7 @@ esac
fi
-for ac_func in fork vfork strftime
+for ac_func in fork vfork
do :
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
@@ -5160,121 +5119,83 @@ _ACEOF
fi
done
-for ac_func in setlinebuf alarm
+for ac_func in setlinebuf
do :
- as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
-ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
-if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
+ ac_fn_c_check_func "$LINENO" "setlinebuf" "ac_cv_func_setlinebuf"
+if test "x$ac_cv_func_setlinebuf" = xyes; then :
cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+#define HAVE_SETLINEBUF 1
_ACEOF
fi
done
-needsnprintf=no
-for ac_func in vsnprintf snprintf
-do :
- as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
-ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
-if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
- cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
-_ACEOF
+#
+# Make sure we have vsnprintf() and snprintf(); we require them.
+#
+ac_fn_c_check_func "$LINENO" "vsnprintf" "ac_cv_func_vsnprintf"
+if test "x$ac_cv_func_vsnprintf" = xyes; then :
else
- needsnprintf=yes
+ as_fn_error $? "vsnprintf() is required but wasn't found" "$LINENO" 5
fi
-done
-if test $needsnprintf = yes; then
- case " $LIBOBJS " in
- *" snprintf.$ac_objext "* ) ;;
- *) LIBOBJS="$LIBOBJS snprintf.$ac_objext"
- ;;
-esac
+ac_fn_c_check_func "$LINENO" "snprintf" "ac_cv_func_snprintf"
+if test "x$ac_cv_func_snprintf" = xyes; then :
+else
+ as_fn_error $? "snprintf() is required but wasn't found" "$LINENO" 5
fi
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking return type of signal handlers" >&5
-$as_echo_n "checking return type of signal handlers... " >&6; }
-if ${ac_cv_type_signal+:} false; then :
- $as_echo_n "(cached) " >&6
+#
+# Define HAVE_NO_PRINTF_Z to make it possible to disable test cases that
+# depend on %zu.
+#
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether printf(3) supports the z length modifier" >&5
+$as_echo_n "checking whether printf(3) supports the z length modifier... " >&6; }
+if test "$cross_compiling" = yes; then :
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: not while cross-compiling" >&5
+$as_echo "not while cross-compiling" >&6; }
+
+
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
-#include <sys/types.h>
-#include <signal.h>
-
-int
-main ()
-{
-return *(signal (0, 0)) (0) == 1;
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
- ac_cv_type_signal=int
-else
- ac_cv_type_signal=void
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_signal" >&5
-$as_echo "$ac_cv_type_signal" >&6; }
-
-cat >>confdefs.h <<_ACEOF
-#define RETSIGTYPE $ac_cv_type_signal
-_ACEOF
- if test "$ac_cv_type_signal" = void ; then
+#include <stdio.h>
+#include <string.h>
-$as_echo "#define RETSIGVAL /**/" >>confdefs.h
+int main()
+{
+ char buf[100];
+ snprintf(buf, sizeof(buf), "%zu", sizeof(buf));
+ return strncmp(buf, "100", sizeof(buf)) ? 1 : 0;
+}
- else
-$as_echo "#define RETSIGVAL (0)" >>confdefs.h
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
- fi
- case "$host_os" in
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
- irix*)
+else
-$as_echo "#define _BSD_SIGNALS 1" >>confdefs.h
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
- ;;
+$as_echo "#define HAVE_NO_PRINTF_Z 1" >>confdefs.h
- *)
- for ac_func in sigaction
-do :
- ac_fn_c_check_func "$LINENO" "sigaction" "ac_cv_func_sigaction"
-if test "x$ac_cv_func_sigaction" = xyes; then :
- cat >>confdefs.h <<_ACEOF
-#define HAVE_SIGACTION 1
-_ACEOF
fi
-done
-
- if test $ac_cv_func_sigaction = no ; then
- for ac_func in sigset
-do :
- ac_fn_c_check_func "$LINENO" "sigset" "ac_cv_func_sigset"
-if test "x$ac_cv_func_sigset" = xyes; then :
- cat >>confdefs.h <<_ACEOF
-#define HAVE_SIGSET 1
-_ACEOF
-
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
fi
-done
- fi
- ;;
- esac
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lrpc" >&5
$as_echo_n "checking for main in -lrpc... " >&6; }
@@ -5378,7 +5299,7 @@ fi
LBL_LIBS="$LIBS"
pfopen=/usr/examples/packetfilter/pfopen.c
if test -f $pfopen ; then
- for ac_func in pfopen
+ for ac_func in pfopen
do :
ac_fn_c_check_func "$LINENO" "pfopen" "ac_cv_func_pfopen"
if test "x$ac_cv_func_pfopen" = xyes; then :
@@ -5389,48 +5310,233 @@ _ACEOF
fi
done
- if test $ac_cv_func_pfopen = "no" ; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: Using $pfopen" >&5
+ if test $ac_cv_func_pfopen = "no" ; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: Using $pfopen" >&5
$as_echo "Using $pfopen" >&6; }
- LIBS="$LIBS $pfopen"
- fi
+ LIBS="$LIBS $pfopen"
+ fi
fi
- libpcap=FAIL
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for local pcap library" >&5
-$as_echo_n "checking for local pcap library... " >&6; }
+ libpcap=FAIL
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to look for a local libpcap" >&5
+$as_echo_n "checking whether to look for a local libpcap... " >&6; }
+ # Check whether --enable-local-libpcap was given.
+if test "${enable_local_libpcap+set}" = set; then :
+ enableval=$enable_local_libpcap;
+else
+ enableval=yes
+fi
-# Check whether --with-system-libpcap was given.
-if test "${with_system_libpcap+set}" = set; then :
- withval=$with_system_libpcap;
-fi
-
- if test "x$with_system_libpcap" != xyes ; then
- lastdir=FAIL
- places=`ls $srcdir/.. | sed -e 's,/$,,' -e "s,^,$srcdir/../," | \
- egrep '/libpcap-[0-9]+\.[0-9]+(\.[0-9]*)?([ab][0-9]*|-PRE-GIT)?$'`
- places2=`ls .. | sed -e 's,/$,,' -e "s,^,../," | \
- egrep '/libpcap-[0-9]+\.[0-9]+(\.[0-9]*)?([ab][0-9]*|-PRE-GIT)?$'`
- for dir in $places $srcdir/../libpcap ../libpcap $srcdir/libpcap $places2 ; do
- basedir=`echo $dir | sed -e 's/[ab][0-9]*$//' | \
- sed -e 's/-PRE-GIT$//' `
- if test $lastdir = $basedir ; then
- continue;
- fi
- lastdir=$dir
- if test -r $dir/libpcap.a ; then
- libpcap=$dir/libpcap.a
- d=$dir
- fi
- done
- fi
- if test $libpcap = FAIL ; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
+ case "$enableval" in
+
+ no)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ #
+ # Don't look for a local libpcap.
+ #
+ using_local_libpcap=no
+ ;;
+
+ *)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+ #
+ # Look for a local pcap library.
+ #
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for local pcap library" >&5
+$as_echo_n "checking for local pcap library... " >&6; }
+ lastdir=FAIL
+ places=`ls $srcdir/.. | sed -e 's,/$,,' -e "s,^,$srcdir/../," | \
+ egrep '/libpcap-[0-9]+\.[0-9]+(\.[0-9]*)?([ab][0-9]*|-PRE-GIT|rc.)?$'`
+ places2=`ls .. | sed -e 's,/$,,' -e "s,^,../," | \
+ egrep '/libpcap-[0-9]+\.[0-9]+(\.[0-9]*)?([ab][0-9]*|-PRE-GIT|rc.)?$'`
+ for dir in $places $srcdir/../libpcap ../libpcap $srcdir/libpcap $places2 ; do
+ basedir=`echo $dir | sed -e 's/[ab][0-9]*$//' | \
+ sed -e 's/-PRE-GIT$//' `
+ if test $lastdir = $basedir ; then
+ continue;
+ fi
+ lastdir=$dir
+ if test -r $dir/libpcap.a ; then
+ libpcap=$dir/libpcap.a
+ local_pcap_dir=$dir
+ fi
+ done
+ if test $libpcap = FAIL ; then
+ #
+ # We didn't find a local libpcap.
+ #
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
$as_echo "not found" >&6; }
+ using_local_libpcap=no;
+ else
+ #
+ # We found a local libpcap.
+ #
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $libpcap" >&5
+$as_echo "$libpcap" >&6; }
+ using_local_libpcap=yes
+ fi
+ ;;
+ esac
- #
- # Look for pcap-config.
- #
- if test -n "$ac_tool_prefix"; then
+ if test $using_local_libpcap = no ; then
+ #
+ # We didn't find a local libpcap.
+ # Look for an installed pkg-config.
+ #
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args.
+set dummy ${ac_tool_prefix}pkg-config; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_PKG_CONFIG+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $PKG_CONFIG in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+PKG_CONFIG=$ac_cv_path_PKG_CONFIG
+if test -n "$PKG_CONFIG"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5
+$as_echo "$PKG_CONFIG" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_path_PKG_CONFIG"; then
+ ac_pt_PKG_CONFIG=$PKG_CONFIG
+ # Extract the first word of "pkg-config", so it can be a program name with args.
+set dummy pkg-config; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_ac_pt_PKG_CONFIG+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $ac_pt_PKG_CONFIG in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG
+if test -n "$ac_pt_PKG_CONFIG"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5
+$as_echo "$ac_pt_PKG_CONFIG" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_pt_PKG_CONFIG" = x; then
+ PKG_CONFIG=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ PKG_CONFIG=$ac_pt_PKG_CONFIG
+ fi
+else
+ PKG_CONFIG="$ac_cv_path_PKG_CONFIG"
+fi
+
+ if test -n "$PKG_CONFIG" ; then
+ #
+ # We have it. Are there .pc files for libpcap?
+ #
+ # --exists was introduced in pkg-config 0.4.0; that
+ # dates back to late 2000, so we won't worry about
+ # earlier releases that lack it.
+ #
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether there are .pc files for libpcap" >&5
+$as_echo_n "checking whether there are .pc files for libpcap... " >&6; }
+ if "$PKG_CONFIG" libpcap --exists ; then
+ #
+ # Yes, so we can use pkg-config to get configuration
+ # information for libpcap.
+ #
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+ pkg_config_usable=yes
+ else
+ #
+ # No, so we can't use pkg-config to get configuration
+ # information for libpcap.
+ #
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ pkg_config_usable=no
+ fi
+ else
+ #
+ # We don't have it, so we obviously can't use it.
+ #
+ pkg_config_usable=no
+ fi
+ if test "$pkg_config_usable" = "yes" ; then
+ #
+ # Found both - use pkg-config to get the include flags for
+ # libpcap and the flags to link with libpcap.
+ #
+ # Please read section 11.6 "Shell Substitutions"
+ # in the autoconf manual before doing anything
+ # to this that involves quoting. Especially note
+ # the statement "There is just no portable way to use
+ # double-quoted strings inside double-quoted back-quoted
+ # expressions (pfew!)."
+ #
+ cflags=`"$PKG_CONFIG" libpcap --cflags`
+ V_INCLS="$cflags $V_INCLS"
+ libpcap=`"$PKG_CONFIG" libpcap --libs`
+ else
+ #
+ # No pkg-config
+ # Look for an installed pcap-config.
+ #
+ if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}pcap-config", so it can be a program name with args.
set dummy ${ac_tool_prefix}pcap-config; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
@@ -5528,26 +5634,140 @@ else
PCAP_CONFIG="$ac_cv_path_PCAP_CONFIG"
fi
- if test -n "$PCAP_CONFIG" ; then
- #
- # Found - use it to get the include flags for
- # libpcap and the flags to link with libpcap.
- #
- # Please read section 11.6 "Shell Substitutions"
- # in the autoconf manual before doing anything
- # to this that involves quoting. Especially note
- # the statement "There is just no portable way to use
- # double-quoted strings inside double-quoted back-quoted
- # expressions (pfew!)."
- #
- cflags=`"$PCAP_CONFIG" --cflags`
- V_INCLS="$cflags $V_INCLS"
- libpcap=`"$PCAP_CONFIG" --libs`
- else
- #
- # Not found; look for pcap.
- #
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lpcap" >&5
+ if test -n "$PCAP_CONFIG" ; then
+ #
+ # Found - use it to get the include flags for
+ # libpcap and the flags to link with libpcap.
+ #
+ # If this is a vendor-supplied pcap-config, which
+ # we define as being "a pcap-config in /usr/bin
+ # or /usr/ccs/bin" (the latter is for Solaris and
+ # Sun/Oracle Studio), there are some issues. Work
+ # around them.
+ #
+ if test \( "$PCAP_CONFIG" = "/usr/bin/pcap-config" \) -o \
+ \( "$PCAP_CONFIG" = "/usr/ccs/bin/pcap-config" \) ; then
+ #
+ # It's vendor-supplied.
+ #
+ case "$host_os" in
+
+ darwin*)
+ #
+ # This is macOS or another Darwin-based OS.
+ #
+ # That means that /usr/bin/pcap-config it
+ # may provide -I/usr/local/include with --cflags
+ # and -L/usr/local/lib with --libs, rather than
+ # pointing to the OS-supplied library and
+ # Xcode-supplied headers. Remember that, so we
+ # ignore those values.
+ #
+ _broken_apple_pcap_config=yes
+ ;;
+
+ solaris*)
+ #
+ # This is Solaris 2 or later, i.e. SunOS 5.x.
+ #
+ # At least on Solaris 11; there's /usr/bin/pcap-config,
+ # which reports -L/usr/lib with --libs, causing
+ # the 32-bit libraries to be found, and there's
+ # /usr/bin/{64bitarch}/pcap-config, where {64bitarch}
+ # is a name for the 64-bit version of the instruction
+ # set, which reports -L /usr/lib/{64bitarch}, causing
+ # the 64-bit libraries to be found.
+ #
+ # So if we're building 64-bit targets, we replace
+ # PCAP_CONFIG with /usr/bin/{64bitarch}; we get
+ # {64bitarch} as the output of "isainfo -n".
+ #
+ # Are we building 32-bit or 64-bit? Get the
+ # size of void *, and check that.
+ #
+ # The cast to long int works around a bug in the HP C Compiler
+# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+# This bug is HP SR number 8606223364.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of void *" >&5
+$as_echo_n "checking size of void *... " >&6; }
+if ${ac_cv_sizeof_void_p+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (void *))" "ac_cv_sizeof_void_p" "$ac_includes_default"; then :
+
+else
+ if test "$ac_cv_type_void_p" = yes; then
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error 77 "cannot compute sizeof (void *)
+See \`config.log' for more details" "$LINENO" 5; }
+ else
+ ac_cv_sizeof_void_p=0
+ fi
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_void_p" >&5
+$as_echo "$ac_cv_sizeof_void_p" >&6; }
+
+
+
+cat >>confdefs.h <<_ACEOF
+#define SIZEOF_VOID_P $ac_cv_sizeof_void_p
+_ACEOF
+
+
+ if test ac_cv_sizeof_void_p -eq 8 ; then
+ isainfo_output=`isainfo -n`
+ if test ! -z "$isainfo_output" ; then
+ #
+ # Success - change PCAP_CONFIG.
+ #
+ PCAP_CONFIG=`echo $PCAP_CONFIG | sed "s;/bin/;/bin/$isainfo_output/;"`
+ fi
+ fi
+ ;;
+ esac
+ fi
+ #
+ # Please read section 11.6 "Shell Substitutions"
+ # in the autoconf manual before doing anything
+ # to this that involves quoting. Especially note
+ # the statement "There is just no portable way to use
+ # double-quoted strings inside double-quoted back-quoted
+ # expressions (pfew!)."
+ #
+ cflags=`"$PCAP_CONFIG" --cflags`
+ #
+ # Work around macOS (and probably other Darwin) brokenness,
+ # by not adding /usr/local/include if it's from the broken
+ # Apple pcap-config.
+ #
+ if test "$_broken_apple_pcap_config" = "yes" ; then
+ #
+ # Strip -I/usr/local/include with sed.
+ #
+ cflags=`echo $cflags | sed 's;-I/usr/local/include;;'`
+ fi
+ V_INCLS="$cflags $V_INCLS"
+ libpcap=`"$PCAP_CONFIG" --libs`
+ #
+ # Work around macOS (and probably other Darwin) brokenness,
+ # by not adding /usr/local/lib if it's from the broken
+ # Apple pcap-config.
+ #
+ if test "$_broken_apple_pcap_config" = "yes" ; then
+ #
+ # Strip -L/usr/local/lib with sed.
+ #
+ libpcap=`echo $libpcap | sed 's;-L/usr/local/lib;;'`
+ fi
+ else
+ #
+ # Not found; look for an installed pcap.
+ #
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lpcap" >&5
$as_echo_n "checking for main in -lpcap... " >&6; }
if ${ac_cv_lib_pcap_main+:} false; then :
$as_echo_n "(cached) " >&6
@@ -5581,52 +5801,40 @@ if test "x$ac_cv_lib_pcap_main" = xyes; then :
libpcap="-lpcap"
fi
- if test $libpcap = FAIL ; then
- as_fn_error $? "see the INSTALL doc for more info" "$LINENO" 5
- fi
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for extraneous pcap header directories" >&5
+ if test $libpcap = FAIL ; then
+ as_fn_error $? "see the INSTALL doc for more info" "$LINENO" 5
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for extraneous pcap header directories" >&5
$as_echo_n "checking for extraneous pcap header directories... " >&6; }
- if test \( ! -r /usr/local/include/pcap.h \) -a \
- \( ! -r /usr/include/pcap.h \); then
- if test -r /usr/local/include/pcap/pcap.h; then
- d="/usr/local/include/pcap"
- elif test -r /usr/include/pcap/pcap.h; then
- d="/usr/include/pcap"
- fi
- fi
- if test -z "$d" ; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
+ if test \( ! -r /usr/local/include/pcap.h \) -a \
+ \( ! -r /usr/include/pcap.h \); then
+ if test -r /usr/local/include/pcap/pcap.h; then
+ d="/usr/local/include/pcap"
+ elif test -r /usr/include/pcap/pcap.h; then
+ d="/usr/include/pcap"
+ fi
+ fi
+ if test -z "$d" ; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
$as_echo "not found" >&6; }
- else
- V_INCLS="-I$d $V_INCLS"
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: found -- -I$d added" >&5
+ else
+ V_INCLS="-I$d $V_INCLS"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: found -- -I$d added" >&5
$as_echo "found -- -I$d added" >&6; }
- fi
- fi
- else
- V_PCAPDEP=$libpcap
- places=`ls $srcdir/.. | sed -e 's,/$,,' -e "s,^,$srcdir/../," | \
- egrep '/libpcap-[0-9]*.[0-9]*(.[0-9]*)?([ab][0-9]*)?$'`
- places2=`ls .. | sed -e 's,/$,,' -e "s,^,../," | \
- egrep '/libpcap-[0-9]*.[0-9]*(.[0-9]*)?([ab][0-9]*)?$'`
- pcapH=FAIL
- if test -r $d/pcap.h; then
- pcapH=$d
- else
- for dir in $places $srcdir/../libpcap ../libpcap $srcdir/libpcap $places2 ; do
- if test -r $dir/pcap.h ; then
- pcapH=$dir
- fi
- done
+ fi
fi
-
- if test $pcapH = FAIL ; then
- as_fn_error $? "cannot find pcap.h: see INSTALL" "$LINENO" 5
- fi
- V_INCLS="-I$pcapH $V_INCLS"
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $libpcap" >&5
-$as_echo "$libpcap" >&6; }
- # Extract the first word of "pcap-config", so it can be a program name with args.
+ fi
+ else
+ #
+ # We found a local libpcap. Add it to the dependencies for
+ # tcpdump.
+ #
+ V_PCAPDEP=$libpcap
+
+ #
+ # Look for its pcap-config script.
+ #
+ # Extract the first word of "pcap-config", so it can be a program name with args.
set dummy pcap-config; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
@@ -5639,7 +5847,7 @@ else
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $d
+for as_dir in $local_pcap_dir
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
@@ -5666,66 +5874,177 @@ $as_echo "no" >&6; }
fi
- if test -n "$PCAP_CONFIG"; then
- #
- # The libpcap directory has a pcap-config script.
- # Use it to get any additioal libraries needed
- # to link with the libpcap archive library in
- # that directory.
- #
- # Please read section 11.6 "Shell Substitutions"
- # in the autoconf manual before doing anything
- # to this that involves quoting. Especially note
- # the statement "There is just no portable way to use
- # double-quoted strings inside double-quoted back-quoted
- # expressions (pfew!)."
- #
- additional_libs=`"$PCAP_CONFIG" --additional-libs --static`
- libpcap="$libpcap $additional_libs"
- fi
+
+ if test -n "$PCAP_CONFIG"; then
+ #
+ # We don't want its --cflags or --libs output, because
+ # those presume it's installed. For the C compiler flags,
+ # we add the source directory for the local libpcap, so
+ # we pick up its header files.
+ #
+ # We do, however, want its additional libraries, as required
+ # when linking statically, because it makes calls to
+ # routines in those libraries, so we'll need to link with
+ # them, because we'll be linking statically with it.
+ #
+ # If it supports --static-pcap-only. use that, as we will be
+ # linking with a static libpcap but won't be linking
+ # statically with any of the libraries on which it depends;
+ # those libraries might not even have static versions
+ # installed.
+ #
+ # That means we need to find out the libraries on which
+ # libpcap directly depends, so we can link with them, but we
+ # don't need to link with the libraries on which those
+ # libraries depend as, on all UN*Xes with which I'm
+ # familiar, the libraries on which a shared library depends
+ # are stored in the library and are automatically loaded by
+ # the run-time linker, without the executable having to be
+ # linked with those libraries. (This allows a library to be
+ # changed to depend on more libraries without breaking that
+ # library's ABI.)
+ #
+ # The only way to test for that support is to see if the
+ # script contains the string "static-pcap-only"; we can't
+ # try using that flag and checking for errors, as the
+ # versions of the script that didn't have that flag wouldn't
+ # report or return an error for an unsupported command-line
+ # flag. Those older versions provided, with --static, only
+ # the libraries on which libpcap depends, not the
+ # dependencies of those libraries; the versions with
+ # --static-pcap-only provide all the dependencies with
+ # --static, for the benefit of programs that are completely
+ # statically linked, and provide only the direct
+ # dependencies with --static-pcap-only.
+ #
+ if grep -s -q "static-pcap-only" "$PCAP_CONFIG"
+ then
+ static_opt="--static-pcap-only"
+ else
+ static_opt="--static"
+ fi
+ V_INCLS="-I$local_pcap_dir $V_INCLS"
+ additional_libs=`"$PCAP_CONFIG" $static_opt --additional-libs`
+ libpcap="$libpcap $additional_libs"
+ else
+ #
+ # It doesn't have a pcap-config script.
+ # Make sure it has a pcap.h file.
+ #
+ places=`ls $srcdir/.. | sed -e 's,/$,,' -e "s,^,$srcdir/../," | \
+ egrep '/libpcap-[0-9]*.[0-9]*(.[0-9]*)?([ab][0-9]*)?$'`
+ places2=`ls .. | sed -e 's,/$,,' -e "s,^,../," | \
+ egrep '/libpcap-[0-9]*.[0-9]*(.[0-9]*)?([ab][0-9]*)?$'`
+ pcapH=FAIL
+ if test -r $local_pcap_dir/pcap.h; then
+ pcapH=$local_pcap_dir
+ else
+ for dir in $places $srcdir/../libpcap ../libpcap $srcdir/libpcap $places2 ; do
+ if test -r $dir/pcap.h ; then
+ pcapH=$dir
+ fi
+ done
+ fi
+
+ if test $pcapH = FAIL ; then
+ as_fn_error $? "cannot find pcap.h: see INSTALL" "$LINENO" 5
+ fi
+
+ #
+ # Force the compiler to look for header files in the
+ # directory containing pcap.h.
+ #
+ V_INCLS="-I$pcapH $V_INCLS"
+ fi
fi
- LIBS="$libpcap $LIBS"
- if ! test -n "$PCAP_CONFIG" ; then
- #
- # We don't have pcap-config; find out any additional link flags
- # we need. (If we have pcap-config, we assume it tells us what
- # we need.)
- #
- case "$host_os" in
- aix*)
- #
- # If libpcap is DLPI-based, we have to use /lib/pse.exp if
- # present, as we use the STREAMS routines.
- #
- # (XXX - true only if we're linking with a static libpcap?)
- #
- pseexe="/lib/pse.exp"
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $pseexe" >&5
+ if test -z "$PKG_CONFIG" -a -z "$PCAP_CONFIG"; then
+ #
+ # We don't have pkg-config or pcap-config; find out any additional
+ # link flags we need. (If we have pkg-config or pcap-config, we
+ # assume it tells us what we need.)
+ #
+ case "$host_os" in
+
+ aix*)
+ #
+ # If libpcap is DLPI-based, we have to use /lib/pse.exp if
+ # present, as we use the STREAMS routines.
+ #
+ # (XXX - true only if we're linking with a static libpcap?)
+ #
+ pseexe="/lib/pse.exp"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $pseexe" >&5
$as_echo_n "checking for $pseexe... " >&6; }
- if test -f $pseexe ; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+ if test -f $pseexe ; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
- LIBS="$LIBS -I:$pseexe"
- fi
+ LIBS="$LIBS -I:$pseexe"
+ fi
- #
- # If libpcap is BPF-based, we need "-lodm" and "-lcfg", as
- # we use them to load the BPF module.
- #
- # (XXX - true only if we're linking with a static libpcap?)
- #
- LIBS="$LIBS -lodm -lcfg"
- ;;
- esac
+ #
+ # If libpcap is BPF-based, we need "-lodm" and "-lcfg", as
+ # we use them to load the BPF module.
+ #
+ # (XXX - true only if we're linking with a static libpcap?)
+ #
+ LIBS="$LIBS -lodm -lcfg"
+ ;;
+
+ solaris*)
+ # libdlpi is needed for Solaris 11 and later.
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlpi_walk in -ldlpi" >&5
+$as_echo_n "checking for dlpi_walk in -ldlpi... " >&6; }
+if ${ac_cv_lib_dlpi_dlpi_walk+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldlpi -L/lib $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dlpi_walk ();
+int
+main ()
+{
+return dlpi_walk ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_dlpi_dlpi_walk=yes
+else
+ ac_cv_lib_dlpi_dlpi_walk=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dlpi_dlpi_walk" >&5
+$as_echo "$ac_cv_lib_dlpi_dlpi_walk" >&6; }
+if test "x$ac_cv_lib_dlpi_dlpi_walk" = xyes; then :
+ LIBS="$LIBS -ldlpi" LDFLAGS="-L/lib $LDFLAGS"
+fi
+
+ ;;
+ esac
fi
+ LIBS="$libpcap $LIBS"
+
ac_fn_c_check_func "$LINENO" "pcap_loop" "ac_cv_func_pcap_loop"
if test "x$ac_cv_func_pcap_loop" = xyes; then :
else
- as_fn_error $? "This is a bug, please follow the guidelines in CONTRIBUTING and include the
+ as_fn_error $? "This is a bug, please follow the guidelines in CONTRIBUTING.md and include the
config.log file in your report. If you have downloaded libpcap from
tcpdump.org, and built it yourself, please also include the config.log
file from the libpcap source directory, the Makefile from the libpcap
@@ -5745,11 +6064,12 @@ fi
#
# You are in a twisty little maze of UN*Xes, all different.
# Some might not have ether_ntohost().
-# Some might have it, but not declare it in any header file.
-# Some might have it, but declare it in <netinet/if_ether.h>.
-# Some might have it, but declare it in <netinet/ether.h>
-# (And some might have it but document it as something declared in
-# <netinet/ethernet.h>, although <netinet/if_ether.h> appears to work.)
+# Some might have it and declare it in <net/ethernet.h>.
+# Some might have it and declare it in <netinet/ether.h>
+# Some might have it and declare it in <sys/ethernet.h>.
+# Some might have it and declare it in <arpa/inet.h>.
+# Some might have it and declare it in <netinet/if_ether.h>.
+# Some might have it and not declare it in any header file.
#
# Before you is a C compiler.
#
@@ -5774,6 +6094,8 @@ else
/* end confdefs.h. */
#include <netdb.h>
+ #include <netinet/ether.h>
+ #include <stdlib.h>
#include <sys/types.h>
#include <sys/param.h>
#include <sys/socket.h>
@@ -5813,27 +6135,46 @@ done
if test "$ac_cv_func_ether_ntohost" = yes -a \
"$ac_cv_buggy_ether_ntohost" = "no"; then
#
- # OK, we have ether_ntohost(). Do we have <netinet/if_ether.h>?
+ # OK, we have ether_ntohost(). Is it declared in <net/ethernet.h>?
+ #
+ # This test fails if we don't have <net/ethernet.h> or if we do
+ # but it doesn't declare ether_ntohost().
+ #
+ ac_fn_c_check_decl "$LINENO" "ether_ntohost" "ac_cv_have_decl_ether_ntohost" "
+#include <net/ethernet.h>
+
+"
+if test "x$ac_cv_have_decl_ether_ntohost" = xyes; then :
+
+
+$as_echo "#define NET_ETHERNET_H_DECLARES_ETHER_NTOHOST /**/" >>confdefs.h
+
+
+fi
+
+ #
+ # Did that succeed?
#
- if test "$ac_cv_header_netinet_if_ether_h" = yes; then
+ if test "$ac_cv_have_decl_ether_ntohost" != yes; then
#
- # Yes. Does it declare ether_ntohost()?
+ # No, how about <netinet/ether.h>, as on Linux?
#
+ # This test fails if we don't have <netinet/ether.h>
+ # or if we do but it doesn't declare ether_ntohost().
+ #
+ # Unset ac_cv_have_decl_ether_ntohost so we don't
+ # treat the previous failure as a cached value and
+ # suppress the next test.
+ #
+ unset ac_cv_have_decl_ether_ntohost
ac_fn_c_check_decl "$LINENO" "ether_ntohost" "ac_cv_have_decl_ether_ntohost" "
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-struct mbuf;
-struct rtentry;
-#include <net/if.h>
-#include <netinet/if_ether.h>
+#include <netinet/ether.h>
"
if test "x$ac_cv_have_decl_ether_ntohost" = xyes; then :
-$as_echo "#define NETINET_IF_ETHER_H_DECLARES_ETHER_NTOHOST /**/" >>confdefs.h
+$as_echo "#define NETINET_ETHER_H_DECLARES_ETHER_NTOHOST /**/" >>confdefs.h
fi
@@ -5844,121 +6185,132 @@ fi
#
if test "$ac_cv_have_decl_ether_ntohost" != yes; then
#
- # No, how about <netinet/ether.h>, as on Linux?
+ # No, how about <sys/ethernet.h>, as on Solaris 10
+ # and later?
#
- for ac_header in netinet/ether.h
-do :
- ac_fn_c_check_header_mongrel "$LINENO" "netinet/ether.h" "ac_cv_header_netinet_ether_h" "$ac_includes_default"
-if test "x$ac_cv_header_netinet_ether_h" = xyes; then :
- cat >>confdefs.h <<_ACEOF
-#define HAVE_NETINET_ETHER_H 1
-_ACEOF
+ # This test fails if we don't have <sys/ethernet.h>
+ # or if we do but it doesn't declare ether_ntohost().
+ #
+ # Unset ac_cv_have_decl_ether_ntohost so we don't
+ # treat the previous failure as a cached value and
+ # suppress the next test.
+ #
+ unset ac_cv_have_decl_ether_ntohost
+ ac_fn_c_check_decl "$LINENO" "ether_ntohost" "ac_cv_have_decl_ether_ntohost" "
+#include <sys/ethernet.h>
-fi
+"
+if test "x$ac_cv_have_decl_ether_ntohost" = xyes; then :
-done
- if test "$ac_cv_header_netinet_ether_h" = yes; then
- #
- # We have it - does it declare ether_ntohost()?
- # Unset ac_cv_have_decl_ether_ntohost so we don't
- # treat the previous failure as a cached value and
- # suppress the next test.
- #
- unset ac_cv_have_decl_ether_ntohost
- ac_fn_c_check_decl "$LINENO" "ether_ntohost" "ac_cv_have_decl_ether_ntohost" "
-#include <netinet/ether.h>
+$as_echo "#define SYS_ETHERNET_H_DECLARES_ETHER_NTOHOST /**/" >>confdefs.h
+
+
+fi
+
+ fi
+ #
+ # Did that succeed?
+ #
+ if test "$ac_cv_have_decl_ether_ntohost" != yes; then
+ #
+ # No, how about <arpa/inet.h>, as in AIX?
+ #
+ # This test fails if we don't have <arpa/inet.h>
+ # (if we have ether_ntohost(), we should have
+ # networking, and if we have networking, we should
+ # have <arpa/inet.h>) or if we do but it doesn't
+ # declare ether_ntohost().
+ #
+ # Unset ac_cv_have_decl_ether_ntohost so we don't
+ # treat the previous failure as a cached value and
+ # suppress the next test.
+ #
+ unset ac_cv_have_decl_ether_ntohost
+ ac_fn_c_check_decl "$LINENO" "ether_ntohost" "ac_cv_have_decl_ether_ntohost" "
+#include <arpa/inet.h>
"
if test "x$ac_cv_have_decl_ether_ntohost" = xyes; then :
-$as_echo "#define NETINET_ETHER_H_DECLARES_ETHER_NTOHOST /**/" >>confdefs.h
+$as_echo "#define ARPA_INET_H_DECLARES_ETHER_NTOHOST /**/" >>confdefs.h
fi
- fi
fi
#
- # Is ether_ntohost() declared?
+ # Did that succeed?
#
if test "$ac_cv_have_decl_ether_ntohost" != yes; then
#
- # No, we'll have to declare it ourselves.
- # Do we have "struct ether_addr"?
+ # No, how about <netinet/if_ether.h>?
+ # On some platforms, it requires <net/if.h> and
+ # <netinet/in.h>, and we always include it with
+ # both of them, so test it with both of them.
#
- ac_fn_c_check_type "$LINENO" "struct ether_addr" "ac_cv_type_struct_ether_addr" "
+ # This test fails if we don't have <netinet/if_ether.h>
+ # and the headers we include before it, or if we do but
+ # <netinet/if_ether.h> doesn't declare ether_hostton().
+ #
+ # Unset ac_cv_have_decl_ether_ntohost so we don't
+ # treat the previous failure as a cached value and
+ # suppress the next test.
+ #
+ unset ac_cv_have_decl_ether_ntohost
+ ac_fn_c_check_decl "$LINENO" "ether_ntohost" "ac_cv_have_decl_ether_ntohost" "
#include <sys/types.h>
#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-struct mbuf;
-struct rtentry;
#include <net/if.h>
+#include <netinet/in.h>
#include <netinet/if_ether.h>
"
-if test "x$ac_cv_type_struct_ether_addr" = xyes; then :
+if test "x$ac_cv_have_decl_ether_ntohost" = xyes; then :
-cat >>confdefs.h <<_ACEOF
-#define HAVE_STRUCT_ETHER_ADDR 1
-_ACEOF
+
+$as_echo "#define NETINET_IF_ETHER_H_DECLARES_ETHER_NTOHOST /**/" >>confdefs.h
fi
+ fi
+ #
+ # After all that, is ether_ntohost() declared?
+ #
+ if test "$ac_cv_have_decl_ether_ntohost" = yes; then
+ #
+ # Yes.
+ #
-$as_echo "#define HAVE_DECL_ETHER_NTOHOST 0" >>confdefs.h
+$as_echo "#define HAVE_DECL_ETHER_NTOHOST 1" >>confdefs.h
else
+ #
+ # No, we'll have to declare it ourselves.
+ # Do we have "struct ether_addr" if we include
+ # <netinet/if_ether.h>?
+ #
+ ac_fn_c_check_type "$LINENO" "struct ether_addr" "ac_cv_type_struct_ether_addr" "
+ #include <sys/types.h>
+ #include <sys/socket.h>
+ #include <net/if.h>
+ #include <netinet/in.h>
+ #include <netinet/if_ether.h>
-$as_echo "#define HAVE_DECL_ETHER_NTOHOST 1" >>confdefs.h
+"
+if test "x$ac_cv_type_struct_ether_addr" = xyes; then :
- fi
-fi
+cat >>confdefs.h <<_ACEOF
+#define HAVE_STRUCT_ETHER_ADDR 1
+_ACEOF
-# libdlpi is needed for Solaris 11 and later.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlpi_walk in -ldlpi" >&5
-$as_echo_n "checking for dlpi_walk in -ldlpi... " >&6; }
-if ${ac_cv_lib_dlpi_dlpi_walk+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- ac_check_lib_save_LIBS=$LIBS
-LIBS="-ldlpi -L/lib $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-/* Override any GCC internal prototype to avoid an error.
- Use char because int might match the return type of a GCC
- builtin and then its argument prototype would still apply. */
-#ifdef __cplusplus
-extern "C"
-#endif
-char dlpi_walk ();
-int
-main ()
-{
-return dlpi_walk ();
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
- ac_cv_lib_dlpi_dlpi_walk=yes
-else
- ac_cv_lib_dlpi_dlpi_walk=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dlpi_dlpi_walk" >&5
-$as_echo "$ac_cv_lib_dlpi_dlpi_walk" >&6; }
-if test "x$ac_cv_lib_dlpi_dlpi_walk" = xyes; then :
- LIBS="$LIBS -ldlpi" LDFLAGS="-L/lib $LDFLAGS"
fi
+ fi
+fi
ac_fn_c_check_func "$LINENO" "pcap_list_datalinks" "ac_cv_func_pcap_list_datalinks"
if test "x$ac_cv_func_pcap_list_datalinks" = xyes; then :
@@ -5989,16 +6341,6 @@ esac
fi
-for ac_func in pcap_set_datalink
-do :
- ac_fn_c_check_func "$LINENO" "pcap_set_datalink" "ac_cv_func_pcap_set_datalink"
-if test "x$ac_cv_func_pcap_set_datalink" = xyes; then :
- cat >>confdefs.h <<_ACEOF
-#define HAVE_PCAP_SET_DATALINK 1
-_ACEOF
-
-fi
-done
ac_fn_c_check_func "$LINENO" "pcap_datalink_name_to_val" "ac_cv_func_pcap_datalink_name_to_val"
if test "x$ac_cv_func_pcap_datalink_name_to_val" = xyes; then :
@@ -6035,33 +6377,28 @@ esac
fi
-for ac_func in pcap_breakloop
+for ac_func in pcap_set_datalink
do :
- ac_fn_c_check_func "$LINENO" "pcap_breakloop" "ac_cv_func_pcap_breakloop"
-if test "x$ac_cv_func_pcap_breakloop" = xyes; then :
+ ac_fn_c_check_func "$LINENO" "pcap_set_datalink" "ac_cv_func_pcap_set_datalink"
+if test "x$ac_cv_func_pcap_set_datalink" = xyes; then :
cat >>confdefs.h <<_ACEOF
-#define HAVE_PCAP_BREAKLOOP 1
+#define HAVE_PCAP_SET_DATALINK 1
_ACEOF
fi
done
-ac_fn_c_check_func "$LINENO" "pcap_dump_ftell" "ac_cv_func_pcap_dump_ftell"
-if test "x$ac_cv_func_pcap_dump_ftell" = xyes; then :
-
-$as_echo "#define HAVE_PCAP_DUMP_FTELL 1" >>confdefs.h
-
-else
-
- case " $LIBOBJS " in
- *" pcap_dump_ftell.$ac_objext "* ) ;;
- *) LIBOBJS="$LIBOBJS pcap_dump_ftell.$ac_objext"
- ;;
-esac
-
+for ac_func in pcap_breakloop
+do :
+ ac_fn_c_check_func "$LINENO" "pcap_breakloop" "ac_cv_func_pcap_breakloop"
+if test "x$ac_cv_func_pcap_breakloop" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_PCAP_BREAKLOOP 1
+_ACEOF
fi
+done
#
@@ -6117,13 +6454,12 @@ fi
# Check for a miscellaneous collection of functions which we use
# if we have them.
#
-for ac_func in pcap_findalldevs pcap_dump_flush pcap_lib_version pcap_setdirection pcap_set_immediate_mode
+for ac_func in pcap_findalldevs
do :
- as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
-ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
-if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
+ ac_fn_c_check_func "$LINENO" "pcap_findalldevs" "ac_cv_func_pcap_findalldevs"
+if test "x$ac_cv_func_pcap_findalldevs" = xyes; then :
cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+#define HAVE_PCAP_FINDALLDEVS 1
_ACEOF
fi
@@ -6145,6 +6481,17 @@ fi
CPPFLAGS="$savedcppflags"
fi
+for ac_func in pcap_dump_flush pcap_lib_version
+do :
+ as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
+if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
if test $ac_cv_func_pcap_lib_version = "no" ; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether pcap_version is defined by libpcap" >&5
@@ -6182,6 +6529,44 @@ $as_echo "#define HAVE_PCAP_VERSION 1" >>confdefs.h
$as_echo "no" >&6; }
fi
fi
+for ac_func in pcap_setdirection pcap_set_immediate_mode pcap_dump_ftell64
+do :
+ as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
+if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+for ac_func in pcap_open pcap_findalldevs_ex
+do :
+ as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
+if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+ac_fn_c_check_func "$LINENO" "pcap_dump_ftell" "ac_cv_func_pcap_dump_ftell"
+if test "x$ac_cv_func_pcap_dump_ftell" = xyes; then :
+ $as_echo "#define HAVE_PCAP_DUMP_FTELL 1" >>confdefs.h
+
+else
+ case " $LIBOBJS " in
+ *" pcap_dump_ftell.$ac_objext "* ) ;;
+ *) LIBOBJS="$LIBOBJS pcap_dump_ftell.$ac_objext"
+ ;;
+esac
+
+fi
+
+
#
# Check for special debugging functions
@@ -6361,109 +6746,6 @@ if test -f /dev/bpf0 ; then
fi
#
-# Make sure we have definitions for all the C99 specified-width types
-# (regardless of whether the environment is a C99 environment or not).
-#
-ac_fn_c_find_intX_t "$LINENO" "8" "ac_cv_c_int8_t"
-case $ac_cv_c_int8_t in #(
- no|yes) ;; #(
- *)
-
-cat >>confdefs.h <<_ACEOF
-#define int8_t $ac_cv_c_int8_t
-_ACEOF
-;;
-esac
-
-ac_fn_c_find_intX_t "$LINENO" "16" "ac_cv_c_int16_t"
-case $ac_cv_c_int16_t in #(
- no|yes) ;; #(
- *)
-
-cat >>confdefs.h <<_ACEOF
-#define int16_t $ac_cv_c_int16_t
-_ACEOF
-;;
-esac
-
-ac_fn_c_find_intX_t "$LINENO" "32" "ac_cv_c_int32_t"
-case $ac_cv_c_int32_t in #(
- no|yes) ;; #(
- *)
-
-cat >>confdefs.h <<_ACEOF
-#define int32_t $ac_cv_c_int32_t
-_ACEOF
-;;
-esac
-
-ac_fn_c_find_intX_t "$LINENO" "64" "ac_cv_c_int64_t"
-case $ac_cv_c_int64_t in #(
- no|yes) ;; #(
- *)
-
-cat >>confdefs.h <<_ACEOF
-#define int64_t $ac_cv_c_int64_t
-_ACEOF
-;;
-esac
-
-ac_fn_c_find_uintX_t "$LINENO" "8" "ac_cv_c_uint8_t"
-case $ac_cv_c_uint8_t in #(
- no|yes) ;; #(
- *)
-
-$as_echo "#define _UINT8_T 1" >>confdefs.h
-
-
-cat >>confdefs.h <<_ACEOF
-#define uint8_t $ac_cv_c_uint8_t
-_ACEOF
-;;
- esac
-
-ac_fn_c_find_uintX_t "$LINENO" "16" "ac_cv_c_uint16_t"
-case $ac_cv_c_uint16_t in #(
- no|yes) ;; #(
- *)
-
-
-cat >>confdefs.h <<_ACEOF
-#define uint16_t $ac_cv_c_uint16_t
-_ACEOF
-;;
- esac
-
-ac_fn_c_find_uintX_t "$LINENO" "32" "ac_cv_c_uint32_t"
-case $ac_cv_c_uint32_t in #(
- no|yes) ;; #(
- *)
-
-$as_echo "#define _UINT32_T 1" >>confdefs.h
-
-
-cat >>confdefs.h <<_ACEOF
-#define uint32_t $ac_cv_c_uint32_t
-_ACEOF
-;;
- esac
-
-ac_fn_c_find_uintX_t "$LINENO" "64" "ac_cv_c_uint64_t"
-case $ac_cv_c_uint64_t in #(
- no|yes) ;; #(
- *)
-
-$as_echo "#define _UINT64_T 1" >>confdefs.h
-
-
-cat >>confdefs.h <<_ACEOF
-#define uint64_t $ac_cv_c_uint64_t
-_ACEOF
-;;
- esac
-
-
-#
# Make sure we have a definition for C99's uintptr_t (regardless of
# whether the environment is a C99 environment or not).
#
@@ -6506,6 +6788,26 @@ fi
#
+# Check whether we have pcap/pcap-inttypes.h.
+# If we do, we use that to get the C99 types defined.
+#
+savedcppflags="$CPPFLAGS"
+CPPFLAGS="$CPPFLAGS $V_INCLS"
+for ac_header in pcap/pcap-inttypes.h
+do :
+ ac_fn_c_check_header_mongrel "$LINENO" "pcap/pcap-inttypes.h" "ac_cv_header_pcap_pcap_inttypes_h" "$ac_includes_default"
+if test "x$ac_cv_header_pcap_pcap_inttypes_h" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_PCAP_PCAP_INTTYPES_H 1
+_ACEOF
+
+fi
+
+done
+
+CPPFLAGS="$savedcppflags"
+
+#
# Define the old BSD specified-width types in terms of the C99 types;
# we may need them with libpcap include files.
#
@@ -6558,370 +6860,6 @@ $as_echo "#define u_int64_t uint64_t" >>confdefs.h
fi
-#
-# Check for <inttypes.h>
-#
-for ac_header in inttypes.h
-do :
- ac_fn_c_check_header_mongrel "$LINENO" "inttypes.h" "ac_cv_header_inttypes_h" "$ac_includes_default"
-if test "x$ac_cv_header_inttypes_h" = xyes; then :
- cat >>confdefs.h <<_ACEOF
-#define HAVE_INTTYPES_H 1
-_ACEOF
-
- #
- # OK, we have inttypes.h, but does it define all the PRI[doxu]64 macros?
- # Some systems have an inttypes.h that doesn't define all of them.
- #
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether inttypes.h defines the PRI[doxu]64 macros" >&5
-$as_echo_n "checking whether inttypes.h defines the PRI[doxu]64 macros... " >&6; }
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-
- #include <inttypes.h>
- #include <stdio.h>
- #include <sys/types.h>
-
- main()
- {
- printf("%" PRId64 "\n", (uint64_t)1);
- printf("%" PRIo64 "\n", (uint64_t)1);
- printf("%" PRIx64 "\n", (uint64_t)1);
- printf("%" PRIu64 "\n", (uint64_t)1);
- }
-
-
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
- ac_lbl_inttypes_h_defines_formats=yes
-
-else
-
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
- ac_lbl_inttypes_h_defines_formats=no
-
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-
-else
-
- #
- # We don't have inttypes.h, so it obviously can't define those
- # macros.
- #
- ac_lbl_inttypes_h_defines_formats=no
-
-fi
-
-done
-
-if test "$ac_lbl_inttypes_h_defines_formats" = no; then
-
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether %lx can be used to format 64-bit integers" >&5
-$as_echo_n "checking whether %lx can be used to format 64-bit integers... " >&6; }
- if test "$cross_compiling" = yes; then :
- { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error $? "cannot run test program while cross compiling
-See \`config.log' for more details" "$LINENO" 5; }
-else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-
-# ifdef HAVE_INTTYPES_H
- #include <inttypes.h>
-# endif
- #include <stdio.h>
- #include <sys/types.h>
-
- main()
- {
- uint64_t t = 1;
- char strbuf[16+1];
- sprintf(strbuf, "%016lx", t << 32);
- if (strcmp(strbuf, "0000000100000000") == 0)
- exit(0);
- else
- exit(1);
- }
-
-
-_ACEOF
-if ac_fn_c_try_run "$LINENO"; then :
-
-
-$as_echo "#define PRId64 \"ld\"" >>confdefs.h
-
-
-$as_echo "#define PRIo64 \"lo\"" >>confdefs.h
-
-
-$as_echo "#define PRIx64 \"lx\"" >>confdefs.h
-
-
-$as_echo "#define PRIu64 \"lu\"" >>confdefs.h
-
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-
-else
-
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-
-
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether %llx can be used to format 64-bit integers" >&5
-$as_echo_n "checking whether %llx can be used to format 64-bit integers... " >&6; }
- if test "$cross_compiling" = yes; then :
- { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error $? "cannot run test program while cross compiling
-See \`config.log' for more details" "$LINENO" 5; }
-else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-
-# ifdef HAVE_INTTYPES_H
- #include <inttypes.h>
-# endif
- #include <stdio.h>
- #include <sys/types.h>
-
- main()
- {
- uint64_t t = 1;
- char strbuf[16+1];
- sprintf(strbuf, "%016llx", t << 32);
- if (strcmp(strbuf, "0000000100000000") == 0)
- exit(0);
- else
- exit(1);
- }
-
-
-_ACEOF
-if ac_fn_c_try_run "$LINENO"; then :
-
-
-$as_echo "#define PRId64 \"lld\"" >>confdefs.h
-
-
-$as_echo "#define PRIo64 \"llo\"" >>confdefs.h
-
-
-$as_echo "#define PRIx64 \"llx\"" >>confdefs.h
-
-
-$as_echo "#define PRIu64 \"llu\"" >>confdefs.h
-
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-
-else
-
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-
-
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether %Lx can be used to format 64-bit integers" >&5
-$as_echo_n "checking whether %Lx can be used to format 64-bit integers... " >&6; }
- if test "$cross_compiling" = yes; then :
- { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error $? "cannot run test program while cross compiling
-See \`config.log' for more details" "$LINENO" 5; }
-else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-
-# ifdef HAVE_INTTYPES_H
- #include <inttypes.h>
-# endif
- #include <stdio.h>
- #include <sys/types.h>
-
- main()
- {
- uint64_t t = 1;
- char strbuf[16+1];
- sprintf(strbuf, "%016Lx", t << 32);
- if (strcmp(strbuf, "0000000100000000") == 0)
- exit(0);
- else
- exit(1);
- }
-
-
-_ACEOF
-if ac_fn_c_try_run "$LINENO"; then :
-
-
-$as_echo "#define PRId64 \"Ld\"" >>confdefs.h
-
-
-$as_echo "#define PRIo64 \"Lo\"" >>confdefs.h
-
-
-$as_echo "#define PRIx64 \"Lx\"" >>confdefs.h
-
-
-$as_echo "#define PRIu64 \"Lu\"" >>confdefs.h
-
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-
-else
-
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-
-
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether %qx can be used to format 64-bit integers" >&5
-$as_echo_n "checking whether %qx can be used to format 64-bit integers... " >&6; }
- if test "$cross_compiling" = yes; then :
- { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error $? "cannot run test program while cross compiling
-See \`config.log' for more details" "$LINENO" 5; }
-else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-
-# ifdef HAVE_INTTYPES_H
- #include <inttypes.h>
-# endif
- #include <stdio.h>
- #include <sys/types.h>
-
- main()
- {
- uint64_t t = 1;
- char strbuf[16+1];
- sprintf(strbuf, "%016qx", t << 32);
- if (strcmp(strbuf, "0000000100000000") == 0)
- exit(0);
- else
- exit(1);
- }
-
-
-_ACEOF
-if ac_fn_c_try_run "$LINENO"; then :
-
-
-$as_echo "#define PRId64 \"qd\"" >>confdefs.h
-
-
-$as_echo "#define PRIo64 \"qo\"" >>confdefs.h
-
-
-$as_echo "#define PRIx64 \"qx\"" >>confdefs.h
-
-
-$as_echo "#define PRIu64 \"qu\"" >>confdefs.h
-
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-
-else
-
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-
- as_fn_error $? "neither %llx nor %Lx nor %qx worked on a 64-bit integer" "$LINENO" 5
-
-
-fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
- conftest.$ac_objext conftest.beam conftest.$ac_ext
-fi
-
-
-
-
-fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
- conftest.$ac_objext conftest.beam conftest.$ac_ext
-fi
-
-
-
-
-fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
- conftest.$ac_objext conftest.beam conftest.$ac_ext
-fi
-
-
-
-
-fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
- conftest.$ac_objext conftest.beam conftest.$ac_ext
-fi
-
-
-fi
-
-#
-# Check for some headers introduced in later versions of libpcap
-# and used by some printers.
-#
-# Those headers use the {u_}intN_t types, so we must do this after
-# we check for what's needed to get them defined.
-#
-savedcppflags="$CPPFLAGS"
-CPPFLAGS="$CPPFLAGS $V_INCLS"
-for ac_header in pcap/bluetooth.h
-do :
- ac_fn_c_check_header_compile "$LINENO" "pcap/bluetooth.h" "ac_cv_header_pcap_bluetooth_h" "#include \"netdissect-stdinc.h\"
-"
-if test "x$ac_cv_header_pcap_bluetooth_h" = xyes; then :
- cat >>confdefs.h <<_ACEOF
-#define HAVE_PCAP_BLUETOOTH_H 1
-_ACEOF
-
-fi
-
-done
-
-for ac_header in pcap/nflog.h
-do :
- ac_fn_c_check_header_compile "$LINENO" "pcap/nflog.h" "ac_cv_header_pcap_nflog_h" "#include \"netdissect-stdinc.h\"
-"
-if test "x$ac_cv_header_pcap_nflog_h" = xyes; then :
- cat >>confdefs.h <<_ACEOF
-#define HAVE_PCAP_NFLOG_H 1
-_ACEOF
-
-fi
-
-done
-
-for ac_header in pcap/usb.h
-do :
- ac_fn_c_check_header_compile "$LINENO" "pcap/usb.h" "ac_cv_header_pcap_usb_h" "#include \"netdissect-stdinc.h\"
-"
-if test "x$ac_cv_header_pcap_usb_h" = xyes; then :
- cat >>confdefs.h <<_ACEOF
-#define HAVE_PCAP_USB_H 1
-_ACEOF
-
-fi
-
-done
-
-CPPFLAGS="$savedcppflags"
-
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
set dummy ${ac_tool_prefix}ranlib; ac_word=$2
@@ -7117,74 +7055,202 @@ rm -f os-proto.h
#
if test "$ac_lbl_cc_dont_try_gcc_dashW" != yes; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler fails when given an unknown warning option" >&5
-$as_echo_n "checking whether the compiler fails when given an unknown warning option... " >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports the -W option" >&5
+$as_echo_n "checking whether the compiler supports the -W option... " >&6; }
save_CFLAGS="$CFLAGS"
- CFLAGS="$CFLAGS -Wxyzzy-this-will-never-succeed-xyzzy"
+ CFLAGS="$CFLAGS -W"
+ #
+ # XXX - yes, this depends on the way AC_LANG_WERROR works,
+ # but no mechanism is provided to turn AC_LANG_WERROR on
+ # *and then turn it back off*, so that we *only* do it when
+ # testing compiler options - 15 years after somebody asked
+ # for it:
+ #
+ # https://autoconf.gnu.narkive.com/gTAVmfKD/how-to-cancel-flags-set-by-ac-lang-werror
+ #
+ save_ac_c_werror_flag="$ac_c_werror_flag"
+ ac_c_werror_flag=yes
+ #
+ # We use AC_LANG_SOURCE() so that we can control the complete
+ # content of the program being compiled. We do not, for example,
+ # want the default "int main()" that AC_LANG_PROGRAM() generates,
+ # as it will generate a warning with -Wold-style-definition, meaning
+ # that we would treat it as not working, as the test will fail if
+ # *any* error output, including a warning due to the flag we're
+ # testing, is generated; see
+ #
+ # https://www.postgresql.org/message-id/2192993.1591682589%40sss.pgh.pa.us
+ # https://www.postgresql.org/message-id/2192993.1591682589%40sss.pgh.pa.us
+ #
+ # This may, as per those two messages, be fixed in autoconf 2.70,
+ # but we only require 2.64 or newer for now.
+ #
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
-
-int
-main ()
-{
-return 0
- ;
- return 0;
-}
+int main(void) { return 0; }
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+ CFLAGS="$save_CFLAGS"
+ V_CCOPT="$V_CCOPT -W"
+
+else
+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
- #
- # We're assuming this is clang, where
- # -Werror=unknown-warning-option is the appropriate
- # option to force the compiler to fail.
- #
- ac_lbl_unknown_warning_option_error="-Werror=unknown-warning-option"
+ CFLAGS="$save_CFLAGS"
-else
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ ac_c_werror_flag="$save_ac_c_werror_flag"
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports the -Wall option" >&5
+$as_echo_n "checking whether the compiler supports the -Wall option... " >&6; }
+ save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -Wall"
+ #
+ # XXX - yes, this depends on the way AC_LANG_WERROR works,
+ # but no mechanism is provided to turn AC_LANG_WERROR on
+ # *and then turn it back off*, so that we *only* do it when
+ # testing compiler options - 15 years after somebody asked
+ # for it:
+ #
+ # https://autoconf.gnu.narkive.com/gTAVmfKD/how-to-cancel-flags-set-by-ac-lang-werror
+ #
+ save_ac_c_werror_flag="$ac_c_werror_flag"
+ ac_c_werror_flag=yes
+ #
+ # We use AC_LANG_SOURCE() so that we can control the complete
+ # content of the program being compiled. We do not, for example,
+ # want the default "int main()" that AC_LANG_PROGRAM() generates,
+ # as it will generate a warning with -Wold-style-definition, meaning
+ # that we would treat it as not working, as the test will fail if
+ # *any* error output, including a warning due to the flag we're
+ # testing, is generated; see
+ #
+ # https://www.postgresql.org/message-id/2192993.1591682589%40sss.pgh.pa.us
+ # https://www.postgresql.org/message-id/2192993.1591682589%40sss.pgh.pa.us
+ #
+ # This may, as per those two messages, be fixed in autoconf 2.70,
+ # but we only require 2.64 or newer for now.
+ #
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+int main(void) { return 0; }
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
+ CFLAGS="$save_CFLAGS"
+ V_CCOPT="$V_CCOPT -Wall"
+
+else
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ CFLAGS="$save_CFLAGS"
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
- CFLAGS="$save_CFLAGS"
+ ac_c_werror_flag="$save_ac_c_werror_flag"
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports the -Wall option" >&5
-$as_echo_n "checking whether the compiler supports the -Wall option... " >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports the -Wassign-enum option" >&5
+$as_echo_n "checking whether the compiler supports the -Wassign-enum option... " >&6; }
save_CFLAGS="$CFLAGS"
- if expr "x-Wall" : "x-W.*" >/dev/null
- then
- CFLAGS="$CFLAGS $ac_lbl_unknown_warning_option_error -Wall"
- elif expr "x-Wall" : "x-f.*" >/dev/null
- then
- CFLAGS="$CFLAGS -Werror -Wall"
- elif expr "x-Wall" : "x-m.*" >/dev/null
- then
- CFLAGS="$CFLAGS -Werror -Wall"
- else
- CFLAGS="$CFLAGS -Wall"
- fi
+ CFLAGS="$CFLAGS -Wassign-enum"
+ #
+ # XXX - yes, this depends on the way AC_LANG_WERROR works,
+ # but no mechanism is provided to turn AC_LANG_WERROR on
+ # *and then turn it back off*, so that we *only* do it when
+ # testing compiler options - 15 years after somebody asked
+ # for it:
+ #
+ # https://autoconf.gnu.narkive.com/gTAVmfKD/how-to-cancel-flags-set-by-ac-lang-werror
+ #
+ save_ac_c_werror_flag="$ac_c_werror_flag"
+ ac_c_werror_flag=yes
+ #
+ # We use AC_LANG_SOURCE() so that we can control the complete
+ # content of the program being compiled. We do not, for example,
+ # want the default "int main()" that AC_LANG_PROGRAM() generates,
+ # as it will generate a warning with -Wold-style-definition, meaning
+ # that we would treat it as not working, as the test will fail if
+ # *any* error output, including a warning due to the flag we're
+ # testing, is generated; see
+ #
+ # https://www.postgresql.org/message-id/2192993.1591682589%40sss.pgh.pa.us
+ # https://www.postgresql.org/message-id/2192993.1591682589%40sss.pgh.pa.us
+ #
+ # This may, as per those two messages, be fixed in autoconf 2.70,
+ # but we only require 2.64 or newer for now.
+ #
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
+int main(void) { return 0; }
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
-int
-main ()
-{
-return 0
- ;
- return 0;
-}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+ CFLAGS="$save_CFLAGS"
+ V_CCOPT="$V_CCOPT -Wassign-enum"
+
+else
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ CFLAGS="$save_CFLAGS"
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ ac_c_werror_flag="$save_ac_c_werror_flag"
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports the -Wcast-qual option" >&5
+$as_echo_n "checking whether the compiler supports the -Wcast-qual option... " >&6; }
+ save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -Wcast-qual"
+ #
+ # XXX - yes, this depends on the way AC_LANG_WERROR works,
+ # but no mechanism is provided to turn AC_LANG_WERROR on
+ # *and then turn it back off*, so that we *only* do it when
+ # testing compiler options - 15 years after somebody asked
+ # for it:
+ #
+ # https://autoconf.gnu.narkive.com/gTAVmfKD/how-to-cancel-flags-set-by-ac-lang-werror
+ #
+ save_ac_c_werror_flag="$ac_c_werror_flag"
+ ac_c_werror_flag=yes
+ #
+ # We use AC_LANG_SOURCE() so that we can control the complete
+ # content of the program being compiled. We do not, for example,
+ # want the default "int main()" that AC_LANG_PROGRAM() generates,
+ # as it will generate a warning with -Wold-style-definition, meaning
+ # that we would treat it as not working, as the test will fail if
+ # *any* error output, including a warning due to the flag we're
+ # testing, is generated; see
+ #
+ # https://www.postgresql.org/message-id/2192993.1591682589%40sss.pgh.pa.us
+ # https://www.postgresql.org/message-id/2192993.1591682589%40sss.pgh.pa.us
+ #
+ # This may, as per those two messages, be fixed in autoconf 2.70,
+ # but we only require 2.64 or newer for now.
+ #
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+int main(void) { return 0; }
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
CFLAGS="$save_CFLAGS"
- V_CCOPT="$V_CCOPT -Wall"
+ V_CCOPT="$V_CCOPT -Wcast-qual"
else
@@ -7194,33 +7260,42 @@ $as_echo "no" >&6; }
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ ac_c_werror_flag="$save_ac_c_werror_flag"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports the -Wmissing-prototypes option" >&5
$as_echo_n "checking whether the compiler supports the -Wmissing-prototypes option... " >&6; }
save_CFLAGS="$CFLAGS"
- if expr "x-Wmissing-prototypes" : "x-W.*" >/dev/null
- then
- CFLAGS="$CFLAGS $ac_lbl_unknown_warning_option_error -Wmissing-prototypes"
- elif expr "x-Wmissing-prototypes" : "x-f.*" >/dev/null
- then
- CFLAGS="$CFLAGS -Werror -Wmissing-prototypes"
- elif expr "x-Wmissing-prototypes" : "x-m.*" >/dev/null
- then
- CFLAGS="$CFLAGS -Werror -Wmissing-prototypes"
- else
- CFLAGS="$CFLAGS -Wmissing-prototypes"
- fi
+ CFLAGS="$CFLAGS -Wmissing-prototypes"
+ #
+ # XXX - yes, this depends on the way AC_LANG_WERROR works,
+ # but no mechanism is provided to turn AC_LANG_WERROR on
+ # *and then turn it back off*, so that we *only* do it when
+ # testing compiler options - 15 years after somebody asked
+ # for it:
+ #
+ # https://autoconf.gnu.narkive.com/gTAVmfKD/how-to-cancel-flags-set-by-ac-lang-werror
+ #
+ save_ac_c_werror_flag="$ac_c_werror_flag"
+ ac_c_werror_flag=yes
+ #
+ # We use AC_LANG_SOURCE() so that we can control the complete
+ # content of the program being compiled. We do not, for example,
+ # want the default "int main()" that AC_LANG_PROGRAM() generates,
+ # as it will generate a warning with -Wold-style-definition, meaning
+ # that we would treat it as not working, as the test will fail if
+ # *any* error output, including a warning due to the flag we're
+ # testing, is generated; see
+ #
+ # https://www.postgresql.org/message-id/2192993.1591682589%40sss.pgh.pa.us
+ # https://www.postgresql.org/message-id/2192993.1591682589%40sss.pgh.pa.us
+ #
+ # This may, as per those two messages, be fixed in autoconf 2.70,
+ # but we only require 2.64 or newer for now.
+ #
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
-
-int
-main ()
-{
-return 0
- ;
- return 0;
-}
+int main(void) { return 0; }
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
@@ -7237,40 +7312,49 @@ $as_echo "no" >&6; }
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ ac_c_werror_flag="$save_ac_c_werror_flag"
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports the -Wstrict-prototypes option" >&5
-$as_echo_n "checking whether the compiler supports the -Wstrict-prototypes option... " >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports the -Wmissing-variable-declarations option" >&5
+$as_echo_n "checking whether the compiler supports the -Wmissing-variable-declarations option... " >&6; }
save_CFLAGS="$CFLAGS"
- if expr "x-Wstrict-prototypes" : "x-W.*" >/dev/null
- then
- CFLAGS="$CFLAGS $ac_lbl_unknown_warning_option_error -Wstrict-prototypes"
- elif expr "x-Wstrict-prototypes" : "x-f.*" >/dev/null
- then
- CFLAGS="$CFLAGS -Werror -Wstrict-prototypes"
- elif expr "x-Wstrict-prototypes" : "x-m.*" >/dev/null
- then
- CFLAGS="$CFLAGS -Werror -Wstrict-prototypes"
- else
- CFLAGS="$CFLAGS -Wstrict-prototypes"
- fi
+ CFLAGS="$CFLAGS -Wmissing-variable-declarations"
+ #
+ # XXX - yes, this depends on the way AC_LANG_WERROR works,
+ # but no mechanism is provided to turn AC_LANG_WERROR on
+ # *and then turn it back off*, so that we *only* do it when
+ # testing compiler options - 15 years after somebody asked
+ # for it:
+ #
+ # https://autoconf.gnu.narkive.com/gTAVmfKD/how-to-cancel-flags-set-by-ac-lang-werror
+ #
+ save_ac_c_werror_flag="$ac_c_werror_flag"
+ ac_c_werror_flag=yes
+ #
+ # We use AC_LANG_SOURCE() so that we can control the complete
+ # content of the program being compiled. We do not, for example,
+ # want the default "int main()" that AC_LANG_PROGRAM() generates,
+ # as it will generate a warning with -Wold-style-definition, meaning
+ # that we would treat it as not working, as the test will fail if
+ # *any* error output, including a warning due to the flag we're
+ # testing, is generated; see
+ #
+ # https://www.postgresql.org/message-id/2192993.1591682589%40sss.pgh.pa.us
+ # https://www.postgresql.org/message-id/2192993.1591682589%40sss.pgh.pa.us
+ #
+ # This may, as per those two messages, be fixed in autoconf 2.70,
+ # but we only require 2.64 or newer for now.
+ #
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
-
-int
-main ()
-{
-return 0
- ;
- return 0;
-}
+int main(void) { return 0; }
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
CFLAGS="$save_CFLAGS"
- V_CCOPT="$V_CCOPT -Wstrict-prototypes"
+ V_CCOPT="$V_CCOPT -Wmissing-variable-declarations"
else
@@ -7280,40 +7364,101 @@ $as_echo "no" >&6; }
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ ac_c_werror_flag="$save_ac_c_werror_flag"
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports the -Wwrite-strings option" >&5
-$as_echo_n "checking whether the compiler supports the -Wwrite-strings option... " >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports the -Wold-style-definition option" >&5
+$as_echo_n "checking whether the compiler supports the -Wold-style-definition option... " >&6; }
save_CFLAGS="$CFLAGS"
- if expr "x-Wwrite-strings" : "x-W.*" >/dev/null
- then
- CFLAGS="$CFLAGS $ac_lbl_unknown_warning_option_error -Wwrite-strings"
- elif expr "x-Wwrite-strings" : "x-f.*" >/dev/null
- then
- CFLAGS="$CFLAGS -Werror -Wwrite-strings"
- elif expr "x-Wwrite-strings" : "x-m.*" >/dev/null
- then
- CFLAGS="$CFLAGS -Werror -Wwrite-strings"
- else
- CFLAGS="$CFLAGS -Wwrite-strings"
- fi
+ CFLAGS="$CFLAGS -Wold-style-definition"
+ #
+ # XXX - yes, this depends on the way AC_LANG_WERROR works,
+ # but no mechanism is provided to turn AC_LANG_WERROR on
+ # *and then turn it back off*, so that we *only* do it when
+ # testing compiler options - 15 years after somebody asked
+ # for it:
+ #
+ # https://autoconf.gnu.narkive.com/gTAVmfKD/how-to-cancel-flags-set-by-ac-lang-werror
+ #
+ save_ac_c_werror_flag="$ac_c_werror_flag"
+ ac_c_werror_flag=yes
+ #
+ # We use AC_LANG_SOURCE() so that we can control the complete
+ # content of the program being compiled. We do not, for example,
+ # want the default "int main()" that AC_LANG_PROGRAM() generates,
+ # as it will generate a warning with -Wold-style-definition, meaning
+ # that we would treat it as not working, as the test will fail if
+ # *any* error output, including a warning due to the flag we're
+ # testing, is generated; see
+ #
+ # https://www.postgresql.org/message-id/2192993.1591682589%40sss.pgh.pa.us
+ # https://www.postgresql.org/message-id/2192993.1591682589%40sss.pgh.pa.us
+ #
+ # This may, as per those two messages, be fixed in autoconf 2.70,
+ # but we only require 2.64 or newer for now.
+ #
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
+int main(void) { return 0; }
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
-int
-main ()
-{
-return 0
- ;
- return 0;
-}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+ CFLAGS="$save_CFLAGS"
+ V_CCOPT="$V_CCOPT -Wold-style-definition"
+
+else
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ CFLAGS="$save_CFLAGS"
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ ac_c_werror_flag="$save_ac_c_werror_flag"
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports the -Wpedantic option" >&5
+$as_echo_n "checking whether the compiler supports the -Wpedantic option... " >&6; }
+ save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -Wpedantic"
+ #
+ # XXX - yes, this depends on the way AC_LANG_WERROR works,
+ # but no mechanism is provided to turn AC_LANG_WERROR on
+ # *and then turn it back off*, so that we *only* do it when
+ # testing compiler options - 15 years after somebody asked
+ # for it:
+ #
+ # https://autoconf.gnu.narkive.com/gTAVmfKD/how-to-cancel-flags-set-by-ac-lang-werror
+ #
+ save_ac_c_werror_flag="$ac_c_werror_flag"
+ ac_c_werror_flag=yes
+ #
+ # We use AC_LANG_SOURCE() so that we can control the complete
+ # content of the program being compiled. We do not, for example,
+ # want the default "int main()" that AC_LANG_PROGRAM() generates,
+ # as it will generate a warning with -Wold-style-definition, meaning
+ # that we would treat it as not working, as the test will fail if
+ # *any* error output, including a warning due to the flag we're
+ # testing, is generated; see
+ #
+ # https://www.postgresql.org/message-id/2192993.1591682589%40sss.pgh.pa.us
+ # https://www.postgresql.org/message-id/2192993.1591682589%40sss.pgh.pa.us
+ #
+ # This may, as per those two messages, be fixed in autoconf 2.70,
+ # but we only require 2.64 or newer for now.
+ #
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+int main(void) { return 0; }
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
CFLAGS="$save_CFLAGS"
- V_CCOPT="$V_CCOPT -Wwrite-strings"
+ V_CCOPT="$V_CCOPT -Wpedantic"
else
@@ -7323,33 +7468,42 @@ $as_echo "no" >&6; }
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ ac_c_werror_flag="$save_ac_c_werror_flag"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports the -Wpointer-arith option" >&5
$as_echo_n "checking whether the compiler supports the -Wpointer-arith option... " >&6; }
save_CFLAGS="$CFLAGS"
- if expr "x-Wpointer-arith" : "x-W.*" >/dev/null
- then
- CFLAGS="$CFLAGS $ac_lbl_unknown_warning_option_error -Wpointer-arith"
- elif expr "x-Wpointer-arith" : "x-f.*" >/dev/null
- then
- CFLAGS="$CFLAGS -Werror -Wpointer-arith"
- elif expr "x-Wpointer-arith" : "x-m.*" >/dev/null
- then
- CFLAGS="$CFLAGS -Werror -Wpointer-arith"
- else
- CFLAGS="$CFLAGS -Wpointer-arith"
- fi
+ CFLAGS="$CFLAGS -Wpointer-arith"
+ #
+ # XXX - yes, this depends on the way AC_LANG_WERROR works,
+ # but no mechanism is provided to turn AC_LANG_WERROR on
+ # *and then turn it back off*, so that we *only* do it when
+ # testing compiler options - 15 years after somebody asked
+ # for it:
+ #
+ # https://autoconf.gnu.narkive.com/gTAVmfKD/how-to-cancel-flags-set-by-ac-lang-werror
+ #
+ save_ac_c_werror_flag="$ac_c_werror_flag"
+ ac_c_werror_flag=yes
+ #
+ # We use AC_LANG_SOURCE() so that we can control the complete
+ # content of the program being compiled. We do not, for example,
+ # want the default "int main()" that AC_LANG_PROGRAM() generates,
+ # as it will generate a warning with -Wold-style-definition, meaning
+ # that we would treat it as not working, as the test will fail if
+ # *any* error output, including a warning due to the flag we're
+ # testing, is generated; see
+ #
+ # https://www.postgresql.org/message-id/2192993.1591682589%40sss.pgh.pa.us
+ # https://www.postgresql.org/message-id/2192993.1591682589%40sss.pgh.pa.us
+ #
+ # This may, as per those two messages, be fixed in autoconf 2.70,
+ # but we only require 2.64 or newer for now.
+ #
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
-
-int
-main ()
-{
-return 0
- ;
- return 0;
-}
+int main(void) { return 0; }
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
@@ -7366,40 +7520,49 @@ $as_echo "no" >&6; }
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ ac_c_werror_flag="$save_ac_c_werror_flag"
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports the -Wcast-qual option" >&5
-$as_echo_n "checking whether the compiler supports the -Wcast-qual option... " >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports the -Wpointer-sign option" >&5
+$as_echo_n "checking whether the compiler supports the -Wpointer-sign option... " >&6; }
save_CFLAGS="$CFLAGS"
- if expr "x-Wcast-qual" : "x-W.*" >/dev/null
- then
- CFLAGS="$CFLAGS $ac_lbl_unknown_warning_option_error -Wcast-qual"
- elif expr "x-Wcast-qual" : "x-f.*" >/dev/null
- then
- CFLAGS="$CFLAGS -Werror -Wcast-qual"
- elif expr "x-Wcast-qual" : "x-m.*" >/dev/null
- then
- CFLAGS="$CFLAGS -Werror -Wcast-qual"
- else
- CFLAGS="$CFLAGS -Wcast-qual"
- fi
+ CFLAGS="$CFLAGS -Wpointer-sign"
+ #
+ # XXX - yes, this depends on the way AC_LANG_WERROR works,
+ # but no mechanism is provided to turn AC_LANG_WERROR on
+ # *and then turn it back off*, so that we *only* do it when
+ # testing compiler options - 15 years after somebody asked
+ # for it:
+ #
+ # https://autoconf.gnu.narkive.com/gTAVmfKD/how-to-cancel-flags-set-by-ac-lang-werror
+ #
+ save_ac_c_werror_flag="$ac_c_werror_flag"
+ ac_c_werror_flag=yes
+ #
+ # We use AC_LANG_SOURCE() so that we can control the complete
+ # content of the program being compiled. We do not, for example,
+ # want the default "int main()" that AC_LANG_PROGRAM() generates,
+ # as it will generate a warning with -Wold-style-definition, meaning
+ # that we would treat it as not working, as the test will fail if
+ # *any* error output, including a warning due to the flag we're
+ # testing, is generated; see
+ #
+ # https://www.postgresql.org/message-id/2192993.1591682589%40sss.pgh.pa.us
+ # https://www.postgresql.org/message-id/2192993.1591682589%40sss.pgh.pa.us
+ #
+ # This may, as per those two messages, be fixed in autoconf 2.70,
+ # but we only require 2.64 or newer for now.
+ #
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
-
-int
-main ()
-{
-return 0
- ;
- return 0;
-}
+int main(void) { return 0; }
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
CFLAGS="$save_CFLAGS"
- V_CCOPT="$V_CCOPT -Wcast-qual"
+ V_CCOPT="$V_CCOPT -Wpointer-sign"
else
@@ -7409,33 +7572,42 @@ $as_echo "no" >&6; }
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ ac_c_werror_flag="$save_ac_c_werror_flag"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports the -Wshadow option" >&5
$as_echo_n "checking whether the compiler supports the -Wshadow option... " >&6; }
save_CFLAGS="$CFLAGS"
- if expr "x-Wshadow" : "x-W.*" >/dev/null
- then
- CFLAGS="$CFLAGS $ac_lbl_unknown_warning_option_error -Wshadow"
- elif expr "x-Wshadow" : "x-f.*" >/dev/null
- then
- CFLAGS="$CFLAGS -Werror -Wshadow"
- elif expr "x-Wshadow" : "x-m.*" >/dev/null
- then
- CFLAGS="$CFLAGS -Werror -Wshadow"
- else
- CFLAGS="$CFLAGS -Wshadow"
- fi
+ CFLAGS="$CFLAGS -Wshadow"
+ #
+ # XXX - yes, this depends on the way AC_LANG_WERROR works,
+ # but no mechanism is provided to turn AC_LANG_WERROR on
+ # *and then turn it back off*, so that we *only* do it when
+ # testing compiler options - 15 years after somebody asked
+ # for it:
+ #
+ # https://autoconf.gnu.narkive.com/gTAVmfKD/how-to-cancel-flags-set-by-ac-lang-werror
+ #
+ save_ac_c_werror_flag="$ac_c_werror_flag"
+ ac_c_werror_flag=yes
+ #
+ # We use AC_LANG_SOURCE() so that we can control the complete
+ # content of the program being compiled. We do not, for example,
+ # want the default "int main()" that AC_LANG_PROGRAM() generates,
+ # as it will generate a warning with -Wold-style-definition, meaning
+ # that we would treat it as not working, as the test will fail if
+ # *any* error output, including a warning due to the flag we're
+ # testing, is generated; see
+ #
+ # https://www.postgresql.org/message-id/2192993.1591682589%40sss.pgh.pa.us
+ # https://www.postgresql.org/message-id/2192993.1591682589%40sss.pgh.pa.us
+ #
+ # This may, as per those two messages, be fixed in autoconf 2.70,
+ # but we only require 2.64 or newer for now.
+ #
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
-
-int
-main ()
-{
-return 0
- ;
- return 0;
-}
+int main(void) { return 0; }
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
@@ -7452,40 +7624,49 @@ $as_echo "no" >&6; }
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ ac_c_werror_flag="$save_ac_c_werror_flag"
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports the -Wdeclaration-after-statement option" >&5
-$as_echo_n "checking whether the compiler supports the -Wdeclaration-after-statement option... " >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports the -Wsign-compare option" >&5
+$as_echo_n "checking whether the compiler supports the -Wsign-compare option... " >&6; }
save_CFLAGS="$CFLAGS"
- if expr "x-Wdeclaration-after-statement" : "x-W.*" >/dev/null
- then
- CFLAGS="$CFLAGS $ac_lbl_unknown_warning_option_error -Wdeclaration-after-statement"
- elif expr "x-Wdeclaration-after-statement" : "x-f.*" >/dev/null
- then
- CFLAGS="$CFLAGS -Werror -Wdeclaration-after-statement"
- elif expr "x-Wdeclaration-after-statement" : "x-m.*" >/dev/null
- then
- CFLAGS="$CFLAGS -Werror -Wdeclaration-after-statement"
- else
- CFLAGS="$CFLAGS -Wdeclaration-after-statement"
- fi
+ CFLAGS="$CFLAGS -Wsign-compare"
+ #
+ # XXX - yes, this depends on the way AC_LANG_WERROR works,
+ # but no mechanism is provided to turn AC_LANG_WERROR on
+ # *and then turn it back off*, so that we *only* do it when
+ # testing compiler options - 15 years after somebody asked
+ # for it:
+ #
+ # https://autoconf.gnu.narkive.com/gTAVmfKD/how-to-cancel-flags-set-by-ac-lang-werror
+ #
+ save_ac_c_werror_flag="$ac_c_werror_flag"
+ ac_c_werror_flag=yes
+ #
+ # We use AC_LANG_SOURCE() so that we can control the complete
+ # content of the program being compiled. We do not, for example,
+ # want the default "int main()" that AC_LANG_PROGRAM() generates,
+ # as it will generate a warning with -Wold-style-definition, meaning
+ # that we would treat it as not working, as the test will fail if
+ # *any* error output, including a warning due to the flag we're
+ # testing, is generated; see
+ #
+ # https://www.postgresql.org/message-id/2192993.1591682589%40sss.pgh.pa.us
+ # https://www.postgresql.org/message-id/2192993.1591682589%40sss.pgh.pa.us
+ #
+ # This may, as per those two messages, be fixed in autoconf 2.70,
+ # but we only require 2.64 or newer for now.
+ #
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
-
-int
-main ()
-{
-return 0
- ;
- return 0;
-}
+int main(void) { return 0; }
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
CFLAGS="$save_CFLAGS"
- V_CCOPT="$V_CCOPT -Wdeclaration-after-statement"
+ V_CCOPT="$V_CCOPT -Wsign-compare"
else
@@ -7495,40 +7676,49 @@ $as_echo "no" >&6; }
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ ac_c_werror_flag="$save_ac_c_werror_flag"
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports the -Wpedantic option" >&5
-$as_echo_n "checking whether the compiler supports the -Wpedantic option... " >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports the -Wstrict-prototypes option" >&5
+$as_echo_n "checking whether the compiler supports the -Wstrict-prototypes option... " >&6; }
save_CFLAGS="$CFLAGS"
- if expr "x-Wpedantic" : "x-W.*" >/dev/null
- then
- CFLAGS="$CFLAGS $ac_lbl_unknown_warning_option_error -Wpedantic"
- elif expr "x-Wpedantic" : "x-f.*" >/dev/null
- then
- CFLAGS="$CFLAGS -Werror -Wpedantic"
- elif expr "x-Wpedantic" : "x-m.*" >/dev/null
- then
- CFLAGS="$CFLAGS -Werror -Wpedantic"
- else
- CFLAGS="$CFLAGS -Wpedantic"
- fi
+ CFLAGS="$CFLAGS -Wstrict-prototypes"
+ #
+ # XXX - yes, this depends on the way AC_LANG_WERROR works,
+ # but no mechanism is provided to turn AC_LANG_WERROR on
+ # *and then turn it back off*, so that we *only* do it when
+ # testing compiler options - 15 years after somebody asked
+ # for it:
+ #
+ # https://autoconf.gnu.narkive.com/gTAVmfKD/how-to-cancel-flags-set-by-ac-lang-werror
+ #
+ save_ac_c_werror_flag="$ac_c_werror_flag"
+ ac_c_werror_flag=yes
+ #
+ # We use AC_LANG_SOURCE() so that we can control the complete
+ # content of the program being compiled. We do not, for example,
+ # want the default "int main()" that AC_LANG_PROGRAM() generates,
+ # as it will generate a warning with -Wold-style-definition, meaning
+ # that we would treat it as not working, as the test will fail if
+ # *any* error output, including a warning due to the flag we're
+ # testing, is generated; see
+ #
+ # https://www.postgresql.org/message-id/2192993.1591682589%40sss.pgh.pa.us
+ # https://www.postgresql.org/message-id/2192993.1591682589%40sss.pgh.pa.us
+ #
+ # This may, as per those two messages, be fixed in autoconf 2.70,
+ # but we only require 2.64 or newer for now.
+ #
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
-
-int
-main ()
-{
-return 0
- ;
- return 0;
-}
+int main(void) { return 0; }
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
CFLAGS="$save_CFLAGS"
- V_CCOPT="$V_CCOPT -Wpedantic"
+ V_CCOPT="$V_CCOPT -Wstrict-prototypes"
else
@@ -7538,40 +7728,49 @@ $as_echo "no" >&6; }
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ ac_c_werror_flag="$save_ac_c_werror_flag"
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports the -Wold-style-definition option" >&5
-$as_echo_n "checking whether the compiler supports the -Wold-style-definition option... " >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports the -Wunreachable-code-return option" >&5
+$as_echo_n "checking whether the compiler supports the -Wunreachable-code-return option... " >&6; }
save_CFLAGS="$CFLAGS"
- if expr "x-Wold-style-definition" : "x-W.*" >/dev/null
- then
- CFLAGS="$CFLAGS $ac_lbl_unknown_warning_option_error -Wold-style-definition"
- elif expr "x-Wold-style-definition" : "x-f.*" >/dev/null
- then
- CFLAGS="$CFLAGS -Werror -Wold-style-definition"
- elif expr "x-Wold-style-definition" : "x-m.*" >/dev/null
- then
- CFLAGS="$CFLAGS -Werror -Wold-style-definition"
- else
- CFLAGS="$CFLAGS -Wold-style-definition"
- fi
+ CFLAGS="$CFLAGS -Wunreachable-code-return"
+ #
+ # XXX - yes, this depends on the way AC_LANG_WERROR works,
+ # but no mechanism is provided to turn AC_LANG_WERROR on
+ # *and then turn it back off*, so that we *only* do it when
+ # testing compiler options - 15 years after somebody asked
+ # for it:
+ #
+ # https://autoconf.gnu.narkive.com/gTAVmfKD/how-to-cancel-flags-set-by-ac-lang-werror
+ #
+ save_ac_c_werror_flag="$ac_c_werror_flag"
+ ac_c_werror_flag=yes
+ #
+ # We use AC_LANG_SOURCE() so that we can control the complete
+ # content of the program being compiled. We do not, for example,
+ # want the default "int main()" that AC_LANG_PROGRAM() generates,
+ # as it will generate a warning with -Wold-style-definition, meaning
+ # that we would treat it as not working, as the test will fail if
+ # *any* error output, including a warning due to the flag we're
+ # testing, is generated; see
+ #
+ # https://www.postgresql.org/message-id/2192993.1591682589%40sss.pgh.pa.us
+ # https://www.postgresql.org/message-id/2192993.1591682589%40sss.pgh.pa.us
+ #
+ # This may, as per those two messages, be fixed in autoconf 2.70,
+ # but we only require 2.64 or newer for now.
+ #
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
-
-int
-main ()
-{
-return 0
- ;
- return 0;
-}
+int main(void) { return 0; }
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
CFLAGS="$save_CFLAGS"
- V_CCOPT="$V_CCOPT -Wold-style-definition"
+ V_CCOPT="$V_CCOPT -Wunreachable-code-return"
else
@@ -7581,33 +7780,42 @@ $as_echo "no" >&6; }
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ ac_c_werror_flag="$save_ac_c_werror_flag"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports the -Wused-but-marked-unused option" >&5
$as_echo_n "checking whether the compiler supports the -Wused-but-marked-unused option... " >&6; }
save_CFLAGS="$CFLAGS"
- if expr "x-Wused-but-marked-unused" : "x-W.*" >/dev/null
- then
- CFLAGS="$CFLAGS $ac_lbl_unknown_warning_option_error -Wused-but-marked-unused"
- elif expr "x-Wused-but-marked-unused" : "x-f.*" >/dev/null
- then
- CFLAGS="$CFLAGS -Werror -Wused-but-marked-unused"
- elif expr "x-Wused-but-marked-unused" : "x-m.*" >/dev/null
- then
- CFLAGS="$CFLAGS -Werror -Wused-but-marked-unused"
- else
- CFLAGS="$CFLAGS -Wused-but-marked-unused"
- fi
+ CFLAGS="$CFLAGS -Wused-but-marked-unused"
+ #
+ # XXX - yes, this depends on the way AC_LANG_WERROR works,
+ # but no mechanism is provided to turn AC_LANG_WERROR on
+ # *and then turn it back off*, so that we *only* do it when
+ # testing compiler options - 15 years after somebody asked
+ # for it:
+ #
+ # https://autoconf.gnu.narkive.com/gTAVmfKD/how-to-cancel-flags-set-by-ac-lang-werror
+ #
+ save_ac_c_werror_flag="$ac_c_werror_flag"
+ ac_c_werror_flag=yes
+ #
+ # We use AC_LANG_SOURCE() so that we can control the complete
+ # content of the program being compiled. We do not, for example,
+ # want the default "int main()" that AC_LANG_PROGRAM() generates,
+ # as it will generate a warning with -Wold-style-definition, meaning
+ # that we would treat it as not working, as the test will fail if
+ # *any* error output, including a warning due to the flag we're
+ # testing, is generated; see
+ #
+ # https://www.postgresql.org/message-id/2192993.1591682589%40sss.pgh.pa.us
+ # https://www.postgresql.org/message-id/2192993.1591682589%40sss.pgh.pa.us
+ #
+ # This may, as per those two messages, be fixed in autoconf 2.70,
+ # but we only require 2.64 or newer for now.
+ #
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
-
-int
-main ()
-{
-return 0
- ;
- return 0;
-}
+int main(void) { return 0; }
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
@@ -7624,40 +7832,49 @@ $as_echo "no" >&6; }
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ ac_c_werror_flag="$save_ac_c_werror_flag"
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports the -W option" >&5
-$as_echo_n "checking whether the compiler supports the -W option... " >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports the -Wwrite-strings option" >&5
+$as_echo_n "checking whether the compiler supports the -Wwrite-strings option... " >&6; }
save_CFLAGS="$CFLAGS"
- if expr "x-W" : "x-W.*" >/dev/null
- then
- CFLAGS="$CFLAGS $ac_lbl_unknown_warning_option_error -W"
- elif expr "x-W" : "x-f.*" >/dev/null
- then
- CFLAGS="$CFLAGS -Werror -W"
- elif expr "x-W" : "x-m.*" >/dev/null
- then
- CFLAGS="$CFLAGS -Werror -W"
- else
- CFLAGS="$CFLAGS -W"
- fi
+ CFLAGS="$CFLAGS -Wwrite-strings"
+ #
+ # XXX - yes, this depends on the way AC_LANG_WERROR works,
+ # but no mechanism is provided to turn AC_LANG_WERROR on
+ # *and then turn it back off*, so that we *only* do it when
+ # testing compiler options - 15 years after somebody asked
+ # for it:
+ #
+ # https://autoconf.gnu.narkive.com/gTAVmfKD/how-to-cancel-flags-set-by-ac-lang-werror
+ #
+ save_ac_c_werror_flag="$ac_c_werror_flag"
+ ac_c_werror_flag=yes
+ #
+ # We use AC_LANG_SOURCE() so that we can control the complete
+ # content of the program being compiled. We do not, for example,
+ # want the default "int main()" that AC_LANG_PROGRAM() generates,
+ # as it will generate a warning with -Wold-style-definition, meaning
+ # that we would treat it as not working, as the test will fail if
+ # *any* error output, including a warning due to the flag we're
+ # testing, is generated; see
+ #
+ # https://www.postgresql.org/message-id/2192993.1591682589%40sss.pgh.pa.us
+ # https://www.postgresql.org/message-id/2192993.1591682589%40sss.pgh.pa.us
+ #
+ # This may, as per those two messages, be fixed in autoconf 2.70,
+ # but we only require 2.64 or newer for now.
+ #
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
-
-int
-main ()
-{
-return 0
- ;
- return 0;
-}
+int main(void) { return 0; }
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
CFLAGS="$save_CFLAGS"
- V_CCOPT="$V_CCOPT -W"
+ V_CCOPT="$V_CCOPT -Wwrite-strings"
else
@@ -7667,6 +7884,7 @@ $as_echo "no" >&6; }
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ ac_c_werror_flag="$save_ac_c_werror_flag"
fi
@@ -7740,12 +7958,15 @@ $as_echo_n "checking whether the compiler supports generating dependencies... "
/* end confdefs.h. */
int main(void) { return 0; }
_ACEOF
- echo "$CC" $ac_lbl_dependency_flag conftest.c >&5
- if "$CC" $ac_lbl_dependency_flag conftest.c >/dev/null 2>&1; then
+ if { { $as_echo "$as_me:${as_lineno-$LINENO}: eval \"\$CC \$ac_lbl_dependency_flag conftest.c >/dev/null 2>&1\""; } >&5
+ (eval "$CC $ac_lbl_dependency_flag conftest.c >/dev/null 2>&1") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes, with $ac_lbl_dependency_flag" >&5
$as_echo "yes, with $ac_lbl_dependency_flag" >&6; }
DEPENDENCY_CFLAG="$ac_lbl_dependency_flag"
- MKDEP='${srcdir}/mkdep'
+ MKDEP='${top_srcdir}/mkdep'
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
@@ -7789,135 +8010,6 @@ $as_echo "$as_me: WARNING: can't find $name" >&2;}
fi
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if sockaddr struct has the sa_len member" >&5
-$as_echo_n "checking if sockaddr struct has the sa_len member... " >&6; }
- if ${ac_cv_lbl_sockaddr_has_sa_len+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-# include <sys/types.h>
-# include <sys/socket.h>
-int
-main ()
-{
-u_int i = sizeof(((struct sockaddr *)0)->sa_len)
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
- ac_cv_lbl_sockaddr_has_sa_len=yes
-else
- ac_cv_lbl_sockaddr_has_sa_len=no
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lbl_sockaddr_has_sa_len" >&5
-$as_echo "$ac_cv_lbl_sockaddr_has_sa_len" >&6; }
- if test $ac_cv_lbl_sockaddr_has_sa_len = yes ; then
-
-$as_echo "#define HAVE_SOCKADDR_SA_LEN 1" >>confdefs.h
-
- fi
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if unaligned accesses fail" >&5
-$as_echo_n "checking if unaligned accesses fail... " >&6; }
- if ${ac_cv_lbl_unaligned_fail+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- case "$host_cpu" in
-
- #
- # These are CPU types where:
- #
- # the CPU faults on an unaligned access, but at least some
- # OSes that support that CPU catch the fault and simulate
- # the unaligned access (e.g., Alpha/{Digital,Tru64} UNIX) -
- # the simulation is slow, so we don't want to use it;
- #
- # the CPU, I infer (from the old
- #
- # XXX: should also check that they don't do weird things (like on arm)
- #
- # comment) doesn't fault on unaligned accesses, but doesn't
- # do a normal unaligned fetch, either (e.g., presumably, ARM);
- #
- # for whatever reason, the test program doesn't work
- # (this has been claimed to be the case for several of those
- # CPUs - I don't know what the problem is; the problem
- # was reported as "the test program dumps core" for SuperH,
- # but that's what the test program is *supposed* to do -
- # it dumps core before it writes anything, so the test
- # for an empty output file should find an empty output
- # file and conclude that unaligned accesses don't work).
- #
- # This run-time test won't work if you're cross-compiling, so
- # in order to support cross-compiling for a particular CPU,
- # we have to wire in the list of CPU types anyway, as far as
- # I know, so perhaps we should just have a set of CPUs on
- # which we know it doesn't work, a set of CPUs on which we
- # know it does work, and have the script just fail on other
- # cpu types and update it when such a failure occurs.
- #
- alpha*|arm*|bfin*|hp*|mips*|sh*|sparc*|ia64|nv1)
- ac_cv_lbl_unaligned_fail=yes
- ;;
-
- *)
- cat >conftest.c <<EOF
-# include <sys/types.h>
-# include <sys/wait.h>
-# include <stdio.h>
- unsigned char a[5] = { 1, 2, 3, 4, 5 };
- main() {
- unsigned int i;
- pid_t pid;
- int status;
- /* avoid "core dumped" message */
- pid = fork();
- if (pid < 0)
- exit(2);
- if (pid > 0) {
- /* parent */
- pid = waitpid(pid, &status, 0);
- if (pid < 0)
- exit(3);
- exit(!WIFEXITED(status));
- }
- /* child */
- i = *(unsigned int *)&a[1];
- printf("%d\n", i);
- exit(0);
- }
-EOF
- ${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS \
- conftest.c $LIBS >/dev/null 2>&1
- if test ! -x conftest ; then
- ac_cv_lbl_unaligned_fail=yes
- else
- ./conftest >conftest.out
- if test ! -s conftest.out ; then
- ac_cv_lbl_unaligned_fail=yes
- else
- ac_cv_lbl_unaligned_fail=no
- fi
- fi
- rm -f -r conftest* core core.conftest
- ;;
- esac
-fi
-
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lbl_unaligned_fail" >&5
-$as_echo "$ac_cv_lbl_unaligned_fail" >&6; }
- if test $ac_cv_lbl_unaligned_fail = yes ; then
-
-$as_echo "#define LBL_ALIGN 1" >>confdefs.h
-
- fi
-
# Check for OpenSSL/libressl libcrypto
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to use OpenSSL/libressl libcrypto" >&5
$as_echo_n "checking whether to use OpenSSL/libressl libcrypto... " >&6; }
@@ -7976,7 +8068,7 @@ if test "$want_libcrypto" != "no"; then
# El Capitan, probably because they don't want you writing
# nasty portable code that could run on other UN*Xes, they
# want you writing code that uses their Shiny New Crypto
- # Library and that only runs on OS X.
+ # Library and that only runs on macOS.
#
ac_fn_c_check_header_mongrel "$LINENO" "openssl/crypto.h" "ac_cv_header_openssl_crypto_h" "$ac_includes_default"
if test "x$ac_cv_header_openssl_crypto_h" = xyes; then :
@@ -8047,19 +8139,19 @@ done
# EVP_CIPHER_CTX, as EVP_CIPHER_CTX may be
# opaque; otherwise, we allocate it ourselves.
#
- # 2) do we have EVP_CipherInit_ex()?
+ # 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_CipherInit(),
- # because a call to EVP_CipherInit() will
+ # 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.
#
- for ac_func in EVP_CIPHER_CTX_new EVP_CipherInit_ex
+ for ac_func in EVP_CIPHER_CTX_new EVP_DecryptInit_ex
do :
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
@@ -8791,7 +8883,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by $as_me, which was
+This file was extended by tcpdump $as_me 4.99.4, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -8857,7 +8949,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-config.status
+tcpdump config.status 4.99.4
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
@@ -9545,8 +9637,8 @@ $as_echo "$as_me: executing $ac_file commands" >&6;}
case $ac_file$ac_mode in
"default-1":C) if test -f .devel; then
echo timestamp > stamp-h
- cat Makefile-devel-adds >> Makefile
- make depend
+ cat $srcdir/Makefile-devel-adds >> Makefile
+ make depend || exit 1
fi ;;
esac
diff --git a/contrib/tcpdump/configure.ac b/contrib/tcpdump/configure.ac
index 56e2a6246849..18d59b6d709f 100644
--- a/contrib/tcpdump/configure.ac
+++ b/contrib/tcpdump/configure.ac
@@ -7,71 +7,37 @@ dnl
#
# See
#
-# http://ftp.gnu.org/gnu/config/README
+# https://ftp.gnu.org/gnu/config/README
#
# for the URLs to use to fetch new versions of config.guess and
# config.sub.
#
-AC_PREREQ(2.61)
-AC_INIT(tcpdump.c)
+AC_PREREQ(2.69)
+AC_INIT(tcpdump, m4_esyscmd_s([cat VERSION]))
+AC_CONFIG_SRCDIR(tcpdump.c)
AC_CANONICAL_HOST
AC_LBL_C_INIT_BEFORE_CC(V_INCLS)
-AC_PROG_CC
+#
+# Try to enable as many C99 features as we can.
+# At minimum, we want C++/C99-style // comments.
+#
+AC_PROG_CC_C99
+if test "$ac_cv_prog_cc_c99" = "no"; then
+ AC_MSG_WARN([The C compiler does not support C99; there may be compiler errors])
+fi
AC_LBL_C_INIT(V_CCOPT, V_INCLS)
AC_LBL_C_INLINE
-AC_C___ATTRIBUTE__
-if test "$ac_cv___attribute__" = "yes"; then
- AC_C___ATTRIBUTE___UNUSED
- AC_C___ATTRIBUTE___NORETURN_FUNCTION_POINTER
- AC_C___ATTRIBUTE___FORMAT
- if test "$ac_cv___attribute___format" = "yes"; then
- AC_C___ATTRIBUTE___FORMAT_FUNCTION_POINTER
- fi
-fi
-
-AC_CHECK_HEADERS(fcntl.h rpc/rpc.h rpc/rpcent.h)
-AC_CHECK_HEADERS(net/pfvar.h, , , [#include <sys/types.h>
-#include <sys/socket.h>
-#include <net/if.h>])
-if test "$ac_cv_header_net_pfvar_h" = yes; then
- AC_CHECK_HEADERS(net/if_pflog.h, , , [#include <sys/types.h>
- #include <sys/socket.h>
- #include <net/if.h>
- #include <net/pfvar.h>])
- if test "$ac_cv_header_net_if_pflog_h" = yes; then
- LOCALSRC="print-pflog.c $LOCALSRC"
- fi
-fi
-AC_CHECK_HEADERS(netinet/if_ether.h, , , [#include <sys/types.h>
-#include <sys/socket.h>])
-if test "$ac_cv_header_netinet_if_ether_h" != yes; then
- #
- # The simple test didn't work.
- # Do we need to include <net/if.h> first?
- # Unset ac_cv_header_netinet_if_ether_h so we don't
- # treat the previous failure as a cached value and
- # suppress the next test.
- #
- AC_MSG_NOTICE([Rechecking with some additional includes])
- unset ac_cv_header_netinet_if_ether_h
- AC_CHECK_HEADERS(netinet/if_ether.h, , , [#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-struct mbuf;
-struct rtentry;
-#include <net/if.h>])
-fi
-AC_HEADER_TIME
+AC_CHECK_HEADERS(fcntl.h rpc/rpc.h rpc/rpcent.h net/if.h)
case "$host_os" in
darwin*)
AC_ARG_ENABLE(universal,
- AC_HELP_STRING([--disable-universal],[don't build universal on OS X]))
+ AS_HELP_STRING([--disable-universal],[don't build universal on macOS]))
if test "$enable_universal" != "no"; then
case "$host_os" in
@@ -98,10 +64,11 @@ darwin*)
esac
-AC_ARG_WITH(smi,
-[ --with-smi link with libsmi (allows to load MIBs on the fly to decode SNMP packets. [default=yes]
- --without-smi don't link with libsmi],,
- with_smi=yes)
+AC_ARG_WITH([smi],
+ [AS_HELP_STRING([--with-smi],
+ [link with libsmi (allows to load MIBs on the fly to decode SNMP packets) [default=yes, if available]])],
+ [],
+ [with_smi=yes])
if test "x$with_smi" != "xno" ; then
AC_CHECK_HEADER(smi.h,
@@ -120,8 +87,11 @@ if test "x$with_smi" != "xno" ; then
AC_TRY_RUN(
[
/* libsmi available check */
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
#include <smi.h>
-main()
+int main()
{
int current, revision, age, n;
const int required = 2;
@@ -168,10 +138,11 @@ main()
fi
AC_MSG_CHECKING([whether to enable the possibly-buggy SMB printer])
-AC_ARG_ENABLE(smb,
-[ --enable-smb enable possibly-buggy SMB printer [default=no]
- --disable-smb disable possibly-buggy SMB printer],,
- enableval=no)
+AC_ARG_ENABLE([smb],
+ [AS_HELP_STRING([--enable-smb],
+ [enable possibly-buggy SMB printer [default=no]])],
+ [],
+ [enableval=no])
case "$enableval" in
yes) AC_MSG_RESULT(yes)
AC_DEFINE(ENABLE_SMB, 1,
@@ -220,10 +191,21 @@ AC_ARG_WITH(sandbox-capsicum,
# XXX - do we need to check for all of them, or are there some that, if
# present, imply others are present?
#
-if test ! -z "$with_sandbox-capsicum" && test "$with_sandbox-capsicum" != "no" ; then
- AC_CHECK_FUNCS(cap_enter cap_rights_limit cap_ioctls_limit openat,
- ac_lbl_capsicum_function_seen=yes,
- ac_lbl_capsicum_function_not_seen=yes)
+if test -z "$with_sandbox_capsicum" || test "$with_sandbox_capsicum" != "no" ; then
+ #
+ # First, make sure we have the required header.
+ #
+ AC_CHECK_HEADER(sys/capsicum.h,
+ [
+ #
+ # We do; now make sure we have the required functions.
+ #
+ AC_CHECK_FUNCS(cap_enter cap_rights_limit cap_ioctls_limit openat,
+ ac_lbl_capsicum_function_seen=yes,
+ ac_lbl_capsicum_function_not_seen=yes)
+ ])
+ AC_CHECK_LIB(casper, cap_init, LIBS="$LIBS -lcasper")
+ AC_CHECK_LIB(cap_dns, cap_gethostbyaddr, LIBS="$LIBS -lcap_dns")
fi
AC_MSG_CHECKING([whether to sandbox using capsicum])
if test "x$ac_lbl_capsicum_function_seen" = "xyes" -a "x$ac_lbl_capsicum_function_not_seen" != "xyes"; then
@@ -232,6 +214,13 @@ if test "x$ac_lbl_capsicum_function_seen" = "xyes" -a "x$ac_lbl_capsicum_functio
else
AC_MSG_RESULT(no)
fi
+AC_MSG_CHECKING([whether to sandbox using Casper library])
+if test "x$ac_cv_lib_casper_cap_init" = "xyes" -a "x$ac_cv_lib_cap_dns_cap_gethostbyaddr" = "xyes"; then
+ AC_DEFINE(HAVE_CASPER, 1, [Casper support available])
+ AC_MSG_RESULT(yes)
+else
+ AC_MSG_RESULT(no)
+fi
#
# We must check this before checking whether to check the OS's IPv6,
@@ -251,10 +240,15 @@ AC_COMPILE_IFELSE(
[
AC_LANG_SOURCE(
[[
+#include <string.h>
/* AF_INET6 available check */
#include <sys/types.h>
+#ifdef _WIN32
+#include <ws2tcpip.h>
+#else
#include <sys/socket.h>
#include <netinet/in.h>
+#endif
#ifdef AF_INET6
void
foo(struct in6_addr *addr)
@@ -385,18 +379,49 @@ if test "$ipv6" = "yes" -a "$ipv6lib" != "none"; then
fi
fi
-AC_REPLACE_FUNCS(vfprintf strlcat strlcpy strdup strsep getopt_long)
-AC_CHECK_FUNCS(fork vfork strftime)
-AC_CHECK_FUNCS(setlinebuf alarm)
+AC_REPLACE_FUNCS(strlcat strlcpy strdup strsep getservent getopt_long)
+AC_CHECK_FUNCS(fork vfork)
+AC_CHECK_FUNCS(setlinebuf)
-needsnprintf=no
-AC_CHECK_FUNCS(vsnprintf snprintf,,
- [needsnprintf=yes])
-if test $needsnprintf = yes; then
- AC_LIBOBJ(snprintf)
-fi
+#
+# Make sure we have vsnprintf() and snprintf(); we require them.
+#
+AC_CHECK_FUNC(vsnprintf,,
+ AC_MSG_ERROR([vsnprintf() is required but wasn't found]))
+AC_CHECK_FUNC(snprintf,,
+ AC_MSG_ERROR([snprintf() is required but wasn't found]))
-AC_LBL_TYPE_SIGNAL
+#
+# Define HAVE_NO_PRINTF_Z to make it possible to disable test cases that
+# depend on %zu.
+#
+AC_MSG_CHECKING([whether printf(3) supports the z length modifier])
+AC_RUN_IFELSE(
+ [
+ AC_LANG_SOURCE([[
+#include <stdio.h>
+#include <string.h>
+
+int main()
+{
+ char buf[100];
+ snprintf(buf, sizeof(buf), "%zu", sizeof(buf));
+ return strncmp(buf, "100", sizeof(buf)) ? 1 : 0;
+}
+ ]])
+ ],
+ [
+ AC_MSG_RESULT(yes)
+ ],
+ [
+ AC_MSG_RESULT(no)
+ AC_DEFINE(HAVE_NO_PRINTF_Z, 1,
+ [Define to 1 if printf(3) does not support the z length modifier.])
+ ],
+ [
+ AC_MSG_RESULT(not while cross-compiling)
+ ]
+)
AC_CHECK_LIB(rpc, main) dnl It's unclear why we might need -lrpc
@@ -412,11 +437,12 @@ AC_LBL_LIBPCAP(V_PCAPDEP, V_INCLS)
#
# You are in a twisty little maze of UN*Xes, all different.
# Some might not have ether_ntohost().
-# Some might have it, but not declare it in any header file.
-# Some might have it, but declare it in <netinet/if_ether.h>.
-# Some might have it, but declare it in <netinet/ether.h>
-# (And some might have it but document it as something declared in
-# <netinet/ethernet.h>, although <netinet/if_ether.h> appears to work.)
+# Some might have it and declare it in <net/ethernet.h>.
+# Some might have it and declare it in <netinet/ether.h>
+# Some might have it and declare it in <sys/ethernet.h>.
+# Some might have it and declare it in <arpa/inet.h>.
+# Some might have it and declare it in <netinet/if_ether.h>.
+# Some might have it and not declare it in any header file.
#
# Before you is a C compiler.
#
@@ -424,6 +450,8 @@ AC_CHECK_FUNCS(ether_ntohost, [
AC_CACHE_CHECK(for buggy ether_ntohost, ac_cv_buggy_ether_ntohost, [
AC_TRY_RUN([
#include <netdb.h>
+ #include <netinet/ether.h>
+ #include <stdlib.h>
#include <sys/types.h>
#include <sys/param.h>
#include <sys/socket.h>
@@ -448,26 +476,41 @@ AC_CHECK_FUNCS(ether_ntohost, [
if test "$ac_cv_func_ether_ntohost" = yes -a \
"$ac_cv_buggy_ether_ntohost" = "no"; then
#
- # OK, we have ether_ntohost(). Do we have <netinet/if_ether.h>?
+ # OK, we have ether_ntohost(). Is it declared in <net/ethernet.h>?
+ #
+ # This test fails if we don't have <net/ethernet.h> or if we do
+ # but it doesn't declare ether_ntohost().
+ #
+ AC_CHECK_DECL(ether_ntohost,
+ [
+ AC_DEFINE(NET_ETHERNET_H_DECLARES_ETHER_NTOHOST,,
+ [Define to 1 if net/ethernet.h declares `ether_ntohost'])
+ ],,
+ [
+#include <net/ethernet.h>
+ ])
+ #
+ # Did that succeed?
#
- if test "$ac_cv_header_netinet_if_ether_h" = yes; then
+ if test "$ac_cv_have_decl_ether_ntohost" != yes; then
#
- # Yes. Does it declare ether_ntohost()?
+ # No, how about <netinet/ether.h>, as on Linux?
+ #
+ # This test fails if we don't have <netinet/ether.h>
+ # or if we do but it doesn't declare ether_ntohost().
+ #
+ # Unset ac_cv_have_decl_ether_ntohost so we don't
+ # treat the previous failure as a cached value and
+ # suppress the next test.
#
+ unset ac_cv_have_decl_ether_ntohost
AC_CHECK_DECL(ether_ntohost,
[
- AC_DEFINE(NETINET_IF_ETHER_H_DECLARES_ETHER_NTOHOST,,
- [Define to 1 if netinet/if_ether.h declares `ether_ntohost'])
+ AC_DEFINE(NETINET_ETHER_H_DECLARES_ETHER_NTOHOST,,
+ [Define to 1 if netinet/ether.h declares `ether_ntohost'])
],,
[
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-struct mbuf;
-struct rtentry;
-#include <net/if.h>
-#include <netinet/if_ether.h>
+#include <netinet/ether.h>
])
fi
#
@@ -475,63 +518,119 @@ struct rtentry;
#
if test "$ac_cv_have_decl_ether_ntohost" != yes; then
#
- # No, how about <netinet/ether.h>, as on Linux?
+ # No, how about <sys/ethernet.h>, as on Solaris 10
+ # and later?
#
- AC_CHECK_HEADERS(netinet/ether.h)
- if test "$ac_cv_header_netinet_ether_h" = yes; then
- #
- # We have it - does it declare ether_ntohost()?
- # Unset ac_cv_have_decl_ether_ntohost so we don't
- # treat the previous failure as a cached value and
- # suppress the next test.
- #
- unset ac_cv_have_decl_ether_ntohost
- AC_CHECK_DECL(ether_ntohost,
- [
- AC_DEFINE(NETINET_ETHER_H_DECLARES_ETHER_NTOHOST,,
- [Define to 1 if netinet/ether.h declares `ether_ntohost'])
- ],,
- [
-#include <netinet/ether.h>
- ])
- fi
+ # This test fails if we don't have <sys/ethernet.h>
+ # or if we do but it doesn't declare ether_ntohost().
+ #
+ # Unset ac_cv_have_decl_ether_ntohost so we don't
+ # treat the previous failure as a cached value and
+ # suppress the next test.
+ #
+ unset ac_cv_have_decl_ether_ntohost
+ AC_CHECK_DECL(ether_ntohost,
+ [
+ AC_DEFINE(SYS_ETHERNET_H_DECLARES_ETHER_NTOHOST,,
+ [Define to 1 if sys/ethernet.h declares `ether_ntohost'])
+ ],,
+ [
+#include <sys/ethernet.h>
+ ])
fi
#
- # Is ether_ntohost() declared?
+ # Did that succeed?
#
if test "$ac_cv_have_decl_ether_ntohost" != yes; then
#
- # No, we'll have to declare it ourselves.
- # Do we have "struct ether_addr"?
+ # No, how about <arpa/inet.h>, as in AIX?
#
- AC_CHECK_TYPES(struct ether_addr,,,
+ # This test fails if we don't have <arpa/inet.h>
+ # (if we have ether_ntohost(), we should have
+ # networking, and if we have networking, we should
+ # have <arpa/inet.h>) or if we do but it doesn't
+ # declare ether_ntohost().
+ #
+ # Unset ac_cv_have_decl_ether_ntohost so we don't
+ # treat the previous failure as a cached value and
+ # suppress the next test.
+ #
+ unset ac_cv_have_decl_ether_ntohost
+ AC_CHECK_DECL(ether_ntohost,
+ [
+ AC_DEFINE(ARPA_INET_H_DECLARES_ETHER_NTOHOST,,
+ [Define to 1 if arpa/inet.h declares `ether_ntohost'])
+ ],,
+ [
+#include <arpa/inet.h>
+ ])
+ fi
+ #
+ # Did that succeed?
+ #
+ if test "$ac_cv_have_decl_ether_ntohost" != yes; then
+ #
+ # No, how about <netinet/if_ether.h>?
+ # On some platforms, it requires <net/if.h> and
+ # <netinet/in.h>, and we always include it with
+ # both of them, so test it with both of them.
+ #
+ # This test fails if we don't have <netinet/if_ether.h>
+ # and the headers we include before it, or if we do but
+ # <netinet/if_ether.h> doesn't declare ether_hostton().
+ #
+ # Unset ac_cv_have_decl_ether_ntohost so we don't
+ # treat the previous failure as a cached value and
+ # suppress the next test.
+ #
+ unset ac_cv_have_decl_ether_ntohost
+ AC_CHECK_DECL(ether_ntohost,
+ [
+ AC_DEFINE(NETINET_IF_ETHER_H_DECLARES_ETHER_NTOHOST,,
+ [Define to 1 if netinet/if_ether.h declares `ether_ntohost'])
+ ],,
[
#include <sys/types.h>
#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-struct mbuf;
-struct rtentry;
#include <net/if.h>
+#include <netinet/in.h>
#include <netinet/if_ether.h>
])
- AC_DEFINE(HAVE_DECL_ETHER_NTOHOST, 0,
- [Define to 1 if you have the declaration of `ether_ntohost', and to 0 if you
-don't.])
- else
+ fi
+ #
+ # After all that, is ether_ntohost() declared?
+ #
+ if test "$ac_cv_have_decl_ether_ntohost" = yes; then
+ #
+ # Yes.
+ #
AC_DEFINE(HAVE_DECL_ETHER_NTOHOST, 1,
- [Define to 1 if you have the declaration of `ether_ntohost', and to 0 if you
-don't.])
+ [Define to 1 if you have the declaration of `ether_ntohost'])
+ else
+ #
+ # No, we'll have to declare it ourselves.
+ # Do we have "struct ether_addr" if we include
+ # <netinet/if_ether.h>?
+ #
+ AC_CHECK_TYPES(struct ether_addr,,,
+ [
+ #include <sys/types.h>
+ #include <sys/socket.h>
+ #include <net/if.h>
+ #include <netinet/in.h>
+ #include <netinet/if_ether.h>
+ ])
fi
fi
-# libdlpi is needed for Solaris 11 and later.
-AC_CHECK_LIB(dlpi, dlpi_walk, LIBS="$LIBS -ldlpi" LDFLAGS="-L/lib $LDFLAGS", ,-L/lib)
-
dnl
-dnl Check for "pcap_list_datalinks()", "pcap_set_datalink()",
-dnl and "pcap_datalink_name_to_val()", and use substitute versions
-dnl if they're not present.
+dnl Check for "pcap_list_datalinks()" and use a substitute version if
+dnl it's not present. If it is present, check for "pcap_free_datalinks()";
+dnl if it's not present, we don't replace it for now. (We could do so
+dnl on UN*X, but not on Windows, where hilarity ensues if a program
+dnl built with one version of the MSVC support library tries to free
+dnl something allocated by a library built with another version of
+dnl the MSVC support library.)
dnl
AC_CHECK_FUNC(pcap_list_datalinks,
[
@@ -542,7 +641,13 @@ AC_CHECK_FUNC(pcap_list_datalinks,
[
AC_LIBOBJ(datalinks)
])
-AC_CHECK_FUNCS(pcap_set_datalink)
+
+dnl
+dnl Check for "pcap_datalink_name_to_val()", and use a substitute
+dnl version if it's not present. If it is present, check for
+dnl "pcap_datalink_val_to_description()", and if we don't have it,
+dnl use a substitute version.
+dnl
AC_CHECK_FUNC(pcap_datalink_name_to_val,
[
AC_DEFINE(HAVE_PCAP_DATALINK_NAME_TO_VAL, 1,
@@ -559,23 +664,19 @@ AC_CHECK_FUNC(pcap_datalink_name_to_val,
])
dnl
+dnl Check for "pcap_set_datalink()"; you can't substitute for it if
+dnl it's absent (it has hooks into libpcap), so just define the
+dnl HAVE_ value if it's there.
+dnl
+AC_CHECK_FUNCS(pcap_set_datalink)
+
+dnl
dnl Check for "pcap_breakloop()"; you can't substitute for it if
dnl it's absent (it has hooks into the live capture routines),
dnl so just define the HAVE_ value if it's there.
dnl
AC_CHECK_FUNCS(pcap_breakloop)
-dnl
-dnl Check for "pcap_dump_ftell()" and use a substitute version
-dnl if it's not present.
-dnl
-AC_CHECK_FUNC(pcap_dump_ftell,
- AC_DEFINE(HAVE_PCAP_DUMP_FTELL, 1,
- [define if libpcap has pcap_dump_ftell()]),
- [
- AC_LIBOBJ(pcap_dump_ftell)
- ])
-
#
# Do we have the new open API? Check for pcap_create, and assume that,
# if we do, we also have pcap_activate() and the other new routines
@@ -599,17 +700,18 @@ fi
# Check for a miscellaneous collection of functions which we use
# if we have them.
#
-AC_CHECK_FUNCS(pcap_findalldevs pcap_dump_flush pcap_lib_version pcap_setdirection pcap_set_immediate_mode)
+AC_CHECK_FUNCS(pcap_findalldevs)
if test $ac_cv_func_pcap_findalldevs = "yes" ; then
-dnl Check for Mac OS X, which may ship pcap.h from 0.6 but libpcap may
-dnl be 0.8; this means that lib has pcap_findalldevs but header doesn't
-dnl have pcap_if_t.
+dnl Check for libpcap having pcap_findalldevs() but the pcap.h header
+dnl not having pcap_if_t; some versions of Mac OS X shipped with pcap.h
+dnl from 0.6 and libpcap 0.8, so that libpcap had pcap_findalldevs but
+dnl pcap.h didn't have pcap_if_t.
savedcppflags="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $V_INCLS"
AC_CHECK_TYPES(pcap_if_t, , , [#include <pcap.h>])
CPPFLAGS="$savedcppflags"
fi
-
+AC_CHECK_FUNCS(pcap_dump_flush pcap_lib_version)
if test $ac_cv_func_pcap_lib_version = "no" ; then
AC_MSG_CHECKING(whether pcap_version is defined by libpcap)
AC_TRY_LINK([],
@@ -627,6 +729,9 @@ if test $ac_cv_func_pcap_lib_version = "no" ; then
AC_MSG_RESULT(no)
fi
fi
+AC_CHECK_FUNCS(pcap_setdirection pcap_set_immediate_mode pcap_dump_ftell64)
+AC_CHECK_FUNCS(pcap_open pcap_findalldevs_ex)
+AC_REPLACE_FUNCS(pcap_dump_ftell)
#
# Check for special debugging functions
@@ -735,25 +840,21 @@ if test -f /dev/bpf0 ; then
fi
#
-# Make sure we have definitions for all the C99 specified-width types
-# (regardless of whether the environment is a C99 environment or not).
-#
-AC_TYPE_INT8_T
-AC_TYPE_INT16_T
-AC_TYPE_INT32_T
-AC_TYPE_INT64_T
-AC_TYPE_UINT8_T
-AC_TYPE_UINT16_T
-AC_TYPE_UINT32_T
-AC_TYPE_UINT64_T
-
-#
# Make sure we have a definition for C99's uintptr_t (regardless of
# whether the environment is a C99 environment or not).
#
AC_TYPE_UINTPTR_T
#
+# Check whether we have pcap/pcap-inttypes.h.
+# If we do, we use that to get the C99 types defined.
+#
+savedcppflags="$CPPFLAGS"
+CPPFLAGS="$CPPFLAGS $V_INCLS"
+AC_CHECK_HEADERS(pcap/pcap-inttypes.h)
+CPPFLAGS="$savedcppflags"
+
+#
# Define the old BSD specified-width types in terms of the C99 types;
# we may need them with libpcap include files.
#
@@ -782,88 +883,11 @@ AC_CHECK_TYPE([u_int64_t], ,
#include <sys/types.h>
])
-#
-# Check for <inttypes.h>
-#
-AC_CHECK_HEADERS(inttypes.h,
- [
- #
- # OK, we have inttypes.h, but does it define all the PRI[doxu]64 macros?
- # Some systems have an inttypes.h that doesn't define all of them.
- #
- AC_MSG_CHECKING([[whether inttypes.h defines the PRI[doxu]64 macros]])
- AC_COMPILE_IFELSE(
- [
- AC_LANG_SOURCE(
- [[
- #include <inttypes.h>
- #include <stdio.h>
- #include <sys/types.h>
-
- main()
- {
- printf("%" PRId64 "\n", (uint64_t)1);
- printf("%" PRIo64 "\n", (uint64_t)1);
- printf("%" PRIx64 "\n", (uint64_t)1);
- printf("%" PRIu64 "\n", (uint64_t)1);
- }
- ]])
- ],
- [
- AC_MSG_RESULT(yes)
- ac_lbl_inttypes_h_defines_formats=yes
- ],
- [
- AC_MSG_RESULT(no)
- ac_lbl_inttypes_h_defines_formats=no
- ])
- ],
- [
- #
- # We don't have inttypes.h, so it obviously can't define those
- # macros.
- #
- ac_lbl_inttypes_h_defines_formats=no
- ])
-if test "$ac_lbl_inttypes_h_defines_formats" = no; then
- AC_LBL_CHECK_64BIT_FORMAT(l,
- [
- AC_LBL_CHECK_64BIT_FORMAT(ll,
- [
- AC_LBL_CHECK_64BIT_FORMAT(L,
- [
- AC_LBL_CHECK_64BIT_FORMAT(q,
- [
- AC_MSG_ERROR([neither %llx nor %Lx nor %qx worked on a 64-bit integer])
- ])
- ])
- ])
- ])
-fi
-
-#
-# Check for some headers introduced in later versions of libpcap
-# and used by some printers.
-#
-# Those headers use the {u_}intN_t types, so we must do this after
-# we check for what's needed to get them defined.
-#
-savedcppflags="$CPPFLAGS"
-CPPFLAGS="$CPPFLAGS $V_INCLS"
-AC_CHECK_HEADERS(pcap/bluetooth.h,,,[#include "netdissect-stdinc.h"])
-AC_CHECK_HEADERS(pcap/nflog.h,,,[#include "netdissect-stdinc.h"])
-AC_CHECK_HEADERS(pcap/usb.h,,,[#include "netdissect-stdinc.h"])
-CPPFLAGS="$savedcppflags"
-
AC_PROG_RANLIB
AC_CHECK_TOOL([AR], [ar])
AC_LBL_DEVEL(V_CCOPT)
-AC_LBL_SOCKADDR_SA_LEN
-
-AC_LBL_UNALIGNED_ACCESS
-
# Check for OpenSSL/libressl libcrypto
AC_MSG_CHECKING(whether to use OpenSSL/libressl libcrypto)
# Specify location for both includes and libraries.
@@ -913,7 +937,7 @@ if test "$want_libcrypto" != "no"; then
# El Capitan, probably because they don't want you writing
# nasty portable code that could run on other UN*Xes, they
# want you writing code that uses their Shiny New Crypto
- # Library and that only runs on OS X.
+ # Library and that only runs on macOS.
#
AC_CHECK_HEADER(openssl/crypto.h,
[
@@ -928,19 +952,19 @@ if test "$want_libcrypto" != "no"; then
# EVP_CIPHER_CTX, as EVP_CIPHER_CTX may be
# opaque; otherwise, we allocate it ourselves.
#
- # 2) do we have EVP_CipherInit_ex()?
+ # 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_CipherInit(),
- # because a call to EVP_CipherInit() will
+ # You Can't Do That with EVP_DecryptInit(),
+ # because a call to EVP_DecryptInit() will
# unconditionally clear the context, and
# if you don't supply a cipher, it'll
# clear the cipher, rendering the context
# unusable and causing a crash.
#
- AC_CHECK_FUNCS(EVP_CIPHER_CTX_new EVP_CipherInit_ex)
+ AC_CHECK_FUNCS(EVP_CIPHER_CTX_new EVP_DecryptInit_ex)
fi
])
fi
@@ -996,8 +1020,8 @@ AC_CONFIG_HEADER(config.h)
AC_OUTPUT_COMMANDS([if test -f .devel; then
echo timestamp > stamp-h
- cat Makefile-devel-adds >> Makefile
- make depend
+ cat $srcdir/Makefile-devel-adds >> Makefile
+ make depend || exit 1
fi])
AC_OUTPUT(Makefile tcpdump.1)
exit 0
diff --git a/contrib/tcpdump/cpack.c b/contrib/tcpdump/cpack.c
index e37d813d39fb..9be7b47d8512 100644
--- a/contrib/tcpdump/cpack.c
+++ b/contrib/tcpdump/cpack.c
@@ -28,18 +28,20 @@
*/
#ifdef HAVE_CONFIG_H
-#include "config.h"
+#include <config.h>
#endif
#include <stdlib.h>
#include <string.h>
-#include <netdissect-stdinc.h>
+#include "netdissect-stdinc.h"
-#include "cpack.h"
+#include "netdissect.h"
#include "extract.h"
+#include "cpack.h"
+
const uint8_t *
-cpack_next_boundary(const uint8_t *buf, const uint8_t *p, size_t alignment)
+nd_cpack_next_boundary(const uint8_t *buf, const uint8_t *p, size_t alignment)
{
size_t misalignment = (size_t)(p - buf) % alignment;
@@ -54,12 +56,12 @@ cpack_next_boundary(const uint8_t *buf, const uint8_t *p, size_t alignment)
* return a pointer to the boundary.
*/
const uint8_t *
-cpack_align_and_reserve(struct cpack_state *cs, size_t wordsize)
+nd_cpack_align_and_reserve(struct cpack_state *cs, size_t wordsize)
{
const uint8_t *next;
/* Ensure alignment. */
- next = cpack_next_boundary(cs->c_buf, cs->c_next, wordsize);
+ next = nd_cpack_next_boundary(cs->c_buf, cs->c_next, wordsize);
/* Too little space for wordsize bytes? */
if (next - cs->c_buf + wordsize > cs->c_len)
@@ -70,7 +72,7 @@ cpack_align_and_reserve(struct cpack_state *cs, size_t wordsize)
/* Advance by N bytes without returning them. */
int
-cpack_advance(struct cpack_state *cs, const size_t toskip)
+nd_cpack_advance(struct cpack_state *cs, const size_t toskip)
{
/* No space left? */
if (cs->c_next - cs->c_buf + toskip > cs->c_len)
@@ -80,7 +82,7 @@ cpack_advance(struct cpack_state *cs, const size_t toskip)
}
int
-cpack_init(struct cpack_state *cs, const uint8_t *buf, size_t buflen)
+nd_cpack_init(struct cpack_state *cs, const uint8_t *buf, size_t buflen)
{
memset(cs, 0, sizeof(*cs));
@@ -93,63 +95,126 @@ cpack_init(struct cpack_state *cs, const uint8_t *buf, size_t buflen)
/* Unpack a 64-bit unsigned integer. */
int
-cpack_uint64(struct cpack_state *cs, uint64_t *u)
+nd_cpack_uint64(netdissect_options *ndo, struct cpack_state *cs, uint64_t *u)
{
const uint8_t *next;
- if ((next = cpack_align_and_reserve(cs, sizeof(*u))) == NULL)
+ if ((next = nd_cpack_align_and_reserve(cs, sizeof(*u))) == NULL)
return -1;
- *u = EXTRACT_LE_64BITS(next);
+ *u = GET_LE_U_8(next);
/* Move pointer past the uint64_t. */
cs->c_next = next + sizeof(*u);
return 0;
}
+/* Unpack a 64-bit signed integer. */
+int
+nd_cpack_int64(netdissect_options *ndo, struct cpack_state *cs, int64_t *u)
+{
+ const uint8_t *next;
+
+ if ((next = nd_cpack_align_and_reserve(cs, sizeof(*u))) == NULL)
+ return -1;
+
+ *u = GET_LE_S_8(next);
+
+ /* Move pointer past the int64_t. */
+ cs->c_next = next + sizeof(*u);
+ return 0;
+}
+
/* Unpack a 32-bit unsigned integer. */
int
-cpack_uint32(struct cpack_state *cs, uint32_t *u)
+nd_cpack_uint32(netdissect_options *ndo, struct cpack_state *cs, uint32_t *u)
{
const uint8_t *next;
- if ((next = cpack_align_and_reserve(cs, sizeof(*u))) == NULL)
+ if ((next = nd_cpack_align_and_reserve(cs, sizeof(*u))) == NULL)
return -1;
- *u = EXTRACT_LE_32BITS(next);
+ *u = GET_LE_U_4(next);
/* Move pointer past the uint32_t. */
cs->c_next = next + sizeof(*u);
return 0;
}
+/* Unpack a 32-bit signed integer. */
+int
+nd_cpack_int32(netdissect_options *ndo, struct cpack_state *cs, int32_t *u)
+{
+ const uint8_t *next;
+
+ if ((next = nd_cpack_align_and_reserve(cs, sizeof(*u))) == NULL)
+ return -1;
+
+ *u = GET_LE_S_4(next);
+
+ /* Move pointer past the int32_t. */
+ cs->c_next = next + sizeof(*u);
+ return 0;
+}
+
/* Unpack a 16-bit unsigned integer. */
int
-cpack_uint16(struct cpack_state *cs, uint16_t *u)
+nd_cpack_uint16(netdissect_options *ndo, struct cpack_state *cs, uint16_t *u)
{
const uint8_t *next;
- if ((next = cpack_align_and_reserve(cs, sizeof(*u))) == NULL)
+ if ((next = nd_cpack_align_and_reserve(cs, sizeof(*u))) == NULL)
return -1;
- *u = EXTRACT_LE_16BITS(next);
+ *u = GET_LE_U_2(next);
/* Move pointer past the uint16_t. */
cs->c_next = next + sizeof(*u);
return 0;
}
+/* Unpack a 16-bit signed integer. */
+int
+nd_cpack_int16(netdissect_options *ndo, struct cpack_state *cs, int16_t *u)
+{
+ const uint8_t *next;
+
+ if ((next = nd_cpack_align_and_reserve(cs, sizeof(*u))) == NULL)
+ return -1;
+
+ *u = GET_LE_S_2(next);
+
+ /* Move pointer past the int16_t. */
+ cs->c_next = next + sizeof(*u);
+ return 0;
+}
+
/* Unpack an 8-bit unsigned integer. */
int
-cpack_uint8(struct cpack_state *cs, uint8_t *u)
+nd_cpack_uint8(netdissect_options *ndo, struct cpack_state *cs, uint8_t *u)
{
/* No space left? */
if ((size_t)(cs->c_next - cs->c_buf) >= cs->c_len)
return -1;
- *u = *cs->c_next;
+ *u = GET_U_1(cs->c_next);
/* Move pointer past the uint8_t. */
cs->c_next++;
return 0;
}
+
+/* Unpack an 8-bit signed integer. */
+int
+nd_cpack_int8(netdissect_options *ndo, struct cpack_state *cs, int8_t *u)
+{
+ /* No space left? */
+ if ((size_t)(cs->c_next - cs->c_buf) >= cs->c_len)
+ return -1;
+
+ *u = GET_S_1(cs->c_next);
+
+ /* Move pointer past the int8_t. */
+ cs->c_next++;
+ return 0;
+}
diff --git a/contrib/tcpdump/cpack.h b/contrib/tcpdump/cpack.h
index 3072e0c37411..4e89300cc204 100644
--- a/contrib/tcpdump/cpack.h
+++ b/contrib/tcpdump/cpack.h
@@ -27,8 +27,10 @@
* OF SUCH DAMAGE.
*/
-#ifndef _CPACK_H
-#define _CPACK_H
+#ifndef ND_CPACK_H
+#define ND_CPACK_H
+
+#include "netdissect.h"
struct cpack_state {
const uint8_t *c_buf;
@@ -36,21 +38,20 @@ struct cpack_state {
size_t c_len;
};
-int cpack_init(struct cpack_state *, const uint8_t *, size_t);
-
-int cpack_uint8(struct cpack_state *, uint8_t *);
-int cpack_uint16(struct cpack_state *, uint16_t *);
-int cpack_uint32(struct cpack_state *, uint32_t *);
-int cpack_uint64(struct cpack_state *, uint64_t *);
+int nd_cpack_init(struct cpack_state *, const uint8_t *, size_t);
-const uint8_t *cpack_next_boundary(const uint8_t *buf, const uint8_t *p, size_t alignment);
-const uint8_t *cpack_align_and_reserve(struct cpack_state *cs, size_t wordsize);
+int nd_cpack_uint8(netdissect_options *, struct cpack_state *, uint8_t *);
+int nd_cpack_int8(netdissect_options *, struct cpack_state *, int8_t *);
+int nd_cpack_uint16(netdissect_options *, struct cpack_state *, uint16_t *);
+int nd_cpack_int16(netdissect_options *, struct cpack_state *, int16_t *);
+int nd_cpack_uint32(netdissect_options *, struct cpack_state *, uint32_t *);
+int nd_cpack_int32(netdissect_options *, struct cpack_state *, int32_t *);
+int nd_cpack_uint64(netdissect_options *, struct cpack_state *, uint64_t *);
+int nd_cpack_int64(netdissect_options *, struct cpack_state *, int64_t *);
-#define cpack_int8(__s, __p) cpack_uint8((__s), (uint8_t*)(__p))
-#define cpack_int16(__s, __p) cpack_uint16((__s), (uint16_t*)(__p))
-#define cpack_int32(__s, __p) cpack_uint32((__s), (uint32_t*)(__p))
-#define cpack_int64(__s, __p) cpack_uint64((__s), (uint64_t*)(__p))
+const uint8_t *nd_cpack_next_boundary(const uint8_t *buf, const uint8_t *p, size_t alignment);
+const uint8_t *nd_cpack_align_and_reserve(struct cpack_state *cs, size_t wordsize);
-extern int cpack_advance(struct cpack_state *, const size_t);
+extern int nd_cpack_advance(struct cpack_state *, const size_t);
-#endif /* _CPACK_H */
+#endif /* ND_CPACK_H */
diff --git a/contrib/tcpdump/diag-control.h b/contrib/tcpdump/diag-control.h
new file mode 100644
index 000000000000..3eb6bcaaf020
--- /dev/null
+++ b/contrib/tcpdump/diag-control.h
@@ -0,0 +1,186 @@
+/* -*- Mode: c; tab-width: 8; indent-tabs-mode: 1; c-basic-offset: 8; -*- */
+/*
+ * Copyright (c) 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 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. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the Computer Systems
+ * Engineering Group at Lawrence Berkeley Laboratory.
+ * 4. Neither the name of the University nor of the Laboratory may be used
+ * to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef _diag_control_h
+#define _diag_control_h
+
+#include "compiler-tests.h"
+
+#ifndef _MSC_VER
+ /*
+ * Clang and GCC both support this way of putting pragmas into #defines.
+ * We don't use it unless we have a compiler that supports it; the
+ * warning-suppressing pragmas differ between Clang and GCC, so we test
+ * for both of those separately.
+ */
+ #define DIAG_DO_PRAGMA(x) _Pragma (#x)
+#endif
+
+/*
+ * XL C 12.1 and 13.1 for AIX require no attention in this department.
+ * XL C 16.1 defines both __GNUC__ and __clang__, so has to be tested first.
+ */
+#if ND_IS_AT_LEAST_XL_C_VERSION(16,1)
+ /*
+ * See respective Clang note below.
+ */
+ #define DIAG_OFF_ASSIGN_ENUM \
+ DIAG_DO_PRAGMA(clang diagnostic push) \
+ DIAG_DO_PRAGMA(clang diagnostic ignored "-Wassign-enum")
+ #define DIAG_ON_ASSIGN_ENUM \
+ DIAG_DO_PRAGMA(clang diagnostic pop)
+
+ #define DIAG_OFF_CAST_QUAL
+ #define DIAG_ON_CAST_QUAL
+ #define DIAG_OFF_DEPRECATION
+ #define DIAG_ON_DEPRECATION
+/*
+ * The current clang compilers also define __GNUC__ and __GNUC_MINOR__
+ * thus we need to test the clang case before the GCC one
+ */
+#elif ND_IS_AT_LEAST_CLANG_VERSION(2,8)
+ /*
+ * Clang complains if you OR together multiple enum values of a
+ * given enum type and them pass it as an argument of that enum
+ * type. Some libcap-ng routines use enums to define bit flags;
+ * we want to squelch the warnings that produces.
+ */
+ #define DIAG_OFF_ASSIGN_ENUM \
+ DIAG_DO_PRAGMA(clang diagnostic push) \
+ DIAG_DO_PRAGMA(clang diagnostic ignored "-Wassign-enum")
+ #define DIAG_ON_ASSIGN_ENUM \
+ DIAG_DO_PRAGMA(clang diagnostic pop)
+
+ /*
+ * It also legitimately complains about some code in the BSD
+ * getopt_long() - that code explicitly and deliberately
+ * violates the contract by permuting the argument vector
+ * (declared as char const *argv[], meaning "I won't change
+ * the vector by changing any of its elements), as do the
+ * GNU and Solaris getopt_long(). This is documented in the
+ * man pages for all versions; it can be suppressed by setting
+ * the environment variable POSIXLY_CORRECT or by putting a "+"
+ * at the beginning of the option string.
+ *
+ * We suppress the warning.
+ */
+ #define DIAG_OFF_CAST_QUAL \
+ DIAG_DO_PRAGMA(clang diagnostic push) \
+ DIAG_DO_PRAGMA(clang diagnostic ignored "-Wcast-qual")
+ #define DIAG_ON_CAST_QUAL \
+ DIAG_DO_PRAGMA(clang diagnostic pop)
+
+ /*
+ * Suppress deprecation warnings.
+ */
+ #define DIAG_OFF_DEPRECATION \
+ DIAG_DO_PRAGMA(clang diagnostic push) \
+ DIAG_DO_PRAGMA(clang diagnostic ignored "-Wdeprecated-declarations")
+ #define DIAG_ON_DEPRECATION \
+ DIAG_DO_PRAGMA(clang diagnostic pop)
+
+ /*
+ * Clang supports the generic C11 extension even if run with the -std=gnu99
+ * flag, which leads FreeBSD <sys/cdefs.h> to use the extension, which
+ * results in Clang emitting a -Wc11-extensions warning. The warning is not
+ * documented in the user manual, but it happens with Clang 10.0.1 on
+ * FreeBSD 12.2, so let's use that as a reference.
+ */
+ #if ND_IS_AT_LEAST_CLANG_VERSION(10,0)
+ #define DIAG_OFF_C11_EXTENSIONS \
+ DIAG_DO_PRAGMA(clang diagnostic push) \
+ DIAG_DO_PRAGMA(clang diagnostic ignored "-Wc11-extensions")
+ #define DIAG_ON_C11_EXTENSIONS \
+ DIAG_DO_PRAGMA(clang diagnostic pop)
+ #endif
+#elif ND_IS_AT_LEAST_GNUC_VERSION(4,2)
+ /* GCC apparently doesn't complain about ORing enums together. */
+ #define DIAG_OFF_ASSIGN_ENUM
+ #define DIAG_ON_ASSIGN_ENUM
+
+ /*
+ * It does, however, complain about casting away constness in
+ * missing/getopt_long.c.
+ */
+ #define DIAG_OFF_CAST_QUAL \
+ DIAG_DO_PRAGMA(GCC diagnostic push) \
+ DIAG_DO_PRAGMA(GCC diagnostic ignored "-Wcast-qual")
+ #define DIAG_ON_CAST_QUAL \
+ DIAG_DO_PRAGMA(GCC diagnostic pop)
+
+ /*
+ * Suppress deprecation warnings.
+ */
+ #define DIAG_OFF_DEPRECATION \
+ DIAG_DO_PRAGMA(GCC diagnostic push) \
+ DIAG_DO_PRAGMA(GCC diagnostic ignored "-Wdeprecated-declarations")
+ #define DIAG_ON_DEPRECATION \
+ DIAG_DO_PRAGMA(GCC diagnostic pop)
+ /*
+ * GCC supports -Wc99-c11-compat since version 5.1.0, but the warning does
+ * not trigger for now, so let's just leave it be.
+ */
+#else
+ #define DIAG_OFF_ASSIGN_ENUM
+ #define DIAG_ON_ASSIGN_ENUM
+ #define DIAG_OFF_CAST_QUAL
+ #define DIAG_ON_CAST_QUAL
+ #define DIAG_OFF_DEPRECATION
+ #define DIAG_ON_DEPRECATION
+#endif
+
+#ifndef DIAG_OFF_C11_EXTENSIONS
+#define DIAG_OFF_C11_EXTENSIONS
+#endif
+#ifndef DIAG_ON_C11_EXTENSIONS
+#define DIAG_ON_C11_EXTENSIONS
+#endif
+
+/*
+ * GCC needs this on AIX for longjmp().
+ */
+#if ND_IS_AT_LEAST_GNUC_VERSION(5,1)
+ /*
+ * Beware that the effect of this builtin is more than just squelching the
+ * warning! GCC trusts it enough for the process to segfault if the control
+ * flow reaches the builtin (an infinite empty loop in the same context would
+ * squelch the warning and ruin the process too, albeit in a different way).
+ * So please remember to use this very carefully.
+ */
+ #define ND_UNREACHABLE __builtin_unreachable();
+#else
+ #define ND_UNREACHABLE
+#endif
+
+#endif /* _diag_control_h */
diff --git a/contrib/tcpdump/doc/README.NetBSD.md b/contrib/tcpdump/doc/README.NetBSD.md
new file mode 100644
index 000000000000..b49be0efad5d
--- /dev/null
+++ b/contrib/tcpdump/doc/README.NetBSD.md
@@ -0,0 +1,22 @@
+# Compiling tcpdump on NetBSD
+
+NetBSD has two libpcap libraries: one that is always installed as a part of the
+OS and another that can be installed as a package from pkgsrc. Also the usual
+method of compiling with the upstream libpcap in `../libpcap` is available.
+
+GCC, Clang, Autoconf and CMake are presumed to work, if this is not the case,
+please report a bug as explained in the
+[guidelines for contributing](../CONTRIBUTING.md).
+
+## NetBSD 9.3
+
+* Upstream libpcap works.
+* OS libpcap works.
+* pkgsrc libpcap works.
+
+## NetBSD 9.2, 9.1 and 9.0
+
+* Upstream libpcap works.
+* OS libpcap cannot be used due to
+ [this bug](https://gnats.netbsd.org/cgi-bin/query-pr-single.pl?number=55901).
+
diff --git a/contrib/tcpdump/doc/README.Win32.md b/contrib/tcpdump/doc/README.Win32.md
new file mode 100644
index 000000000000..b7e81d1cf1c4
--- /dev/null
+++ b/contrib/tcpdump/doc/README.Win32.md
@@ -0,0 +1,200 @@
+Building tcpdump on Windows with Visual Studio
+==============================================
+
+Unlike the UN*Xes on which libpcap can capture network traffic, Windows
+has no network traffic capture mechanism that libpcap can use.
+Therefore, libpcap requires a driver, and a library to access the
+driver, provided by the Npcap or WinPcap projects.
+
+Those projects include versions of libpcap built to use that driver and
+library; these instructions are for people who want to build libpcap
+source releases, or libpcap from the Git repository, as a replacement
+for the version provided with Npcap or WinPcap.
+
+Npcap and WinPcap SDK
+---------------------
+
+In order to build tcpdump, you will need to download Npcap and its
+software development kit (SDK) or WinPcap and its software development
+kit.
+
+Npcap is currently being developed and maintained, and offers many
+additional capabilities that WinPcap does not.
+
+WinPcap is no longer being developed or maintained; it should be used
+only if there is some other requirement to use it rather than Npcap,
+such as a requirement to support versions of Windows earlier than
+Windows Vista, which is the earliest version supported by Npcap.
+
+Npcap and its SDK can be downloaded from its [home page](https://npcap.com).
+The SDK is a ZIP archive; create a folder on your `C:` drive, e.g.
+`C:\npcap-sdk`, and put the contents of the ZIP archive into that folder.
+
+The WinPcap installer can be downloaded from
+[here](https://www.winpcap.org/install/default.htm)
+and the WinPcap Developer's Kit can be downloaded from
+[here](https://www.winpcap.org/devel.htm).
+
+Required build tools
+--------------------
+
+The Developer's Kit is a ZIP archive; it contains a folder named
+`WpdPack`, which you should place on your `C:` drive, e.g. `C:\WpdPack`.
+
+Building tcpdump on Windows requires Visual Studio 2015 or later. The
+Community Edition of Visual Studio can be downloaded at no cost from
+[here](https://visualstudio.microsoft.com).
+
+Additional tools are also required. Chocolatey is a package manager for
+Windows with which those tools, and other tools, can be installed; it
+can be downloaded from [here](https://chocolatey.org).
+
+It is a command-line tool; a GUI tool, Chocolatey GUI, is provided as a
+Chocolatey package, which can be installed from the command line:
+
+```
+choco install chocolateygui
+```
+
+For convenience, the `choco install` command can be run with the `-y`
+flag, forcing it to automatically answer all questions asked of the user
+with "yes":
+
+```
+choco install -y chocolateygui
+```
+
+The required tools are:
+
+### CMake ###
+
+libpcap does not provide supported project files for Visual Studio
+(there are currently unsupported project files provided, but we do not
+guarantee that they will work or that we will continue to provide them).
+It does provide files for CMake, which is a cross-platform tool that
+runs on UN\*Xes and on Windows and that can generate project files for
+UN\*X Make, the Ninja build system, and Visual Studio, among other build
+systems.
+
+Visual Studio 2015 does not provide CMake; an installer can be
+downloaded from [here](https://cmake.org/download/).
+
+When you run the installer, you should choose to add CMake to the system
+`PATH` for all users and to create the desktop icon.
+
+CMake can also be installed as the Chocolatey package `cmake`:
+
+```
+choco install -y cmake
+```
+
+Visual Studio 2017 and later provide CMake, so you will not need to
+install CMake if you have installed Visual Studio 2017 or later. They
+include built-in support for CMake-based projects as described
+[here](https://devblogs.microsoft.com/cppblog/cmake-support-in-visual-studio/).
+
+For Visual Studio 2017, make sure "Visual C++ tools for CMake" is
+installed; for Visual Studio 2019, make sure "C++ CMake tools for
+Windows" is installed.
+
+Git
+---
+
+An optional tool, required only if you will be building from a Git
+repository rather than from a release source tarball, is Git. Git is
+provided as an optional installation component, "Git for Windows", with
+Visual Studio 2017 and later.
+
+Building from the Visual Studio GUI
+-----------------------------------
+
+### Visual Studio 2017 ###
+
+Open the folder containing the libpcap source with Open > Folder.
+Visual Studio will run CMake; however, you will need to indicate where
+the Npcap or WinPcap SDK is installed.
+
+To do this, go to Project > "Change CMake Settings" > tcpdump and:
+
+Choose which configuration type to build, if you don't want the default
+Debug build.
+
+In the CMakeSettings.json tab, change cmakeCommandArgs to include
+
+```
+-DPacket_ROOT={path-to-sdk}
+```
+
+where `{path-to-sdk}` is the path of the directory containing the Npcap or
+WinPcap SDK. Note that backslashes in the path must be specified as two
+backslashes.
+
+Save the configuration changes with File > "Save CMakeSettings.json" or
+with Control-S.
+
+Visual Studio will then re-run CMake. If that completes without errors,
+you can build with CMake > "Build All".
+
+### Visual Studio 2019 ###
+
+Open the folder containing the libpcap source with Open > Folder.
+Visual Studio will run CMake; however, you will need to indicate where
+the Npcap or WinPcap SDK is installed.
+
+To do this, go to Project > "CMake Settings for tcpdump" and:
+
+Choose which configuration type to build, if you don't want the default
+Debug build.
+
+Scroll down to "Cmake variables and cache", scroll through the list
+looking for the entry for Packet_ROOT, and either type in the path of
+the directory containing the Npcap or WinPcap SDK or use the "Browse..."
+button to browse for that directory.
+
+Save the configuration changes with File > "Save CMakeSettings.json" or
+with Control-S.
+
+Visual Studio will then re-run CMake. If that completes without errors,
+you can build with Build > "Build All".
+
+Building from the command line
+------------------------------
+
+Start the appropriate Native Tools command line prompt.
+
+Change to the directory into which you want to build tcpdump, possibly
+after creating it first. One choice is to create it as a subdirectory
+of the tcpdump source directory.
+
+Run the command
+
+```
+cmake "-DPacket_ROOT={path-to-sdk}" -G {generator} {path-to-tcpdump-source}
+```
+
+`{path-to-sdk}` is the path of the directory containing the Npcap or
+WinPcap SDK.
+
+`{generator}` is the string "Visual Studio N YYYY", where `N` is the
+version of Visual Studio and `YYYY` is the year number for that version;
+if you are building a 64-bit version of tcpdump, `YYYY` must be followed
+by a space and "Win64". For example, to build a 32-bit version of
+tcpdump with Visual Studio 2017, `{generator}` would be "Visual Studio
+15 2017" and to build a 64-bit version of tcpdump with Visual Studio
+2017, `{generator}` would be "Visual Studio 15 2017 Win64".
+
+`{path-to-tcpdump-source}` is the pathname of the top-level source
+directory for tcpdump.
+
+Run the command
+
+```
+msbuild /m /nologo /p:Configuration={configuration} tcpdump.sln
+```
+
+where `{configuration}` can be "Release", "Debug", or "RelWithDebInfo".
+
+Building with MinGW
+-------------------
+
+(XXX - this should be added)
diff --git a/contrib/tcpdump/doc/README.aix.md b/contrib/tcpdump/doc/README.aix.md
new file mode 100644
index 000000000000..3bfa550be10a
--- /dev/null
+++ b/contrib/tcpdump/doc/README.aix.md
@@ -0,0 +1,17 @@
+# Compiling tcpdump on AIX
+
+* Autoconf works everywhere.
+
+## AIX 7.1/POWER7
+
+* Only local libpcap is suitable.
+* CMake 3.16.0 does not work.
+* GCC 8.3.0 and XL C 12.1.0.0 work.
+* System m4 does not work, GNU m4 1.4.17 works.
+
+## AIX 7.2/POWER8
+
+* Only local libpcap is suitable.
+* GCC 7.2.0 and XL C 13.1.3.6 work.
+* System m4 does not work, GNU m4 1.4.17 works.
+
diff --git a/contrib/tcpdump/doc/README.solaris.md b/contrib/tcpdump/doc/README.solaris.md
new file mode 100644
index 000000000000..afdd8f7356e1
--- /dev/null
+++ b/contrib/tcpdump/doc/README.solaris.md
@@ -0,0 +1,41 @@
+# Compiling tcpdump on Solaris and related OSes
+
+* Autoconf works everywhere.
+
+## OmniOS r151042/AMD64
+
+* Both system and local libpcap are suitable.
+* CMake 3.23.1 works.
+* GCC 11.2.0 and Clang 14.0.3 work.
+
+## OpenIndiana 2021.04/AMD64
+
+* Both system and local libpcap are suitable.
+* CMake 3.21.1 works.
+* GCC 7.5.0 and GCC 10.3.0 work, Clang 9.0.1 works.
+
+For reference, the tests were done using a system installed from
+`OI-hipster-text-20210430.iso` plus the following packages:
+```shell
+xargs -L1 pkg install <<ENDOFTEXT
+developer/build/autoconf
+developer/build/cmake
+developer/gcc-10
+developer/clang-90
+ENDOFTEXT
+```
+
+## Oracle Solaris 11.4.42/AMD64
+
+* Both system and local libpcap are suitable.
+* GCC 11.2 and Clang 11.0 work.
+
+For reference, the tests were done on a VM booted from `sol-11_4-vbox.ova`
+and updated to 11.4.42.111.0 plus the following packages:
+```shell
+xargs -L1 pkg install <<ENDOFTEXT
+developer/build/autoconf
+developer/gcc
+developer/llvm/clang
+ENDOFTEXT
+```
diff --git a/contrib/tcpdump/ethertype.h b/contrib/tcpdump/ethertype.h
index 2aa53a08823d..8b71b3025523 100644
--- a/contrib/tcpdump/ethertype.h
+++ b/contrib/tcpdump/ethertype.h
@@ -20,6 +20,13 @@
*/
/*
+ * Maximum length of the length field in an Ethernet header; any value
+ * greater than this is not a length value, so it's either an Ethernet
+ * type or an invalid value.
+ */
+#define MAX_ETHERNET_LENGTH_VAL 1500
+
+/*
* Ethernet types.
*
* We wrap the declarations with #ifdef, so that if a file includes
@@ -106,8 +113,8 @@
#endif
/* see:
- http://en.wikipedia.org/wiki/IEEE_802.1Q
- and http://en.wikipedia.org/wiki/QinQ
+ https://en.wikipedia.org/wiki/IEEE_802.1Q
+ and https://en.wikipedia.org/wiki/QinQ
*/
#ifndef ETHERTYPE_8021Q9100
#define ETHERTYPE_8021Q9100 0x9100
@@ -118,6 +125,9 @@
#ifndef ETHERTYPE_8021QinQ
#define ETHERTYPE_8021QinQ 0x88a8
#endif
+#ifndef ETHERTYPE_MACSEC
+#define ETHERTYPE_MACSEC 0x88e5
+#endif
#ifndef ETHERTYPE_IPX
#define ETHERTYPE_IPX 0x8137
#endif
@@ -145,6 +155,9 @@
#ifndef ETHERTYPE_PPPOES
#define ETHERTYPE_PPPOES 0x8864
#endif
+#ifndef ETHERTYPE_NSH
+#define ETHERTYPE_NSH 0x894F
+#endif
#ifndef ETHERTYPE_PPPOED2
#define ETHERTYPE_PPPOED2 0x3c12
#endif
@@ -161,13 +174,16 @@
#define ETHERTYPE_LLDP 0x88cc
#endif
#ifndef ETHERTYPE_EAPOL
-#define ETHERTYPE_EAPOL 0x888e
+#define ETHERTYPE_EAPOL 0x888e
#endif
-#ifndef ETHERTYPE_RRCP
-#define ETHERTYPE_RRCP 0x8899
+#ifndef ETHERTYPE_REALTEK
+#define ETHERTYPE_REALTEK 0x8899 /* Realtek layer 2 protocols and switch tags */
#endif
#ifndef ETHERTYPE_AOE
-#define ETHERTYPE_AOE 0x88a2
+#define ETHERTYPE_AOE 0x88a2
+#endif
+#ifndef ETHERTYPE_PTP
+#define ETHERTYPE_PTP 0x88f7
#endif
#ifndef ETHERTYPE_LOOPBACK
#define ETHERTYPE_LOOPBACK 0x9000
@@ -196,8 +212,8 @@
#ifndef ETHERTYPE_GEONET
#define ETHERTYPE_GEONET 0x8947 /* ETSI GeoNetworking (Official IEEE registration from Jan 2013) */
#endif
-#ifndef ETHERTYPE_MEDSA
-#define ETHERTYPE_MEDSA 0xdada /* Marvel Distributed Switch Architecture */
+#ifndef ETHERTYPE_ARISTA
+#define ETHERTYPE_ARISTA 0xd28b /* Arista Networks vendor specific EtherTyp