Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 16 Apr 2015 21:54:08 +0000 (UTC)
From:      Garrett Cooper <ngie@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-user@freebsd.org
Subject:   svn commit: r281621 - in user/ngie/more-tests: . bin/csh etc/mtree include lib/libcompiler_rt sbin/pfctl share/man/man3 share/mk sys/amd64/vmm/amd sys/arm64/conf sys/boot/forth sys/conf sys/contrib...
Message-ID:  <201504162154.t3GLs8Di007246@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ngie
Date: Thu Apr 16 21:54:08 2015
New Revision: 281621
URL: https://svnweb.freebsd.org/changeset/base/281621

Log:
  MFhead @ r281620

Added:
  user/ngie/more-tests/sys/crypto/aesni/aesni_os.h
     - copied unchanged from r281620, head/sys/crypto/aesni/aesni_os.h
  user/ngie/more-tests/sys/net/altq/
     - copied from r281620, head/sys/net/altq/
Deleted:
  user/ngie/more-tests/sys/contrib/altq/
Modified:
  user/ngie/more-tests/Makefile.inc1
  user/ngie/more-tests/ObsoleteFiles.inc
  user/ngie/more-tests/UPDATING
  user/ngie/more-tests/bin/csh/iconv_stub.h
  user/ngie/more-tests/etc/mtree/BSD.include.dist
  user/ngie/more-tests/include/Makefile
  user/ngie/more-tests/lib/libcompiler_rt/Makefile
  user/ngie/more-tests/sbin/pfctl/parse.y
  user/ngie/more-tests/sbin/pfctl/pfctl.c
  user/ngie/more-tests/sbin/pfctl/pfctl_altq.c
  user/ngie/more-tests/sbin/pfctl/pfctl_qstats.c
  user/ngie/more-tests/share/man/man3/queue.3
  user/ngie/more-tests/share/mk/src.libnames.mk
  user/ngie/more-tests/sys/amd64/vmm/amd/svm.c
  user/ngie/more-tests/sys/arm64/conf/DEFAULTS
  user/ngie/more-tests/sys/boot/forth/check-password.4th
  user/ngie/more-tests/sys/boot/forth/check-password.4th.8
  user/ngie/more-tests/sys/boot/forth/loader.conf
  user/ngie/more-tests/sys/conf/files
  user/ngie/more-tests/sys/conf/kern.pre.mk
  user/ngie/more-tests/sys/conf/kmod.mk
  user/ngie/more-tests/sys/crypto/aesni/aesencdec.h
  user/ngie/more-tests/sys/crypto/aesni/aesni_ghash.c
  user/ngie/more-tests/sys/dev/usb/wlan/if_urtwn.c
  user/ngie/more-tests/sys/kern/init_main.c
  user/ngie/more-tests/sys/net/if_var.h
  user/ngie/more-tests/sys/net/ifq.h
  user/ngie/more-tests/sys/netinet/tcp_subr.c
  user/ngie/more-tests/sys/netinet/tcp_timer.c
  user/ngie/more-tests/sys/netinet/tcp_timer.h
  user/ngie/more-tests/sys/netinet/tcp_var.h
  user/ngie/more-tests/sys/netpfil/pf/pf_ioctl.c
  user/ngie/more-tests/sys/sys/param.h
  user/ngie/more-tests/sys/sys/procfs.h
  user/ngie/more-tests/usr.bin/wc/wc.c
  user/ngie/more-tests/usr.sbin/bhyve/bhyverun.c
  user/ngie/more-tests/usr.sbin/bsdinstall/scripts/zfsboot
Directory Properties:
  user/ngie/more-tests/   (props changed)
  user/ngie/more-tests/etc/   (props changed)
  user/ngie/more-tests/include/   (props changed)
  user/ngie/more-tests/sbin/   (props changed)
  user/ngie/more-tests/share/   (props changed)
  user/ngie/more-tests/sys/   (props changed)
  user/ngie/more-tests/sys/amd64/vmm/   (props changed)
  user/ngie/more-tests/sys/boot/   (props changed)
  user/ngie/more-tests/sys/conf/   (props changed)
  user/ngie/more-tests/usr.sbin/bhyve/   (props changed)

Modified: user/ngie/more-tests/Makefile.inc1
==============================================================================
--- user/ngie/more-tests/Makefile.inc1	Thu Apr 16 21:49:15 2015	(r281620)
+++ user/ngie/more-tests/Makefile.inc1	Thu Apr 16 21:54:08 2015	(r281621)
@@ -1304,12 +1304,10 @@ _lex=		usr.bin/lex
 _awk=		usr.bin/awk
 .endif
 
-.if ${BOOTSTRAPPING} < 1001506
 _yacc=		lib/liby \
 		usr.bin/yacc
 
 ${_bt}-usr.bin/yacc: ${_bt}-lib/liby
-.endif
 
 .if ${MK_BSNMP} != "no"
 _gensnmptree=	usr.sbin/bsnmpd/gensnmptree
@@ -1359,8 +1357,13 @@ _kerberos5_bootstrap_tools= \
 	kerberos5/tools/slc \
 	usr.bin/compile_et
 
-${_bt}-kerberos5/tools/slc: ${_bt}-kerberos5/lib/libroken
-${_bt}-kerberos5/tools/asn1_compile: ${_bt}-kerberos5/lib/libroken
+${_bt}-kerberos5/lib/libroken: ${_bt}-kerberos5/tools/make-roken
+${_bt}-kerberos5/tools/asn1_compile: \
+    ${_bt}-kerberos5/lib/libroken ${_bt}-kerberos5/lib/libvers
+${_bt}-kerberos5/tools/slc: \
+    ${_bt}-kerberos5/lib/libroken ${_bt}-kerberos5/lib/libvers
+${_bt}-usr.bin/compile_et: \
+    ${_bt}-kerberos5/lib/libroken ${_bt}-kerberos5/lib/libvers
 .endif
 
 bootstrap-tools: .PHONY

Modified: user/ngie/more-tests/ObsoleteFiles.inc
==============================================================================
--- user/ngie/more-tests/ObsoleteFiles.inc	Thu Apr 16 21:49:15 2015	(r281620)
+++ user/ngie/more-tests/ObsoleteFiles.inc	Thu Apr 16 21:54:08 2015	(r281621)
@@ -38,6 +38,21 @@
 #   xargs -n1 | sort | uniq -d;
 # done
 
