svn commit: r274311 - in projects/ifnet: cddl/contrib/opensolaris/cmd/zdb cddl/contrib/opensolaris/lib/libzpool/common contrib/llvm/lib/MC/MCParser contrib/llvm/patches share/mk sys/amd64/amd64 sys...

Gleb Smirnoff glebius at FreeBSD.org
Sun Nov 9 14:07:32 UTC 2014


Author: glebius
Date: Sun Nov  9 14:07:24 2014
New Revision: 274311
URL: https://svnweb.freebsd.org/changeset/base/274311

Log:
  Merge head r256150 through r274310.

Added:
  projects/ifnet/contrib/llvm/patches/patch-r274286-llvm-r201784-asm-dollar.diff
     - copied unchanged from r274310, head/contrib/llvm/patches/patch-r274286-llvm-r201784-asm-dollar.diff
Modified:
  projects/ifnet/cddl/contrib/opensolaris/cmd/zdb/zdb.c
  projects/ifnet/cddl/contrib/opensolaris/lib/libzpool/common/taskq.c
  projects/ifnet/contrib/llvm/lib/MC/MCParser/AsmParser.cpp
  projects/ifnet/share/mk/bsd.lib.mk
  projects/ifnet/share/mk/bsd.own.mk
  projects/ifnet/share/mk/bsd.prog.mk
  projects/ifnet/sys/amd64/amd64/support.S
  projects/ifnet/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_traverse.c
  projects/ifnet/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_impl.h
  projects/ifnet/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h
  projects/ifnet/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_disk.c
  projects/ifnet/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_file.c
  projects/ifnet/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c
  projects/ifnet/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_mirror.c
  projects/ifnet/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_missing.c
  projects/ifnet/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_raidz.c
  projects/ifnet/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c
  projects/ifnet/sys/modules/if_gre/Makefile
  projects/ifnet/sys/net/if.c
  projects/ifnet/sys/net/if_clone.c
  projects/ifnet/sys/net/if_clone.h
  projects/ifnet/sys/net/if_ethersubr.c
  projects/ifnet/sys/net/if_gre.c
  projects/ifnet/sys/net/if_var.h
  projects/ifnet/sys/netinet/tcp_input.c
  projects/ifnet/sys/netinet6/frag6.c
  projects/ifnet/sys/netinet6/icmp6.c
  projects/ifnet/sys/netinet6/ip6_input.c
  projects/ifnet/sys/netinet6/ip6_var.h
  projects/ifnet/usr.sbin/ctld/Makefile
  projects/ifnet/usr.sbin/ctld/ctl.conf.5
  projects/ifnet/usr.sbin/ctld/ctld.8
  projects/ifnet/usr.sbin/ctld/ctld.c
  projects/ifnet/usr.sbin/ctld/ctld.h
  projects/ifnet/usr.sbin/ctld/login.c
  projects/ifnet/usr.sbin/ctld/parse.y
  projects/ifnet/usr.sbin/ctld/token.l
Directory Properties:
  projects/ifnet/   (props changed)
  projects/ifnet/cddl/   (props changed)
  projects/ifnet/cddl/contrib/opensolaris/   (props changed)
  projects/ifnet/contrib/llvm/   (props changed)
  projects/ifnet/share/   (props changed)
  projects/ifnet/sys/   (props changed)
  projects/ifnet/sys/cddl/contrib/opensolaris/   (props changed)

Modified: projects/ifnet/cddl/contrib/opensolaris/cmd/zdb/zdb.c
==============================================================================
--- projects/ifnet/cddl/contrib/opensolaris/cmd/zdb/zdb.c	Sun Nov  9 13:45:35 2014	(r274310)
+++ projects/ifnet/cddl/contrib/opensolaris/cmd/zdb/zdb.c	Sun Nov  9 14:07:24 2014	(r274311)
@@ -77,9 +77,11 @@
 #ifndef lint
 extern boolean_t zfs_recover;
 extern uint64_t zfs_arc_max, zfs_arc_meta_limit;
+extern int zfs_vdev_async_read_max_active;
 #else
 boolean_t zfs_recover;
 uint64_t zfs_arc_max, zfs_arc_meta_limit;
+int zfs_vdev_async_read_max_active;
 #endif
 
 const char cmdname[] = "zdb";
