--- /dev/null	Sun Mar 13 14:59:14 1994
+++ ./GNUmakefile	Sat Feb 21 15:49:20 1998
@@ -0,0 +1,24 @@
+# %%% copyright-cmetz-96
+# This software is Copyright 1996-1998 by Craig Metz, All Rights Reserved.
+# The Inner Net License Version 2 applies to this software.
+# You should have received a copy of the license with this software. If
+# you didn't get a copy, you may request one from <license@inner.net>.
+#
+
+ifndef CONFIG_DIR
+CONFIG_DIR=/usr/inet6/lib/
+endif
+
+include $(CONFIG_DIR)GNUmakefile.inc
+
+CFLAGS+=$(DINET6) $(DIPSEC)
+
+all install:
+	if [ ! -f Makefile.autoconf ]; then sh ./configure --prefix=$(DESTDIR) --sbindir=$(DESTDIR)$(USR_SBINDIR); fi
+	$(MAKE) -f Makefile.autoconf XCFLAGS="$(CFLAGS)" XLIBS="$(LOADLIBES)" $@
+
+clean:
+	if [ -f Makefile.autoconf ]; then $(MAKE) -f Makefile.autoconf $@; fi
+
+realclean:
+	if [ -f Makefile.autoconf ]; then $(MAKE) -f Makefile.autoconf distclean; fi
--- Makefile.in	Mon Jul 28 01:15:42 1997
+++ Makefile.in	Sat Feb 21 15:22:52 1998
@@ -1,3 +1,8 @@
+#
+# This file has been slightly modified by NRL for use with IPv6+IPsec.
+# Search for INET6 and/or IPSEC to see the blocks where this happened.
+# See the NRL Copyright notice for conditions on the modifications.
+#
 #  Copyright (c) 1993, 1994, 1995, 1996
 # 	The Regents of the University of California.  All rights reserved.
 #
@@ -47,7 +52,7 @@
 DEFS = @DEFS@
 
 # Standard CFLAGS
-CFLAGS = $(CCOPT) $(INCLS) $(DEFS)
+CFLAGS = $(CCOPT) $(INCLS) $(DEFS) $(XCFLAGS)
 
 INSTALL = @INSTALL@
 RANLIB = @V_RANLIB@
@@ -118,27 +123,19 @@
 	@rm -f $@
 	sed -e 's/.*/char pcap_version[] = "&";/' $(srcdir)/VERSION > $@
 
-install: force
-	$(INSTALL) -m 444 -o bin -g bin libpcap.a $(DESTDIR)$(LIBDEST)/libpcap.a
+install: libpcap.a
+	$(INSTALL) -m 444 libpcap.a $(DESTDIR)$(LIBDEST)
 	$(RANLIB) $(DESTDIR)$(LIBDEST)/libpcap.a
-
-install-incl: force
-	$(INSTALL) -m 444 -o bin -g bin $(srcdir)/pcap.h \
-	    $(DESTDIR)$(INCLDEST)/pcap.h
-	$(INSTALL) -m 444 -o bin -g bin $(srcdir)/pcap-namedb.h \
-	    $(DESTDIR)$(INCLDEST)/pcap-namedb.h
-	$(INSTALL) -m 444 -o bin -g bin $(srcdir)/net/bpf.h \
-	    $(DESTDIR)$(INCLDEST)/net/bpf.h
-
-install-man: force
-	$(INSTALL) -m 444 -o bin -g bin $(srcdir)/pcap.3 \
-	    $(DESTDIR)$(MANDEST)/man3/pcap.3
+	$(INSTALL) -m 444 $(srcdir)/pcap.h $(DESTDIR)$(INCLDEST)
+	$(INSTALL) -m 444 $(srcdir)/pcap-namedb.h $(DESTDIR)$(INCLDEST)
+	$(INSTALL) -m 444 $(srcdir)/net/bpf.h $(DESTDIR)$(INCLDEST)/net
+	$(INSTALL) -m 444 $(srcdir)/pcap.3 $(DESTDIR)$(MANDEST)/man3
 
 clean:
 	rm -f $(CLEANFILES)
 
 distclean:
-	rm -f $(CLEANFILES) Makefile config.cache config.log config.status \
+	rm -f $(CLEANFILES) Makefile.autoconf config.cache config.log config.status \
 	    gnuc.h os-proto.h bpf_filter.c net
 
 tags: $(TAGFILES)
--- /dev/null	Sun Mar 13 14:59:14 1994
+++ ./README.ipv6	Sat Feb 21 15:49:20 1998
@@ -0,0 +1,33 @@
+IPv6 Support Patch for libpcap 0.4a6
+====================================
+
+  This program has been modified to support IPv6. Please see the notices on
+individual files for the copyrights and licenses that apply to the changes.
+This package REQUIRES that the inet6-apps package be installed first. That
+package also contains more documentation and the actual license notices
+referenced in the copyright notice.
+
+History
+=======
+
+1       Initial release. Run through the user-space BPF even when the LSF
+	being used -- the LSF is letting packets through that it shouldn't.
+	Fixed realclean target.
+
+Pre-History
+===========
+
+libpcap 0.4a5
+
+1       Initial release. Updated patches and merged in stuff from ANK's
+        patches. Added support for the Linux Socket Filter.
+
+libpcap-0.4a2
+
+1       Initial release.
+
+libpcap-0.3.1a2
+
+2       Updated makefile.
+1       Initial release independent of inet6-apps.
+
--- config.guess	Fri Nov 29 17:38:35 1996
+++ config.guess	Sat Feb 21 15:22:52 1998
@@ -407,26 +407,26 @@
 	# first see if it will tell us.
 	ld_help_string=`ld --help 2>&1`
 	if echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: elf_i.86"; then
-	  echo "${UNAME_MACHINE}-pc-linux-gnu" ; exit 0
+	  echo "${UNAME_MACHINE}-pc-linux" ; exit 0
 	elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: i.86linux"; then
-	  echo "${UNAME_MACHINE}-pc-linux-gnuaout" ; exit 0
+	  echo "${UNAME_MACHINE}-pc-linux-aout" ; exit 0
 	elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: i.86coff"; then
-	  echo "${UNAME_MACHINE}-pc-linux-gnucoff" ; exit 0
+	  echo "${UNAME_MACHINE}-pc-linux-coff" ; exit 0
 	elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: m68kelf"; then
-	  echo "${UNAME_MACHINE}-unknown-linux-gnu" ; exit 0
+	  echo "${UNAME_MACHINE}-unknown-linux" ; exit 0
 	elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: m68klinux"; then
-	  echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0
+	  echo "${UNAME_MACHINE}-unknown-linux-aout" ; exit 0
 	elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: elf32ppc"; then
-	  echo "powerpc-unknown-linux-gnu" ; exit 0
+	  echo "powerpc-unknown-linux" ; exit 0
 	elif test "${UNAME_MACHINE}" = "alpha" ; then
-	  echo alpha-unknown-linux-gnu ; exit 0
+	  echo alpha-unknown-linux ; exit 0
 	elif test "${UNAME_MACHINE}" = "sparc" ; then
-	  echo sparc-unknown-linux-gnu ; exit 0
+	  echo sparc-unknown-linux ; exit 0
 	else
-	  # Either a pre-BFD a.out linker (linux-gnuoldld) or one that does not give us
-	  # useful --help.  Gcc wants to distinguish between linux-gnuoldld and linux-gnuaout.
+	  # Either a pre-BFD a.out linker (linux-oldld) or one that does not give us
+	  # useful --help.  Gcc wants to distinguish between linux-oldld and linux-aout.
 	  test ! -d /usr/lib/ldscripts/. \
-	    && echo "${UNAME_MACHINE}-pc-linux-gnuoldld" && exit 0
+	    && echo "${UNAME_MACHINE}-pc-linux-oldld" && exit 0
 	  # Determine whether the default compiler is a.out or elf
 	  cat >dummy.c <<EOF
 main(argc, argv)