+# 20150416: ALTQ moved to net/altq
+OLD_FILES+=usr/include/altq/altq_rmclass_debug.h
+OLD_FILES+=usr/include/altq/altq.h
+OLD_FILES+=usr/include/altq/altq_cdnr.h
+OLD_FILES+=usr/include/altq/altq_hfsc.h
+OLD_FILES+=usr/include/altq/altq_priq.h
+OLD_FILES+=usr/include/altq/altqconf.h
+OLD_FILES+=usr/include/altq/altq_classq.h
+OLD_FILES+=usr/include/altq/altq_red.h
+OLD_FILES+=usr/include/altq/if_altq.h
+OLD_FILES+=usr/include/altq/altq_var.h
+OLD_FILES+=usr/include/altq/altq_rmclass.h
+OLD_FILES+=usr/include/altq/altq_cbq.h
+OLD_FILES+=usr/include/altq/altq_rio.h
+OLD_DIRS+=usr/include/altq
 # 20150410
 OLD_FILES+=usr/share/doc/usd/10.exref/paper.ascii.gz
 OLD_FILES+=usr/share/doc/usd/10.exref/summary.ascii.gz

Modified: user/ngie/more-tests/UPDATING
==============================================================================
--- user/ngie/more-tests/UPDATING	Thu Apr 16 21:49:15 2015	(r281620)
+++ user/ngie/more-tests/UPDATING	Thu Apr 16 21:54:08 2015	(r281621)
@@ -35,6 +35,11 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 11
 	The const qualifier has been removed from iconv(3) to comply with
 	POSIX.  The ports tree is aware of this from r384038 onwards.
 
+20150416:
+	Libraries specified by LIBADD in Makefiles must have a corresponding
+	DPADD_<lib> variable to ensure correct dependencies.  This is now
+	enforced in src.libnames.mk.
+
 20150324:
 	From legacy ata(4) driver was removed support for SATA controllers
 	supported by more functional drivers ahci(4), siis(4) and mvs(4).

Modified: user/ngie/more-tests/bin/csh/iconv_stub.h
==============================================================================
--- user/ngie/more-tests/bin/csh/iconv_stub.h	Thu Apr 16 21:49:15 2015	(r281620)
+++ user/ngie/more-tests/bin/csh/iconv_stub.h	Thu Apr 16 21:54:08 2015	(r281621)
@@ -30,7 +30,7 @@
 #define _ICONV_H_
 
 typedef void *iconv_t;
-typedef size_t dl_iconv_t(iconv_t, const char **, size_t *, char **, size_t *);
+typedef size_t dl_iconv_t(iconv_t, char **, size_t *, char **, size_t *);
 typedef int dl_iconv_close_t(iconv_t);
 
 extern iconv_t dl_iconv_open(const char *, const char *);

Modified: user/ngie/more-tests/etc/mtree/BSD.include.dist
==============================================================================
--- user/ngie/more-tests/etc/mtree/BSD.include.dist	Thu Apr 16 21:49:15 2015	(r281620)
+++ user/ngie/more-tests/etc/mtree/BSD.include.dist	Thu Apr 16 21:54:08 2015	(r281621)
@@ -5,8 +5,6 @@
 
 /set type=dir uname=root gname=wheel mode=0755
 .
-    altq
-    ..
     arpa
     ..
     atf-c
@@ -254,6 +252,8 @@
         ..
     ..
     net
+        altq
+        ..
     ..
     net80211
     ..

Modified: user/ngie/more-tests/include/Makefile
==============================================================================
--- user/ngie/more-tests/include/Makefile	Thu Apr 16 21:49:15 2015	(r281620)
+++ user/ngie/more-tests/include/Makefile	Thu Apr 16 21:54:08 2015	(r281621)
@@ -50,6 +50,7 @@ LSUBDIRS=	cam/ata cam/scsi \
 	geom/cache geom/concat geom/eli geom/gate geom/journal geom/label \
 	geom/mirror geom/mountver geom/multipath geom/nop \
 	geom/raid geom/raid3 geom/shsec geom/stripe geom/virstor \
+	net/altq \
 	netgraph/atm netgraph/netflow \
 	security/audit \
 	security/mac_biba security/mac_bsdextended security/mac_lomac \
@@ -144,7 +145,7 @@ compat:
 	    -p ${DESTDIR}${INCLUDEDIR}
 
 copies:
-.for i in ${LDIRS} ${LSUBDIRS} ${LSUBSUBDIRS} altq crypto machine machine/pc \
+.for i in ${LDIRS} ${LSUBDIRS} ${LSUBSUBDIRS} crypto machine machine/pc \
 	${_MARCHS}
 .if exists(${DESTDIR}${INCLUDEDIR}/$i)
 	cd ${DESTDIR}${INCLUDEDIR}/$i; \
@@ -179,9 +180,6 @@ copies:
 	cd ${.CURDIR}/../sys/dev/pci; \
 	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 pcireg.h \
 	    ${DESTDIR}${INCLUDEDIR}/dev/pci
-	cd ${.CURDIR}/../sys/contrib/altq/altq; \
-	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
-	    ${DESTDIR}${INCLUDEDIR}/altq
 	cd ${.CURDIR}/../sys/fs/cd9660/; \
 	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
 	    ${DESTDIR}${INCLUDEDIR}/isofs/cd9660
@@ -279,11 +277,6 @@ symlinks:
 		ln -fs ../../../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
 	done
 .endfor
-	cd ${.CURDIR}/../sys/contrib/altq/altq; \
-	for h in *.h; do \
-		ln -fs ../../../sys/contrib/altq/altq/$$h \
-		    ${DESTDIR}${INCLUDEDIR}/altq; \
-	done
 .if ${MK_IPFILTER} != "no"
 	cd ${.CURDIR}/../sys/contrib/ipfilter/netinet; \
 	for h in *.h; do \

Modified: user/ngie/more-tests/lib/libcompiler_rt/Makefile
==============================================================================
--- user/ngie/more-tests/lib/libcompiler_rt/Makefile	Thu Apr 16 21:49:15 2015	(r281620)
+++ user/ngie/more-tests/lib/libcompiler_rt/Makefile	Thu Apr 16 21:54:08 2015	(r281621)
@@ -144,6 +144,7 @@ SRCF+=	addtf3 \
 	fixunstfdi \
 	fixunstfsi \
 	fixunstfti \
+	floatunsitf \
 	multf3 \
 	subtf3 \
 	trunctfdf2 \

Modified: user/ngie/more-tests/sbin/pfctl/parse.y
==============================================================================
--- user/ngie/more-tests/sbin/pfctl/parse.y	Thu Apr 16 21:49:15 2015	(r281620)
+++ user/ngie/more-tests/sbin/pfctl/parse.y	Thu Apr 16 21:54:08 2015	(r281621)
@@ -44,10 +44,10 @@ __FBSDID("$FreeBSD$");
 #include <netinet/icmp6.h>
 #include <net/pfvar.h>
 #include <arpa/inet.h>
-#include <altq/altq.h>
-#include <altq/altq_cbq.h>
-#include <altq/altq_priq.h>
-#include <altq/altq_hfsc.h>
+#include <net/altq/altq.h>
+#include <net/altq/altq_cbq.h>
+#include <net/altq/altq_priq.h>
+#include <net/altq/altq_hfsc.h>
 
 #include <stdio.h>
 #include <unistd.h>

