CVS commit: src/sys/arch/amd64/amd64

2014-11-26 Thread Masao Uebayashi
Module Name:src
Committed By:   uebayasi
Date:   Thu Nov 27 04:48:39 UTC 2014

Modified Files:
src/sys/arch/amd64/amd64: spl.S

Log Message:
Comments.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/amd64/amd64/spl.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/amd64/amd64/spl.S
diff -u src/sys/arch/amd64/amd64/spl.S:1.28 src/sys/arch/amd64/amd64/spl.S:1.29
--- src/sys/arch/amd64/amd64/spl.S:1.28	Sun Jan 12 20:31:50 2014
+++ src/sys/arch/amd64/amd64/spl.S	Thu Nov 27 04:48:39 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: spl.S,v 1.28 2014/01/12 20:31:50 joerg Exp $	*/
+/*	$NetBSD: spl.S,v 1.29 2014/11/27 04:48:39 uebayasi Exp $	*/
 
 /*
  * Copyright (c) 2003 Wasabi Systems, Inc.
@@ -115,7 +115,7 @@ IDTVEC(softintr)
 	xchgq	%r15,CPUVAR(CURLWP)	/* must be globally visible */
 	popq	%r15			/* unwind switchframe */
 	addq	$(5 * 8),%rsp
-	jmp	*%r13			/* back to splx/doreti */
+	jmp	*%r13			/* back to Xspllower/Xdoreti */
 END(Xsoftintr)
 
 /*
@@ -130,7 +130,7 @@ NENTRY(softintr_ret)
 	incl	CPUVAR(MTX_COUNT)	/* re-adjust after mi_switch */
 	movl	$0, L_CTXSWTCH(%rax)	/* %rax from cpu_switchto */
 	cli
-	jmp	*%r13			/* back to splx/doreti */
+	jmp	*%r13			/* back to Xspllower/Xdoreti */
 END(softintr_ret)
 
 /*
@@ -155,7 +155,7 @@ IDTVEC(preemptrecurse)
 	xorq	%rdi, %rdi
 	call	_C_LABEL(kpreempt)
 	cli
-	jmp	*%r13
+	jmp	*%r13			/* back to Xspllower */
 END(Xpreemptrecurse)
 
 /*
@@ -171,11 +171,11 @@ IDTVEC(preemptresume)
 	movq	TF_RIP(%rsp), %rdi
 	call	_C_LABEL(kpreempt)		# from kernel
 	cli
-	jmp	*%r13
+	jmp	*%r13			/* back to Xdoreti */
 1:
 	call	_C_LABEL(preempt)		# from user
 	cli
-	jmp	*%r13
+	jmp	*%r13			/* back to Xdoreti */
 END(Xpreemptresume)
 
 /*
@@ -303,6 +303,8 @@ IDTVEC(spllower)
 END(Xspllower)
 
 /*
+ * void Xdoreti(void);
+ * 
  * Handle return from interrupt after device handler finishes.
  *
  * Important registers:



CVS commit: src/sys/arch/amd64/include

2014-11-26 Thread Masao Uebayashi
Module Name:src
Committed By:   uebayasi
Date:   Thu Nov 27 04:41:55 UTC 2014

Modified Files:
src/sys/arch/amd64/include: frame_regs.h

Log Message:
Improve grep'ability..


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/amd64/include/frame_regs.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/amd64/include/frame_regs.h
diff -u src/sys/arch/amd64/include/frame_regs.h:1.4 src/sys/arch/amd64/include/frame_regs.h:1.5
--- src/sys/arch/amd64/include/frame_regs.h:1.4	Wed Feb  6 22:02:17 2008
+++ src/sys/arch/amd64/include/frame_regs.h	Thu Nov 27 04:41:55 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: frame_regs.h,v 1.4 2008/02/06 22:02:17 dsl Exp $	*/
+/*	$NetBSD: frame_regs.h,v 1.5 2014/11/27 04:41:55 uebayasi Exp $	*/
 
 #ifndef _AMD64_FRAME_REGS_H_
 #define _AMD64_FRAME_REGS_H_
@@ -29,38 +29,40 @@
  * than 6 args (SYS_MAXSYSARGS is 8, + 2 entries for SYS___SYSCALL).
  */
 #define _FRAME_REG(greg, freg) 	\
-	greg(rdi, RDI, 0)	\
-	greg(rsi, RSI, 1)	\
-	greg(rdx, RDX, 2)	\
-	greg(r10, R10, 6)	\
-	greg(r8,  R8,  4)	\
-	greg(r9,  R9,  5)	\
-	freg(arg6, @,  @)	/* syscall arg from stack */ \
-	freg(arg7, @,  @)	/* syscall arg from stack */ \
-	freg(arg8, @,  @)	/* syscall arg from stack */ \
-	freg(arg9, @,  @)	/* syscall arg from stack */ \
-	greg(rcx, RCX, 3)	\
-	greg(r11, R11, 7)	\
-	greg(r12, R12, 8)	\
-	greg(r13, R13, 9)	\
-	greg(r14, R14, 10)	\
-	greg(r15, R15, 11)	\
-	greg(rbp, RBP, 12)	\
-	greg(rbx, RBX, 13)	\
-	greg(rax, RAX, 14)	\
-	greg(gs,  GS,  15)	\
-	greg(fs,  FS,  16)	\
-	greg(es,  ES,  17)	\
-	greg(ds,  DS,  18)	\
-	greg(trapno, TRAPNO, 19)	\
-	/* below portion defined in hardware */ \
-	greg(err, ERR, 20)	/* Dummy inserted if not defined */ \
-	greg(rip, RIP, 21)	\
-	greg(cs,  CS,  22)	\
-	greg(rflags, RFLAGS, 23)	\
+	greg(rdi, RDI, 0)	/* tf_rdi */ \
+	greg(rsi, RSI, 1)	/* tf_rsi */ \
+	greg(rdx, RDX, 2)	/* tf_rdx */ \
+	greg(r10, R10, 6)	/* tf_r10 */ \
+	greg(r8,  R8,  4)	/* tf_r8 */ \
+	greg(r9,  R9,  5)	/* tf_r9 */ \
+	freg(arg6, @,  @)	/* tf_arg6: syscall arg from stack */ \
+	freg(arg7, @,  @)	/* tf_arg7: syscall arg from stack */ \
+	freg(arg8, @,  @)	/* tf_arg8: syscall arg from stack */ \
+	freg(arg9, @,  @)	/* tf_arg9: syscall arg from stack */ \
+	greg(rcx, RCX, 3)	/* tf_rcx */ \
+	greg(r11, R11, 7)	/* tf_r11 */ \
+	greg(r12, R12, 8)	/* tf_r12 */ \
+	greg(r13, R13, 9)	/* tf_r13 */ \
+	greg(r14, R14, 10)	/* tf_r14 */ \
+	greg(r15, R15, 11)	/* tf_r15 */ \
+	greg(rbp, RBP, 12)	/* tf_rbp */ \
+	greg(rbx, RBX, 13)	/* tf_rbx */ \
+	greg(rax, RAX, 14)	/* tf_rax */ \
+	greg(gs,  GS,  15)	/* tf_gs */ \
+	greg(fs,  FS,  16)	/* tf_fs */ \
+	greg(es,  ES,  17)	/* tf_es */ \
+	greg(ds,  DS,  18)	/* tf_ds */ \
+	greg(trapno, TRAPNO,	/* tf_trapno */ \
+	19) \
+	/* Below portion defined in hardware */ \
+	greg(err, ERR, 20)	/* tf_err: Dummy inserted if not defined */ \
+	greg(rip, RIP, 21)	/* tf_rip */ \
+	greg(cs,  CS,  22)	/* tf_cs */ \
+	greg(rflags, RFLAGS,	/* tf_rflags */ \
+	23) \
 	/* These are pushed unconditionally on the x86-64 */ \
-	greg(rsp, RSP, 24)	\
-	greg(ss,  SS,  25)
+	greg(rsp, RSP, 24)	/* tf_rsp */ \
+	greg(ss,  SS,  25)	/* tf_ss */
 
 #define _FRAME_NOREG(reg, REG, idx)
 



CVS commit: src/sys/arch/arm/arm32

2014-11-26 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Nov 27 04:09:50 UTC 2014

Modified Files:
src/sys/arch/arm/arm32: cpu.c

Log Message:
Add entry for Cortex-A17 r1