@@ -434,9 +434,9 @@
 char *argv[];
 {
 #ifdef __ELF__
-  printf ("%s-pc-linux-gnu\n", argv[1]);
+  printf ("%s-pc-linux\n", argv[1]);
 #else
-  printf ("%s-pc-linux-gnuaout\n", argv[1]);
+  printf ("%s-pc-linux-aout\n", argv[1]);
 #endif
   return 0;
 }
--- config.sub	Fri Nov 29 17:38:36 1996
+++ config.sub	Sat Feb 21 15:22:52 1998
@@ -68,7 +68,7 @@
 # Here we must recognize all the valid KERNEL-OS combinations.
 maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
 case $maybe_os in
-  linux-gnu*)
+  linux*)
     os=-$maybe_os
     basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
     ;;
@@ -671,9 +671,6 @@
 	-unixware* | svr4*)
 		os=-sysv4
 		;;
-	-gnu/linux*)
-		os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
-		;;
 	# First accept the basic system types.
 	# The portable systems comes first.
 	# Each alternative MUST END IN A *, to match a version number.
@@ -689,11 +686,8 @@
 	      | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
 	      | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
 	      | -cygwin32* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
-	      | -linux-gnu* | -uxpv*)
+	      | -linux* | -uxpv*)
 	# Remember, each alternative MUST END IN *, to match a version number.
-		;;
-	-linux*)
-		os=`echo $os | sed -e 's|linux|linux-gnu|'`
 		;;
 	-sunos5*)
 		os=`echo $os | sed -e 's|sunos5|solaris2|'`
--- configure	Fri Jan 30 21:32:18 1998
+++ configure	Sat Feb 21 15:22:52 1998
@@ -1959,7 +1959,7 @@
 ac_given_srcdir=$srcdir
 ac_given_INSTALL="$INSTALL"
 
-trap 'rm -fr `echo "Makefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
+trap 'rm -fr `echo "Makefile.autoconf:Makefile.in" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
 EOF
 cat >> $CONFIG_STATUS <<EOF
 
@@ -2056,7 +2056,7 @@
 
 cat >> $CONFIG_STATUS <<EOF
 
-CONFIG_FILES=\${CONFIG_FILES-"Makefile"}
+CONFIG_FILES=\${CONFIG_FILES-"Makefile.autoconf:Makefile.in"}
 EOF
 cat >> $CONFIG_STATUS <<\EOF
 for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
--- configure.in	Mon Jul 28 01:16:01 1997
+++ configure.in	Sat Feb 21 15:22:53 1998
@@ -1,4 +1,13 @@
 dnl @(#) $Header: configure.in,v 1.67 97/07/27 22:16:17 leres Exp $ (LBL)
+dnl
+dnl %%% portions-copyright-cmetz-97
+dnl Portions of this software are Copyright 1997-1998 by Craig Metz, All Rights
+dnl Reserved. The Inner Net License Version 2 applies to these portions of
+dnl the software.
+dnl You should have received a copy of the license with this software. If
+dnl you didn't get a copy, you may request one from <license@inner.net>.
+dnl
+
 dnl
 dnl Copyright (c) 1994, 1995, 1996, 1997
 dnl	The Regents of the University of California.  All rights reserved.
@@ -181,7 +190,7 @@
 
 AC_PROG_INSTALL
 
-AC_OUTPUT(Makefile)
+AC_OUTPUT(Makefile.autoconf:Makefile.in)
 
 if test -f .devel ; then
 	make depend
--- nametoaddr.c	Fri Jun 13 16:16:01 1997
+++ nametoaddr.c	Sat Feb 21 15:22:53 1998
@@ -1,4 +1,9 @@
 /*
+ * This file has been slightly modified by NRL for use with IPv6+IPsec.
+ * Search for INET6 and/or IPSEC to see the blocks where this happened.
+ * See the NRL Copyright notice for conditions on the modifications.
+ */
+/*
  * Copyright (c) 1990, 1991, 1992, 1993, 1994, 1995, 1996
  *	The Regents of the University of California.  All rights reserved.
  *
@@ -201,6 +206,10 @@
 	{ "loopback", ETHERTYPE_LOOPBACK },
 	{ "decdts", ETHERTYPE_DECDTS },
 	{ "decdns", ETHERTYPE_DECDNS },
+#ifndef ETHERTYPE_IPV6
+#define ETHERTYPE_IPV6 0x86dd
+#endif /* ETHERTYPE_IPV6 */
+	{ "ipv6", ETHERTYPE_IPV6 },
 	{ (char *)0, 0 }
 };
 