Modified: user/ngie/more-tests/sbin/pfctl/pfctl.c
==============================================================================
--- user/ngie/more-tests/sbin/pfctl/pfctl.c	Thu Apr 16 21:49:15 2015	(r281620)
+++ user/ngie/more-tests/sbin/pfctl/pfctl.c	Thu Apr 16 21:54:08 2015	(r281621)
@@ -44,7 +44,7 @@ __FBSDID("$FreeBSD$");
 #include <netinet/in.h>
 #include <net/pfvar.h>
 #include <arpa/inet.h>
-#include <altq/altq.h>
+#include <net/altq/altq.h>
 #include <sys/sysctl.h>
 
 #include <err.h>

Modified: user/ngie/more-tests/sbin/pfctl/pfctl_altq.c
==============================================================================
--- user/ngie/more-tests/sbin/pfctl/pfctl_altq.c	Thu Apr 16 21:49:15 2015	(r281620)
+++ user/ngie/more-tests/sbin/pfctl/pfctl_altq.c	Thu Apr 16 21:54:08 2015	(r281621)
@@ -38,10 +38,10 @@ __FBSDID("$FreeBSD$");
 #include <string.h>
 #include <unistd.h>
 
-#include <altq/altq.h>
-#include <altq/altq_cbq.h>
-#include <altq/altq_priq.h>
-#include <altq/altq_hfsc.h>
+#include <net/altq/altq.h>
+#include <net/altq/altq_cbq.h>
+#include <net/altq/altq_priq.h>
+#include <net/altq/altq_hfsc.h>
 
 #include "pfctl_parser.h"
 #include "pfctl.h"

Modified: user/ngie/more-tests/sbin/pfctl/pfctl_qstats.c
==============================================================================
--- user/ngie/more-tests/sbin/pfctl/pfctl_qstats.c	Thu Apr 16 21:49:15 2015	(r281620)
+++ user/ngie/more-tests/sbin/pfctl/pfctl_qstats.c	Thu Apr 16 21:54:08 2015	(r281621)
@@ -34,10 +34,10 @@ __FBSDID("$FreeBSD$");
 #include <string.h>
 #include <unistd.h>
 
-#include <altq/altq.h>
-#include <altq/altq_cbq.h>
-#include <altq/altq_priq.h>
-#include <altq/altq_hfsc.h>
+#include <net/altq/altq.h>
+#include <net/altq/altq_cbq.h>
+#include <net/altq/altq_priq.h>
+#include <net/altq/altq_hfsc.h>
 
 #include "pfctl.h"
 #include "pfctl_parser.h"

Modified: user/ngie/more-tests/share/man/man3/queue.3
==============================================================================
--- user/ngie/more-tests/share/man/man3/queue.3	Thu Apr 16 21:49:15 2015	(r281620)
+++ user/ngie/more-tests/share/man/man3/queue.3	Thu Apr 16 21:54:08 2015	(r281621)
@@ -147,7 +147,7 @@ lists and tail queues
 .Fn STAILQ_INSERT_AFTER "STAILQ_HEAD *head" "TYPE *listelm" "TYPE *elm" "STAILQ_ENTRY NAME"
 .Fn STAILQ_INSERT_HEAD "STAILQ_HEAD *head" "TYPE *elm" "STAILQ_ENTRY NAME"
 .Fn STAILQ_INSERT_TAIL "STAILQ_HEAD *head" "TYPE *elm" "STAILQ_ENTRY NAME"
-.Fn STAILQ_LAST "STAILQ_HEAD *head" "TYPE" "STAILQ_ENTRY NAME"
+.Fn STAILQ_LAST "STAILQ_HEAD *head" "TYPE *elm" "STAILQ_ENTRY NAME"
 .Fn STAILQ_NEXT "TYPE *elm" "STAILQ_ENTRY NAME"
 .Fn STAILQ_REMOVE_AFTER "STAILQ_HEAD *head" "TYPE *elm" "STAILQ_ENTRY NAME"
 .Fn STAILQ_REMOVE_HEAD "STAILQ_HEAD *head" "STAILQ_ENTRY NAME"

Modified: user/ngie/more-tests/share/mk/src.libnames.mk
==============================================================================
--- user/ngie/more-tests/share/mk/src.libnames.mk	Thu Apr 16 21:49:15 2015	(r281620)
+++ user/ngie/more-tests/share/mk/src.libnames.mk	Thu Apr 16 21:54:08 2015	(r281621)
@@ -282,10 +282,14 @@ LDADD_gssapi_krb5+=	${LDADD_pthread}
 .if ${_PRIVATELIBS:M${_l}}
 USEPRIVATELIB+=	${_l}
 .endif
-DPADD+=		${DPADD_${_l}}
+DPADD+=		${DPADD_${_l}:Umissing-dpadd_${_l}}
 LDADD+=		${LDADD_${_l}}
 .endfor
 