To generate a diff of this commit:
cvs rdiff -u -r1.105 -r1.106 src/sys/arch/arm/arm32/cpu.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/arm/arm32/cpu.c
diff -u src/sys/arch/arm/arm32/cpu.c:1.105 src/sys/arch/arm/arm32/cpu.c:1.106
--- src/sys/arch/arm/arm32/cpu.c:1.105	Mon Sep  1 13:43:31 2014
+++ src/sys/arch/arm/arm32/cpu.c	Thu Nov 27 04:09:50 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.c,v 1.105 2014/09/01 13:43:31 reinoud Exp $	*/
+/*	$NetBSD: cpu.c,v 1.106 2014/11/27 04:09:50 matt Exp $	*/
 
 /*
  * Copyright (c) 1995 Mark Brinicombe.
@@ -46,7 +46,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.105 2014/09/01 13:43:31 reinoud Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.106 2014/11/27 04:09:50 matt Exp $");
 
 #include 
 #include 
@@ -511,6 +511,8 @@ const struct cpuidtab cpuids[] = {
 	  pN_steppings, "7A" },
 	{ CPU_ID_CORTEXA15R3,	CPU_CLASS_CORTEX,	"Cortex-A15 r3",
 	  pN_steppings, "7A" },
+	{ CPU_ID_CORTEXA17R1,	CPU_CLASS_CORTEX,	"Cortex-A17 r1",
+	  pN_steppings, "7A" },
 
 	{ CPU_ID_MV88SV581X_V6, CPU_CLASS_PJ4B,  "Sheeva 88SV581x",
 	  generic_steppings },



CVS commit: src/sys/arch/arm/include

2014-11-26 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Nov 27 04:07:13 UTC 2014

Modified Files:
src/sys/arch/arm/include: armreg.h

Log Message:
Add Cortex-A17 ID


To generate a diff of this commit:
cvs rdiff -u -r1.101 -r1.102 src/sys/arch/arm/include/armreg.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/arm/include/armreg.h
diff -u src/sys/arch/arm/include/armreg.h:1.101 src/sys/arch/arm/include/armreg.h:1.102
--- src/sys/arch/arm/include/armreg.h:1.101	Wed Oct 15 21:58:22 2014
+++ src/sys/arch/arm/include/armreg.h	Thu Nov 27 04:07:13 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: armreg.h,v 1.101 2014/10/15 21:58:22 skrll Exp $	*/
+/*	$NetBSD: armreg.h,v 1.102 2014/11/27 04:07:13 matt Exp $	*/
 
 /*
  * Copyright (c) 1998, 2001 Ben Harris
@@ -225,6 +225,7 @@
 #define CPU_ID_CORTEXA9R4	0x413fc090
 #define CPU_ID_CORTEXA15R2	0x412fc0f0
 #define CPU_ID_CORTEXA15R3	0x413fc0f0
+#define CPU_ID_CORTEXA17R1	0x411fc0e0
 #define CPU_ID_CORTEX_P(n)	((n & 0xff0ff000) == 0x410fc000)
 #define CPU_ID_CORTEX_A5_P(n)	((n & 0xff0ff0f0) == 0x410fc050)
 #define CPU_ID_CORTEX_A7_P(n)	((n & 0xff0ff0f0) == 0x410fc070)



CVS commit: src/sys

2014-11-26 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Thu Nov 27 03:15:51 UTC 2014

Modified Files:
src/sys/kern: uipc_mbuf.c
src/sys/net: if.c if.h
src/sys/rump/librump/rumpnet: net_stub.c

Log Message:
Pull if_drain routine out of m_reclaim

It's if-specific and should be in if.c.

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.158 -r1.159 src/sys/kern/uipc_mbuf.c
cvs rdiff -u -r1.298 -r1.299 src/sys/net/if.c
cvs rdiff -u -r1.179 -r1.180 src/sys/net/if.h
cvs rdiff -u -r1.18 -r1.19 src/sys/rump/librump/rumpnet/net_stub.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/uipc_mbuf.c
diff -u src/sys/kern/uipc_mbuf.c:1.158 src/sys/kern/uipc_mbuf.c:1.159
--- src/sys/kern/uipc_mbuf.c:1.158	Tue Feb 25 18:30:11 2014
+++ src/sys/kern/uipc_mbuf.c	Thu Nov 27 03:15:51 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: uipc_mbuf.c,v 1.158 2014/02/25 18:30:11 pooka Exp $	*/
+/*	$NetBSD: uipc_mbuf.c,v 1.159 2014/11/27 03:15:51 ozaki-r Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2001 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uipc_mbuf.c,v 1.158 2014/02/25 18:30:11 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_mbuf.c,v 1.159 2014/11/27 03:15:51 ozaki-r Exp $");
 
 #include "opt_mbuftrace.h"
 #include "opt_nmbclusters.h"
@@ -543,7 +543,6 @@ m_reclaim(void *arg, int flags)
 {
 	struct domain *dp;
 	const struct protosw *pr;
-	struct ifnet *ifp;
 	int s;
 
 	KERNEL_LOCK(1, NULL);
@@ -554,10 +553,7 @@ m_reclaim(void *arg, int flags)
 			if (pr->pr_drain)
 (*pr->pr_drain)();
 	}
-	IFNET_FOREACH(ifp) {
-		if (ifp->if_drain)
-			(*ifp->if_drain)(ifp);
-	}
+	if_drain_all();
 	splx(s);
 	mbstat.m_drain++;
 	KERNEL_UNLOCK_ONE(NULL);

Index: src/sys/net/if.c
diff -u src/sys/net/if.c:1.298 src/sys/net/if.c:1.299
--- src/sys/net/if.c:1.298	Wed Nov 26 09:53:53 2014
+++ src/sys/net/if.c	Thu Nov 27 03:15:51 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: if.c,v 1.298 2014/11/26 09:53:53 ozaki-r Exp $	*/
+/*	$NetBSD: if.c,v 1.299 2014/11/27 03:15:51 ozaki-r Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2008 The NetBSD Foundation, Inc.
@@ -90,7 +90,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.298 2014/11/26 09:53:53 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.299 2014/11/27 03:15:51 ozaki-r Exp $");
 
 #include "opt_inet.h"
 
@@ -2324,6 +2324,17 @@ if_mcast_op(ifnet_t *ifp, const unsigned
 	return rc;
 }
 
+void
+if_drain_all(void)
+{
+	struct ifnet *ifp;
+
+	IFNET_FOREACH(ifp) {
+		if (ifp->if_drain)
+			(*ifp->if_drain)(ifp);
+	}
+}
+
 static void
 sysctl_sndq_setup(struct sysctllog **clog, const char *ifname,
 struct ifaltq *ifq)

Index: src/sys/net/if.h
diff -u src/sys/net/if.h:1.179 src/sys/net/if.h:1.180
--- src/sys/net/if.h:1.179	Wed Nov 26 09:38:42 2014
+++ src/sys/net/if.h	Thu Nov 27 03:15:51 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: if.h,v 1.179 2014/11/26 09:38:42 ozaki-r Exp $	*/
+/*	$NetBSD: if.h,v 1.180 2014/11/27 03:15:51 ozaki-r Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -968,6 +968,7 @@ extern struct ifnet_head ifnet_list;
 extern struct ifnet *lo0ifp;
 
 ifnet_t *	if_byindex(u_int);
+void		if_drain_all(void);
 
 /*
  * ifq sysctl support

Index: src/sys/rump/librump/rumpnet/net_stub.c
diff -u src/sys/rump/librump/rumpnet/net_stub.c:1.18 src/sys/rump/librump/rumpnet/net_stub.c:1.19
--- src/sys/rump/librump/rumpnet/net_stub.c:1.18	Sun May 18 14:03:26 2014
+++ src/sys/rump/librump/rumpnet/net_stub.c	Thu Nov 27 03:15:51 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: net_stub.c,v 1.18 2014/05/18 14:03:26 rmind Exp $	*/
+/*	$NetBSD: net_stub.c,v 1.19 2014/11/27 03:15:51 ozaki-r Exp $	*/
 
 /*
  * Copyright (c) 2008 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: net_stub.c,v 1.18 2014/05/18 14:03:26 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: net_stub.c,v 1.19 2014/11/27 03:15:51 ozaki-r Exp $");
 
 #include 
 #include 
@@ -61,7 +61,9 @@ __weak_alias(agr_input,rumpnet_stub);
 __weak_alias(ieee8023ad_lacp_input,rumpnet_stub);
 __weak_alias(ieee8023ad_marker_input,rumpnet_stub);
 
+/* if */
 struct ifnet_head ifnet_list;
+__weak_alias(if_drain_all,rumpnet_stub);
 
 int
 compat_ifconf(u_long cmd, void *data)



CVS commit: src/sys/sys

2014-11-26 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Thu Nov 27 01:44:59 UTC 2014

Modified Files:
src/sys/sys: param.h

Log Message:
Welcome to 7.99.2 (struct ifnet change)


To generate a diff of this commit:
cvs rdiff -u -r1.461 -r1.462 src/sys/sys/param.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/sys/param.h
diff -u src/sys/sys/param.h:1.461 src/sys/sys/param.h:1.462
--- src/sys/sys/param.h:1.461	Fri Sep 19 17:27:55 2014
+++ src/sys/sys/param.h	Thu Nov 27 01:44:59 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: param.h,v 1.461 2014/09/19 17:27:55 matt Exp $	*/
+/*	$NetBSD: param.h,v 1.462 2014/11/27 01:44:59 ozaki-r Exp $	*/
 
 /*-
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -63,7 +63,7 @@
  *	2.99.9		(299000900)
  */
 
-#define	__NetBSD_Version__	799000100	/* NetBSD 7.99.1 */
+#define	__NetBSD_Version__	799000200	/* NetBSD 7.99.2 */
 
 #define __NetBSD_Prereq__(M,m,p) (M) * 1) + \
 (m) * 100) + (p) * 100) <= __NetBSD_Version__)



CVS commit: src

2014-11-26 Thread enami tsugutomo
Module Name:src
Committed By:   enami
Date:   Wed Nov 26 23:44:21 UTC 2014

Modified Files:
src/lib/libc/net: rcmd.c
src/usr.bin/rsh: rsh.c

Log Message:
Changes done in rsh.c rev. 1.35 was incomplete.  As chuq pointed
in private mail, it broke rcp(1).