@@ -2384,8 +2386,14 @@ zdb_blkptr_cb(spa_t *spa, zilog_t *zilog
 
 	zcb->zcb_readfails = 0;
 
-	if (dump_opt['b'] < 5 &&
-	    gethrtime() > zcb->zcb_lastprint + NANOSEC) {
+	/* only call gethrtime() every 100 blocks */
+	static int iters;
+	if (++iters > 100)
+		iters = 0;
+	else
+		return (0);
+
+	if (dump_opt['b'] < 5 && gethrtime() > zcb->zcb_lastprint + NANOSEC) {
 		uint64_t now = gethrtime();
 		char buf[10];
 		uint64_t bytes = zcb->zcb_type[ZB_TOTAL][ZDB_OT_TOTAL].zb_asize;
@@ -2494,6 +2502,14 @@ zdb_leak_init(spa_t *spa, zdb_cb_t *zcb)
 					    (longlong_t)vd->vdev_ms_count);
 
 					msp->ms_ops = &zdb_metaslab_ops;
+
+					/*
+					 * We don't want to spend the CPU
+					 * manipulating the size-ordered
+					 * tree, so clear the range_tree
+					 * ops.
+					 */
+					msp->ms_tree->rt_ops = NULL;
 					VERIFY0(space_map_load(msp->ms_sm,
 					    msp->ms_tree, SM_ALLOC));
 					msp->ms_loaded = B_TRUE;
@@ -3508,6 +3524,13 @@ main(int argc, char **argv)
 	 */
 	zfs_arc_max = zfs_arc_meta_limit = 256 * 1024 * 1024;
 
+	/*
+	 * "zdb -c" uses checksum-verifying scrub i/os which are async reads.
+	 * "zdb -b" uses traversal prefetch which uses async reads.
+	 * For good performance, let several of them be active at once.
+	 */
+	zfs_vdev_async_read_max_active = 10;
+
 	kernel_init(FREAD);
 	g_zfs = libzfs_init();
 	ASSERT(g_zfs != NULL);

Modified: projects/ifnet/cddl/contrib/opensolaris/lib/libzpool/common/taskq.c
==============================================================================
--- projects/ifnet/cddl/contrib/opensolaris/lib/libzpool/common/taskq.c	Sun Nov  9 13:45:35 2014	(r274310)
+++ projects/ifnet/cddl/contrib/opensolaris/lib/libzpool/common/taskq.c	Sun Nov  9 14:07:24 2014	(r274311)
@@ -24,6 +24,8 @@
  */
 /*
  * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
+ * Copyright 2012 Garrett D'Amore <garrett at damore.org>.  All rights reserved.
+ * Copyright (c) 2014 by Delphix. All rights reserved.
  */
 
 #include <sys/zfs_context.h>
@@ -32,8 +34,10 @@ int taskq_now;
 taskq_t *system_taskq;
 
 #define	TASKQ_ACTIVE	0x00010000
+#define	TASKQ_NAMELEN	31
 
 struct taskq {
+	char		tq_name[TASKQ_NAMELEN + 1];
 	kmutex_t	tq_lock;
 	krwlock_t	tq_threadlock;
 	kcondvar_t	tq_dispatch_cv;
@@ -136,6 +140,7 @@ taskq_dispatch(taskq_t *tq, task_func_t 
 	t->tqent_prev->tqent_next = t;
 	t->tqent_func = func;
 	t->tqent_arg = arg;
+	t->tqent_flags = 0;
 	cv_signal(&tq->tq_dispatch_cv);
 	mutex_exit(&tq->tq_lock);
 	return (1);
@@ -245,6 +250,7 @@ taskq_create(const char *name, int nthre
 	cv_init(&tq->tq_dispatch_cv, NULL, CV_DEFAULT, NULL);
 	cv_init(&tq->tq_wait_cv, NULL, CV_DEFAULT, NULL);
 	cv_init(&tq->tq_maxalloc_cv, NULL, CV_DEFAULT, NULL);
+	(void) strncpy(tq->tq_name, name, TASKQ_NAMELEN + 1);
 	tq->tq_flags = flags | TASKQ_ACTIVE;
 	tq->tq_active = nthreads;
 	tq->tq_nthreads = nthreads;

Modified: projects/ifnet/contrib/llvm/lib/MC/MCParser/AsmParser.cpp
==============================================================================
--- projects/ifnet/contrib/llvm/lib/MC/MCParser/AsmParser.cpp	Sun Nov  9 13:45:35 2014	(r274310)
+++ projects/ifnet/contrib/llvm/lib/MC/MCParser/AsmParser.cpp	Sun Nov  9 14:07:24 2014	(r274311)
@@ -1695,7 +1695,7 @@ bool AsmParser::expandMacro(raw_svector_
                             const MCAsmMacroParameters &Parameters,
                             const MCAsmMacroArguments &A, const SMLoc &L) {
   unsigned NParameters = Parameters.size();
-  if (NParameters != 0 && NParameters != A.size())
+  if ((!IsDarwin || NParameters != 0) && NParameters != A.size())
     return Error(L, "Wrong number of arguments");
 
   // A macro without parameters is handled differently on Darwin:
@@ -1705,7 +1705,7 @@ bool AsmParser::expandMacro(raw_svector_
     std::size_t End = Body.size(), Pos = 0;
     for (; Pos != End; ++Pos) {
       // Check for a substitution or escape.
-      if (!NParameters) {
+      if (IsDarwin && !NParameters) {
         // This macro has no parameters, look for $0, $1, etc.
         if (Body[Pos] != '$' || Pos + 1 == End)
           continue;
@@ -1728,7 +1728,7 @@ bool AsmParser::expandMacro(raw_svector_
     if (Pos == End)
       break;
 
-    if (!NParameters) {
+    if (IsDarwin && !NParameters) {
       switch (Body[Pos + 1]) {
       // $$ => $
       case '$':

Copied: projects/ifnet/contrib/llvm/patches/patch-r274286-llvm-r201784-asm-dollar.diff (from r274310, head/contrib/llvm/patches/patch-r274286-llvm-r201784-asm-dollar.diff)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/ifnet/contrib/llvm/patches/patch-r274286-llvm-r201784-asm-dollar.diff	Sun Nov  9 14:07:24 2014	(r274311, copy of r274310, head/contrib/llvm/patches/patch-r274286-llvm-r201784-asm-dollar.diff)
@@ -0,0 +1,55 @@
+Pull in r201784 from upstream llvm trunk (by Benjamin Kramer):
+
+  AsmParser: Disable Darwin-style macro argument expansion on non-darwin targets.
+
+  There is code in the wild that relies on $0 not being expanded.
+
+This fixes some cases of using $ signs in literals being incorrectly
+assembled.
+
+Reported by:	Richard Henderson
+Upstream PR:	http://llvm.org/PR21500
+
+Introduced here: http://svnweb.freebsd.org/changeset/base/274286
+
+Index: lib/MC/MCParser/AsmParser.cpp
+===================================================================
+--- lib/MC/MCParser/AsmParser.cpp
++++ lib/MC/MCParser/AsmParser.cpp
+@@ -1695,7 +1695,7 @@ bool AsmParser::expandMacro(raw_svector_ostream &O
+                             const MCAsmMacroParameters &Parameters,
+                             const MCAsmMacroArguments &A, const SMLoc &L) {
+   unsigned NParameters = Parameters.size();
+-  if (NParameters != 0 && NParameters != A.size())
++  if ((!IsDarwin || NParameters != 0) && NParameters != A.size())
+     return Error(L, "Wrong number of arguments");
+ 
+   // A macro without parameters is handled differently on Darwin:
+@@ -1705,7 +1705,7 @@ bool AsmParser::expandMacro(raw_svector_ostream &O
+     std::size_t End = Body.size(), Pos = 0;
+     for (; Pos != End; ++Pos) {
+       // Check for a substitution or escape.
+-      if (!NParameters) {
++      if (IsDarwin && !NParameters) {
+         // This macro has no parameters, look for $0, $1, etc.
+         if (Body[Pos] != '$' || Pos + 1 == End)
+           continue;
+@@ -1728,7 +1728,7 @@ bool AsmParser::expandMacro(raw_svector_ostream &O
+     if (Pos == End)
+       break;
+ 
+-    if (!NParameters) {
++    if (IsDarwin && !NParameters) {
+       switch (Body[Pos + 1]) {
+       // $$ => $
+       case '$':
+Index: test/MC/AsmParser/exprs.s
+===================================================================
+--- test/MC/AsmParser/exprs.s
++++ test/MC/AsmParser/exprs.s
+@@ -1,4 +1,4 @@
+-// RUN: llvm-mc -triple i386-unknown-unknown %s > %t
++// RUN: llvm-mc -triple i386-apple-darwin %s
+ 
+ .macro check_expr
+   .if ($0) != ($1)

Modified: projects/ifnet/share/mk/bsd.lib.mk
==============================================================================
--- projects/ifnet/share/mk/bsd.lib.mk	Sun Nov  9 13:45:35 2014	(r274310)
+++ projects/ifnet/share/mk/bsd.lib.mk	Sun Nov  9 14:07:24 2014	(r274311)
@@ -36,7 +36,7 @@ NO_WERROR=
 .if defined(DEBUG_FLAGS)
 CFLAGS+= ${DEBUG_FLAGS}
 
-.if ${MK_CTF} != "no"
+.if ${MK_CTF} != "no" && ${DEBUG_FLAGS:M-g} != ""
 CTFFLAGS+= -g
 .endif
 .else

Modified: projects/ifnet/share/mk/bsd.own.mk
==============================================================================
--- projects/ifnet/share/mk/bsd.own.mk	Sun Nov  9 13:45:35 2014	(r274310)
+++ projects/ifnet/share/mk/bsd.own.mk	Sun Nov  9 14:07:24 2014	(r274311)
@@ -128,7 +128,6 @@ __<bsd.own.mk>__:
 
 .if ${MK_CTF} != "no"
 CTFCONVERT_CMD=	${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
-DEBUG_FLAGS+=	-g
 .elif defined(.PARSEDIR) || (defined(MAKE_VERSION) && ${MAKE_VERSION} >= 5201111300)
 CTFCONVERT_CMD=
 .else

Modified: projects/ifnet/share/mk/bsd.prog.mk
==============================================================================
--- projects/ifnet/share/mk/bsd.prog.mk	Sun Nov  9 13:45:35 2014	(r274310)
+++ projects/ifnet/share/mk/bsd.prog.mk	Sun Nov  9 14:07:24 2014	(r274311)
@@ -20,7 +20,7 @@ NO_WERROR=
 CFLAGS+=${DEBUG_FLAGS}
 CXXFLAGS+=${DEBUG_FLAGS}
 
-.if ${MK_CTF} != "no"
+.if ${MK_CTF} != "no" && ${DEBUG_FLAGS:M-g} != ""
 CTFFLAGS+= -g
 .endif
 .endif

Modified: projects/ifnet/sys/amd64/amd64/support.S
==============================================================================
--- projects/ifnet/sys/amd64/amd64/support.S	Sun Nov  9 13:45:35 2014	(r274310)
+++ projects/ifnet/sys/amd64/amd64/support.S	Sun Nov  9 14:07:24 2014	(r274311)
@@ -100,6 +100,8 @@ END(bcmp)
  *  ws at tools.de     (Wolfgang Solfrank, TooLs GmbH) +49-228-985800
  */
 ENTRY(bcopy)
+	pushq	%rbp
+	movq	%rsp,%rbp
 	xchgq	%rsi,%rdi
 	movq	%rdx,%rcx
 
@@ -116,6 +118,7 @@ ENTRY(bcopy)
 	andq	$7,%rcx				/* any bytes left? */
 	rep
 	movsb
+	popq	%rbp
 	ret
 
 	/* ALIGN_TEXT */
@@ -135,6 +138,7 @@ ENTRY(bcopy)
 	rep
 	movsq
 	cld
+	popq	%rbp
 	ret
 END(bcopy)
 

Modified: projects/ifnet/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_traverse.c
==============================================================================
--- projects/ifnet/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_traverse.c	Sun Nov  9 13:45:35 2014	(r274310)
+++ projects/ifnet/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_traverse.c	Sun Nov  9 14:07:24 2014	(r274311)
@@ -59,6 +59,7 @@ typedef struct traverse_data {
 	int td_flags;
 	prefetch_data_t *td_pfd;
 	boolean_t td_paused;
+	uint64_t td_hole_birth_enabled_txg;
 	blkptr_cb_t *td_func;
 	void *td_arg;
 } traverse_data_t;
@@ -229,25 +230,20 @@ traverse_visitbp(traverse_data_t *td, co
 	}
 
 	if (bp->blk_birth == 0) {
-		if (spa_feature_is_active(td->td_spa, SPA_FEATURE_HOLE_BIRTH)) {
-			/*
-			 * Since this block has a birth time of 0 it must be a
-			 * hole created before the SPA_FEATURE_HOLE_BIRTH
-			 * feature was enabled.  If SPA_FEATURE_HOLE_BIRTH
-			 * was enabled before the min_txg for this traveral we
-			 * know the hole must have been created before the
-			 * min_txg for this traveral, so we can skip it. If
-			 * SPA_FEATURE_HOLE_BIRTH was enabled after the min_txg
-			 * for this traveral we cannot tell if the hole was
-			 * created before or after the min_txg for this
-			 * traversal, so we cannot skip it.
-			 */
-			uint64_t hole_birth_enabled_txg;
-			VERIFY(spa_feature_enabled_txg(td->td_spa,
-			    SPA_FEATURE_HOLE_BIRTH, &hole_birth_enabled_txg));
-			if (hole_birth_enabled_txg < td->td_min_txg)
-				return (0);
-		}
+		/*
+		 * Since this block has a birth time of 0 it must be a
+		 * hole created before the SPA_FEATURE_HOLE_BIRTH
+		 * feature was enabled.  If SPA_FEATURE_HOLE_BIRTH
+		 * was enabled before the min_txg for this traveral we
+		 * know the hole must have been created before the
+		 * min_txg for this traveral, so we can skip it. If
+		 * SPA_FEATURE_HOLE_BIRTH was enabled after the min_txg
+		 * for this traveral we cannot tell if the hole was
+		 * created before or after the min_txg for this
+		 * traversal, so we cannot skip it.
+		 */
+		if (td->td_hole_birth_enabled_txg < td->td_min_txg)
+			return (0);
 	} else if (bp->blk_birth <= td->td_min_txg) {
 		return (0);
 	}
@@ -523,6 +519,13 @@ traverse_impl(spa_t *spa, dsl_dataset_t 
 	td.td_flags = flags;
 	td.td_paused = B_FALSE;
 
+	if (spa_feature_is_active(spa, SPA_FEATURE_HOLE_BIRTH)) {
+		VERIFY(spa_feature_enabled_txg(spa,
+		    SPA_FEATURE_HOLE_BIRTH, &td.td_hole_birth_enabled_txg));
+	} else {
+		td.td_hole_birth_enabled_txg = 0;
+	}
+
 	pd.pd_blks_max = zfs_pd_blks_max;
 	pd.pd_flags = flags;
 	mutex_init(&pd.pd_mtx, NULL, MUTEX_DEFAULT, NULL);

Modified: projects/ifnet/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_impl.h
==============================================================================
--- projects/ifnet/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_impl.h	Sun Nov  9 13:45:35 2014	(r274310)
+++ projects/ifnet/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_impl.h	Sun Nov  9 14:07:24 2014	(r274311)
@@ -60,7 +60,7 @@ typedef int	vdev_open_func_t(vdev_t *vd,
     uint64_t *logical_ashift, uint64_t *physical_ashift);
 typedef void	vdev_close_func_t(vdev_t *vd);
 typedef uint64_t vdev_asize_func_t(vdev_t *vd, uint64_t psize);
-typedef int	vdev_io_start_func_t(zio_t *zio);
+typedef void	vdev_io_start_func_t(zio_t *zio);
 typedef void	vdev_io_done_func_t(zio_t *zio);
 typedef void	vdev_state_change_func_t(vdev_t *vd, int, int);
 typedef void	vdev_hold_func_t(vdev_t *vd);

Modified: projects/ifnet/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h
==============================================================================
--- projects/ifnet/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h	Sun Nov  9 13:45:35 2014	(r274310)
+++ projects/ifnet/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h	Sun Nov  9 14:07:24 2014	(r274311)
@@ -152,9 +152,6 @@ typedef enum zio_priority {
 	ZIO_PRIORITY_NOW		/* non-queued I/Os (e.g. ioctl) */
 } zio_priority_t;
 
-#define	ZIO_PIPELINE_CONTINUE		0x100
-#define	ZIO_PIPELINE_STOP		0x101
-
 enum zio_flag {
 	/*
 	 * Flags inherited by gang, ddt, and vdev children,

Modified: projects/ifnet/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_disk.c
==============================================================================
--- projects/ifnet/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_disk.c	Sun Nov  9 13:45:35 2014	(r274310)
+++ projects/ifnet/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_disk.c	Sun Nov  9 14:07:24 2014	(r274311)
@@ -715,7 +715,7 @@ vdev_disk_ioctl_done(void *zio_arg, int 
 	zio_interrupt(zio);
 }
 
-static int
+static void
 vdev_disk_io_start(zio_t *zio)
 {
 	vdev_t *vd = zio->io_vd;
@@ -732,7 +732,7 @@ vdev_disk_io_start(zio_t *zio)
 	if (dvd == NULL || (dvd->vd_ldi_offline && dvd->vd_lh == NULL)) {
 		zio->io_error = SET_ERROR(ENXIO);
 		zio_interrupt(zio);
-		return (ZIO_PIPELINE_STOP);
+		return;
 	}
 
 	if (zio->io_type == ZIO_TYPE_IOCTL) {
@@ -740,7 +740,7 @@ vdev_disk_io_start(zio_t *zio)
 		if (!vdev_readable(vd)) {
 			zio->io_error = SET_ERROR(ENXIO);
 			zio_interrupt(zio);
-			return (ZIO_PIPELINE_STOP);
+			return;
 		}
 
 		switch (zio->io_cmd) {
@@ -771,7 +771,7 @@ vdev_disk_io_start(zio_t *zio)
 				 * and will call vdev_disk_ioctl_done()
 				 * upon completion.
 				 */
-				return (ZIO_PIPELINE_STOP);
+				return;
 			}
 
 			if (error == ENOTSUP || error == ENOTTY) {
@@ -792,8 +792,8 @@ vdev_disk_io_start(zio_t *zio)
 			zio->io_error = SET_ERROR(ENOTSUP);
 		}
 
-		zio_interrupt(zio);
-		return (ZIO_PIPELINE_STOP);
+		zio_execute(zio);
+		return;
 	}
 
 	vb = kmem_alloc(sizeof (vdev_buf_t), KM_SLEEP);
@@ -814,8 +814,6 @@ vdev_disk_io_start(zio_t *zio)
 
 	/* ldi_strategy() will return non-zero only on programming errors */
 	VERIFY(ldi_strategy(dvd->vd_lh, bp) == 0);
-
-	return (ZIO_PIPELINE_STOP);
 }
 
 static void

Modified: projects/ifnet/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_file.c
==============================================================================
--- projects/ifnet/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_file.c	Sun Nov  9 13:45:35 2014	(r274310)
+++ projects/ifnet/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_file.c	Sun Nov  9 14:07:24 2014	(r274311)
@@ -20,7 +20,7 @@
  */
 /*
  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2013 by Delphix. All rights reserved.
+ * Copyright (c) 2011, 2014 by Delphix. All rights reserved.
  */
 
 #include <sys/zfs_context.h>
@@ -154,7 +154,7 @@ vdev_file_close(vdev_t *vd)
 	vd->vdev_tsd = NULL;
 }
 
-static int
+static void
 vdev_file_io_start(zio_t *zio)
 {
 	vdev_t *vd = zio->io_vd;
@@ -165,7 +165,7 @@ vdev_file_io_start(zio_t *zio)
 	if (!vdev_readable(vd)) {
 		zio->io_error = SET_ERROR(ENXIO);
 		zio_interrupt(zio);
-		return (ZIO_PIPELINE_STOP);
+		return;
 	}
 
 	vf = vd->vdev_tsd;
@@ -181,8 +181,8 @@ vdev_file_io_start(zio_t *zio)
 			zio->io_error = SET_ERROR(ENOTSUP);
 		}
 
-		zio_interrupt(zio);
-		return (ZIO_PIPELINE_STOP);
+		zio_execute(zio);
+		return;
 	}
 
 	zio->io_error = vn_rdwr(zio->io_type == ZIO_TYPE_READ ?
@@ -194,7 +194,10 @@ vdev_file_io_start(zio_t *zio)
 
 	zio_interrupt(zio);
 
-	return (ZIO_PIPELINE_STOP);
+#ifdef illumos
+	VERIFY3U(taskq_dispatch(system_taskq, vdev_file_io_strategy, bp,
+	    TQ_SLEEP), !=, 0);
+#endif
 }
 
 /* ARGSUSED */

Modified: projects/ifnet/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c
==============================================================================
--- projects/ifnet/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c	Sun Nov  9 13:45:35 2014	(r274310)
+++ projects/ifnet/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c	Sun Nov  9 14:07:24 2014	(r274311)
@@ -788,7 +788,7 @@ vdev_geom_io_intr(struct bio *bp)
 	zio_interrupt(zio);
 }
 
-static int
+static void
 vdev_geom_io_start(zio_t *zio)
 {
 	vdev_t *vd;
@@ -803,6 +803,8 @@ vdev_geom_io_start(zio_t *zio)
 		/* XXPOLICY */
 		if (!vdev_readable(vd)) {
 			zio->io_error = SET_ERROR(ENXIO);
+			zio_interrupt(zio);
+			return;
 		} else {
 			switch (zio->io_cmd) {
 			case DKIOCFLUSHWRITECACHE:
@@ -818,23 +820,23 @@ vdev_geom_io_start(zio_t *zio)
 			}
 		}
 
-		zio_interrupt(zio);
-		return (ZIO_PIPELINE_STOP);
+		zio_execute(zio);
+		return;
 	case ZIO_TYPE_FREE:
 		if (vd->vdev_notrim) {
 			zio->io_error = SET_ERROR(ENOTSUP);
 		} else if (!vdev_geom_bio_delete_disable) {
 			goto sendreq;
 		}
-		zio_interrupt(zio);
-		return (ZIO_PIPELINE_STOP);
+		zio_execute(zio);
+		return;
 	}
 sendreq:
 	cp = vd->vdev_tsd;
 	if (cp == NULL) {
 		zio->io_error = SET_ERROR(ENXIO);
 		zio_interrupt(zio);
-		return (ZIO_PIPELINE_STOP);
+		return;
 	}
 	bp = g_alloc_bio();
 	bp->bio_caller1 = zio;
@@ -863,8 +865,6 @@ sendreq:
 	bp->bio_done = vdev_geom_io_intr;
 
 	g_io_request(bp, cp);
-
-	return (ZIO_PIPELINE_STOP);
 }
 
 static void

Modified: projects/ifnet/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_mirror.c
==============================================================================
--- projects/ifnet/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_mirror.c	Sun Nov  9 13:45:35 2014	(r274310)
+++ projects/ifnet/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_mirror.c	Sun Nov  9 14:07:24 2014	(r274311)
@@ -24,7 +24,7 @@
  */
 
 /*
- * Copyright (c) 2013 by Delphix. All rights reserved.
+ * Copyright (c) 2012, 2014 by Delphix. All rights reserved.
  */
 
 #include <sys/zfs_context.h>
@@ -425,7 +425,7 @@ vdev_mirror_child_select(zio_t *zio)
 	return (-1);
 }
 
-static int
+static void
 vdev_mirror_io_start(zio_t *zio)
 {
 	mirror_map_t *mm;
@@ -450,8 +450,8 @@ vdev_mirror_io_start(zio_t *zio)
 				    zio->io_type, zio->io_priority, 0,
 				    vdev_mirror_scrub_done, mc));
 			}
-			zio_interrupt(zio);
-			return (ZIO_PIPELINE_STOP);
+			zio_execute(zio);
+			return;
 		}
 		/*
 		 * For normal reads just pick one child.
@@ -478,8 +478,7 @@ vdev_mirror_io_start(zio_t *zio)
 		c++;
 	}
 
-	zio_interrupt(zio);
-	return (ZIO_PIPELINE_STOP);
+	zio_execute(zio);
 }
 
 static int

Modified: projects/ifnet/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_missing.c
==============================================================================
--- projects/ifnet/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_missing.c	Sun Nov  9 13:45:35 2014	(r274310)
+++ projects/ifnet/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_missing.c	Sun Nov  9 14:07:24 2014	(r274311)
@@ -24,7 +24,7 @@
  */
 
 /*
- * Copyright (c) 2013 by Delphix. All rights reserved.
+ * Copyright (c) 2012, 2014 by Delphix. All rights reserved.
  */
 
 /*
@@ -67,12 +67,11 @@ vdev_missing_close(vdev_t *vd)
 }
 
 /* ARGSUSED */
-static int
+static void
 vdev_missing_io_start(zio_t *zio)
 {
 	zio->io_error = SET_ERROR(ENOTSUP);
-	zio_interrupt(zio);
-	return (ZIO_PIPELINE_STOP);
+	zio_execute(zio);
 }
 
 /* ARGSUSED */

Modified: projects/ifnet/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_raidz.c
==============================================================================
--- projects/ifnet/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_raidz.c	Sun Nov  9 13:45:35 2014	(r274310)
+++ projects/ifnet/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_raidz.c	Sun Nov  9 14:07:24 2014	(r274311)
@@ -21,7 +21,7 @@
 
 /*
  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2013 by Delphix. All rights reserved.
+ * Copyright (c) 2012, 2014 by Delphix. All rights reserved.
  * Copyright (c) 2013, Joyent, Inc. All rights reserved.
  */
 
@@ -1726,7 +1726,7 @@ vdev_raidz_child_done(zio_t *zio)
  *      vdevs have had errors, then create zio read operations to the parity
  *      columns' VDevs as well.
  */
-static int
+static void
 vdev_raidz_io_start(zio_t *zio)
 {
 	vdev_t *vd = zio->io_vd;
@@ -1756,8 +1756,8 @@ vdev_raidz_io_start(zio_t *zio)
 			    vdev_raidz_child_done, rc));
 		}
 
-		zio_interrupt(zio);
-		return (ZIO_PIPELINE_STOP);
+		zio_execute(zio);
+		return;
 	}
 
 	if (zio->io_type == ZIO_TYPE_WRITE) {
@@ -1789,8 +1789,8 @@ vdev_raidz_io_start(zio_t *zio)
 			    ZIO_FLAG_NODATA | ZIO_FLAG_OPTIONAL, NULL, NULL));
 		}
 
-		zio_interrupt(zio);
-		return (ZIO_PIPELINE_STOP);
+		zio_execute(zio);
+		return;
 	}
 
 	ASSERT(zio->io_type == ZIO_TYPE_READ);
@@ -1830,8 +1830,7 @@ vdev_raidz_io_start(zio_t *zio)
 		}
 	}
 
-	zio_interrupt(zio);
-	return (ZIO_PIPELINE_STOP);
+	zio_execute(zio);
 }
 
 

Modified: projects/ifnet/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c
==============================================================================
--- projects/ifnet/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c	Sun Nov  9 13:45:35 2014	(r274310)
+++ projects/ifnet/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c	Sun Nov  9 14:07:24 2014	(r274311)
@@ -90,6 +90,9 @@ kmem_cache_t *zio_data_buf_cache[SPA_MAX
 extern vmem_t *zio_alloc_arena;
 #endif
 
+#define	ZIO_PIPELINE_CONTINUE		0x100
+#define	ZIO_PIPELINE_STOP		0x101
+
 /*
  * The following actions directly effect the spa's sync-to-convergence logic.
  * The values below define the sync pass when we start performing the action.
@@ -2557,6 +2560,18 @@ zio_free_zil(spa_t *spa, uint64_t txg, b
  * Read, write and delete to physical devices
  * ==========================================================================
  */
+
+
+/*
+ * Issue an I/O to the underlying vdev. Typically the issue pipeline
+ * stops after this stage and will resume upon I/O completion.
+ * However, there are instances where the vdev layer may need to
+ * continue the pipeline when an I/O was not issued. Since the I/O
+ * that was sent to the vdev layer might be different than the one
+ * currently active in the pipeline (see vdev_queue_io()), we explicitly
+ * force the underlying vdev layers to call either zio_execute() or
+ * zio_interrupt() to ensure that the pipeline continues with the correct I/O.
+ */
 static int
 zio_vdev_io_start(zio_t *zio)
 {
@@ -2575,7 +2590,8 @@ zio_vdev_io_start(zio_t *zio)
 		/*
 		 * The mirror_ops handle multiple DVAs in a single BP.
 		 */
-		return (vdev_mirror_ops.vdev_op_io_start(zio));
+		vdev_mirror_ops.vdev_op_io_start(zio);
+		return (ZIO_PIPELINE_STOP);
 	}
 
 	if (vd->vdev_ops->vdev_op_leaf && zio->io_type == ZIO_TYPE_FREE &&
@@ -2589,7 +2605,7 @@ zio_vdev_io_start(zio_t *zio)
 	 * can quickly react to certain workloads.  In particular, we care
 	 * about non-scrubbing, top-level reads and writes with the following
 	 * characteristics:
-	 * 	- synchronous writes of user data to non-slog devices
+	 *	- synchronous writes of user data to non-slog devices
 	 *	- any reads of user data
 	 * When these conditions are met, adjust the timestamp of spa_last_io
 	 * which allows the scan thread to adjust its workload accordingly.
@@ -2693,10 +2709,8 @@ zio_vdev_io_start(zio_t *zio)
 			return (ZIO_PIPELINE_STOP);
 	}
 
-	ret = vd->vdev_ops->vdev_op_io_start(zio);
-	ASSERT(ret == ZIO_PIPELINE_STOP);
-
-	return (ret);
+	vd->vdev_ops->vdev_op_io_start(zio);
+	return (ZIO_PIPELINE_STOP);
 }
 
 static int

Modified: projects/ifnet/sys/modules/if_gre/Makefile
==============================================================================
--- projects/ifnet/sys/modules/if_gre/Makefile	Sun Nov  9 13:45:35 2014	(r274310)
+++ projects/ifnet/sys/modules/if_gre/Makefile	Sun Nov  9 14:07:24 2014	(r274311)
@@ -6,10 +6,24 @@
 KMOD=	if_gre
 SRCS=	if_gre.c opt_inet.h opt_inet6.h
 
+.if defined(KERNBUILDDIR)
+OPT_INET!= cat ${KERNBUILDDIR}/opt_inet.h; echo
+.if empty(OPT_INET)
+MK_INET_SUPPORT=no
+.endif
+.endif
+
 .if ${MK_INET_SUPPORT} != "no"
 SRCS+=	ip_gre.c
 .endif
 
+.if defined(KERNBUILDDIR)
+OPT_INET6!= cat ${KERNBUILDDIR}/opt_inet6.h; echo
+.if empty(OPT_INET6)
+MK_INET6_SUPPORT=no
+.endif
+.endif
+
 .if ${MK_INET6_SUPPORT} != "no"
 SRCS+=	ip6_gre.c
 .endif

Modified: projects/ifnet/sys/net/if.c
==============================================================================
--- projects/ifnet/sys/net/if.c	Sun Nov  9 13:45:35 2014	(r274310)
+++ projects/ifnet/sys/net/if.c	Sun Nov  9 14:07:24 2014	(r274311)
@@ -159,7 +159,6 @@ static void	if_attachdomain(void *);
 static void	if_attachdomain1(struct ifnet *);
 static int	ifconf(u_long, caddr_t);
 static void	if_freemulti(struct ifmultiaddr *);
-static void	if_init(void *);
 static void	if_grow(void);
 static void	if_route(struct ifnet *, int flag, int fam);
 static int	if_setflag(struct ifnet *, int, int, int *, int);
@@ -207,7 +206,9 @@ VNET_DEFINE(struct ifnet **, ifindex_tab
  * inversions and deadlocks.
  */
 struct rwlock ifnet_rwlock;
+RW_SYSINIT_FLAGS(ifnet_rw, &ifnet_rwlock, "ifnet_rw", RW_RECURSE);
 struct sx ifnet_sxlock;
+SX_SYSINIT_FLAGS(ifnet_sx, &ifnet_sxlock, "ifnet_sx", SX_RECURSE);
 
 /*
  * The allocation of network interfaces is a rather non-atomic affair; we
@@ -364,17 +365,6 @@ vnet_if_init(const void *unused __unused
 VNET_SYSINIT(vnet_if_init, SI_SUB_INIT_IF, SI_ORDER_SECOND, vnet_if_init,
     NULL);
 
-/* ARGSUSED*/
-static void
-if_init(void *dummy __unused)
-{
-
-	IFNET_LOCK_INIT();
-	if_clone_init();
-}
-SYSINIT(interfaces, SI_SUB_INIT_IF, SI_ORDER_FIRST, if_init, NULL);
-
-
 #ifdef VIMAGE
 static void
 vnet_if_uninit(const void *unused __unused)

Modified: projects/ifnet/sys/net/if_clone.c
==============================================================================
--- projects/ifnet/sys/net/if_clone.c	Sun Nov  9 13:45:35 2014	(r274310)
+++ projects/ifnet/sys/net/if_clone.c	Sun Nov  9 14:07:24 2014	(r274311)
@@ -103,15 +103,14 @@ static int     ifc_simple_match(struct i
 static int     ifc_simple_create(struct if_clone *, char *, size_t, caddr_t);
 static int     ifc_simple_destroy(struct if_clone *, struct ifnet *);
 
-static struct mtx	if_cloners_mtx;
+static struct mtx if_cloners_mtx;
+MTX_SYSINIT(if_cloners_lock, &if_cloners_mtx, "if_cloners lock", MTX_DEF);
 static VNET_DEFINE(int, if_cloners_count);
 VNET_DEFINE(LIST_HEAD(, if_clone), if_cloners);
 
 #define	V_if_cloners_count	VNET(if_cloners_count)
 #define	V_if_cloners		VNET(if_cloners)
 
-#define IF_CLONERS_LOCK_INIT()		\
-    mtx_init(&if_cloners_mtx, "if_cloners lock", NULL, MTX_DEF)
 #define IF_CLONERS_LOCK_ASSERT()	mtx_assert(&if_cloners_mtx, MA_OWNED)
 #define IF_CLONERS_LOCK()		mtx_lock(&if_cloners_mtx)
 #define IF_CLONERS_UNLOCK()		mtx_unlock(&if_cloners_mtx)
@@ -169,13 +168,6 @@ vnet_if_clone_init(void)
 	LIST_INIT(&V_if_cloners);
 }
 
-void
-if_clone_init(void)
-{
-
-	IF_CLONERS_LOCK_INIT();
-}
-
 /*
  * Lookup and create a clone network interface.
  */

Modified: projects/ifnet/sys/net/if_clone.h
==============================================================================
--- projects/ifnet/sys/net/if_clone.h	Sun Nov  9 13:45:35 2014	(r274310)
+++ projects/ifnet/sys/net/if_clone.h	Sun Nov  9 14:07:24 2014	(r274311)
@@ -65,7 +65,6 @@ EVENTHANDLER_DECLARE(if_clone_event, if_
 #endif
 
 /* The below interfaces used only by net/if.c. */
-void	if_clone_init(void);
 void	vnet_if_clone_init(void);
 int	if_clone_create(char *, size_t, caddr_t);
 int	if_clone_destroy(const char *);

Modified: projects/ifnet/sys/net/if_ethersubr.c
==============================================================================
--- projects/ifnet/sys/net/if_ethersubr.c	Sun Nov  9 13:45:35 2014	(r274310)
+++ projects/ifnet/sys/net/if_ethersubr.c	Sun Nov  9 14:07:24 2014	(r274311)
@@ -78,11 +78,6 @@
 #ifdef INET6
 #include <netinet6/nd6.h>
 #endif
-
-int (*ef_inputp)(struct ifnet*, struct ether_header *eh, struct mbuf *m);
-int (*ef_outputp)(struct ifnet *ifp, struct mbuf **mp,
-		const struct sockaddr *dst, short *tp, int *hlen);
-
 #include <security/mac/mac_framework.h>
 
 #ifdef CTASSERT

Modified: projects/ifnet/sys/net/if_gre.c
==============================================================================
--- projects/ifnet/sys/net/if_gre.c	Sun Nov  9 13:45:35 2014	(r274310)
+++ projects/ifnet/sys/net/if_gre.c	Sun Nov  9 14:07:24 2014	(r274311)
@@ -632,6 +632,7 @@ gre_set_tunnel(struct ifnet *ifp, struct
 	gre_updatehdr(sc);
 	GRE_WUNLOCK(sc);
 
+	error = 0;
 	switch (src->sa_family) {
 #ifdef INET
 	case AF_INET:
@@ -865,6 +866,8 @@ gre_transmit(struct ifnet *ifp, struct m
 	want_seq = (sc->gre_options & GRE_ENABLE_SEQ) != 0;
 	if (want_seq)
 		oseq = sc->gre_oseq++; /* XXX */
+	else
+		oseq = 0;		/* Make compiler happy. */
 	want_csum = (sc->gre_options & GRE_ENABLE_CSUM) != 0;
 	M_SETFIB(m, sc->gre_fibnum);
 	M_PREPEND(m, hlen, M_NOWAIT);

Modified: projects/ifnet/sys/net/if_var.h
==============================================================================
--- projects/ifnet/sys/net/if_var.h	Sun Nov  9 13:45:35 2014	(r274310)
+++ projects/ifnet/sys/net/if_var.h	Sun Nov  9 14:07:24 2014	(r274311)
@@ -421,11 +421,6 @@ struct ifmultiaddr {
 extern	struct rwlock ifnet_rwlock;
 extern	struct sx ifnet_sxlock;
 
-#define	IFNET_LOCK_INIT() do {						\
-	rw_init_flags(&ifnet_rwlock, "ifnet_rw",  RW_RECURSE);		\
-	sx_init_flags(&ifnet_sxlock, "ifnet_sx",  SX_RECURSE);		\
-} while(0)
-
 #define	IFNET_WLOCK() do {						\
 	sx_xlock(&ifnet_sxlock);					\
 	rw_wlock(&ifnet_rwlock);					\

Modified: projects/ifnet/sys/netinet/tcp_input.c
==============================================================================
--- projects/ifnet/sys/netinet/tcp_input.c	Sun Nov  9 13:45:35 2014	(r274310)
+++ projects/ifnet/sys/netinet/tcp_input.c	Sun Nov  9 14:07:24 2014	(r274311)
@@ -513,6 +513,7 @@ tcp6_input(struct mbuf **mp, int *offp, 
 {
 	struct mbuf *m = *mp;
 	struct in6_ifaddr *ia6;
+	struct ip6_hdr *ip6;
 
 	IP6_EXTHDR_CHECK(m, *offp, sizeof(struct tcphdr), IPPROTO_DONE);
 
@@ -520,7 +521,8 @@ tcp6_input(struct mbuf **mp, int *offp, 
 	 * draft-itojun-ipv6-tcp-to-anycast
 	 * better place to put this in?
 	 */
-	ia6 = ip6_getdstifaddr(m);
+	ip6 = mtod(m, struct ip6_hdr *);
+	ia6 = in6ifa_ifwithaddr(&ip6->ip6_dst, 0 /* XXX */);
 	if (ia6 && (ia6->ia6_flags & IN6_IFF_ANYCAST)) {
 		struct ip6_hdr *ip6;
 
@@ -1251,7 +1253,7 @@ relocked:
 		if (isipv6 && !V_ip6_use_deprecated) {
 			struct in6_ifaddr *ia6;
 
-			ia6 = ip6_getdstifaddr(m);
+			ia6 = in6ifa_ifwithaddr(&ip6->ip6_dst, 0 /* XXX */);
 			if (ia6 != NULL &&
 			    (ia6->ia6_flags & IN6_IFF_DEPRECATED)) {
 				ifa_free(&ia6->ia_ifa);

Modified: projects/ifnet/sys/netinet6/frag6.c
==============================================================================
--- projects/ifnet/sys/netinet6/frag6.c	Sun Nov  9 13:45:35 2014	(r274310)
+++ projects/ifnet/sys/netinet6/frag6.c	Sun Nov  9 14:07:24 2014	(r274311)
@@ -59,13 +59,6 @@ __FBSDID("$FreeBSD$");
 
 #include <security/mac/mac_framework.h>
 
-/*
- * Define it to get a correct behavior on per-interface statistics.
- * You will need to perform an extra routing table lookup, per fragment,
- * to do it.  This may, or may not be, a performance hit.
- */
-#define IN6_IFSTAT_STRICT
-
 static void frag6_enq(struct ip6asfrag *, struct ip6asfrag *);
 static void frag6_deq(struct ip6asfrag *);
 static void frag6_insque(struct ip6q *, struct ip6q *);
@@ -160,9 +153,7 @@ frag6_input(struct mbuf **mp, int *offp,
 	struct ip6_frag *ip6f;
 	struct ip6q *q6;
 	struct ip6asfrag *af6, *ip6af, *af6dwn;
-#ifdef IN6_IFSTAT_STRICT
 	struct in6_ifaddr *ia;
-#endif
 	int offset = *offp, nxt, i, next;
 	int first_frag = 0;
 	int fragoff, frgpartlen;	/* must be larger than u_int16_t */
@@ -183,18 +174,12 @@ frag6_input(struct mbuf **mp, int *offp,
 #endif
 
 	dstifp = NULL;
-#ifdef IN6_IFSTAT_STRICT
 	/* find the destination interface of the packet. */
-	if ((ia = ip6_getdstifaddr(m)) != NULL) {
+	ia = in6ifa_ifwithaddr(&ip6->ip6_dst, 0 /* XXX */);
+	if (ia != NULL) {
 		dstifp = ia->ia_ifp;
 		ifa_free(&ia->ia_ifa);
 	}
-#else
-	/* we are violating the spec, this is not the destination interface */
-	if ((m->m_flags & M_PKTHDR) != 0)
-		dstifp = m->m_pkthdr.rcvif;
-#endif
-
 	/* jumbo payload can't contain a fragment header */
 	if (ip6->ip6_plen == 0) {
 		icmp6_error(m, ICMP6_PARAM_PROB, ICMP6_PARAMPROB_HEADER, offset);

Modified: projects/ifnet/sys/netinet6/icmp6.c
==============================================================================
--- projects/ifnet/sys/netinet6/icmp6.c	Sun Nov  9 13:45:35 2014	(r274310)
+++ projects/ifnet/sys/netinet6/icmp6.c	Sun Nov  9 14:07:24 2014	(r274311)
@@ -1313,7 +1313,8 @@ ni6_input(struct mbuf *m, int off)
 			goto bad;
 		/* else it's a link-local multicast, fine */
 	} else {		/* unicast or anycast */
-		if ((ia6 = ip6_getdstifaddr(m)) == NULL)
+		ia6 = in6ifa_ifwithaddr(&ip6->ip6_dst, 0 /* XXX */);
+		if (ia6 == NULL)
 			goto bad; /* XXX impossible */
 
 		if ((ia6->ia6_flags & IN6_IFF_TEMPORARY) &&
@@ -2136,13 +2137,13 @@ icmp6_rip6_input(struct mbuf **mp, int o
 void
 icmp6_reflect(struct mbuf *m, size_t off)
 {
+	struct in6_addr src, *srcp = NULL;
 	struct ip6_hdr *ip6;
 	struct icmp6_hdr *icmp6;
 	struct in6_ifaddr *ia = NULL;
+	struct ifnet *outif = NULL;
 	int plen;
 	int type, code;
-	struct ifnet *outif = NULL;
-	struct in6_addr origdst, src, *srcp = NULL;
 
 	/* too short to reflect */
 	if (off < sizeof(struct ip6_hdr)) {
@@ -2189,43 +2190,18 @@ icmp6_reflect(struct mbuf *m, size_t off
 	type = icmp6->icmp6_type; /* keep type for statistics */
 	code = icmp6->icmp6_code; /* ditto. */
 
-	origdst = ip6->ip6_dst;
-	/*
-	 * ip6_input() drops a packet if its src is multicast.
-	 * So, the src is never multicast.
-	 */
-	ip6->ip6_dst = ip6->ip6_src;
-
 	/*
 	 * If the incoming packet was addressed directly to us (i.e. unicast),
 	 * use dst as the src for the reply.
 	 * The IN6_IFF_NOTREADY case should be VERY rare, but is possible
 	 * (for example) when we encounter an error while forwarding procedure
 	 * destined to a duplicated address of ours.
-	 * Note that ip6_getdstifaddr() may fail if we are in an error handling
-	 * procedure of an outgoing packet of our own, in which case we need
-	 * to search in the ifaddr list.
 	 */
-	if (!IN6_IS_ADDR_MULTICAST(&origdst)) {
-		if ((ia = ip6_getdstifaddr(m))) {
-			if (!(ia->ia6_flags &
-			    (IN6_IFF_ANYCAST|IN6_IFF_NOTREADY)))
-				srcp = &ia->ia_addr.sin6_addr;
-		} else {
-			struct sockaddr_in6 d;
-
-			bzero(&d, sizeof(d));
-			d.sin6_family = AF_INET6;
-			d.sin6_len = sizeof(d);
-			d.sin6_addr = origdst;
-			ia = (struct in6_ifaddr *)
-			    ifa_ifwithaddr((struct sockaddr *)&d);
-			if (ia &&
-			    !(ia->ia6_flags &
-			    (IN6_IFF_ANYCAST|IN6_IFF_NOTREADY))) {
-				srcp = &ia->ia_addr.sin6_addr;
-			}
-		}
+	if (!IN6_IS_ADDR_MULTICAST(&ip6->ip6_dst)) {
+		ia = in6ifa_ifwithaddr(&ip6->ip6_dst, 0 /* XXX */);
+		if (ia != NULL && !(ia->ia6_flags &
+		    (IN6_IFF_ANYCAST|IN6_IFF_NOTREADY)))
+			srcp = &ia->ia_addr.sin6_addr;
 	}
 
 	if (srcp == NULL) {
@@ -2257,7 +2233,11 @@ icmp6_reflect(struct mbuf *m, size_t off
 		}
 		srcp = &src;
 	}
-
+	/*
+	 * ip6_input() drops a packet if its src is multicast.
+	 * So, the src is never multicast.
+	 */
+	ip6->ip6_dst = ip6->ip6_src;

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***


More information about the svn-src-projects mailing list