--- pcap-linux.c	Fri Oct  3 01:39:32 1997
+++ pcap-linux.c	Sat Feb 21 15:22:53 1998
@@ -1,4 +1,20 @@
 /*
+%%% portions-copyright-cmetz-98
+Portions of this software are Copyright 1998 by Craig Metz, All Rights
+Reserved. The Inner Net License Version 2 applies to these portions of
+the software.
+You should have received a copy of the license with this software. If
+you didn't get a copy, you may request one from <license@inner.net>.
+
+*/
+
+/*
+Portions of the PF_PACKET support were taken from patches written by Alexey
+Kuznetsov. There's no copyright statement on those chunks, but I'm guessing
+he'd want GPL. Give him credit and me blame -- cmetz 
+*/
+
+/*
  * Copyright (c) 1996, 1997
  *	The Regents of the University of California.  All rights reserved.
  *
@@ -36,6 +52,14 @@
 #endif
 #include <linux/if_ether.h>
 
+#ifdef PF_PACKET
+#include <linux/if_packet.h>
+
+#ifndef SOL_PACKET
+#define SOL_PACKET 263
+#endif /* SOL_PACKET */
+#endif /* PF_PACKET */
+
 #include <netinet/in.h>
 
 #include <errno.h>
@@ -71,7 +95,11 @@
 	register int bufsize;
 	register int caplen;
 	register u_char *bp;
+#ifdef PF_PACKET
+	struct sockaddr_ll from;
+#else /* PF_PACKET */
 	struct sockaddr from;
+#endif /* PF_PACKET */
 	int fromlen;
 
 	bp = p->buffer + p->offset;
@@ -85,7 +113,7 @@
 again:
 	do {
 		fromlen = sizeof(from);
-		cc = recvfrom(p->fd, bp, bufsize, 0, &from, &fromlen);
+		cc = recvfrom(p->fd, bp, bufsize, 0, (struct sockaddr *)&from, &fromlen);
 		if (cc < 0) {
 			/* Don't choke when we get ptraced */
 			switch (errno) {
@@ -99,7 +127,11 @@
 			sprintf(p->errbuf, "read: %s", pcap_strerror(errno));
 			return (-1);
 		}
+#ifdef PF_PACKET
+	} while (0);
+#else /* PF_PACKET */
 	} while (strcmp(p->md.device, from.sa_data));
+#endif /* PF_PACKET */
 
 	/* If we need have leading zero bytes, adjust count */
 	cc += p->md.pad;
@@ -143,7 +175,11 @@
 	register int fd, broadcast;
 	register pcap_t *p;
 	struct ifreq ifr;
+#if PF_PACKET
+	struct sockaddr_ll sa;
+#else /* PF_PACKET */
 	struct sockaddr sa;