To achieve the documented behavior and to fix long standing incorrect
rsh(1) behavior which I've tried to fix in rev. 1.35, rcmd(1) should have
two operation mode; whether it should relay signal information on
auxiliary channel or not, depending on the argument `fd2p' passed to rcmd(3).
So, make rcmd(1) behave differntly depending on the environment variable and
set it when necessary in rcmd(3) according to how auxiliary channel
is set up by rcmd(3).


To generate a diff of this commit:
cvs rdiff -u -r1.70 -r1.71 src/lib/libc/net/rcmd.c
cvs rdiff -u -r1.37 -r1.38 src/usr.bin/rsh/rsh.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/net/rcmd.c
diff -u src/lib/libc/net/rcmd.c:1.70 src/lib/libc/net/rcmd.c:1.71
--- src/lib/libc/net/rcmd.c:1.70	Thu Sep 18 13:58:20 2014
+++ src/lib/libc/net/rcmd.c	Wed Nov 26 23:44:21 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: rcmd.c,v 1.70 2014/09/18 13:58:20 christos Exp $	*/
+/*	$NetBSD: rcmd.c,v 1.71 2014/11/26 23:44:21 enami Exp $	*/
 
 /*
  * Copyright (c) 1983, 1993, 1994
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)rcmd.c	8.3 (Berkeley) 3/26/94";
 #else
-__RCSID("$NetBSD: rcmd.c,v 1.70 2014/09/18 13:58:20 christos Exp $");
+__RCSID("$NetBSD: rcmd.c,v 1.71 2014/11/26 23:44:21 enami Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -464,6 +464,9 @@ rshrcmd(int af, char **ahost, u_int32_t 
 			const char *program;
 			program = strrchr(rshcmd, '/');
 			program = program ? program + 1 : rshcmd;
+			if (fd2p)
+/* ask rcmd to relay signal information */
+setenv("RCMD_RELAY_SIGNAL", "YES", 1);
 			switch (af) {
 			case AF_INET:
 execlp(rshcmd, program, "-4", "-l", remuser,

Index: src/usr.bin/rsh/rsh.c
diff -u src/usr.bin/rsh/rsh.c:1.37 src/usr.bin/rsh/rsh.c:1.38
--- src/usr.bin/rsh/rsh.c:1.37	Thu Oct 30 06:13:50 2014
+++ src/usr.bin/rsh/rsh.c	Wed Nov 26 23:44:21 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: rsh.c,v 1.37 2014/10/30 06:13:50 dholland Exp $	*/
+/*	$NetBSD: rsh.c,v 1.38 2014/11/26 23:44:21 enami Exp $	*/
 
 /*-
  * Copyright (c) 1983, 1990, 1993, 1994
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 19
 #if 0
 static char sccsid[] = "@(#)rsh.c	8.4 (Berkeley) 4/29/95";
 #else
-__RCSID("$NetBSD: rsh.c,v 1.37 2014/10/30 06:13:50 dholland Exp $");
+__RCSID("$NetBSD: rsh.c,v 1.38 2014/11/26 23:44:21 enami Exp $");
 #endif
 #endif /* not lint */
 
@@ -76,9 +76,7 @@ int	remerr;
 static int sigs[] = { SIGINT, SIGTERM, SIGQUIT };
 
 static char   *copyargs(char **);
-#ifndef IN_RCMD
 static void	sendsig(int);
-#endif
 static int	checkfd(struct pollfd *, int);
 static void	talk(int, sigset_t *, pid_t, int);
 __dead static void	usage(void);
@@ -87,6 +85,7 @@ int	 orcmd(char **, int, const char *,
 const char *, const char *, int *);
 int	 orcmd_af(char **, int, const char *,
 const char *, const char *, int *, int);
+static int	relay_signal;
 #endif
 
 int
@@ -98,7 +97,7 @@ main(int argc, char **argv)
 	struct protoent *proto;
 
 #ifdef IN_RCMD
-	char	*locuser = 0, *loop;
+	char	*locuser = 0, *loop, *relay;
 #endif /* IN_RCMD */
 	int argoff, asrsh, ch, dflag, nflag, one, rem;
 	size_t i;
@@ -133,6 +132,8 @@ main(int argc, char **argv)
 	}
 
 #ifdef IN_RCMD
+	if ((relay = getenv("RCMD_RELAY_SIGNAL")) && strcmp(relay, "YES") == 0)
+		relay_signal = 1;
 	if ((loop = getenv("RCMD_LOOP")) && strcmp(loop, "YES") == 0)
 		warnx("rcmd appears to be looping!");
 
@@ -152,7 +153,7 @@ main(int argc, char **argv)
 	if ((name = strdup(pw->pw_name)) == NULL)
 		err(1, "malloc");
 	while ((ch = getopt(argc - argoff, argv + argoff, OPTIONS)) != -1)
-		switch(ch) {
+		switch (ch) {
 		case '4':
 			family = AF_INET;
 			break;
@@ -268,16 +269,17 @@ main(int argc, char **argv)
 
 	(void)sigprocmask(SIG_BLOCK, &nset, &oset);
 
-#ifndef IN_RCMD
-	for (i = 0; i < sizeof(sigs) / sizeof(sigs[0]); i++) {
-		struct sigaction sa;
+#ifdef IN_RCMD
+	if (!relay_signal)
+#endif
+		for (i = 0; i < sizeof(sigs) / sizeof(sigs[0]); i++) {
+			struct sigaction sa;
 
-		if (sa.sa_handler != SIG_IGN) {
-			sa.sa_handler = sendsig;
-			(void)sigaction(sigs[i], &sa, NULL);
+			if (sa.sa_handler != SIG_IGN) {
+sa.sa_handler = sendsig;
+(void)sigaction(sigs[i], &sa, NULL);
+			}
 		}
-	}
-#endif
 
 	if (!nflag) {
 		pid = fork();
@@ -390,17 +392,18 @@ done:
 		exit(0);
 	}
 
-#ifdef IN_RCMD
-	fdp = &fds[0];
-	nfds = 3;
-	fds[0].events = POLLIN|POLLNVAL|POLLERR|POLLHUP;
-	fds[0].fd = 2;
-#else
-	(void)sigprocmask(SIG_SETMASK, oset, NULL);
 	fdp = &fds[1];
 	nfds = 2;
 	fds[0].events = 0;
+#ifdef IN_RCMD
+	if (relay_signal) {
+		fdp = &fds[0];
+		nfds = 3;
+		fds[0].events = POLLIN|POLLNVAL|POLLERR|POLLHUP;

CVS commit: src/sys

2014-11-26 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Nov 26 22:50:22 UTC 2014

Modified Files:
src/sys/arch/arm/s3c2xx0: s3c2440_sdi.c
src/sys/dev/ic: dm9000.c

Log Message:
Appease gcc 4.8 - from Greg Willatt in private email.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/s3c2xx0/s3c2440_sdi.c
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/ic/dm9000.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/arm/s3c2xx0/s3c2440_sdi.c
diff -u src/sys/arch/arm/s3c2xx0/s3c2440_sdi.c:1.2 src/sys/arch/arm/s3c2xx0/s3c2440_sdi.c:1.3
--- src/sys/arch/arm/s3c2xx0/s3c2440_sdi.c:1.2	Sat Oct 27 17:17:40 2012
+++ src/sys/arch/arm/s3c2xx0/s3c2440_sdi.c	Wed Nov 26 22:50:22 2014
@@ -384,7 +384,9 @@ sssdi_exec_command(sdmmc_chipset_handle_
 	struct sssdi_softc *sc = (struct sssdi_softc*)sch;
 	uint32_t cmd_control;
 	int status = 0;
+#ifdef SSSDI_DEBUG
 	uint32_t data_status;
+#endif
 	int transfer = SSSDI_TRANSFER_NONE;
 	dmac_xfer_t xfer;
 
@@ -566,8 +568,8 @@ sssdi_exec_command(sdmmc_chipset_handle_
 	DPRINTF(("Remaining Block Number  : %d\n",
 		 SDIDATCNT_BLK_NUM_CNT(status)));
 
-	data_status = bus_space_read_4(sc->iot, sc->ioh, SDI_DAT_STA);
 #ifdef SSSDI_DEBUG
+	data_status = bus_space_read_4(sc->iot, sc->ioh, SDI_DAT_STA);
 	printf("SDI Data Status Register Before xfer: 0x%X\n", data_status);
 #endif
 	if (transfer == SSSDI_TRANSFER_READ) {
@@ -646,7 +648,6 @@ sssdi_exec_command(sdmmc_chipset_handle_
 
 void sssdi_perform_pio_read(struct sssdi_softc *sc, struct sdmmc_command *cmd)
 {
-	uint32_t status;
 	uint32_t fifo_status;
 	int count;
 	uint32_t written;
@@ -657,7 +658,7 @@ void sssdi_perform_pio_read(struct sssdi
 	while (written < cmd->c_datalen ) {
 		/* Wait until the FIFO is full or has the final data.
 		   In the latter case it might not get filled. */
-		status = sssdi_wait_intr(sc, SDI_FIFO_RX_FULL | SDI_FIFO_RX_LAST, 1000);
+		sssdi_wait_intr(sc, SDI_FIFO_RX_FULL | SDI_FIFO_RX_LAST, 1000);
 
 		fifo_status = bus_space_read_4(sc->iot, sc->ioh, SDI_DAT_FSTA);
 		count = SDIDATFSTA_FFCNT(fifo_status);

Index: src/sys/dev/ic/dm9000.c
diff -u src/sys/dev/ic/dm9000.c:1.4 src/sys/dev/ic/dm9000.c:1.5
--- src/sys/dev/ic/dm9000.c:1.4	Sat Jan 28 08:29:55 2012
+++ src/sys/dev/ic/dm9000.c	Wed Nov 26 22:50:22 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: dm9000.c,v 1.4 2012/01/28 08:29:55 nisimura Exp $	*/
+/*	$NetBSD: dm9000.c,v 1.5 2014/11/26 22:50:22 skrll Exp $	*/
 
 /*
  * Copyright (c) 2009 Paul Fleischer
@@ -762,7 +762,6 @@ dme_mediastatus(struct ifnet *ifp, struc
 void
 dme_transmit(struct dme_softc *sc)
 {
-	uint8_t status;
 
 	TX_DPRINTF(("dme_transmit: PRE: txready: %d, txbusy: %d\n",
 		sc->txready, sc->txbusy));
@@ -771,7 +770,7 @@ dme_transmit(struct dme_softc *sc)
 	dme_write(sc, DM9000_TXPLH, (sc->txready_length >> 8) & 0xff );
 
 	/* Request to send the packet */
-	status = dme_read(sc, DM9000_ISR);
+	dme_read(sc, DM9000_ISR);
 
 	dme_write(sc, DM9000_TCR, DM9000_TCR_TXREQ);
 



CVS commit: src/sys/net/npf

2014-11-26 Thread Mindaugas Rasiukevicius
Module Name:src
Committed By:   rmind
Date:   Wed Nov 26 21:25:35 UTC 2014

Modified Files:
src/sys/net/npf: npf_nat.c npf_ruleset.c

Log Message:
NPF: fix the reference counting and share the active NAT portmap correctly
when performing the reload.  Should fixes PR/49412, reported by kardel@.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/net/npf/npf_nat.c
cvs rdiff -u -r1.37 -r1.38 src/sys/net/npf/npf_ruleset.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/net/npf/npf_nat.c
diff -u src/sys/net/npf/npf_nat.c:1.34 src/sys/net/npf/npf_nat.c:1.35
--- src/sys/net/npf/npf_nat.c:1.34	Sun Aug 24 20:36:30 2014
+++ src/sys/net/npf/npf_nat.c	Wed Nov 26 21:25:35 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: npf_nat.c,v 1.34 2014/08/24 20:36:30 rmind Exp $	*/
+/*	$NetBSD: npf_nat.c,v 1.35 2014/11/26 21:25:35 rmind Exp $	*/
 
 /*-
  * Copyright (c) 2014 Mindaugas Rasiukevicius 
@@ -71,7 +71,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: npf_nat.c,v 1.34 2014/08/24 20:36:30 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: npf_nat.c,v 1.35 2014/11/26 21:25:35 rmind Exp $");
 
 #include 
 #include 
@@ -313,9 +313,10 @@ npf_nat_freepolicy(npf_natpolicy_t *np)
 		kpause("npfgcnat", false, 1, NULL);
 	}
 	KASSERT(LIST_EMPTY(&np->n_nat_list));
+	KASSERT(pm == NULL || pm->p_refcnt > 0);
 
 	/* Destroy the port map, on last reference. */
-	if (pm && --pm->p_refcnt == 0) {
+	if (pm && atomic_dec_uint_nv(&pm->p_refcnt) == 0) {
 		KASSERT((np->n_flags & NPF_NAT_PORTMAP) != 0);
 		kmem_free(pm, PORTMAP_MEM_SIZE);
 	}
@@ -373,17 +374,21 @@ npf_nat_sharepm(npf_natpolicy_t *np, npf
 	if (memcmp(&np->n_taddr, &mnp->n_taddr, np->n_alen) != 0) {
 		return false;
 	}
-	/* If NAT policy has an old port map - drop the reference. */
 	mpm = mnp->n_portmap;
-	if (mpm) {
-		/* Note: at this point we cannot hold a last reference. */
-		KASSERT(mpm->p_refcnt > 1);
-		mpm->p_refcnt--;
+	KASSERT(mpm == NULL || mpm->p_refcnt > 0);
+
+	/*
+	 * If NAT policy has an old port map - drop the reference
+	 * and destroy the port map if it was the last.
+	 */
+	if (mpm && atomic_dec_uint_nv(&mpm->p_refcnt) == 0) {
+		kmem_free(mpm, PORTMAP_MEM_SIZE);
 	}
+
 	/* Share the port map. */
 	pm = np->n_portmap;
+	atomic_inc_uint(&pm->p_refcnt);
 	mnp->n_portmap = pm;
-	pm->p_refcnt++;
 	return true;
 }
 

Index: src/sys/net/npf/npf_ruleset.c
diff -u src/sys/net/npf/npf_ruleset.c:1.37 src/sys/net/npf/npf_ruleset.c:1.38
--- src/sys/net/npf/npf_ruleset.c:1.37	Mon Aug 11 01:54:12 2014
+++ src/sys/net/npf/npf_ruleset.c	Wed Nov 26 21:25:35 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: npf_ruleset.c,v 1.37 2014/08/11 01:54:12 rmind Exp $	*/
+/*	$NetBSD: npf_ruleset.c,v 1.38 2014/11/26 21:25:35 rmind Exp $	*/
 
 /*-
  * Copyright (c) 2009-2013 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: npf_ruleset.c,v 1.37 2014/08/11 01:54:12 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: npf_ruleset.c,v 1.38 2014/11/26 21:25:35 rmind Exp $");
 
 #include 
 #include 
@@ -421,22 +421,6 @@ npf_ruleset_gc(npf_ruleset_t *rlset)
 }
 
 /*
- * npf_ruleset_cmpnat: find a matching NAT policy in the ruleset.
- */
-static inline npf_rule_t *
-npf_ruleset_cmpnat(npf_ruleset_t *rlset, npf_natpolicy_t *mnp)
-{
-	npf_rule_t *rl;
-
-	/* Find a matching NAT policy in the old ruleset. */
-	LIST_FOREACH(rl, &rlset->rs_all, r_aentry) {
-		if (rl->r_natp && npf_nat_cmppolicy(rl->r_natp, mnp))
-			break;
-	}
-	return rl;
-}
-
-/*
  * npf_ruleset_reload: prepare the new ruleset by scanning the active
  * ruleset and 1) sharing the dynamic rules 2) sharing NAT policies.
  *
@@ -492,18 +476,30 @@ npf_ruleset_reload(npf_ruleset_t *newset
 			continue;
 		}
 
+		/*
+		 * First, try to share the active port map.  If this
+		 * policy will be unused, npf_nat_freepolicy() will
+		 * drop the reference.
+		 */
+		npf_ruleset_sharepm(oldset, np);
+
 		/* Does it match with any policy in the active ruleset? */
-		if ((actrl = npf_ruleset_cmpnat(oldset, np)) == NULL) {
+		LIST_FOREACH(actrl, &oldset->rs_all, r_aentry) {
+			if (!actrl->r_natp)
+continue;
+			if ((actrl->r_attr & NPF_RULE_KEEPNAT) != 0)
+continue;
+			if (npf_nat_cmppolicy(actrl->r_natp, np))
+break;
+		}
+		if (!actrl) {
+			/* No: just set the ID and continue. */
 			npf_nat_setid(np, ++nid);
 			continue;
 		}
 
-		/*
-		 * Inherit the matching NAT policy and check other ones
-		 * in the new ruleset for sharing the portmap.
-		 */
+		/* Yes: inherit the matching NAT policy. */
 		rl->r_natp = actrl->r_natp;
-		npf_ruleset_sharepm(newset, rl->r_natp);
 		npf_nat_setid(rl->r_natp, ++nid);
 
 		/*
@@ -525,13 +521,8 @@ npf_ruleset_sharepm(npf_ruleset_t *rlset
 	npf_natpolicy_t *np;
 	npf_rule_t *rl;
 
-	/* Find a matching NAT policy in the old ruleset. */
+	/* Find a matching NAT policy in the old ruleset; skip the self. */
 	LIST_FOREACH(rl, &rlset->rs_all, r_aentry) {
-		/*
-

CVS commit: src/share/man/man9

2014-11-26 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Wed Nov 26 20:46:46 UTC 2014

Modified Files:
src/share/man/man9: cpu_rootconf.9

Log Message:
New sentence, new line. Use more markup. Sort SEE ALSO.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/share/man/man9/cpu_rootconf.9

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/share/man/man9/cpu_rootconf.9
diff -u src/share/man/man9/cpu_rootconf.9:1.9 src/share/man/man9/cpu_rootconf.9:1.10
--- src/share/man/man9/cpu_rootconf.9:1.9	Wed Nov 26 20:42:29 2014
+++ src/share/man/man9/cpu_rootconf.9	Wed Nov 26 20:46:46 2014
@@ -1,4 +1,4 @@
-.\" $NetBSD: cpu_rootconf.9,v 1.9 2014/11/26 20:42:29 mlelstv Exp $
+.\" $NetBSD: cpu_rootconf.9,v 1.10 2014/11/26 20:46:46 wiz Exp $
 .\"
 .\" Copyright (c) 2002 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd July 29, 2012
+.Dd November 11, 2014
 .Dt CPU_ROOTCONF 9
 .Os
 .Sh NAME
@@ -68,7 +68,8 @@ for use in machine-independent code.
 .Pp
 .Fa rootconf
 may adjust the global variables and determines the parameters
-for setroot. This is for example used to translate a device
+for setroot.
+This is for example used to translate a device
 and partition number provided by the bootloader into a disk
 wedge device covering the same partition.
 .Pp
@@ -90,10 +91,10 @@ The kernel configuration variable
 .Fa rootspec
 which is set by
 .Xr config 1 .
-The value is the name and unit of the root device, e.g. "sd0" (disk)
+The value is the name and unit of the root device, e.g., "sd0" (disk)
 or "dk0" (wedge) or "le0" (network) or the prefix "wedge:" followed
-by the name of the disk wedge. For disk devices the partition
-passed as argument to
+by the name of the disk wedge.
+For disk devices the partition passed as argument to
 .Fa setroot
 is used.
 .It
@@ -103,22 +104,26 @@ following the same syntax.
 .It
 The result of an interactive query of the root device if
 .Fa boothowto
-has set the flag RB_ASKNAME. The input uses the same syntax
-as the previous sources. Here also the kernel dump device
-is queried.
+has set the flag
+.Dv RB_ASKNAME .
+The input uses the same syntax as the previous sources.
+Here also the kernel dump device is queried.
 .It
 The boot device and partition passed as arguments.
 .El
 .Pp
 If a root device cannot be selected,
 .Fa setroot
-sets the RB_ASKNAME flag and loops.
+sets the
+.Dv RB_ASKNAME
+flag and loops.
 .Pp
 Otherwise the kernel dump device is identified in a similar
 manner from
 .Bl -enum
 .It
-The result of a previous interactive query. See above.
+The result of a previous interactive query.
+See above.
 .It
 The kernel configuration variable
 .Fa dumpspec ,
@@ -129,7 +134,7 @@ The second partition of the root device,
 The first disk wedge device of type DKW_PTYPE_SWAP.
 .El
 .Sh SEE ALSO
+.Xr config 1 ,
 .Xr dk 4 ,
 .Xr boot 8 ,
-.Xr config 1 ,
 .Xr boothowto 9



CVS commit: src/share/man/man9

2014-11-26 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Wed Nov 26 20:42:29 UTC 2014

Modified Files:
src/share/man/man9: cpu_rootconf.9

Log Message:
Mention the new bootspec variable.
Give more details about the root device configuration.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/share/man/man9/cpu_rootconf.9

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/share/man/man9/cpu_rootconf.9
diff -u src/share/man/man9/cpu_rootconf.9:1.8 src/share/man/man9/cpu_rootconf.9:1.9
--- src/share/man/man9/cpu_rootconf.9:1.8	Sun Jul 29 18:51:48 2012
+++ src/share/man/man9/cpu_rootconf.9	Wed Nov 26 20:42:29 2014
@@ -1,4 +1,4 @@
-.\" $NetBSD: cpu_rootconf.9,v 1.8 2012/07/29 18:51:48 wiz Exp $
+.\" $NetBSD: cpu_rootconf.9,v 1.9 2014/11/26 20:42:29 mlelstv Exp $
 .\"
 .\" Copyright (c) 2002 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -55,28 +55,81 @@ provides the global variables
 .Fa booted_device ,
 .Fa booted_partition ,
 .Fa booted_startblk ,
+.Fa booted_nblks ,
 and
-.Fa booted_nblks
-and invokes the machine-independent function
-.Fa rootconf
-which
+.Fa bootspec .
+.Fa cpu_rootconf
+invokes the machine-independent function
 .Fa rootconf
-then calls the function
+which calls the function
 .Fa setroot
-to record the boot/root device and the boot partition information
+to record the root device and the root partition information
 for use in machine-independent code.
 .Pp
-For disk boot, if
-.Fa booted_nblks
-is not 0, then
+.Fa rootconf
+may adjust the global variables and determines the parameters
+for setroot. This is for example used to translate a device
+and partition number provided by the bootloader into a disk
+wedge device covering the same partition.
+.Pp
+If the bootloader already identified a disk wedge, it passes
+a non-zero value for
+.Fa booted_nblks ,
+then
 .Fa booted_startblk
 and
 .Fa booted_nblks
-are supposed to specify a disk wedge that is used as the root device.
-Otherwise the
-.Fa booted_partition
+specify a disk wedge as the boot device.
+.Pp
+.Fa setroot
+evaluates several sources to identify the root device in the
+following order until a valid device is selected:
+.Bl -enum
+.It
+The kernel configuration variable
+.Fa rootspec
+which is set by
+.Xr config 1 .
+The value is the name and unit of the root device, e.g. "sd0" (disk)
+or "dk0" (wedge) or "le0" (network) or the prefix "wedge:" followed
+by the name of the disk wedge. For disk devices the partition
+passed as argument to
+.Fa setroot
 is used.
+.It
+The variable
+.Fa bootspec
+following the same syntax.
+.It
+The result of an interactive query of the root device if
+.Fa boothowto
+has set the flag RB_ASKNAME. The input uses the same syntax
+as the previous sources. Here also the kernel dump device
+is queried.
+.It
+The boot device and partition passed as arguments.
+.El
+.Pp
+If a root device cannot be selected,
+.Fa setroot
+sets the RB_ASKNAME flag and loops.
+.Pp
+Otherwise the kernel dump device is identified in a similar
+manner from
+.Bl -enum
+.It
+The result of a previous interactive query. See above.
+.It
+The kernel configuration variable
+.Fa dumpspec ,
+if set.
+.It
+The second partition of the root device, if it is a regular disk.
+.It
+The first disk wedge device of type DKW_PTYPE_SWAP.
+.El
 .Sh SEE ALSO
 .Xr dk 4 ,
 .Xr boot 8 ,
+.Xr config 1 ,
 .Xr boothowto 9



CVS commit: src/lib/libc/gen

2014-11-26 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Nov 26 16:48:43 UTC 2014

Modified Files:
src/lib/libc/gen: opendir.c

Log Message:
- Use O_DIRECTORY to open the file, so that we don't need to stat() after
  that.
- Move the stat() call to fdopendir() and change it's error handling so that
  it does not hide errors.
- According to POSIX, fdopendir() transfers ownership of the fd only on
  success, so don't close it on failure. XXX: We still make it non-blocking
  on failure, but that's nitpicking.

XXX: pullup-7?


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/lib/libc/gen/opendir.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/gen/opendir.c
diff -u src/lib/libc/gen/opendir.c:1.38 src/lib/libc/gen/opendir.c:1.39
--- src/lib/libc/gen/opendir.c:1.38	Sat Oct 15 19:00:01 2011
+++ src/lib/libc/gen/opendir.c	Wed Nov 26 11:48:43 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: opendir.c,v 1.38 2011/10/15 23:00:01 christos Exp $	*/
+/*	$NetBSD: opendir.c,v 1.39 2014/11/26 16:48:43 christos Exp $	*/
 
 /*
  * Copyright (c) 1983, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)opendir.c	8.7 (Berkeley) 12/10/94";
 #else
-__RCSID("$NetBSD: opendir.c,v 1.38 2011/10/15 23:00:01 christos Exp $");
+__RCSID("$NetBSD: opendir.c,v 1.39 2014/11/26 16:48:43 christos Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -75,17 +75,36 @@ opendir(const char *name)
 DIR *
 __opendir2(const char *name, int flags)
 {
+	DIR *dirp;
 	int fd;
 
-	if ((fd = open(name, O_RDONLY | O_NONBLOCK | O_CLOEXEC)) == -1)
+	if ((fd = open(name, O_RDONLY|O_DIRECTORY|O_NONBLOCK|O_CLOEXEC)) == -1)
 		return NULL;
-	return __opendir_common(fd, name, flags);
+
+	dirp = __opendir_common(fd, name, flags);
+	if (dirp == NULL) {
+		int serrno = errno;
+		(void)close(fd);
+		errno = serrno;
+	}
+	return dirp;
 }
 
 #ifndef __LIBC12_SOURCE__
 DIR *
 _fdopendir(int fd)
 {
+	struct stat sb;
+
+	if (fstat(fd, &sb) == -1)
+		return NULL;
+
+	if (!S_ISDIR(sb.st_mode)) {
+		errno = ENOTDIR;
+		return NULL;
+	}
+
+	/* This is optional according to POSIX, but a good measure */
 	if (fcntl(fd, F_SETFD, FD_CLOEXEC) == -1)
 		return NULL;
 
@@ -96,16 +115,11 @@ _fdopendir(int fd)
 static DIR *
 __opendir_common(int fd, const char *name, int flags)
 {
-	DIR *dirp = NULL;
+	DIR *dirp;
 	int serrno;
-	struct stat sb;
 	struct statvfs sfb;
 	int error;
 
-	if (fstat(fd, &sb) || !S_ISDIR(sb.st_mode)) {
-		errno = ENOTDIR;
-		goto error;
-	}
 	if ((dirp = malloc(sizeof(*dirp))) == NULL)
 		goto error;
 	dirp->dd_buf = NULL;
@@ -157,8 +171,6 @@ error:
 		free(dirp->dd_buf);
 	}
 	free(dirp);
-	if (fd != -1)
-		(void)close(fd);
 	errno = serrno;
 	return NULL;
 }



CVS commit: src/doc

2014-11-26 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Wed Nov 26 16:05:51 UTC 2014

Modified Files:
src/doc: 3RDPARTY CHANGES

Log Message:
Note import of dhcpcd-6.6.4


To generate a diff of this commit:
cvs rdiff -u -r1.1176 -r1.1177 src/doc/3RDPARTY
cvs rdiff -u -r1.2022 -r1.2023 src/doc/CHANGES

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/doc/3RDPARTY
diff -u src/doc/3RDPARTY:1.1176 src/doc/3RDPARTY:1.1177
--- src/doc/3RDPARTY:1.1176	Wed Nov 26 13:45:00 2014
+++ src/doc/3RDPARTY	Wed Nov 26 16:05:51 2014
@@ -1,4 +1,4 @@
-#	$NetBSD: 3RDPARTY,v 1.1176 2014/11/26 13:45:00 roy Exp $
+#	$NetBSD: 3RDPARTY,v 1.1177 2014/11/26 16:05:51 roy Exp $
 #
 # This file contains a list of the software that has been integrated into
 # NetBSD where we are not the primary maintainer.
@@ -305,8 +305,8 @@ Notes:
 Use the dhcp2netbsd script.
 
 Package:	dhcpcd
-Version:	6.6.3
-Current Vers:	6.6.3
+Version:	6.6.4
+Current Vers:	6.6.4
 Maintainer:	roy
 Archive Site:	ftp://roy.marples.name/pub/dhcpcd/
 Home Page:	http://roy.marples.name/projects/dhcpcd/

Index: src/doc/CHANGES
diff -u src/doc/CHANGES:1.2022 src/doc/CHANGES:1.2023
--- src/doc/CHANGES:1.2022	Wed Nov 26 13:45:00 2014
+++ src/doc/CHANGES	Wed Nov 26 16:05:51 2014
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2022 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2023 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -108,4 +108,4 @@ Changes from NetBSD 7.0 to NetBSD 8.0:
 	libc: Update to tzcode2014j. [christos 20141117]
 	libpcap: Import 1.6.2. [christos 20141119]
 	tcpdump(8): Import 4.6.2. [christos 20141119]
-	dhcpcd(8): Import dhcpcd-6.6.3. [roy 20141126]
+	dhcpcd(8): Import dhcpcd-6.6.4. [roy 20141126]



CVS commit: src/external/bsd/dhcpcd/dist

2014-11-26 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Wed Nov 26 16:05:14 UTC 2014

Modified Files:
src/external/bsd/dhcpcd/dist: defs.h dhcpcd-run-hooks.in ipv4.c
script.c
src/external/bsd/dhcpcd/dist/dhcpcd-hooks: 01-test

Log Message:
Sync


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/external/bsd/dhcpcd/dist/defs.h \
src/external/bsd/dhcpcd/dist/ipv4.c
cvs rdiff -u -r1.6 -r1.7 src/external/bsd/dhcpcd/dist/dhcpcd-run-hooks.in
cvs rdiff -u -r1.14 -r1.15 src/external/bsd/dhcpcd/dist/script.c
cvs rdiff -u -r1.6 -r1.7 src/external/bsd/dhcpcd/dist/dhcpcd-hooks/01-test

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/dhcpcd/dist/defs.h
diff -u src/external/bsd/dhcpcd/dist/defs.h:1.8 src/external/bsd/dhcpcd/dist/defs.h:1.9
--- src/external/bsd/dhcpcd/dist/defs.h:1.8	Wed Nov 26 13:43:06 2014
+++ src/external/bsd/dhcpcd/dist/defs.h	Wed Nov 26 16:05:14 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: defs.h,v 1.8 2014/11/26 13:43:06 roy Exp $ */
+/* $NetBSD: defs.h,v 1.9 2014/11/26 16:05:14 roy Exp $ */
 
 /*
  * dhcpcd - DHCP client daemon
@@ -30,7 +30,7 @@
 #define CONFIG_H
 
 #define PACKAGE			"dhcpcd"
-#define VERSION			"6.6.3"
+#define VERSION			"6.6.4"
 
 #ifndef CONFIG
 # define CONFIG			SYSCONFDIR "/" PACKAGE ".conf"
Index: src/external/bsd/dhcpcd/dist/ipv4.c
diff -u src/external/bsd/dhcpcd/dist/ipv4.c:1.8 src/external/bsd/dhcpcd/dist/ipv4.c:1.9
--- src/external/bsd/dhcpcd/dist/ipv4.c:1.8	Wed Nov 26 13:43:06 2014
+++ src/external/bsd/dhcpcd/dist/ipv4.c	Wed Nov 26 16:05:14 2014
@@ -1,5 +1,5 @@
 #include 
- __RCSID("$NetBSD: ipv4.c,v 1.8 2014/11/26 13:43:06 roy Exp $");
+ __RCSID("$NetBSD: ipv4.c,v 1.9 2014/11/26 16:05:14 roy Exp $");
 
 /*
  * dhcpcd - DHCP client daemon
@@ -598,7 +598,7 @@ ipv4_buildroutes(struct dhcpcd_ctx *ctx)
 	struct rt_head *nrs, *dnr;
 	struct rt *or, *rt, *rtn;
 	struct interface *ifp;
-	const struct dhcp_state *state, *ostate;
+	const struct dhcp_state *state;
 
 	nrs = malloc(sizeof(*nrs));
 	if (nrs == NULL) {

Index: src/external/bsd/dhcpcd/dist/dhcpcd-run-hooks.in
diff -u src/external/bsd/dhcpcd/dist/dhcpcd-run-hooks.in:1.6 src/external/bsd/dhcpcd/dist/dhcpcd-run-hooks.in:1.7
--- src/external/bsd/dhcpcd/dist/dhcpcd-run-hooks.in:1.6	Fri Nov  7 20:51:02 2014
+++ src/external/bsd/dhcpcd/dist/dhcpcd-run-hooks.in	Wed Nov 26 16:05:14 2014
@@ -1,5 +1,5 @@
 #!/bin/sh
-# $NetBSD: dhcpcd-run-hooks.in,v 1.6 2014/11/07 20:51:02 roy Exp $
+# $NetBSD: dhcpcd-run-hooks.in,v 1.7 2014/11/26 16:05:14 roy Exp $
 
 # dhcpcd client configuration script 
 
@@ -26,6 +26,7 @@ _detected_init=false
 
 : ${if_up:=false}
 : ${if_down:=false}
+: ${syslog_debug:=false}
 
 # Ensure that all arguments are unique
 uniqify()
@@ -191,6 +192,9 @@ syslog()
 {
 	local lvl="$1"
 
+	if [ "$lvl" = debug ]; then
+		${syslog_debug} || return 0
+	fi
 	[ -n "$lvl" ] && shift
 	if [ -n "$*" ]; then
 		if type logger >/dev/null 2>&1; then

Index: src/external/bsd/dhcpcd/dist/script.c
diff -u src/external/bsd/dhcpcd/dist/script.c:1.14 src/external/bsd/dhcpcd/dist/script.c:1.15
--- src/external/bsd/dhcpcd/dist/script.c:1.14	Fri Nov  7 20:51:03 2014
+++ src/external/bsd/dhcpcd/dist/script.c	Wed Nov 26 16:05:14 2014
@@ -1,5 +1,5 @@
 #include 
- __RCSID("$NetBSD: script.c,v 1.14 2014/11/07 20:51:03 roy Exp $");
+ __RCSID("$NetBSD: script.c,v 1.15 2014/11/26 16:05:14 roy Exp $");
 
 /*
  * dhcpcd - DHCP client daemon
@@ -291,8 +291,8 @@ make_env(const struct interface *ifp, co
 		elen = 13;
 
 #define EMALLOC(i, l) if ((env[(i)] = malloc((l))) == NULL) goto eexit;
-	/* Make our env */
-	env = calloc(1, sizeof(char *) * (elen + 1));
+	/* Make our env + space for profile, wireless and debug */
+	env = calloc(1, sizeof(char *) * (elen + 3 + 1));
 	if (env == NULL)
 		goto eexit;
 	e = strlen("interface") + strlen(ifp->name) + 2;
@@ -375,8 +375,13 @@ make_env(const struct interface *ifp, co
 		env[12] = strdup("if_ipwaited=false");
 	if (env[12] == NULL)
 		goto eexit;
+	if (ifo->options & DHCPCD_DEBUG) {
+		e = strlen("syslog_debug=true") + 1;
+		EMALLOC(elen, e);
+		snprintf(env[elen++], e, "syslog_debug=true");
+	}
 	if (*ifp->profile) {
-		e = strlen("profile=") + strlen(ifp->profile) + 2;
+		e = strlen("profile=") + strlen(ifp->profile) + 1;
 		EMALLOC(elen, e);
 		snprintf(env[elen++], e, "profile=%s", ifp->profile);
 	}

Index: src/external/bsd/dhcpcd/dist/dhcpcd-hooks/01-test
diff -u src/external/bsd/dhcpcd/dist/dhcpcd-hooks/01-test:1.6 src/external/bsd/dhcpcd/dist/dhcpcd-hooks/01-test:1.7
--- src/external/bsd/dhcpcd/dist/dhcpcd-hooks/01-test:1.6	Fri Nov  7 20:51:03 2014
+++ src/external/bsd/dhcpcd/dist/dhcpcd-hooks/01-test	Wed Nov 26 16:05:14 2014
@@ -1,9 +1,9 @@
-# $NetBSD: 01-test,v 1.6 2014/11/07 20:51:03 roy Exp $
+# $NetBSD: 01-test,v 1.7 2014/11/26 16:05:14 roy Exp $
 
 # Just echo our DHCP options we have
 
 if [ "$reason" = "TEST" ]; then
-	set | grep "^\(interface\|pid\|re

CVS import: src/external/bsd/dhcpcd/dist

2014-11-26 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Wed Nov 26 16:03:51 UTC 2014

Update of /cvsroot/src/external/bsd/dhcpcd/dist
In directory ivanova.netbsd.org:/tmp/cvs-serv23966

Log Message:
Import dhcpcd-6.6.4 with the following changes:
  *  Fix a compile warning in dhcpcd-6.6.3
  *  Notify dhcpcd-run-hooks if running in debug mode
  *  Report selected profile in test mode

Status:

Vendor Tag: roy
Release Tags:   dhcpcd-6-6-4

U src/external/bsd/dhcpcd/dist/common.c
U src/external/bsd/dhcpcd/dist/control.c
U src/external/bsd/dhcpcd/dist/dhcpcd.c
U src/external/bsd/dhcpcd/dist/duid.c
U src/external/bsd/dhcpcd/dist/eloop.c
U src/external/bsd/dhcpcd/dist/if.c
U src/external/bsd/dhcpcd/dist/if-options.c
C src/external/bsd/dhcpcd/dist/script.c
U src/external/bsd/dhcpcd/dist/dhcp-common.c
U src/external/bsd/dhcpcd/dist/dhcpcd-embedded.c
U src/external/bsd/dhcpcd/dist/if-bsd.c
U src/external/bsd/dhcpcd/dist/arp.c
U src/external/bsd/dhcpcd/dist/dhcp.c
C src/external/bsd/dhcpcd/dist/ipv4.c
U src/external/bsd/dhcpcd/dist/ipv4ll.c
U src/external/bsd/dhcpcd/dist/ipv6.c
U src/external/bsd/dhcpcd/dist/ipv6nd.c
U src/external/bsd/dhcpcd/dist/dhcp6.c
U src/external/bsd/dhcpcd/dist/auth.c
U src/external/bsd/dhcpcd/dist/dhcpcd.conf
U src/external/bsd/dhcpcd/dist/dhcpcd-definitions.conf
U src/external/bsd/dhcpcd/dist/dhcpcd-embedded.c.in
U src/external/bsd/dhcpcd/dist/dhcpcd-embedded.h.in
U src/external/bsd/dhcpcd/dist/dhcpcd-run-hooks.8.in
C src/external/bsd/dhcpcd/dist/dhcpcd-run-hooks.in
U src/external/bsd/dhcpcd/dist/dhcpcd.8.in
U src/external/bsd/dhcpcd/dist/dhcpcd.conf.5.in
U src/external/bsd/dhcpcd/dist/arp.h
U src/external/bsd/dhcpcd/dist/auth.h
U src/external/bsd/dhcpcd/dist/bpf-filter.h
U src/external/bsd/dhcpcd/dist/common.h
U src/external/bsd/dhcpcd/dist/config.h
U src/external/bsd/dhcpcd/dist/control.h
C src/external/bsd/dhcpcd/dist/defs.h
U src/external/bsd/dhcpcd/dist/dev.h
U src/external/bsd/dhcpcd/dist/dhcp-common.h
U src/external/bsd/dhcpcd/dist/dhcp.h
U src/external/bsd/dhcpcd/dist/dhcp6.h
U src/external/bsd/dhcpcd/dist/dhcpcd-embedded.h
U src/external/bsd/dhcpcd/dist/dhcpcd.h
U src/external/bsd/dhcpcd/dist/duid.h
U src/external/bsd/dhcpcd/dist/eloop.h
U src/external/bsd/dhcpcd/dist/if-options.h
U src/external/bsd/dhcpcd/dist/if.h
U src/external/bsd/dhcpcd/dist/ipv4.h
U src/external/bsd/dhcpcd/dist/ipv4ll.h
U src/external/bsd/dhcpcd/dist/ipv6.h
U src/external/bsd/dhcpcd/dist/ipv6nd.h
U src/external/bsd/dhcpcd/dist/script.h
U src/external/bsd/dhcpcd/dist/crypt/hmac_md5.c
U src/external/bsd/dhcpcd/dist/crypt/crypt.h
C src/external/bsd/dhcpcd/dist/dhcpcd-hooks/01-test
U src/external/bsd/dhcpcd/dist/dhcpcd-hooks/02-dump
U src/external/bsd/dhcpcd/dist/dhcpcd-hooks/10-mtu
U src/external/bsd/dhcpcd/dist/dhcpcd-hooks/10-wpa_supplicant
U src/external/bsd/dhcpcd/dist/dhcpcd-hooks/15-timezone
U src/external/bsd/dhcpcd/dist/dhcpcd-hooks/20-resolv.conf
U src/external/bsd/dhcpcd/dist/dhcpcd-hooks/29-lookup-hostname
U src/external/bsd/dhcpcd/dist/dhcpcd-hooks/30-hostname
U src/external/bsd/dhcpcd/dist/dhcpcd-hooks/50-ntp.conf
U src/external/bsd/dhcpcd/dist/dhcpcd-hooks/50-ypbind

5 conflicts created by this import.
Use the following command to help the merge:

cvs checkout -jroy:yesterday -jroy src/external/bsd/dhcpcd/dist



CVS commit: src/doc

2014-11-26 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Wed Nov 26 13:45:00 UTC 2014

Modified Files:
src/doc: 3RDPARTY CHANGES

Log Message:
Note import of dhcpcd-6.6.3


To generate a diff of this commit:
cvs rdiff -u -r1.1175 -r1.1176 src/doc/3RDPARTY
cvs rdiff -u -r1.2021 -r1.2022 src/doc/CHANGES

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/doc/3RDPARTY
diff -u src/doc/3RDPARTY:1.1175 src/doc/3RDPARTY:1.1176
--- src/doc/3RDPARTY:1.1175	Thu Nov 20 03:07:30 2014
+++ src/doc/3RDPARTY	Wed Nov 26 13:45:00 2014
@@ -1,4 +1,4 @@
-#	$NetBSD: 3RDPARTY,v 1.1175 2014/11/20 03:07:30 christos Exp $
+#	$NetBSD: 3RDPARTY,v 1.1176 2014/11/26 13:45:00 roy Exp $
 #
 # This file contains a list of the software that has been integrated into
 # NetBSD where we are not the primary maintainer.
@@ -305,8 +305,8 @@ Notes:
 Use the dhcp2netbsd script.
 
 Package:	dhcpcd
-Version:	6.6.2
-Current Vers:	6.6.2
+Version:	6.6.3
+Current Vers:	6.6.3
 Maintainer:	roy
 Archive Site:	ftp://roy.marples.name/pub/dhcpcd/
 Home Page:	http://roy.marples.name/projects/dhcpcd/

Index: src/doc/CHANGES
diff -u src/doc/CHANGES:1.2021 src/doc/CHANGES:1.2022
--- src/doc/CHANGES:1.2021	Thu Nov 20 03:07:30 2014
+++ src/doc/CHANGES	Wed Nov 26 13:45:00 2014
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2021 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2022 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -108,3 +108,4 @@ Changes from NetBSD 7.0 to NetBSD 8.0:
 	libc: Update to tzcode2014j. [christos 20141117]
 	libpcap: Import 1.6.2. [christos 20141119]
 	tcpdump(8): Import 4.6.2. [christos 20141119]
+	dhcpcd(8): Import dhcpcd-6.6.3. [roy 20141126]



CVS commit: src/external/bsd/dhcpcd/dist

2014-11-26 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Wed Nov 26 13:43:06 UTC 2014

Modified Files:
src/external/bsd/dhcpcd/dist: arp.c defs.h dhcp.c dhcp6.c dhcpcd.8.in
dhcpcd.c dhcpcd.h if-options.c if-options.h if.c ipv4.c ipv4.h
ipv6nd.c

Log Message:
Sync


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/external/bsd/dhcpcd/dist/arp.c \
src/external/bsd/dhcpcd/dist/defs.h src/external/bsd/dhcpcd/dist/dhcpcd.h \
src/external/bsd/dhcpcd/dist/ipv4.c
cvs rdiff -u -r1.23 -r1.24 src/external/bsd/dhcpcd/dist/dhcp.c
cvs rdiff -u -r1.6 -r1.7 src/external/bsd/dhcpcd/dist/dhcp6.c \
src/external/bsd/dhcpcd/dist/if-options.h \
src/external/bsd/dhcpcd/dist/if.c src/external/bsd/dhcpcd/dist/ipv4.h
cvs rdiff -u -r1.36 -r1.37 src/external/bsd/dhcpcd/dist/dhcpcd.8.in
cvs rdiff -u -r1.17 -r1.18 src/external/bsd/dhcpcd/dist/dhcpcd.c \
src/external/bsd/dhcpcd/dist/ipv6nd.c
cvs rdiff -u -r1.18 -r1.19 src/external/bsd/dhcpcd/dist/if-options.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/dhcpcd/dist/arp.c
diff -u src/external/bsd/dhcpcd/dist/arp.c:1.7 src/external/bsd/dhcpcd/dist/arp.c:1.8
--- src/external/bsd/dhcpcd/dist/arp.c:1.7	Fri Nov 14 12:00:54 2014
+++ src/external/bsd/dhcpcd/dist/arp.c	Wed Nov 26 13:43:06 2014
@@ -1,5 +1,5 @@
 #include 
- __RCSID("$NetBSD: arp.c,v 1.7 2014/11/14 12:00:54 roy Exp $");
+ __RCSID("$NetBSD: arp.c,v 1.8 2014/11/26 13:43:06 roy Exp $");
 
 /*
  * dhcpcd - DHCP client daemon
@@ -127,7 +127,7 @@ arp_packet(void *arg)
 	while (!(flags & RAW_EOF)) {
 		bytes = if_readrawpacket(ifp, ETHERTYPE_ARP,
 		arp_buffer, sizeof(arp_buffer), &flags);
-		if (bytes == 0 || bytes == -1) {
+		if (bytes == -1) {
 			syslog(LOG_ERR, "%s: arp if_readrawpacket: %m",
 			ifp->name);
 			dhcp_close(ifp);
@@ -217,13 +217,15 @@ arp_announce1(void *arg)
 
 	if (++astate->claims < ANNOUNCE_NUM)
 		syslog(LOG_DEBUG,
-		"%s: sending ARP announce (%d of %d), "
+		"%s: ARP announcing %s (%d of %d), "
 		"next in %d.0 seconds",
-		ifp->name, astate->claims, ANNOUNCE_NUM, ANNOUNCE_WAIT);
+		ifp->name, inet_ntoa(astate->addr),
+		astate->claims, ANNOUNCE_NUM, ANNOUNCE_WAIT);
 	else
 		syslog(LOG_DEBUG,
-		"%s: sending ARP announce (%d of %d)",
-		ifp->name, astate->claims, ANNOUNCE_NUM);
+		"%s: ARP announcing %s (%d of %d)",
+		ifp->name, inet_ntoa(astate->addr),
+		astate->claims, ANNOUNCE_NUM);
 	if (arp_send(ifp, ARPOP_REQUEST,
 		astate->addr.s_addr, astate->addr.s_addr) == -1)
 		syslog(LOG_ERR, "send_arp: %m");
@@ -268,8 +270,9 @@ arp_probe1(void *arg)
 		eloop_timeout_add_tv(ifp->ctx->eloop, &tv, arp_probed, astate);
 	}
 	syslog(LOG_DEBUG,
-	"%s: sending ARP probe (%d of %d), next in %0.1f seconds",
-	ifp->name, astate->probes ? astate->probes : PROBE_NUM, PROBE_NUM,
+	"%s: ARP probing %s (%d of %d), next in %0.1f seconds",
+	ifp->name, inet_ntoa(astate->addr),
+	astate->probes ? astate->probes : PROBE_NUM, PROBE_NUM,
 	timeval_to_double(&tv));
 	if (arp_send(ifp, ARPOP_REQUEST, 0, astate->addr.s_addr) == -1)
 		syslog(LOG_ERR, "send_arp: %m");
Index: src/external/bsd/dhcpcd/dist/defs.h
diff -u src/external/bsd/dhcpcd/dist/defs.h:1.7 src/external/bsd/dhcpcd/dist/defs.h:1.8
--- src/external/bsd/dhcpcd/dist/defs.h:1.7	Fri Nov 14 12:00:54 2014
+++ src/external/bsd/dhcpcd/dist/defs.h	Wed Nov 26 13:43:06 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: defs.h,v 1.7 2014/11/14 12:00:54 roy Exp $ */
+/* $NetBSD: defs.h,v 1.8 2014/11/26 13:43:06 roy Exp $ */
 
 /*
  * dhcpcd - DHCP client daemon
@@ -30,7 +30,7 @@
 #define CONFIG_H
 
 #define PACKAGE			"dhcpcd"
-#define VERSION			"6.6.2"
+#define VERSION			"6.6.3"
 
 #ifndef CONFIG
 # define CONFIG			SYSCONFDIR "/" PACKAGE ".conf"
Index: src/external/bsd/dhcpcd/dist/dhcpcd.h
diff -u src/external/bsd/dhcpcd/dist/dhcpcd.h:1.7 src/external/bsd/dhcpcd/dist/dhcpcd.h:1.8
--- src/external/bsd/dhcpcd/dist/dhcpcd.h:1.7	Fri Nov 14 12:00:54 2014
+++ src/external/bsd/dhcpcd/dist/dhcpcd.h	Wed Nov 26 13:43:06 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: dhcpcd.h,v 1.7 2014/11/14 12:00:54 roy Exp $ */
+/* $NetBSD: dhcpcd.h,v 1.8 2014/11/26 13:43:06 roy Exp $ */
 
 /*
  * dhcpcd - DHCP client daemon
@@ -96,6 +96,8 @@ struct dhcpcd_ctx {
 	char **ifdv;	/* denied interfaces */
 	int ifc;	/* listed interfaces */
 	char **ifv;	/* listed interfaces */
+	int ifcc;	/* configured interfaces */
+	char **ifcv;	/* configured interfaces */
 	unsigned char *duid;
 	size_t duid_len;
 	int pid_fd;
Index: src/external/bsd/dhcpcd/dist/ipv4.c
diff -u src/external/bsd/dhcpcd/dist/ipv4.c:1.7 src/external/bsd/dhcpcd/dist/ipv4.c:1.8
--- src/external/bsd/dhcpcd/dist/ipv4.c:1.7	Fri Nov 14 12:00:54 2014
+++ src/external/bsd/dhcpcd/dist/ipv4.c	Wed Nov 26 13:43:06 2014
@@ -1,5 +1,5 @@
 #include 
- __RCSID("$NetBSD: ipv4.c,v 1.7 2014/11/14 12:00:54 roy Exp $");
+ __RCSID("$NetBSD: ipv4.c,v 1.

CVS import: src/external/bsd/dhcpcd/dist

2014-11-26 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Wed Nov 26 13:41:32 UTC 2014

Update of /cvsroot/src/external/bsd/dhcpcd/dist
In directory ivanova.netbsd.org:/tmp/cvs-serv24972

Log Message:
Import dhcpcd-6.6.3 with the following changes:
  *  Log which IP address we are ARPing.
  *  Only free other ARP states if not assinging an IPv4LL address.
  *  Reload global config when running per interface commands.
 This matches the signal behaviour.
  *  If we don't have a hardware address, fallback to creating a default
 IAID from the interface name and index as we used to.
  *  If we don't have a hwlen and no clientid has been set, force a DUID
 based ClientID.
  *  Disable IPv6RS if a loopback, pointopoint or not a multicast interface.
  *  If allowinterfaces is not specified, allow all configured interfaces
 to work, such as loopback and ppp.
  *  When not daemonising, don't exit on timeout.
  *  Zero length UDP packets are not an error condition on the socket.
  *  If the IP address is still on the interface when reading a lease,
 fake add the address and routes so the lease can be cleaned up if needed.

Status:

Vendor Tag: roy
Release Tags:   dhcpcd-6-6-3

U src/external/bsd/dhcpcd/dist/common.c
U src/external/bsd/dhcpcd/dist/control.c
C src/external/bsd/dhcpcd/dist/dhcpcd.c
U src/external/bsd/dhcpcd/dist/duid.c
U src/external/bsd/dhcpcd/dist/eloop.c
C src/external/bsd/dhcpcd/dist/if.c
C src/external/bsd/dhcpcd/dist/if-options.c
U src/external/bsd/dhcpcd/dist/script.c
U src/external/bsd/dhcpcd/dist/dhcp-common.c
U src/external/bsd/dhcpcd/dist/dhcpcd-embedded.c
U src/external/bsd/dhcpcd/dist/if-bsd.c
C src/external/bsd/dhcpcd/dist/arp.c
C src/external/bsd/dhcpcd/dist/dhcp.c
C src/external/bsd/dhcpcd/dist/ipv4.c
U src/external/bsd/dhcpcd/dist/ipv4ll.c
U src/external/bsd/dhcpcd/dist/ipv6.c
C src/external/bsd/dhcpcd/dist/ipv6nd.c
C src/external/bsd/dhcpcd/dist/dhcp6.c
U src/external/bsd/dhcpcd/dist/auth.c
U src/external/bsd/dhcpcd/dist/dhcpcd.conf
U src/external/bsd/dhcpcd/dist/dhcpcd-definitions.conf
U src/external/bsd/dhcpcd/dist/dhcpcd-embedded.c.in
U src/external/bsd/dhcpcd/dist/dhcpcd-embedded.h.in
U src/external/bsd/dhcpcd/dist/dhcpcd-run-hooks.8.in
U src/external/bsd/dhcpcd/dist/dhcpcd-run-hooks.in
C src/external/bsd/dhcpcd/dist/dhcpcd.8.in
U src/external/bsd/dhcpcd/dist/dhcpcd.conf.5.in
U src/external/bsd/dhcpcd/dist/arp.h
U src/external/bsd/dhcpcd/dist/auth.h
U src/external/bsd/dhcpcd/dist/bpf-filter.h
U src/external/bsd/dhcpcd/dist/common.h
U src/external/bsd/dhcpcd/dist/config.h
U src/external/bsd/dhcpcd/dist/control.h
C src/external/bsd/dhcpcd/dist/defs.h
U src/external/bsd/dhcpcd/dist/dev.h
U src/external/bsd/dhcpcd/dist/dhcp-common.h
U src/external/bsd/dhcpcd/dist/dhcp.h
U src/external/bsd/dhcpcd/dist/dhcp6.h
U src/external/bsd/dhcpcd/dist/dhcpcd-embedded.h
C src/external/bsd/dhcpcd/dist/dhcpcd.h
U src/external/bsd/dhcpcd/dist/duid.h
U src/external/bsd/dhcpcd/dist/eloop.h
C src/external/bsd/dhcpcd/dist/if-options.h
U src/external/bsd/dhcpcd/dist/if.h
C src/external/bsd/dhcpcd/dist/ipv4.h
U src/external/bsd/dhcpcd/dist/ipv4ll.h
U src/external/bsd/dhcpcd/dist/ipv6.h
U src/external/bsd/dhcpcd/dist/ipv6nd.h
U src/external/bsd/dhcpcd/dist/script.h
U src/external/bsd/dhcpcd/dist/crypt/hmac_md5.c
U src/external/bsd/dhcpcd/dist/crypt/crypt.h
U src/external/bsd/dhcpcd/dist/dhcpcd-hooks/01-test
U src/external/bsd/dhcpcd/dist/dhcpcd-hooks/02-dump
U src/external/bsd/dhcpcd/dist/dhcpcd-hooks/10-mtu
U src/external/bsd/dhcpcd/dist/dhcpcd-hooks/10-wpa_supplicant
U src/external/bsd/dhcpcd/dist/dhcpcd-hooks/15-timezone
U src/external/bsd/dhcpcd/dist/dhcpcd-hooks/20-resolv.conf
U src/external/bsd/dhcpcd/dist/dhcpcd-hooks/29-lookup-hostname
U src/external/bsd/dhcpcd/dist/dhcpcd-hooks/30-hostname
U src/external/bsd/dhcpcd/dist/dhcpcd-hooks/50-ntp.conf
U src/external/bsd/dhcpcd/dist/dhcpcd-hooks/50-ypbind

13 conflicts created by this import.
Use the following command to help the merge:

cvs checkout -jroy:yesterday -jroy src/external/bsd/dhcpcd/dist



CVS commit: src/sys/kern

2014-11-26 Thread Emmanuel Dreyfus
Module Name:src
Committed By:   manu
Date:   Wed Nov 26 10:50:36 UTC 2014

Modified Files:
src/sys/kern: vfs_syscalls.c

Log Message:
Do not follow symlinks in sys_unmount()

There are situations where the underlying filesystem is unreachable
(e.g: NFS) causing symlink resolution to hang. Such a situation
should be avoided by using umount -f -R (force and raw), but while -R
causes the symlink resolution to be skipped in umount(8), the kernel was
still doing it in sys_unmount(). This changes fixes that.

When the -R flag is not given, umount(8) does symlinks resolution through
realpath(3) before calling unmount(2), hence not doing it in the kernel
would not change behavior.


To generate a diff of this commit:
cvs rdiff -u -r1.491 -r1.492 src/sys/kern/vfs_syscalls.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/vfs_syscalls.c
diff -u src/sys/kern/vfs_syscalls.c:1.491 src/sys/kern/vfs_syscalls.c:1.492
--- src/sys/kern/vfs_syscalls.c:1.491	Fri Sep  5 09:20:59 2014
+++ src/sys/kern/vfs_syscalls.c	Wed Nov 26 10:50:36 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_syscalls.c,v 1.491 2014/09/05 09:20:59 matt Exp $	*/
+/*	$NetBSD: vfs_syscalls.c,v 1.492 2014/11/26 10:50:36 manu Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -70,7 +70,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.491 2014/09/05 09:20:59 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.492 2014/11/26 10:50:36 manu Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_fileassoc.h"
@@ -574,7 +574,7 @@ sys_unmount(struct lwp *l, const struct 
 		return error;
 	}
 
-	NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF | TRYEMULROOT, pb);
+	NDINIT(&nd, LOOKUP, LOCKLEAF | TRYEMULROOT, pb);
 	if ((error = namei(&nd)) != 0) {
 		pathbuf_destroy(pb);
 		return error;



CVS commit: src/sys/netinet

2014-11-26 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Wed Nov 26 10:18:38 UTC 2014

Modified Files:
src/sys/netinet: ip_output.c

Log Message:
Call looutput with holding KERNEL_LOCK

This fixes diagnostic assertion "KERNEL_LOCKED_P()" in if_loop.c.

PR kern/49410


To generate a diff of this commit:
cvs rdiff -u -r1.232 -r1.233 src/sys/netinet/ip_output.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/netinet/ip_output.c
diff -u src/sys/netinet/ip_output.c:1.232 src/sys/netinet/ip_output.c:1.233
--- src/sys/netinet/ip_output.c:1.232	Sun Oct 12 19:00:21 2014
+++ src/sys/netinet/ip_output.c	Wed Nov 26 10:18:37 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip_output.c,v 1.232 2014/10/12 19:00:21 christos Exp $	*/
+/*	$NetBSD: ip_output.c,v 1.233 2014/11/26 10:18:37 ozaki-r Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -91,7 +91,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ip_output.c,v 1.232 2014/10/12 19:00:21 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_output.c,v 1.233 2014/11/26 10:18:37 ozaki-r Exp $");
 
 #include "opt_inet.h"
 #include "opt_ipsec.h"
@@ -1713,5 +1713,7 @@ ip_mloopback(struct ifnet *ifp, struct m
 
 	ip->ip_sum = 0;
 	ip->ip_sum = in_cksum(copym, ip->ip_hl << 2);
+	KERNEL_LOCK(1, NULL);
 	(void)looutput(ifp, copym, sintocsa(dst), NULL);
+	KERNEL_UNLOCK_ONE(NULL);
 }



CVS commit: src/crypto/external/bsd/heimdal/dist/lib/hdb

2014-11-26 Thread Fredrik Pettai
Module Name:src
Committed By:   pettai
Date:   Wed Nov 26 10:12:27 UTC 2014

Modified Files:
src/crypto/external/bsd/heimdal/dist/lib/hdb: keys.c

Log Message:
fix comma error


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/crypto/external/bsd/heimdal/dist/lib/hdb/keys.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/crypto/external/bsd/heimdal/dist/lib/hdb/keys.c
diff -u src/crypto/external/bsd/heimdal/dist/lib/hdb/keys.c:1.2 src/crypto/external/bsd/heimdal/dist/lib/hdb/keys.c:1.3
--- src/crypto/external/bsd/heimdal/dist/lib/hdb/keys.c:1.2	Wed Nov 26 07:39:52 2014
+++ src/crypto/external/bsd/heimdal/dist/lib/hdb/keys.c	Wed Nov 26 10:12:27 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: keys.c,v 1.2 2014/11/26 07:39:52 pettai Exp $	*/
+/*	$NetBSD: keys.c,v 1.3 2014/11/26 10:12:27 pettai Exp $	*/
 
 
 /*
@@ -77,8 +77,8 @@ static const krb5_enctype des_etypes[] =
 
 static const krb5_enctype all_etypes[] = {
 ETYPE_AES256_CTS_HMAC_SHA1_96,
-ETYPE_DES3_CBC_SHA1
-ETYPE_ARCFOUR_HMAC_MD5,
+ETYPE_DES3_CBC_SHA1,
+ETYPE_ARCFOUR_HMAC_MD5
 };
 
 static krb5_error_code



CVS commit: src/sys

2014-11-26 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Wed Nov 26 09:53:53 UTC 2014

Modified Files:
src/sys/compat/common: uipc_syscalls_40.c
src/sys/compat/linux/common: linux_socket.c
src/sys/compat/linux32/common: linux32_socket.c
src/sys/net: if.c

Log Message:
Tweak ifconf variants

The tweaks make the code intention clear and make further changes easy.

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/compat/common/uipc_syscalls_40.c
cvs rdiff -u -r1.121 -r1.122 src/sys/compat/linux/common/linux_socket.c
cvs rdiff -u -r1.18 -r1.19 src/sys/compat/linux32/common/linux32_socket.c
cvs rdiff -u -r1.297 -r1.298 src/sys/net/if.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/compat/common/uipc_syscalls_40.c
diff -u src/sys/compat/common/uipc_syscalls_40.c:1.7 src/sys/compat/common/uipc_syscalls_40.c:1.8
--- src/sys/compat/common/uipc_syscalls_40.c:1.7	Wed Jan 19 10:21:16 2011
+++ src/sys/compat/common/uipc_syscalls_40.c	Wed Nov 26 09:53:53 2014
@@ -1,9 +1,9 @@
-/*	$NetBSD: uipc_syscalls_40.c,v 1.7 2011/01/19 10:21:16 tsutsui Exp $	*/
+/*	$NetBSD: uipc_syscalls_40.c,v 1.8 2014/11/26 09:53:53 ozaki-r Exp $	*/
 
 /* written by Pavel Cahyna, 2006. Public domain. */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uipc_syscalls_40.c,v 1.7 2011/01/19 10:21:16 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_syscalls_40.c,v 1.8 2014/11/26 09:53:53 ozaki-r Exp $");
 
 /*
  * System call interface to the socket abstraction.
@@ -35,14 +35,16 @@ compat_ifconf(u_long cmd, void *data)
 	struct oifconf *ifc = data;
 	struct ifnet *ifp;
 	struct ifaddr *ifa;
-	struct oifreq ifr, *ifrp;
-	int space, error = 0;
+	struct oifreq ifr, *ifrp = NULL;
+	int space = 0, error = 0;
 	const int sz = (int)sizeof(ifr);
+	const bool docopy = ifc->ifc_req != NULL;
 
-	if ((ifrp = ifc->ifc_req) == NULL)
-		space = 0;
-	else
+	if (docopy) {
 		space = ifc->ifc_len;
+		ifrp = ifc->ifc_req;
+	}
+
 	IFNET_FOREACH(ifp) {
 		(void)strncpy(ifr.ifr_name, ifp->if_xname,
 		sizeof(ifr.ifr_name));
@@ -105,7 +107,7 @@ compat_ifconf(u_long cmd, void *data)
 			space -= sz;
 		}
 	}
-	if (ifrp != NULL)
+	if (docopy)
 		ifc->ifc_len -= space;
 	else
 		ifc->ifc_len = -space;

Index: src/sys/compat/linux/common/linux_socket.c
diff -u src/sys/compat/linux/common/linux_socket.c:1.121 src/sys/compat/linux/common/linux_socket.c:1.122
--- src/sys/compat/linux/common/linux_socket.c:1.121	Fri Nov 21 06:03:04 2014
+++ src/sys/compat/linux/common/linux_socket.c	Wed Nov 26 09:53:53 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_socket.c,v 1.121 2014/11/21 06:03:04 ozaki-r Exp $	*/
+/*	$NetBSD: linux_socket.c,v 1.122 2014/11/26 09:53:53 ozaki-r Exp $	*/
 
 /*-
  * Copyright (c) 1995, 1998, 2008 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: linux_socket.c,v 1.121 2014/11/21 06:03:04 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_socket.c,v 1.122 2014/11/26 09:53:53 ozaki-r Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_inet.h"
@@ -,24 +,25 @@ linux_getifname(struct lwp *l, register_
 int
 linux_getifconf(struct lwp *l, register_t *retval, void *data)
 {
-	struct linux_ifreq ifr, *ifrp;
+	struct linux_ifreq ifr, *ifrp = NULL;
 	struct linux_ifconf ifc;
 	struct ifnet *ifp;
 	struct ifaddr *ifa;
 	struct sockaddr *sa;
 	struct osockaddr *osa;
-	int space, error = 0;
+	int space = 0, error = 0;
 	const int sz = (int)sizeof(ifr);
+	bool docopy;
 
 	error = copyin(data, &ifc, sizeof(ifc));
 	if (error)
 		return error;
 
-	ifrp = ifc.ifc_req;
-	if (ifrp == NULL)
-		space = 0;
-	else
+	docopy = ifc.ifc_req != NULL;
+	if (docopy) {
 		space = ifc.ifc_len;
+		ifrp = ifc.ifc_req;
+	}
 
 	IFNET_FOREACH(ifp) {
 		(void)strncpy(ifr.ifr_name, ifp->if_xname,
@@ -1155,7 +1156,7 @@ linux_getifconf(struct lwp *l, register_
 		}
 	}
 
-	if (ifrp != NULL)
+	if (docopy)
 		ifc.ifc_len -= space;
 	else
 		ifc.ifc_len = -space;

Index: src/sys/compat/linux32/common/linux32_socket.c
diff -u src/sys/compat/linux32/common/linux32_socket.c:1.18 src/sys/compat/linux32/common/linux32_socket.c:1.19
--- src/sys/compat/linux32/common/linux32_socket.c:1.18	Sat May 17 21:26:20 2014
+++ src/sys/compat/linux32/common/linux32_socket.c	Wed Nov 26 09:53:53 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux32_socket.c,v 1.18 2014/05/17 21:26:20 rmind Exp $ */
+/*	$NetBSD: linux32_socket.c,v 1.19 2014/11/26 09:53:53 ozaki-r Exp $ */
 
 /*-
  * Copyright (c) 2006 Emmanuel Dreyfus, all rights reserved.
@@ -33,7 +33,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: linux32_socket.c,v 1.18 2014/05/17 21:26:20 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux32_socket.c,v 1.19 2014/11/26 09:53:53 ozaki-r Exp $");
 
 #include 
 #include 
@@ -410,24 +410,25 @@ linux32_getifname(struct lwp *l, registe
 int
 linux32_getifconf(struct lwp *l, register_t *retval, void *data)
 {
-	struct linux32_if

CVS commit: src/sys/net

2014-11-26 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Wed Nov 26 09:38:42 UTC 2014

Modified Files:
src/sys/net: if.c if.h

Log Message:
Change if_slowtimo_ch to a pointer

One benefit to do so is to reduce memory used for struct callout;
we can avoid to allocate struct callout for interfaces that don't
use callout.

Requested by uebayasi@.


To generate a diff of this commit:
cvs rdiff -u -r1.296 -r1.297 src/sys/net/if.c
cvs rdiff -u -r1.178 -r1.179 src/sys/net/if.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/net/if.c
diff -u src/sys/net/if.c:1.296 src/sys/net/if.c:1.297
--- src/sys/net/if.c:1.296	Wed Nov 26 07:43:04 2014
+++ src/sys/net/if.c	Wed Nov 26 09:38:42 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: if.c,v 1.296 2014/11/26 07:43:04 ozaki-r Exp $	*/
+/*	$NetBSD: if.c,v 1.297 2014/11/26 09:38:42 ozaki-r Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2008 The NetBSD Foundation, Inc.
@@ -90,7 +90,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.296 2014/11/26 07:43:04 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.297 2014/11/26 09:38:42 ozaki-r Exp $");
 
 #include "opt_inet.h"
 
@@ -635,8 +635,10 @@ if_attach(ifnet_t *ifp)
 	rt_ifannouncemsg(ifp, IFAN_ARRIVAL);
 
 	if (ifp->if_slowtimo != NULL) {
-		callout_init(&ifp->if_slowtimo_ch, 0);
-		callout_setfunc(&ifp->if_slowtimo_ch, if_slowtimo, ifp);
+		ifp->if_slowtimo_ch =
+		kmem_zalloc(sizeof(*ifp->if_slowtimo_ch), KM_SLEEP);
+		callout_init(ifp->if_slowtimo_ch, 0);
+		callout_setfunc(ifp->if_slowtimo_ch, if_slowtimo, ifp);
 		if_slowtimo(ifp);
 	}
 }
@@ -739,8 +741,9 @@ if_detach(struct ifnet *ifp)
 	s = splnet();
 
 	if (ifp->if_slowtimo != NULL) {
-		callout_halt(&ifp->if_slowtimo_ch, NULL);
-		callout_destroy(&ifp->if_slowtimo_ch);
+		callout_halt(ifp->if_slowtimo_ch, NULL);
+		callout_destroy(ifp->if_slowtimo_ch);
+		kmem_free(ifp->if_slowtimo_ch, sizeof(*ifp->if_slowtimo_ch));
 	}
 
 	/*
@@ -1516,7 +1519,7 @@ if_slowtimo(void *arg)
 		(*ifp->if_slowtimo)(ifp);
 
 	splx(s);
-	callout_schedule(&ifp->if_slowtimo_ch, hz / IFNET_SLOWHZ);
+	callout_schedule(ifp->if_slowtimo_ch, hz / IFNET_SLOWHZ);
 }
 
 /*

Index: src/sys/net/if.h
diff -u src/sys/net/if.h:1.178 src/sys/net/if.h:1.179
--- src/sys/net/if.h:1.178	Wed Nov 26 07:43:04 2014
+++ src/sys/net/if.h	Wed Nov 26 09:38:42 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: if.h,v 1.178 2014/11/26 07:43:04 ozaki-r Exp $	*/
+/*	$NetBSD: if.h,v 1.179 2014/11/26 09:38:42 ozaki-r Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -245,6 +245,7 @@ TAILQ_HEAD(ifnet_head, ifnet);		/* the a
 
 struct bridge_softc;
 struct bridge_iflist;
+struct callout;
 
 typedef struct ifnet {
 	void	*if_softc;		/* lower-level data for this if */
@@ -344,7 +345,7 @@ typedef struct ifnet {
 	int (*if_setflags)(struct ifnet *, const short);
 	struct ifnet_lock *if_ioctl_lock;
 #ifdef _KERNEL /* XXX kvm(3) */
-	callout_t if_slowtimo_ch;
+	struct callout *if_slowtimo_ch;
 #endif
 } ifnet_t;