+.if defined(DPADD) && ${DPADD:Mmissing-dpadd_*}
+.error Missing ${DPADD:Mmissing-dpadd_*:S/missing-dpadd_//:S/^/DPADD_/} variable add "${DPADD:Mmissing-dpadd_*:S/missing-dpadd_//}" to _LIBRARIES, _INTERNALLIBS, or _PRIVATELIBS and define "${DPADD:Mmissing-dpadd_*:S/missing-dpadd_//:S/^/LIB/:tu}".
+.endif
+
 .if defined(USEPRIVATELIB)
 LDFLAGS+=	-rpath ${LIBPRIVATEDIR}
 .endif

Modified: user/ngie/more-tests/sys/amd64/vmm/amd/svm.c
==============================================================================
--- user/ngie/more-tests/sys/amd64/vmm/amd/svm.c	Thu Apr 16 21:49:15 2015	(r281620)
+++ user/ngie/more-tests/sys/amd64/vmm/amd/svm.c	Thu Apr 16 21:54:08 2015	(r281621)
@@ -1917,7 +1917,7 @@ svm_vmrun(void *arg, int vcpu, register_
 		}
 
 		/* We are asked to give the cpu by scheduler. */
-		if (curthread->td_flags & (TDF_ASTPENDING | TDF_NEEDRESCHED)) {
+		if (vcpu_should_yield(vm, vcpu)) {
 			enable_gintr();
 			vm_exit_astpending(vm, vcpu, state->rip);
 			break;

Modified: user/ngie/more-tests/sys/arm64/conf/DEFAULTS
==============================================================================
--- user/ngie/more-tests/sys/arm64/conf/DEFAULTS	Thu Apr 16 21:49:15 2015	(r281620)
+++ user/ngie/more-tests/sys/arm64/conf/DEFAULTS	Thu Apr 16 21:54:08 2015	(r281621)
@@ -3,7 +3,7 @@
 #
 # $FreeBSD$
 
-machine		arm64
+machine		arm64 aarch64
 
 # Pseudo devices.
 device		mem		# Memory and kernel memory devices

Modified: user/ngie/more-tests/sys/boot/forth/check-password.4th
==============================================================================
--- user/ngie/more-tests/sys/boot/forth/check-password.4th	Thu Apr 16 21:49:15 2015	(r281620)
+++ user/ngie/more-tests/sys/boot/forth/check-password.4th	Thu Apr 16 21:54:08 2015	(r281621)
@@ -146,6 +146,15 @@ only forth definitions also password-pro
 		2drop read-reset
 	else drop then
 
+	\ Prompt for GEOM ELI (geli(8)) passphrase if enabled
+	s" geom_eli_passphrase_prompt" getenv dup -1 <> if
+		s" YES" compare-insensitive 0= if
+			s" GELI Passphrase: " read ( prompt -- )
+			readval readlen @ s" kern.geom.eli.passphrase" setenv
+			read-reset
+		then
+	else drop then
+
 	\ Exit if a password was not set
 	s" password" getenv -1 = if exit else drop then
 

Modified: user/ngie/more-tests/sys/boot/forth/check-password.4th.8
==============================================================================
--- user/ngie/more-tests/sys/boot/forth/check-password.4th.8	Thu Apr 16 21:49:15 2015	(r281620)
+++ user/ngie/more-tests/sys/boot/forth/check-password.4th.8	Thu Apr 16 21:54:08 2015	(r281621)
@@ -1,4 +1,4 @@
-.\" Copyright (c) 2011-2012 Devin Teske
+.\" Copyright (c) 2011-2015 Devin Teske
 .\" All rights reserved.
 .\"
 .\" Redistribution and use in source and binary forms, with or without
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd December 10, 2012
+.Dd March 20, 2015
 .Dt CHECK-PASSWORD.4TH 8
 .Os
 .Sh NAME
@@ -33,8 +33,12 @@
 .Sh DESCRIPTION
 The file that goes by the name of
 .Nm
-is a set of commands designed to either prevent booting or prevent modification
-of boot options without an appropriately configured password.
+is a set of commands designed to do one or more of the following:
+.Pp
+.Dl o Prevent booting without password
+.Dl o Prevent modification of boot options without password
+.Dl o Provide a password to mount geli(8) encrypted root disk(s)
+.Pp
 The commands of
 .Nm
 by themselves are not enough for most uses.
@@ -58,14 +62,23 @@ The commands provided by it are:
 .Pp
 .Bl -tag -width disable-module_module -compact -offset indent
 .It Ic check-password
-Dual-purpose function that can either protect the interactive boot menu or
-prevent boot without password (separately).
+Multi-purpose function that can protect the interactive boot menu,
+prevent boot without password, or prompt for geli(8) passphrase
+.Pq depending on Xr loader.conf 5 settings .
 .Pp
 First checks
 .Va bootlock_password
 and if-set, the user cannot continue until the correct password is entered.
 .Pp
-Next checks
+Next, checks
+.Va geom_eli_passphrase_prompt
+and if set to
+.Li YES
+.Pq case-insensitive
+prompts the user to enter their GELI password for later mounting of the root
+device(s) during boot.
+.Pp
+Last, checks
 .Va password
 and if-set, tries to
 .Ic autoboot
@@ -81,6 +94,11 @@ The environment variables that effect it
 Sets the bootlock password (up to 16 characters long) that is required by
 .Ic check-password
 to be entered before the system is allowed to boot.
+.It Va geom_eli_passphrase_prompt
+Selects whether loader(8) will prompt for GELI credentials, handing-off to the
+kernel for later mounting of
+.Xr geli 8
+encrypted root device(s).
 .It Va password
 Sets the password (up to 16 characters long) that is required by
 .Ic check-password
@@ -122,6 +140,16 @@ to prevent booting without password:
 .Bd -literal -offset indent -compact
 bootlock_password="boot"
 .Ed
+.Pp
+Add the following to
+.Xr loader.conf 5
+to generate a prompt at boot to collect GELI credentials for mounting
+.Xr geli 8
+encrypted root device(s):
+.Pp
+.Bd -literal -offset indent -compact
+geom_eli_passphrase_prompt="YES"
+.Ed
 .Sh SEE ALSO
 .Xr loader.conf 5 ,
 .Xr loader 8 ,

Modified: user/ngie/more-tests/sys/boot/forth/loader.conf
==============================================================================
--- user/ngie/more-tests/sys/boot/forth/loader.conf	Thu Apr 16 21:49:15 2015	(r281620)
+++ user/ngie/more-tests/sys/boot/forth/loader.conf	Thu Apr 16 21:54:08 2015	(r281621)
@@ -62,6 +62,7 @@ entropy_cache_type="/boot/entropy"	
 				# "NO" to disable autobooting
 #password=""			# Prevent changes to boot options
 #bootlock_password=""		# Prevent booting (see check-password.4th(8))
+#geom_eli_passphrase_prompt="NO" # Prompt for geli(8) passphrase to mount root
 #beastie_disable="NO"		# Turn the beastie boot menu on and off
 #kernels="kernel kernel.old"	# Kernels to display in the boot menu
 #loader_logo="orbbw"		# Desired logo: orbbw, orb, fbsdbw, beastiebw, beastie, none

Modified: user/ngie/more-tests/sys/conf/files
==============================================================================
--- user/ngie/more-tests/sys/conf/files	Thu Apr 16 21:49:15 2015	(r281620)
+++ user/ngie/more-tests/sys/conf/files	Thu Apr 16 21:54:08 2015	(r281621)
@@ -247,14 +247,6 @@ compat/freebsd32/freebsd32_ioctl.c	optio
 compat/freebsd32/freebsd32_misc.c	optional compat_freebsd32
 compat/freebsd32/freebsd32_syscalls.c	optional compat_freebsd32
 compat/freebsd32/freebsd32_sysent.c	optional compat_freebsd32
-contrib/altq/altq/altq_cbq.c		optional altq
-contrib/altq/altq/altq_cdnr.c		optional altq
-contrib/altq/altq/altq_hfsc.c		optional altq
-contrib/altq/altq/altq_priq.c		optional altq
-contrib/altq/altq/altq_red.c		optional altq
-contrib/altq/altq/altq_rio.c		optional altq
-contrib/altq/altq/altq_rmclass.c	optional altq
-contrib/altq/altq/altq_subr.c		optional altq
 contrib/dev/acpica/common/ahids.c			optional acpi acpi_debug
 contrib/dev/acpica/common/ahuuids.c			optional acpi acpi_debug
 contrib/dev/acpica/components/debugger/dbcmds.c		optional acpi acpi_debug
@@ -3272,6 +3264,14 @@ libkern/strtoul.c		standard
 libkern/strtouq.c		standard
 libkern/strvalid.c		standard
 libkern/timingsafe_bcmp.c	standard
+net/altq/altq_cbq.c		optional altq
+net/altq/altq_cdnr.c		optional altq
+net/altq/altq_hfsc.c		optional altq
+net/altq/altq_priq.c		optional altq
+net/altq/altq_red.c		optional altq
+net/altq/altq_rio.c		optional altq
+net/altq/altq_rmclass.c		optional altq
+net/altq/altq_subr.c		optional altq
 net/bpf.c			standard
 net/bpf_buffer.c		optional bpf
 net/bpf_jitter.c		optional bpf_jitter

Modified: user/ngie/more-tests/sys/conf/kern.pre.mk
==============================================================================
--- user/ngie/more-tests/sys/conf/kern.pre.mk	Thu Apr 16 21:49:15 2015	(r281620)
+++ user/ngie/more-tests/sys/conf/kern.pre.mk	Thu Apr 16 21:54:08 2015	(r281621)
@@ -64,13 +64,10 @@ NOSTDINC= -nostdinc
 
 INCLUDES= ${NOSTDINC} ${INCLMAGIC} -I. -I$S
 
-# This hack lets us use the OpenBSD altq code without spamming a new
-# include path into contrib'ed source files.
-INCLUDES+= -I$S/contrib/altq
-
 .if make(depend) || make(kernel-depend)
 
-# ... and the same for ipfilter
+# This hack lets us use the ipfilter code without spamming a new
+# include path into contrib'ed source files.
 INCLUDES+= -I$S/contrib/ipfilter
 
 # ... and the same for ath

Modified: user/ngie/more-tests/sys/conf/kmod.mk
==============================================================================
--- user/ngie/more-tests/sys/conf/kmod.mk	Thu Apr 16 21:49:15 2015	(r281620)
+++ user/ngie/more-tests/sys/conf/kmod.mk	Thu Apr 16 21:54:08 2015	(r281621)
@@ -101,10 +101,6 @@ CFLAGS+=	-DHAVE_KERNEL_OPTION_HEADERS -i
 # set because there are no standard paths for non-headers.
 CFLAGS+=	-I. -I${SYSDIR}
 
-# Add -I path for altq headers as they are included via net/if_var.h
-# for example.
-CFLAGS+=	-I${SYSDIR}/contrib/altq
-
 CFLAGS.gcc+=	-finline-limit=${INLINE_LIMIT}
 CFLAGS.gcc+=	-fms-extensions
 CFLAGS.gcc+= --param inline-unit-growth=100

Modified: user/ngie/more-tests/sys/crypto/aesni/aesencdec.h
==============================================================================
--- user/ngie/more-tests/sys/crypto/aesni/aesencdec.h	Thu Apr 16 21:49:15 2015	(r281620)
+++ user/ngie/more-tests/sys/crypto/aesni/aesencdec.h	Thu Apr 16 21:54:08 2015	(r281621)
@@ -27,6 +27,8 @@
  *
  */
 
+#include <crypto/aesni/aesni_os.h>
+
 #include <wmmintrin.h>
 
 static inline void

Modified: user/ngie/more-tests/sys/crypto/aesni/aesni_ghash.c
==============================================================================
--- user/ngie/more-tests/sys/crypto/aesni/aesni_ghash.c	Thu Apr 16 21:49:15 2015	(r281620)
+++ user/ngie/more-tests/sys/crypto/aesni/aesni_ghash.c	Thu Apr 16 21:54:08 2015	(r281621)
@@ -67,6 +67,7 @@
 
 #ifdef _KERNEL
 #include <crypto/aesni/aesni.h>
+#include <crypto/aesni/aesni_os.h>
 #else
 #include <stdint.h>
 #endif

Copied: user/ngie/more-tests/sys/crypto/aesni/aesni_os.h (from r281620, head/sys/crypto/aesni/aesni_os.h)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ user/ngie/more-tests/sys/crypto/aesni/aesni_os.h	Thu Apr 16 21:54:08 2015	(r281621, copy of r281620, head/sys/crypto/aesni/aesni_os.h)
@@ -0,0 +1,33 @@
+/*-
+ * Copyright 2015 Craig Rodrigues <rodrigc@FreeBSD.org>
+ * 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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.
+ *
+ * $FreeBSD$
+ *
+ */
+
+#if defined(__GNUC__) && defined(_KERNEL)
+/* Suppress inclusion of gcc's mm_malloc.h header */
+#define _MM_MALLOC_H_INCLUDED 1
+#endif

Modified: user/ngie/more-tests/sys/dev/usb/wlan/if_urtwn.c
==============================================================================
--- user/ngie/more-tests/sys/dev/usb/wlan/if_urtwn.c	Thu Apr 16 21:49:15 2015	(r281620)
+++ user/ngie/more-tests/sys/dev/usb/wlan/if_urtwn.c	Thu Apr 16 21:54:08 2015	(r281621)
@@ -1195,7 +1195,7 @@ urtwn_efuse_read(struct urtwn_softc *sc)
 	uint8_t *rom = (uint8_t *)&sc->rom;
 	uint16_t addr = 0;
 	uint32_t reg;
-	uint8_t off, msk;
+	uint8_t off, msk, vol;
 	int i;
 
 	urtwn_efuse_switch_power(sc);
@@ -1228,10 +1228,15 @@ urtwn_efuse_read(struct urtwn_softc *sc)
 		printf("\n");
 	}
 #endif
+	/* Disable LDO 2.5V. */
+	vol = urtwn_read_1(sc, R92C_EFUSE_TEST + 3);
+	urtwn_write_1(sc, R92C_EFUSE_TEST + 3, vol & ~(0x80));
+
 }
 static void
 urtwn_efuse_switch_power(struct urtwn_softc *sc)
 {
+	uint8_t vol;
 	uint32_t reg;
 
 	reg = urtwn_read_2(sc, R92C_SYS_ISO_CTRL);
@@ -1250,6 +1255,12 @@ urtwn_efuse_switch_power(struct urtwn_so
 		urtwn_write_2(sc, R92C_SYS_CLKR,
 		    reg | R92C_SYS_CLKR_LOADER_EN | R92C_SYS_CLKR_ANA8M);
 	}
+
+	/* Enable LDO 2.5V. */
+	vol = urtwn_read_1(sc, R92C_EFUSE_TEST + 3);
+	vol &= 0x0f;
+	vol |= 0x30;
+	urtwn_write_1(sc, R92C_EFUSE_TEST + 3, (vol | 0x80));
 }
 
 static int

Modified: user/ngie/more-tests/sys/kern/init_main.c
==============================================================================
--- user/ngie/more-tests/sys/kern/init_main.c	Thu Apr 16 21:49:15 2015	(r281620)
+++ user/ngie/more-tests/sys/kern/init_main.c	Thu Apr 16 21:54:08 2015	(r281621)
@@ -710,6 +710,9 @@ start_init(void *dummy)
 
 	vfs_mountroot();
 
+	/* Wipe GELI passphrase from the environment. */
+	kern_unsetenv("kern.geom.eli.passphrase");
+
 	/*
 	 * Need just enough stack to hold the faked-up "execve()" arguments.
 	 */

Modified: user/ngie/more-tests/sys/net/if_var.h
==============================================================================
--- user/ngie/more-tests/sys/net/if_var.h	Thu Apr 16 21:49:15 2015	(r281620)
+++ user/ngie/more-tests/sys/net/if_var.h	Thu Apr 16 21:54:08 2015	(r281621)
@@ -83,7 +83,7 @@ struct	netmap_adapter;
 
 #define	IF_DUNIT_NONE	-1
 
-#include <altq/if_altq.h>
+#include <net/altq/if_altq.h>
 
 TAILQ_HEAD(ifnethead, ifnet);	/* we use TAILQs so that the order of */
 TAILQ_HEAD(ifaddrhead, ifaddr);	/* instantiation is preserved in the list */

Modified: user/ngie/more-tests/sys/net/ifq.h
==============================================================================
--- user/ngie/more-tests/sys/net/ifq.h	Thu Apr 16 21:49:15 2015	(r281620)
+++ user/ngie/more-tests/sys/net/ifq.h	Thu Apr 16 21:54:08 2015	(r281621)
@@ -47,7 +47,7 @@
  */
 #define	IF_DUNIT_NONE	-1
 
-#include <altq/if_altq.h>
+#include <net/altq/if_altq.h>
 
 /*
  * Structure defining a queue for a network interface.

Modified: user/ngie/more-tests/sys/netinet/tcp_subr.c
==============================================================================
--- user/ngie/more-tests/sys/netinet/tcp_subr.c	Thu Apr 16 21:49:15 2015	(r281620)
+++ user/ngie/more-tests/sys/netinet/tcp_subr.c	Thu Apr 16 21:54:08 2015	(r281621)
@@ -230,6 +230,7 @@ static struct inpcb *tcp_notify(struct i
 static struct inpcb *tcp_mtudisc_notify(struct inpcb *, int);
 static char *	tcp_log_addr(struct in_conninfo *inc, struct tcphdr *th,
 		    void *ip4hdr, const void *ip6hdr);
+static void	tcp_timer_discard(struct tcpcb *, uint32_t);
 
 /*
  * Target size of TCP PCB hash tables. Must be a power of two.
@@ -801,7 +802,13 @@ tcp_newtcpcb(struct inpcb *inp)
 	if (V_tcp_do_sack)
 		tp->t_flags |= TF_SACK_PERMIT;
 	TAILQ_INIT(&tp->snd_holes);
-	tp->t_inpcb = inp;	/* XXX */
+	/*
+	 * The tcpcb will hold a reference on its inpcb until tcp_discardcb()
+	 * is called.
+	 */
+	in_pcbref(inp);	/* Reference for tcpcb */
+	tp->t_inpcb = inp;
+
 	/*
 	 * Init srtt to TCPTV_SRTTBASE (0), so we can tell that we have no
 	 * rtt estimate.  Set rttvar so that srtt + 4 * rttvar gives
@@ -920,6 +927,7 @@ tcp_discardcb(struct tcpcb *tp)
 #ifdef INET6
 	int isipv6 = (inp->inp_vflag & INP_IPV6) != 0;
 #endif /* INET6 */
+	int released;
 
 	INP_WLOCK_ASSERT(inp);
 
@@ -927,22 +935,15 @@ tcp_discardcb(struct tcpcb *tp)
 	 * Make sure that all of our timers are stopped before we delete the
 	 * PCB.
 	 *
-	 * XXXRW: Really, we would like to use callout_drain() here in order
-	 * to avoid races experienced in tcp_timer.c where a timer is already
-	 * executing at this point.  However, we can't, both because we're
-	 * running in a context where we can't sleep, and also because we
-	 * hold locks required by the timers.  What we instead need to do is
-	 * test to see if callout_drain() is required, and if so, defer some
-	 * portion of the remainder of tcp_discardcb() to an asynchronous
-	 * context that can callout_drain() and then continue.  Some care
-	 * will be required to ensure that no further processing takes place
-	 * on the tcpcb, even though it hasn't been freed (a flag?).
-	 */
-	callout_stop(&tp->t_timers->tt_rexmt);
-	callout_stop(&tp->t_timers->tt_persist);
-	callout_stop(&tp->t_timers->tt_keep);
-	callout_stop(&tp->t_timers->tt_2msl);
-	callout_stop(&tp->t_timers->tt_delack);
+	 * If stopping a timer fails, we schedule a discard function in same
+	 * callout, and the last discard function called will take care of
+	 * deleting the tcpcb.
+	 */
+	tcp_timer_stop(tp, TT_REXMT);
+	tcp_timer_stop(tp, TT_PERSIST);
+	tcp_timer_stop(tp, TT_KEEP);
+	tcp_timer_stop(tp, TT_2MSL);
+	tcp_timer_stop(tp, TT_DELACK);
 
 	/*
 	 * If we got enough samples through the srtt filter,
@@ -1019,8 +1020,80 @@ tcp_discardcb(struct tcpcb *tp)
 
 	CC_ALGO(tp) = NULL;
 	inp->inp_ppcb = NULL;
-	tp->t_inpcb = NULL;
-	uma_zfree(V_tcpcb_zone, tp);
+	if ((tp->t_timers->tt_flags & TT_MASK) == 0) {
+		/* We own the last reference on tcpcb, let's free it. */
+		tp->t_inpcb = NULL;
+		uma_zfree(V_tcpcb_zone, tp);
+		released = in_pcbrele_wlocked(inp);
+		KASSERT(!released, ("%s: inp %p should not have been released "
+			"here", __func__, inp));
+	}
+}
+
+void
+tcp_timer_2msl_discard(void *xtp)
+{
+
+	tcp_timer_discard((struct tcpcb *)xtp, TT_2MSL);
+}
+
+void
+tcp_timer_keep_discard(void *xtp)
+{
+
+	tcp_timer_discard((struct tcpcb *)xtp, TT_KEEP);
+}
+
+void
+tcp_timer_persist_discard(void *xtp)
+{
+
+	tcp_timer_discard((struct tcpcb *)xtp, TT_PERSIST);
+}
+
+void
+tcp_timer_rexmt_discard(void *xtp)
+{
+
+	tcp_timer_discard((struct tcpcb *)xtp, TT_REXMT);
+}
+
+void
+tcp_timer_delack_discard(void *xtp)
+{
+
+	tcp_timer_discard((struct tcpcb *)xtp, TT_DELACK);
+}
+
+void
+tcp_timer_discard(struct tcpcb *tp, uint32_t timer_type)
+{
+	struct inpcb *inp;
+
+	CURVNET_SET(tp->t_vnet);
+	INP_INFO_WLOCK(&V_tcbinfo);
+	inp = tp->t_inpcb;
+	KASSERT(inp != NULL, ("%s: tp %p tp->t_inpcb == NULL",
+		__func__, tp));
+	INP_WLOCK(inp);
+	KASSERT((tp->t_timers->tt_flags & TT_STOPPED) != 0,
+		("%s: tcpcb has to be stopped here", __func__));
+	KASSERT((tp->t_timers->tt_flags & timer_type) != 0,
+		("%s: discard callout should be running", __func__));
+	tp->t_timers->tt_flags &= ~timer_type;
+	if ((tp->t_timers->tt_flags & TT_MASK) == 0) {
+		/* We own the last reference on this tcpcb, let's free it. */
+		tp->t_inpcb = NULL;
+		uma_zfree(V_tcpcb_zone, tp);
+		if (in_pcbrele_wlocked(inp)) {
+			INP_INFO_WUNLOCK(&V_tcbinfo);
+			CURVNET_RESTORE();
+			return;
+		}
+	}
+	INP_WUNLOCK(inp);
+	INP_INFO_WUNLOCK(&V_tcbinfo);
+	CURVNET_RESTORE();
 }
 
 /*

Modified: user/ngie/more-tests/sys/netinet/tcp_timer.c
==============================================================================
--- user/ngie/more-tests/sys/netinet/tcp_timer.c	Thu Apr 16 21:49:15 2015	(r281620)
+++ user/ngie/more-tests/sys/netinet/tcp_timer.c	Thu Apr 16 21:54:08 2015	(r281621)
@@ -258,10 +258,6 @@ int	tcp_backoff[TCP_MAXRXTSHIFT + 1] =
 
 static int tcp_totbackoff = 2559;	/* sum of tcp_backoff[] */
 
