18056927 Update libpcap to 1.5.1 s11u1-sru
authorNorm Jacobs <Norm.Jacobs@Oracle.COM>
Tue, 21 Jan 2014 15:46:29 -0800
branchs11u1-sru
changeset 2908 8f5c62cdd648
parent 2907 b70f4f71f1b5
child 2909 a4709a200379
18056927 Update libpcap to 1.5.1
components/libpcap/Makefile
components/libpcap/libpcap.p5m
components/libpcap/patches/10-biocsetlif.patch
components/libpcap/patches/20-zonenameprefix.patch
components/libpcap/patches/30-getifaddrs.patch
components/libpcap/patches/40-ipoib.patch
--- a/components/libpcap/Makefile	Tue Jan 21 15:46:29 2014 -0800
+++ b/components/libpcap/Makefile	Tue Jan 21 15:46:29 2014 -0800
@@ -18,17 +18,17 @@
 #
 # CDDL HEADER END
 #
-# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
 #
 include ../../make-rules/shared-macros.mk
 
 COMPONENT_NAME=		libpcap
-COMPONENT_VERSION=	1.1.1
+COMPONENT_VERSION=	1.5.1
 COMPONENT_PROJECT_URL=	http://www.tcpdump.org/
 COMPONENT_SRC=		$(COMPONENT_NAME)-$(COMPONENT_VERSION)
 COMPONENT_ARCHIVE=	$(COMPONENT_SRC).tar.gz
 COMPONENT_ARCHIVE_HASH=	\
-    sha256:508cca15547e55d1318498b838456a21770c450beb2dc7d7d4a96d90816e5a85
+    sha256:259db4fe1e9f0b6b9c43a057ec5916dec7d0a821b00d6d6c4dff7db2445fa7e4
 COMPONENT_ARCHIVE_URL=	$(COMPONENT_PROJECT_URL)release/$(COMPONENT_ARCHIVE)
 
 include ../../make-rules/prep.mk
@@ -41,6 +41,7 @@
 #
 CC += $(CC_BITS)
 CONFIGURE_OPTIONS  +=	CFLAGS="$(CFLAGS) -DHAVE_CONFIG_H"
+CONFIGURE_OPTIONS  +=	--disable-dbus
 
 # common targets
 build:		$(BUILD_32_and_64)
--- a/components/libpcap/libpcap.p5m	Tue Jan 21 15:46:29 2014 -0800
+++ b/components/libpcap/libpcap.p5m	Tue Jan 21 15:46:29 2014 -0800
@@ -18,7 +18,7 @@
 #
 # CDDL HEADER END
 #
-# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
 #
 <transform file path=usr.*/man/.+ -> default mangler.man.stability uncommitted>
 # The libpcap man pages should go in section 3pcap instead of
@@ -27,27 +27,19 @@
 set name=pkg.fmri \
     value=pkg:/system/library/[email protected]$(IPS_COMPONENT_VERSION),$(BUILD_VERSION)
 set name=pkg.summary value="Packet capture library"
+set name=pkg.description \
+    value="The library provides a portable framework for low-level network monitoring and user-level packet capture. Applications include network statistics collection, security monitoring, network debugging, etc."
+set name=com.oracle.info.description value="the libpcap package capture library"
+set name=com.oracle.info.tpno value=15968
 set name=info.classification \
     value=org.opensolaris.category.2008:System/Libraries
 set name=info.source-url value=$(COMPONENT_ARCHIVE_URL)
 set name=info.upstream-url value=$(COMPONENT_PROJECT_URL)
-set name=org.opensolaris.arc-caseid \
-    value=PSARC/2008/288
+set name=org.opensolaris.arc-caseid value=PSARC/2008/288
 set name=org.opensolaris.consolidation value=$(CONSOLIDATION)
 #
-dir path=usr
-dir path=usr/include
-dir path=usr/lib
-dir path=usr/lib/$(MACH64)
-dir path=usr/share
-dir path=usr/share/man
-dir path=usr/share/man/man1
-dir path=usr/share/man/man3pcap
-dir path=usr/share/man/man4
-dir path=usr/share/man/man5
-#
+file path=usr/bin/$(MACH64)/pcap-config
 file path=usr/bin/pcap-config