+#endif /* PF_PACKET */
 
 	p = (pcap_t *)malloc(sizeof(*p));
 	if (p == NULL) {
@@ -153,7 +189,11 @@
 	memset(p, 0, sizeof(*p));
 	fd = -1;
 
+#ifdef PF_PACKET
+	fd = socket(PF_PACKET, SOCK_RAW, htons(ETH_P_ALL));
+#else /* PF_PACKET */
 	fd = socket(PF_INET, SOCK_PACKET, htons(ETH_P_ALL));
+#endif /* PF_PACKET */
 	if (fd < 0) {
 		sprintf(ebuf, "socket: %s", pcap_strerror(errno));
 		goto bad;
@@ -162,13 +202,50 @@
 
 	/* Bind to the interface name */
 	memset(&sa, 0, sizeof(sa));
+#ifdef PF_PACKET
+	strcpy(ifr.ifr_name, device);
+	if (ioctl(p->fd, SIOCGIFINDEX, &ifr) < 0) {
+	    sprintf(ebuf, "ioctl(...,SIOCGIFINDEX,...): %s", pcap_strerror(errno));
+	    goto bad;
+	}
+	sa.sll_family = AF_PACKET;
+	sa.sll_ifindex = ifr.ifr_ifindex;
+	sa.sll_protocol = htons(ETH_P_ALL);
+#else /* PF_PACKET */
 	sa.sa_family = AF_INET;
 	(void)strncpy(sa.sa_data, device, sizeof(sa.sa_data));
-	if (bind(p->fd, &sa, sizeof(sa))) {
+#endif /* PF_PACKET */
+	if (bind(p->fd, (struct sockaddr *)&sa, sizeof(sa))) {
 		sprintf(ebuf, "bind: %s: %s", device, pcap_strerror(errno));
 		goto bad;
 	}
 
+#if 0 /* def PF_PACKET */
+	if (!promisc) {
+		struct packet_mreq mr;
+		memset(&mr, 0, sizeof(mr));
+		mr.mr_ifindex = sa.sll_ifindex;
+		mr.mr_type = PACKET_MR_ALLMULTI;
+		if (setsockopt(p->fd, SOL_PACKET, PACKET_ADD_MEMBERSHIP, (char *)&mr, sizeof(mr)) < 0) {
+			sprintf(ebuf, "setsockopt %s: %s", device, pcap_strerror(errno));
+			goto bad;
+		}
+	}
+#endif /* PF_PACKET */
+
+#ifdef PF_PACKET
+	{
+	struct packet_mreq mr;
+	memset(&mr, 0, sizeof(mr));
+	mr.mr_ifindex = sa.sll_ifindex;
+	mr.mr_type = promisc ? PACKET_MR_PROMISC : PACKET_MR_ALLMULTI;
+	if (setsockopt(p->fd, SOL_PACKET, PACKET_ADD_MEMBERSHIP, (char *)&mr, sizeof(mr)) < 0) {
+		sprintf(ebuf, "setsockopt %s: %s", device, pcap_strerror(errno));
+		goto bad;
+	}
+	}
+#endif /* PF_PACKET */
+
 	memset(&ifr, 0, sizeof(ifr));
 	strncpy(ifr.ifr_name, device, sizeof(ifr.ifr_name));
 	if (ioctl(p->fd, SIOCGIFHWADDR, &ifr) < 0 ) {
@@ -273,6 +350,7 @@
 		goto bad;
 	}
 
+#ifndef PF_PACKET
 	/* XXX */
 	if (promisc && broadcast) {
 		memset(&ifr, 0, sizeof(ifr));
@@ -290,6 +368,7 @@
 		ifr.ifr_flags &= ~IFF_PROMISC;
 		atexit(linux_restore_ifr);
 	}
+#endif /* PF_PACKET */
 
 	p->md.device = strdup(device);
 	if (p->md.device == NULL) {
@@ -313,6 +392,20 @@
 int
 pcap_setfilter(pcap_t *p, struct bpf_program *fp)
 {
+#ifdef SO_ATTACH_FILTER
+  if (!p->sf.rfile) {
+    if (!setsockopt(p->fd, SOL_SOCKET, SO_ATTACH_FILTER, fp, sizeof(struct bpf_program))) {
+      memset(&p->fcode, 0, sizeof(p->fcode));
+#if 0
+      return 0;
+#endif /* 0 */
+    };
+    if ((errno != ENOPROTOOPT) && (errno != EOPNOTSUPP)) {
+      sprintf(p->errbuf, "SO_ATTACH_FILTER: %s(%d)", pcap_strerror(errno), errno);
+      return -1;
+    };
+  };
+#endif /* SO_ATTACH_FILTER */
 
 	p->fcode = *fp;
 	return (0);