-static int tcp_timer_race;
-SYSCTL_INT(_net_inet_tcp, OID_AUTO, timer_race, CTLFLAG_RD, &tcp_timer_race,
-    0, "Count of t_inpcb races on tcp_discardcb");
-
 /*
  * TCP timer processing.
  */
@@ -274,18 +270,7 @@ tcp_timer_delack(void *xtp)
 	CURVNET_SET(tp->t_vnet);
 
 	inp = tp->t_inpcb;
-	/*
-	 * XXXRW: While this assert is in fact correct, bugs in the tcpcb
-	 * tear-down mean we need it as a work-around for races between
-	 * timers and tcp_discardcb().
-	 *
-	 * KASSERT(inp != NULL, ("tcp_timer_delack: inp == NULL"));
-	 */
-	if (inp == NULL) {
-		tcp_timer_race++;
-		CURVNET_RESTORE();
-		return;
-	}
+	KASSERT(inp != NULL, ("%s: tp %p tp->t_inpcb == NULL", __func__, tp));
 	INP_WLOCK(inp);
 	if (callout_pending(&tp->t_timers->tt_delack) ||
 	    !callout_active(&tp->t_timers->tt_delack)) {
@@ -299,6 +284,10 @@ tcp_timer_delack(void *xtp)
 		CURVNET_RESTORE();
 		return;
 	}