-file path=usr/bin/$(MACH64)/pcap-config
 file path=usr/include/pcap-bpf.h
 file path=usr/include/pcap-namedb.h
 file path=usr/include/pcap.h
@@ -59,8 +51,12 @@
 file path=usr/include/pcap/sll.h
 file path=usr/include/pcap/usb.h
 file path=usr/include/pcap/vlan.h
-file path=usr/lib/$(MACH64)/libpcap.so.1.1.1
-file path=usr/lib/libpcap.so.1.1.1
+link path=usr/lib/$(MACH64)/libpcap.so target=libpcap.so.1
+link path=usr/lib/$(MACH64)/libpcap.so.1 target=libpcap.so.1.5.1
+file path=usr/lib/$(MACH64)/libpcap.so.1.5.1
+link path=usr/lib/libpcap.so target=libpcap.so.1
+link path=usr/lib/libpcap.so.1 target=libpcap.so.1.5.1
+file path=usr/lib/libpcap.so.1.5.1
 file path=usr/share/man/man1/pcap-config.1
 file path=usr/share/man/man3pcap/pcap.3pcap
 file path=usr/share/man/man3pcap/pcap_activate.3pcap
@@ -71,40 +67,70 @@
 file path=usr/share/man/man3pcap/pcap_create.3pcap
 file path=usr/share/man/man3pcap/pcap_datalink.3pcap
 file path=usr/share/man/man3pcap/pcap_datalink_name_to_val.3pcap
+link path=usr/share/man/man3pcap/pcap_datalink_val_to_description.3pcap \
+    target=pcap_datalink_val_to_name.3pcap
 file path=usr/share/man/man3pcap/pcap_datalink_val_to_name.3pcap
+link path=usr/share/man/man3pcap/pcap_dispatch.3pcap target=pcap_loop.3pcap
 file path=usr/share/man/man3pcap/pcap_dump.3pcap
 file path=usr/share/man/man3pcap/pcap_dump_close.3pcap
 file path=usr/share/man/man3pcap/pcap_dump_file.3pcap
 file path=usr/share/man/man3pcap/pcap_dump_flush.3pcap
+link path=usr/share/man/man3pcap/pcap_dump_fopen.3pcap \
+    target=pcap_dump_open.3pcap
 file path=usr/share/man/man3pcap/pcap_dump_ftell.3pcap
 file path=usr/share/man/man3pcap/pcap_dump_open.3pcap
 file path=usr/share/man/man3pcap/pcap_file.3pcap
 file path=usr/share/man/man3pcap/pcap_fileno.3pcap
 file path=usr/share/man/man3pcap/pcap_findalldevs.3pcap
-file path=usr/share/man/man3pcap/pcap_fopen_offline.3pcap
-file path=usr/share/man/man3pcap/pcap_free_datalinks.3pcap
-file path=usr/share/man/man3pcap/pcap_freealldevs.3pcap
+link path=usr/share/man/man3pcap/pcap_fopen_offline.3pcap \
+    target=pcap_open_offline.3pcap
+link \
+    path=usr/share/man/man3pcap/pcap_fopen_offline_with_tstamp_precision.3pcap \
+    target=pcap_open_offline.3pcap
+link path=usr/share/man/man3pcap/pcap_free_datalinks.3pcap \
+    target=pcap_list_datalinks.3pcap
+link path=usr/share/man/man3pcap/pcap_free_tstamp_types.3pcap \
+    target=pcap_list_tstamp_types.3pcap
+link path=usr/share/man/man3pcap/pcap_freealldevs.3pcap \
+    target=pcap_findalldevs.3pcap
 file path=usr/share/man/man3pcap/pcap_freecode.3pcap
 file path=usr/share/man/man3pcap/pcap_get_selectable_fd.3pcap