+	KASSERT((tp->t_timers->tt_flags & TT_STOPPED) == 0,
+		("%s: tp %p tcpcb can't be stopped here", __func__, tp));
+	KASSERT((tp->t_timers->tt_flags & TT_DELACK) != 0,
+		("%s: tp %p delack callout should be running", __func__, tp));
 
 	tp->t_flags |= TF_ACKNOW;
 	TCPSTAT_INC(tcps_delack);
@@ -318,24 +307,9 @@ tcp_timer_2msl(void *xtp)
 
 	ostate = tp->t_state;
 #endif
-	/*
-	 * XXXRW: Does this actually happen?
-	 */
 	INP_INFO_WLOCK(&V_tcbinfo);
 	inp = tp->t_inpcb;
-	/*
-	 * XXXRW: While this assert is in fact correct, bugs in the tcpcb
-	 * tear-down mean we need it as a work-around for races between
-	 * timers and tcp_discardcb().
-	 *
-	 * KASSERT(inp != NULL, ("tcp_timer_2msl: inp == NULL"));
-	 */
-	if (inp == NULL) {
-		tcp_timer_race++;
-		INP_INFO_WUNLOCK(&V_tcbinfo);
-		CURVNET_RESTORE();
-		return;
-	}
+	KASSERT(inp != NULL, ("%s: tp %p tp->t_inpcb == NULL", __func__, tp));
 	INP_WLOCK(inp);
 	tcp_free_sackholes(tp);
 	if (callout_pending(&tp->t_timers->tt_2msl) ||
@@ -352,6 +326,10 @@ tcp_timer_2msl(void *xtp)
 		CURVNET_RESTORE();
 		return;
 	}