+file path=usr/share/man/man3pcap/pcap_get_tstamp_precision.3pcap
+file path=usr/share/man/man3pcap/pcap_geterr.3pcap
+link path=usr/share/man/man3pcap/pcap_getnonblock.3pcap \
+    target=pcap_setnonblock.3pcap
 file path=usr/share/man/man3pcap/pcap_inject.3pcap
 file path=usr/share/man/man3pcap/pcap_is_swapped.3pcap
 file path=usr/share/man/man3pcap/pcap_lib_version.3pcap
 file path=usr/share/man/man3pcap/pcap_list_datalinks.3pcap
+file path=usr/share/man/man3pcap/pcap_list_tstamp_types.3pcap
 file path=usr/share/man/man3pcap/pcap_lookupdev.3pcap
 file path=usr/share/man/man3pcap/pcap_lookupnet.3pcap
 file path=usr/share/man/man3pcap/pcap_loop.3pcap
 file path=usr/share/man/man3pcap/pcap_major_version.3pcap
-file path=usr/share/man/man3pcap/pcap_next.3pcap
+link path=usr/share/man/man3pcap/pcap_minor_version.3pcap \
+    target=pcap_major_version.3pcap
+link path=usr/share/man/man3pcap/pcap_next.3pcap target=pcap_next_ex.3pcap
+file path=usr/share/man/man3pcap/pcap_next_ex.3pcap
 file path=usr/share/man/man3pcap/pcap_offline_filter.3pcap
 file path=usr/share/man/man3pcap/pcap_open_dead.3pcap
+link path=usr/share/man/man3pcap/pcap_open_dead_with_tstamp_precision.3pcap \
+    target=pcap_open_dead.3pcap
 file path=usr/share/man/man3pcap/pcap_open_live.3pcap
-file path=usr/share/man/man3pcap/pcap_perror.3pcap
+file path=usr/share/man/man3pcap/pcap_open_offline.3pcap
+link path=usr/share/man/man3pcap/pcap_open_offline_with_tstamp_precision.3pcap \
+    target=pcap_open_offline.3pcap
+link path=usr/share/man/man3pcap/pcap_perror.3pcap target=pcap_geterr.3pcap
+link path=usr/share/man/man3pcap/pcap_sendpacket.3pcap target=pcap_inject.3pcap
 file path=usr/share/man/man3pcap/pcap_set_buffer_size.3pcap
 file path=usr/share/man/man3pcap/pcap_set_datalink.3pcap
+file path=usr/share/man/man3pcap/pcap_set_immediate_mode.3pcap
 file path=usr/share/man/man3pcap/pcap_set_promisc.3pcap
 file path=usr/share/man/man3pcap/pcap_set_rfmon.3pcap
 file path=usr/share/man/man3pcap/pcap_set_snaplen.3pcap
 file path=usr/share/man/man3pcap/pcap_set_timeout.3pcap
+file path=usr/share/man/man3pcap/pcap_set_tstamp_precision.3pcap
+file path=usr/share/man/man3pcap/pcap_set_tstamp_type.3pcap
 file path=usr/share/man/man3pcap/pcap_setdirection.3pcap
 file path=usr/share/man/man3pcap/pcap_setfilter.3pcap
 file path=usr/share/man/man3pcap/pcap_setnonblock.3pcap
@@ -112,29 +138,11 @@
 file path=usr/share/man/man3pcap/pcap_stats.3pcap
 file path=usr/share/man/man3pcap/pcap_statustostr.3pcap
 file path=usr/share/man/man3pcap/pcap_strerror.3pcap
+file path=usr/share/man/man3pcap/pcap_tstamp_type_name_to_val.3pcap
+file path=usr/share/man/man3pcap/pcap_tstamp_type_val_to_name.3pcap
 file path=usr/share/man/man4/pcap-savefile.4
 file path=usr/share/man/man5/pcap-filter.5
 file path=usr/share/man/man5/pcap-linktype.5
+file path=usr/share/man/man5/pcap-tstamp.5
+#
 license license.pcap license=BSD