+	KASSERT((tp->t_timers->tt_flags & TT_STOPPED) == 0,
+		("%s: tp %p tcpcb can't be stopped here", __func__, tp));
+	KASSERT((tp->t_timers->tt_flags & TT_2MSL) != 0,
+		("%s: tp %p 2msl callout should be running", __func__, tp));
 	/*
 	 * 2 MSL timeout in shutdown went off.  If we're closed but
 	 * still waiting for peer to close and connection has been idle
@@ -402,19 +380,7 @@ tcp_timer_keep(void *xtp)
 #endif
 	INP_INFO_WLOCK(&V_tcbinfo);
 	inp = tp->t_inpcb;
-	/*
-	 * XXXRW: While this assert is in fact correct, bugs in the tcpcb
-	 * tear-down mean we need it as a work-around for races between
-	 * timers and tcp_discardcb().
-	 *
-	 * KASSERT(inp != NULL, ("tcp_timer_keep: inp == NULL"));
-	 */
-	if (inp == NULL) {
-		tcp_timer_race++;
-		INP_INFO_WUNLOCK(&V_tcbinfo);
-		CURVNET_RESTORE();
-		return;
-	}
+	KASSERT(inp != NULL, ("%s: tp %p tp->t_inpcb == NULL", __func__, tp));
 	INP_WLOCK(inp);
 	if (callout_pending(&tp->t_timers->tt_keep) ||
 	    !callout_active(&tp->t_timers->tt_keep)) {
@@ -430,6 +396,10 @@ tcp_timer_keep(void *xtp)
 		CURVNET_RESTORE();
 		return;
 	}
+	KASSERT((tp->t_timers->tt_flags & TT_STOPPED) == 0,
+		("%s: tp %p tcpcb can't be stopped here", __func__, tp));
+	KASSERT((tp->t_timers->tt_flags & TT_KEEP) != 0,
+		("%s: tp %p keep callout should be running", __func__, tp));
 	/*
 	 * Keep-alive timer went off; send something
 	 * or drop connection if idle for too long.
@@ -505,19 +475,7 @@ tcp_timer_persist(void *xtp)
 #endif
 	INP_INFO_WLOCK(&V_tcbinfo);
 	inp = tp->t_inpcb;
-	/*
-	 * XXXRW: While this assert is in fact correct, bugs in the tcpcb
-	 * tear-down mean we need it as a work-around for races between
-	 * timers and tcp_discardcb().
-	 *
-	 * KASSERT(inp != NULL, ("tcp_timer_persist: inp == NULL"));
-	 */
-	if (inp == NULL) {
-		tcp_timer_race++;
-		INP_INFO_WUNLOCK(&V_tcbinfo);
-		CURVNET_RESTORE();
-		return;
-	}
+	KASSERT(inp != NULL, ("%s: tp %p tp->t_inpcb == NULL", __func__, tp));
 	INP_WLOCK(inp);
 	if (callout_pending(&tp->t_timers->tt_persist) ||
 	    !callout_active(&tp->t_timers->tt_persist)) {
@@ -533,6 +491,10 @@ tcp_timer_persist(void *xtp)
 		CURVNET_RESTORE();
 		return;
 	}
+	KASSERT((tp->t_timers->tt_flags & TT_STOPPED) == 0,
+		("%s: tp %p tcpcb can't be stopped here", __func__, tp));
+	KASSERT((tp->t_timers->tt_flags & TT_PERSIST) != 0,
+		("%s: tp %p persist callout should be running", __func__, tp));
 	/*
 	 * Persistance timer into zero window.
 	 * Force a byte to be output, if possible.
@@ -594,19 +556,7 @@ tcp_timer_rexmt(void * xtp)
 
 	INP_INFO_RLOCK(&V_tcbinfo);
 	inp = tp->t_inpcb;
-	/*
-	 * XXXRW: While this assert is in fact correct, bugs in the tcpcb
-	 * tear-down mean we need it as a work-around for races between
-	 * timers and tcp_discardcb().
-	 *
-	 * KASSERT(inp != NULL, ("tcp_timer_rexmt: inp == NULL"));
-	 */
-	if (inp == NULL) {
-		tcp_timer_race++;
-		INP_INFO_RUNLOCK(&V_tcbinfo);
-		CURVNET_RESTORE();
-		return;
-	}
+	KASSERT(inp != NULL, ("%s: tp %p tp->t_inpcb == NULL", __func__, tp));
 	INP_WLOCK(inp);
 	if (callout_pending(&tp->t_timers->tt_rexmt) ||
 	    !callout_active(&tp->t_timers->tt_rexmt)) {
@@ -622,6 +572,10 @@ tcp_timer_rexmt(void * xtp)
 		CURVNET_RESTORE();
 		return;
 	}
+	KASSERT((tp->t_timers->tt_flags & TT_STOPPED) == 0,
+		("%s: tp %p tcpcb can't be stopped here", __func__, tp));
+	KASSERT((tp->t_timers->tt_flags & TT_REXMT) != 0,
+		("%s: tp %p rexmt callout should be running", __func__, tp));
 	tcp_free_sackholes(tp);
 	/*
 	 * Retransmission timer went off.  Message has not
@@ -850,7 +804,7 @@ out:
 }
 
 void
-tcp_timer_activate(struct tcpcb *tp, int timer_type, u_int delta)
+tcp_timer_activate(struct tcpcb *tp, uint32_t timer_type, u_int delta)
 {
 	struct callout *t_callout;
 	timeout_t *f_callout;
@@ -862,6 +816,9 @@ tcp_timer_activate(struct tcpcb *tp, int
 		return;
 #endif
 
+	if (tp->t_timers->tt_flags & TT_STOPPED)
+		return;
+
 	switch (timer_type) {
 		case TT_DELACK:
 			t_callout = &tp->t_timers->tt_delack;
@@ -887,14 +844,23 @@ tcp_timer_activate(struct tcpcb *tp, int
 			panic("tp %p bad timer_type %#x", tp, timer_type);
 		}
 	if (delta == 0) {
-		callout_stop(t_callout);
+		if ((tp->t_timers->tt_flags & timer_type) &&
+		    callout_stop(t_callout)) {
+			tp->t_timers->tt_flags &= ~timer_type;
+		}
 	} else {
-		callout_reset_on(t_callout, delta, f_callout, tp, cpu);
+		if ((tp->t_timers->tt_flags & timer_type) == 0) {
+			tp->t_timers->tt_flags |= timer_type;
+			callout_reset_on(t_callout, delta, f_callout, tp, cpu);
+		} else {
+			/* Reset already running callout on the same CPU. */
+			callout_reset(t_callout, delta, f_callout, tp);
+		}
 	}
 }
 
 int
-tcp_timer_active(struct tcpcb *tp, int timer_type)
+tcp_timer_active(struct tcpcb *tp, uint32_t timer_type)
 {
 	struct callout *t_callout;
 
@@ -920,6 +886,58 @@ tcp_timer_active(struct tcpcb *tp, int t
 	return callout_active(t_callout);
 }
 
+void
+tcp_timer_stop(struct tcpcb *tp, uint32_t timer_type)
+{
+	struct callout *t_callout;
+	timeout_t *f_callout;
+
+	tp->t_timers->tt_flags |= TT_STOPPED;
+
+	switch (timer_type) {
+		case TT_DELACK:
+			t_callout = &tp->t_timers->tt_delack;
+			f_callout = tcp_timer_delack_discard;
+			break;
+		case TT_REXMT:
+			t_callout = &tp->t_timers->tt_rexmt;
+			f_callout = tcp_timer_rexmt_discard;
+			break;
+		case TT_PERSIST:
+			t_callout = &tp->t_timers->tt_persist;
+			f_callout = tcp_timer_persist_discard;
+			break;
+		case TT_KEEP:
+			t_callout = &tp->t_timers->tt_keep;
+			f_callout = tcp_timer_keep_discard;
+			break;
+		case TT_2MSL:
+			t_callout = &tp->t_timers->tt_2msl;
+			f_callout = tcp_timer_2msl_discard;
+			break;
+		default:
+			panic("tp %p bad timer_type %#x", tp, timer_type);
+		}
+
+	if (tp->t_timers->tt_flags & timer_type) {
+		if (callout_stop(t_callout)) {
+			tp->t_timers->tt_flags &= ~timer_type;
+		} else {
+			/*
+			 * Can't stop the callout, defer tcpcb actual deletion
+			 * to the last tcp timer discard callout.
+			 * The TT_STOPPED flag will ensure that no tcp timer
+			 * callouts can be restarted on our behalf, and
+			 * past this point currently running callouts waiting
+			 * on inp lock will return right away after the
+			 * classical check for callout reset/stop events:
+			 * callout_pending() || !callout_active()
+			 */
+			callout_reset(t_callout, 1, f_callout, tp);
+		}
+	}
+}

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201504162154.t3GLs8Di007246>