-link path=usr/lib/$(MACH64)/libpcap.so target=./libpcap.so.1.1.1
-link path=usr/lib/$(MACH64)/libpcap.so.1 target=./libpcap.so.1.1.1
-link path=usr/lib/libpcap.so target=./libpcap.so.1.1.1
-link path=usr/lib/libpcap.so.1 target=./libpcap.so.1.1.1
-link path=usr/share/man/man3pcap/pcap_datalink_val_to_description.3pcap \
-    target=./pcap_datalink_val_to_name.3pcap
-link path=usr/share/man/man3pcap/pcap_dispatch.3pcap \
-    target=./pcap_loop.3pcap
-link path=usr/share/man/man3pcap/pcap_dump_fopen.3pcap \
-    target=./pcap_dump_open.3pcap
-link path=usr/share/man/man3pcap/pcap_geterr.3pcap \
-    target=./pcap_perror.3pcap
-link path=usr/share/man/man3pcap/pcap_getnonblock.3pcap \
-    target=./pcap_setnonblock.3pcap
-link path=usr/share/man/man3pcap/pcap_minor_version.3pcap \
-    target=./pcap_major_version.3pcap
-link path=usr/share/man/man3pcap/pcap_next_ex.3pcap \
-    target=./pcap_next.3pcap
-link path=usr/share/man/man3pcap/pcap_open_offline.3pcap \
-    target=./pcap_fopen_offline.3pcap
-link path=usr/share/man/man3pcap/pcap_sendpacket.3pcap \
-    target=./pcap_inject.3pcap
--- a/components/libpcap/patches/10-biocsetlif.patch	Tue Jan 21 15:46:29 2014 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,71 +0,0 @@
---- libpcap-1.1.1/pcap-bpf.c	Thu Mar 11 17:56:54 2010
-+++ patched-libpcap-1.1.1/pcap-bpf.c	Tue Jul 12 14:49:10 2011
[email protected]@ -1392,7 +1392,15 @@
- {
- 	int status = 0;
- 	int fd;
-+#ifdef LIFNAMSIZ
-+	struct lifreq ifr;
-+	char *ifrname = ifr.lifr_name;
-+	const size_t ifnamsiz = sizeof(ifr.lifr_name);
-+#else
- 	struct ifreq ifr;
-+	char *ifrname = ifr.ifr_name;
-+	const size_t ifnamsiz = sizeof(ifr.ifr_name);
-+#endif
- 	struct bpf_version bv;
- #ifdef __APPLE__
- 	int sockfd;
[email protected]@ -1484,9 +1492,7 @@
- 					 */
- 					sockfd = socket(AF_INET, SOCK_DGRAM, 0);
- 					if (sockfd != -1) {
--						strlcpy(ifr.ifr_name,
--						    p->opt.source,
--						    sizeof(ifr.ifr_name));
-+						strlcpy(ifrname, p->opt.source, ifnamsiz);
- 						if (ioctl(sockfd, SIOCGIFFLAGS,
- 						    (char *)&ifr) < 0) {
- 							/*
[email protected]@ -1608,7 +1614,7 @@
- 			    pcap_strerror(errno));
- 			goto bad;
- 		}
--		(void)strncpy(ifr.ifr_name, p->opt.source, sizeof(ifr.ifr_name));
-+		(void)strncpy(ifrname, p->opt.source, ifrnamsiz);
- 		if (ioctl(fd, BIOCSETIF, (caddr_t)&ifr) < 0) {
- 			snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "BIOCSETIF: %s: %s",
- 			    p->opt.source, pcap_strerror(errno));
[email protected]@ -1638,9 +1644,14 @@
- 			/*
- 			 * Now bind to the device.
- 			 */
--			(void)strncpy(ifr.ifr_name, p->opt.source,
--			    sizeof(ifr.ifr_name));
--			if (ioctl(fd, BIOCSETIF, (caddr_t)&ifr) < 0) {
-+			(void)strncpy(ifrname, p->opt.source, ifnamsiz);
-+#ifdef BIOCSETLIF
-+			if (ioctl(fd, BIOCSETLIF, (caddr_t)&ifr) < 0)
-+#else
-+
-+			if (ioctl(fd, BIOCSETIF, (caddr_t)&ifr) < 0)
-+#endif
-+			{
- 				status = check_setif_failure(p, errno);
- 				goto bad;
- 			}
[email protected]@ -1667,9 +1678,12 @@
- 				 */
- 				(void) ioctl(fd, BIOCSBLEN, (caddr_t)&v);
- 
--				(void)strncpy(ifr.ifr_name, p->opt.source,
--				    sizeof(ifr.ifr_name));
-+				(void)strncpy(ifrname, p->opt.source, ifnamsiz);
-+#ifdef BIOCSETLIF
-+				if (ioctl(fd, BIOCSETLIF, (caddr_t)&ifr) >= 0)
-+#else
- 				if (ioctl(fd, BIOCSETIF, (caddr_t)&ifr) >= 0)
-+#endif
- 					break;	/* that size worked; we're done */
- 
- 				if (errno != ENOBUFS) {
--- a/components/libpcap/patches/20-zonenameprefix.patch	Tue Jan 21 15:46:29 2014 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,51 +0,0 @@
---- libpcap-1.1.1/pcap-bpf-patch1.c	Mon Jul 18 16:40:47 2011
-+++ patched-libpcap-1.1.1/pcap-bpf.c	Mon Jul 18 16:38:14 2011
[email protected]@ -155,6 +155,10 @@
- 
- #endif /* BIOCGDLTLIST */
- 
-+#if defined(sun) && defined(LIFNAMSIZ) && defined(lifr_zoneid)
-+#include <zone.h>
-+#endif
-+
- /*
-  * We include the OS's <net/bpf.h>, not our "pcap/bpf.h", so we probably
-  * don't get DLT_DOCSIS defined.
[email protected]@ -1393,6 +1397,7 @@
- 	int status = 0;
- 	int fd;
- #ifdef LIFNAMSIZ
-+	char *zonesep;
- 	struct lifreq ifr;
- 	char *ifrname = ifr.lifr_name;
- 	const size_t ifnamsiz = sizeof(ifr.lifr_name);
[email protected]@ -1447,6 +1452,29 @@
- 		goto bad;
- 	}
- 
-+#if defined(LIFNAMSIZ) && defined(ZONENAME_MAX) && defined(lifr_zoneid)
-+	/*
-+	 * Check if the given source network device has a '/' separated
-+	 * zonename prefix string. The zonename prefixed source device
-+	 * can be used by libpcap consumers to capture network traffic
-+	 * in non-global zones from the global zone on Solaris 11 and
-+	 * above. If the zonename prefix is present then we strip the
-+	 * prefix and pass the zone ID as part of lifr_zoneid.
-+	 */
-+	if ((zonesep = strchr(p->opt.source, '/')) != NULL) {
-+		char zonename[ZONENAME_MAX];
-+		int  znamelen;
-+		char *lnamep;
-+
-+		znamelen = zonesep - p->opt.source;
-+		(void) strlcpy(zonename, p->opt.source, znamelen + 1);
-+		lnamep = strdup(zonesep + 1);
-+		ifr.lifr_zoneid = getzoneidbyname(zonename);
-+		free(p->opt.source);
-+		p->opt.source = lnamep;
-+	}
-+#endif
-+
- 	p->md.device = strdup(p->opt.source);
- 	if (p->md.device == NULL) {
- 		snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "strdup: %s",
--- a/components/libpcap/patches/30-getifaddrs.patch	Tue Jan 21 15:46:29 2014 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,11 +0,0 @@
---- libpcap-1.1.1/fad-getad.c	Mon Apr  5 10:54:05 2010
-+++ patched-libpcap-1.1.1/fad-getad.c	Wed Jul 20 14:50:56 2011
[email protected]@ -64,7 +64,7 @@
- # ifdef __Lynx__
- /* LynxOS */
- #  include <netpacket/if_packet.h>
--# else
-+# elif defined(linux)
- /* Linux */
- #  include <linux/types.h>
- #  include <linux/if_packet.h>
--- a/components/libpcap/patches/40-ipoib.patch	Tue Jan 21 15:46:29 2014 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,91 +0,0 @@
-diff -u libpcap-1.1.1/gencode.c libpcap-1.1.1.new/gencode.c
---- libpcap-1.1.1/gencode.c	Thu Mar 11 17:56:54 2010
-+++ libpcap-1.1.1.new/gencode.c	Thu Jul 14 08:29:39 2011
[email protected]@ -1588,6 +1588,13 @@
- 		off_nl = 0;
- 		off_nl_nosnap = -1;
- 		return;
-+
-+	case DLT_IPOIB:
-+		off_linktype = 40;
-+		off_macpl = 44;		/* IPoIB mac_ib prefix length */
-+		off_nl = 0;
-+		off_nl_nosnap = -1;
-+		return;
- 	}
- 	bpf_error("unknown data link type %d", linktype);
- 	/* NOTREACHED */
[email protected]@ -2048,6 +2055,16 @@
- 	return gen_false();
- }
- 
-+static struct block *
-+gen_ipoib_linktype(proto)
-+	register int proto;
-+{
-+	/*
-+	 * This is an Ethernet type, so compare the length field with it.
-+	 */
-+	return gen_cmp(OR_LINK, off_linktype, BPF_H, (bpf_int32)proto);
-+}
-+
- /*
-  * Generate code to match a particular packet type.
-  *
[email protected]@ -3474,6 +3491,9 @@
- 	case DLT_IPNET:
- 		return gen_ipnet_linktype(proto);
- 
-+	case DLT_IPOIB:
-+		return gen_ipoib_linktype(proto);
-+
- 	case DLT_LINUX_IRDA:
- 		bpf_error("IrDA link-layer type filtering not implemented");
- 
-diff -u libpcap-1.1.1/pcap-common.c libpcap-1.1.1.new/pcap-common.c
---- libpcap-1.1.1/pcap-common.c	Thu Mar 11 17:56:54 2010
-+++ libpcap-1.1.1.new/pcap-common.c	Thu Jul 14 08:25:56 2011
[email protected]@ -278,6 +278,11 @@
- #define LINKTYPE_USER15		162
- 
- /*
-+ * IPoIB for Solaris.
-+ */
-+#define	LINKTYPE_IPOIB		DLT_IPOIB
-+
-+/*
-  * For future use with 802.11 captures - defined by AbsoluteValue
-  * Systems to store a number of bits of link-layer information
-  * including radio information:
[email protected]@ -1067,6 +1072,9 @@
- 	/* Solaris IPNET */
- 	{ DLT_IPNET,		LINKTYPE_IPNET },
- 
-+	/* Solaris IPoIB */
-+	{ DLT_IPOIB,		LINKTYPE_IPOIB },
-+
- 	/* CAN frames with SocketCAN headers */
- 	{ DLT_CAN_SOCKETCAN,	LINKTYPE_CAN_SOCKETCAN },
- 
-diff -u libpcap-1.1.1/pcap.c libpcap-1.1.1.new/pcap.c
---- libpcap-1.1.1/pcap.c	Thu Mar 11 17:56:54 2010
-+++ libpcap-1.1.1.new/pcap.c	Thu Jul 14 08:29:55 2011
[email protected]@ -670,6 +670,7 @@
- 	DLT_CHOICE(DLT_FC_2, "Fibre Channel FC-2"),
- 	DLT_CHOICE(DLT_FC_2_WITH_FRAME_DELIMS, "Fibre Channel FC-2 with frame delimiters"),
- 	DLT_CHOICE(DLT_IPNET, "Solaris ipnet"),
-+	DLT_CHOICE(DLT_IPOIB, "Solaris IPoIB"),
- 	DLT_CHOICE(DLT_CAN_SOCKETCAN, "CAN-bus with SocketCAN headers"),
- 	DLT_CHOICE(DLT_IPV4, "Raw IPv4"),
- 	DLT_CHOICE(DLT_IPV6, "Raw IPv6"),
---- libpcap-1.1.1/pcap/bpf.h.dist	2010-03-11 17:56:54.000000000 -0800
-+++ libpcap-1.1.1/pcap/bpf.h	2011-07-27 03:06:09.410830949 -0700
[email protected]@ -502,6 +502,8 @@
- #define DLT_USER14		161
- #define DLT_USER15		162
- 
-+#define	DLT_IPOIB		DLT_USER15
-+
- /*
-  * For future use with 802.11 captures - defined by AbsoluteValue
-  * Systems to store a number of bits of link-layer information