CVS commit: src/sys

2019-01-11 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Fri Jan 11 23:10:41 UTC 2019

Modified Files:
src/sys/arch/mips/alchemy/dev: com_aubus.c
src/sys/arch/mips/ralink: ralink_com.c
src/sys/dev/ic: com.c comvar.h ns16550reg.h

Log Message:
Simplify regmap initialization, and fix an regmap issue that
affected TI OMAP (LCR register would get clobbered due to
using the wrong offset for the MDR1 register) reported by Lwazi Dube
(who also found the root cause).


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/mips/alchemy/dev/com_aubus.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/mips/ralink/ralink_com.c
cvs rdiff -u -r1.354 -r1.355 src/sys/dev/ic/com.c
cvs rdiff -u -r1.91 -r1.92 src/sys/dev/ic/comvar.h
cvs rdiff -u -r1.12 -r1.13 src/sys/dev/ic/ns16550reg.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/mips/alchemy/dev/com_aubus.c
diff -u src/sys/arch/mips/alchemy/dev/com_aubus.c:1.8 src/sys/arch/mips/alchemy/dev/com_aubus.c:1.9
--- src/sys/arch/mips/alchemy/dev/com_aubus.c:1.8	Sat Dec  8 21:14:36 2018
+++ src/sys/arch/mips/alchemy/dev/com_aubus.c	Fri Jan 11 23:10:40 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: com_aubus.c,v 1.8 2018/12/08 21:14:36 thorpej Exp $ */
+/* $NetBSD: com_aubus.c,v 1.9 2019/01/11 23:10:40 thorpej Exp $ */
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: com_aubus.c,v 1.8 2018/12/08 21:14:36 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: com_aubus.c,v 1.9 2019/01/11 23:10:40 thorpej Exp $");
 
 #include 
 #include 
@@ -172,6 +172,21 @@ com_aubus_disable(struct com_softc *sc)
 	AUCOM_MODCTL, 0);
 }
 
+static const bus_size_t com_aubus_regmap[COM_REGMAP_NENTRIES] = {
+	[COM_REG_RXDATA]	=	AUCOM_RXDATA,
+	[COM_REG_TXDATA]	=	AUCOM_TXDATA,
+	[COM_REG_DLBL]		=	AUCOM_DLB,
+	[COM_REG_DLBH]		=	AUCOM_DLB,
+	[COM_REG_IER]		=	AUCOM_IER,
+	[COM_REG_IIR]		=	AUCOM_IIR,
+	[COM_REG_FIFO]		=	AUCOM_FIFO,
+	[COM_REG_TCR]		=	AUCOM_FIFO,
+	[COM_REG_LCR]		=	AUCOM_LCTL,
+	[COM_REG_MCR]		=	AUCOM_MCR,
+	[COM_REG_LSR]		=	AUCOM_LSR,
+	[COM_REG_MSR]		=	AUCOM_MSR,
+};
+
 void
 com_aubus_init_regs(struct com_regs *regsp, bus_space_tag_t bst,
 		bus_space_handle_t bsh, bus_addr_t addr)
@@ -179,19 +194,8 @@ com_aubus_init_regs(struct com_regs *reg
 
 	com_init_regs(regsp, bst, bsh, addr);
 
+	memcpy(regsp->cr_map, com_aubus_regmap, sizeof(regsp->cr_map));
 	regsp->cr_nports = AUCOM_NPORTS;
-	regsp->cr_map[COM_REG_RXDATA] = AUCOM_RXDATA;
-	regsp->cr_map[COM_REG_TXDATA] = AUCOM_TXDATA;
-	regsp->cr_map[COM_REG_DLBL] = AUCOM_DLB;
-	regsp->cr_map[COM_REG_DLBH] = AUCOM_DLB;
-	regsp->cr_map[COM_REG_IER] = AUCOM_IER;
-	regsp->cr_map[COM_REG_IIR] = AUCOM_IIR;
-	regsp->cr_map[COM_REG_FIFO] = AUCOM_FIFO;
-	regsp->cr_map[COM_REG_EFR] = 0;
-	regsp->cr_map[COM_REG_LCR] = AUCOM_LCTL;
-	regsp->cr_map[COM_REG_MCR] = AUCOM_MCR;
-	regsp->cr_map[COM_REG_LSR] = AUCOM_LSR;
-	regsp->cr_map[COM_REG_MSR] = AUCOM_MSR;
 }
 
 int

Index: src/sys/arch/mips/ralink/ralink_com.c
diff -u src/sys/arch/mips/ralink/ralink_com.c:1.7 src/sys/arch/mips/ralink/ralink_com.c:1.8
--- src/sys/arch/mips/ralink/ralink_com.c:1.7	Sat Dec  8 21:14:36 2018
+++ src/sys/arch/mips/ralink/ralink_com.c	Fri Jan 11 23:10:40 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: ralink_com.c,v 1.7 2018/12/08 21:14:36 thorpej Exp $	*/
+/*	$NetBSD: ralink_com.c,v 1.8 2019/01/11 23:10:40 thorpej Exp $	*/
 /*-
  * Copyright (c) 2011 CradlePoint Technology, Inc.
  * All rights reserved.
@@ -130,7 +130,7 @@
 /* ralink_com.c -- Ralink 3052 uart console driver */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ralink_com.c,v 1.7 2018/12/08 21:14:36 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ralink_com.c,v 1.8 2019/01/11 23:10:40 thorpej Exp $");
 
 #include "locators.h"
 #include 
@@ -367,6 +367,23 @@ ralink_com_attach(device_t parent, devic
 	com_attach_subr(sc);
 }
 
+static const bus_size_t ralink_com_regmap[] = {
+	[COM_REG_RXDATA]	=	RA_UART_RBR,
+	[COM_REG_TXDATA]	=	RA_UART_TBR,
+	[COM_REG_DLBL]		=	RA_UART_DLL,
+#if defined(MT7628)
+	[COM_REG_DLBH]		=	RA_UART_DLM,
+#endif
+	[COM_REG_IER]		=	RA_UART_IER,
+	[COM_REG_IIR]		=	RA_UART_IIR,
+	[COM_REG_FIFO]		=	RA_UART_FCR,
+	[COM_REG_TCR]		=	RA_UART_FCR,
+	[COM_REG_LCR]		=	RA_UART_LCR,
+	[COM_REG_MCR]		=	RA_UART_MCR,
+	[COM_REG_LSR]		=	RA_UART_LSR,
+	[COM_REG_MSR]		=	RA_UART_MSR,
+};
+
 static void
 ralink_com_init_regs(struct com_regs *regsp, bus_space_tag_t st,
 		 bus_space_handle_t sh, bus_addr_t addr)
@@ -374,20 +391,7 @@ ralink_com_init_regs(struct com_regs *re
 
 	com_init_regs(regsp, st, sh, addr);
 
-	regsp->cr_map[COM_REG_RXDATA] = RA_UART_RBR;
-	regsp->cr_map[COM_REG_TXDATA] = RA_UART_TBR;
-	regsp->cr_map[COM_REG_DLBL]   = RA_UART_DLL;
-#if defined(MT7628)
-	regsp->cr_map[COM_REG_DLBH]   = RA_UART_DLM;
-#endif
-	regsp->cr_map[COM_REG_IER]= RA_UART_IER;
-	regsp->cr_map[COM_REG_IIR]= RA_UART_IIR;
-	regsp->cr_map[COM_REG_FIFO]   

CVS commit: src/sys

2019-01-11 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Fri Jan 11 23:10:41 UTC 2019

Modified Files:
src/sys/arch/mips/alchemy/dev: com_aubus.c
src/sys/arch/mips/ralink: ralink_com.c
src/sys/dev/ic: com.c comvar.h ns16550reg.h

Log Message:
Simplify regmap initialization, and fix an regmap issue that
affected TI OMAP (LCR register would get clobbered due to
using the wrong offset for the MDR1 register) reported by Lwazi Dube
(who also found the root cause).


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/mips/alchemy/dev/com_aubus.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/mips/ralink/ralink_com.c
cvs rdiff -u -r1.354 -r1.355 src/sys/dev/ic/com.c
cvs rdiff -u -r1.91 -r1.92 src/sys/dev/ic/comvar.h
cvs rdiff -u -r1.12 -r1.13 src/sys/dev/ic/ns16550reg.h

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



CVS commit: xsrc/external/mit/xf86-video-r128/dist/src

2019-01-11 Thread Michael Lorenz
Module Name:xsrc
Committed By:   macallan
Date:   Fri Jan 11 22:59:52 UTC 2019

Modified Files:
xsrc/external/mit/xf86-video-r128/dist/src: r128_output.c

Log Message:
- don't try to access a nonexistant video BIOS
- don't blindly assume VGA output
- on mobility chips assume LVDS and VGA outputs if no other info is available
Now this works again on my Pismo


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 \
xsrc/external/mit/xf86-video-r128/dist/src/r128_output.c

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

Modified files:

Index: xsrc/external/mit/xf86-video-r128/dist/src/r128_output.c
diff -u xsrc/external/mit/xf86-video-r128/dist/src/r128_output.c:1.7 xsrc/external/mit/xf86-video-r128/dist/src/r128_output.c:1.8
--- xsrc/external/mit/xf86-video-r128/dist/src/r128_output.c:1.7	Sun Dec 30 06:46:48 2018
+++ xsrc/external/mit/xf86-video-r128/dist/src/r128_output.c	Fri Jan 11 22:59:52 2019
@@ -294,7 +294,7 @@ static R128MonitorType R128DisplayDDCCon
 unsigned char *R128MMIO = info->MMIO;
 R128OutputPrivatePtr r128_output = output->driver_private;
 
-R128MonitorType MonType = MT_CRT;
+R128MonitorType MonType = MT_NONE;
 xf86MonPtr *MonInfo = >MonInfo;
 uint32_t mask1, mask2;
 
@@ -476,7 +476,14 @@ void R128GetConnectorInfoFromBIOS(ScrnIn
 
 /* non-x86 platform */
 if (!info->VBIOS) {
-otypes[0] = OUTPUT_VGA;
+	if (info->isDFP) {
+	/* XXX assume LVDS on chips that can have them */ 
+otypes[0] = OUTPUT_LVDS;
+otypes[1] = OUTPUT_VGA;
+} else {
+otypes[0] = OUTPUT_VGA;
+}
+return;
 }
 
 bios_header = R128_BIOS16(0x48);



CVS commit: xsrc/external/mit/xf86-video-r128/dist/src

2019-01-11 Thread Michael Lorenz
Module Name:xsrc
Committed By:   macallan
Date:   Fri Jan 11 22:59:52 UTC 2019

Modified Files:
xsrc/external/mit/xf86-video-r128/dist/src: r128_output.c

Log Message:
- don't try to access a nonexistant video BIOS
- don't blindly assume VGA output
- on mobility chips assume LVDS and VGA outputs if no other info is available
Now this works again on my Pismo


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 \
xsrc/external/mit/xf86-video-r128/dist/src/r128_output.c

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



Pre-branch commits

2019-01-11 Thread Robert Elz


  | Anyway, what was the urgency?  Were you somehow under
  | the impression that the branch was taking place last weekend
  | and you had to rush these

This message is not a comment (in any way) on the substance
of the issue being discussed in the quote above, or about the code
involved, or the motives of any concerned developers, but about the
more general problem.(Hence I have removed all attributions from
this message, though I know they would not be hard to track.)

There is a problem we need to deal with ... if releng announces
"the branch for netbsd-XX will happen on Foomonth the 57th",
then in the few days leading up to that date, lots of developers
commit their not-really-ready code to HEAD, so that it will be in
the branch, and then can be fixed via pullups later (which then
is likely to increase the preiod between branch and release
while everything that needs fixing gets fixed and the release
waits on that one last thing.)

To avoid that problem, we have the current situation, where there
is no such announcement, but the branch simply happens with
no warning  except that everyone knows it is coming "soon".
Then developers rush to commit whatever they have, asap, to
make sure their new code is in the branch, and then it can be
fixed later, and if that happens after the branch has occurred, 
pullups are requested,   Nothing has changed except we get even
worse code (less tested, less reviewed) being commmitted to HEAD
because of the uncertainty.

I'd like to suggest a possible solution:   Go back to the old way,
and announce the branch date in advance (with a reasonable
lead time, not just a day or so, which would change nothing.
Reasonable here is likely to be something like a month.)

Then developers have plenty of advance warning, and can
finish their code properly, get it reviewed (as needed) and
properly tested.

For the cases where there still was not enough time, and code
that is not really ready gets committed, and then there's an
attempt to fix it later, the policy should be that on the branch,
any changes made between the pre-announcement of the
branch date, and the actual branch, which later need corrections
will not be corrected on the branch, instead the change which
occurred in that period will be reverted on the branch.

Of course, exceptions can be made for changes that are
really needed, or where an update is required because of
something unforseeable (ie: the change commit seemed to
be correct, and tested, but some later event, or unrelated
change, requires alterations).Both of those should be
rare - if there are "really needed" changes, the branch
date should normally not have beeen announced until they
are done (that's the "we need ABC in the next release" kind
of thing, and ABC isn't yet finished, and the unforseeable type
will simply be rare by its nature.

kre



CVS commit: src/usr.sbin/rtadvd

2019-01-11 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Jan 11 20:41:53 UTC 2019

Modified Files:
src/usr.sbin/rtadvd: Makefile rtadvd.c

Log Message:
use expandm from libwrap.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/usr.sbin/rtadvd/Makefile
cvs rdiff -u -r1.66 -r1.67 src/usr.sbin/rtadvd/rtadvd.c

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

Modified files:

Index: src/usr.sbin/rtadvd/Makefile
diff -u src/usr.sbin/rtadvd/Makefile:1.21 src/usr.sbin/rtadvd/Makefile:1.22
--- src/usr.sbin/rtadvd/Makefile:1.21	Tue Oct 10 15:30:41 2017
+++ src/usr.sbin/rtadvd/Makefile	Fri Jan 11 15:41:53 2019
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.21 2017/10/10 19:30:41 christos Exp $
+# $NetBSD: Makefile,v 1.22 2019/01/11 20:41:53 christos Exp $
 
 WARNS?=	4
 
@@ -14,6 +14,12 @@ CPPFLAGS+=	-DINET6
 LDADD+=		-lutil
 DPADD+=		${LIBUTIL}
 
+LIBWRAP=	${NETBSDSRCDIR}/lib/libwrap
+SRCS+=		expandm.c
+.PATH.c:	${LIBWRAP}
+CPPFLAGS+=	-I${LIBWRAP}
+
+
 .if ${MKSHARE} != "no"
 FILESDIR=	/usr/share/examples/rtadvd
 FILES=	rtadvd.conf

Index: src/usr.sbin/rtadvd/rtadvd.c
diff -u src/usr.sbin/rtadvd/rtadvd.c:1.66 src/usr.sbin/rtadvd/rtadvd.c:1.67
--- src/usr.sbin/rtadvd/rtadvd.c:1.66	Tue Apr 24 14:31:48 2018
+++ src/usr.sbin/rtadvd/rtadvd.c	Fri Jan 11 15:41:53 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: rtadvd.c,v 1.66 2018/04/24 18:31:48 roy Exp $	*/
+/*	$NetBSD: rtadvd.c,v 1.67 2019/01/11 20:41:53 christos Exp $	*/
 /*	$KAME: rtadvd.c,v 1.92 2005/10/17 14:40:02 suz Exp $	*/
 
 /*
@@ -70,6 +70,7 @@
 #include "dump.h"
 #include "logit.h"
 #include "prog_ops.h"
+#include "expandm.h"
 
 struct msghdr rcvmhdr;
 static unsigned char *rcvcmsgbuf;
@@ -1842,36 +1843,11 @@ ra_timer_update(void *data, struct times
 	   (intmax_t)tm->tv_sec, (intmax_t)tm->tv_nsec);
 }
 
- __format_arg(3)
-static const char *
-expandm(char *buf, size_t len, const char *fmt)
-{
-	char *ptr;
-	const char *e = strerror(errno);
-	size_t cur = 0, elen = strlen(e);
-
-	*buf = '\0';
-	while ((ptr = strstr(fmt, "%m")) != NULL) {
-		size_t l = (size_t)(ptr - fmt);
-		if (cur + elen + l + 1 >= len)
-			return buf;
-		memcpy(buf + cur, fmt, l);
-		cur += l;
-		memcpy(buf + cur, e, elen);
-		cur += elen;
-		fmt += l + 2;
-		buf[cur] = '\0';
-	}
-	strlcat(buf, fmt, len);
-	strlcat(buf, "\n", len); /* syslog does not need \n, printf does */
-	return buf;
-}
-
 void
 logit(int level, const char *fmt, ...)
 {
 	va_list ap;
-	char buf[1024];
+	char *buf;
 
 	va_start(ap, fmt);
 	if (!Dflag) {
@@ -1880,6 +1856,8 @@ logit(int level, const char *fmt, ...)
 		return;
 	}
 
-	vfprintf(stderr, expandm(buf, sizeof(buf), fmt), ap);
+	vfprintf(stderr, buf = expandm(fmt, "\n"), ap);
+	if (buf != fmt)
+		free(buf);
 	va_end(ap);
 }



CVS commit: src/usr.sbin/rtadvd

2019-01-11 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Jan 11 20:41:53 UTC 2019

Modified Files:
src/usr.sbin/rtadvd: Makefile rtadvd.c

Log Message:
use expandm from libwrap.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/usr.sbin/rtadvd/Makefile
cvs rdiff -u -r1.66 -r1.67 src/usr.sbin/rtadvd/rtadvd.c

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



CVS commit: src/lib/libwrap

2019-01-11 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Jan 11 20:37:30 UTC 2019

Modified Files:
src/lib/libwrap: Makefile diag.c
Added Files:
src/lib/libwrap: expandm.c expandm.h

Log Message:
Use a utility function to expand %m correctly...


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/lib/libwrap/Makefile
cvs rdiff -u -r1.15 -r1.16 src/lib/libwrap/diag.c
cvs rdiff -u -r0 -r1.1 src/lib/libwrap/expandm.c src/lib/libwrap/expandm.h

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

Modified files:

Index: src/lib/libwrap/Makefile
diff -u src/lib/libwrap/Makefile:1.10 src/lib/libwrap/Makefile:1.11
--- src/lib/libwrap/Makefile:1.10	Mon May 28 08:06:22 2007
+++ src/lib/libwrap/Makefile	Fri Jan 11 15:37:30 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.10 2007/05/28 12:06:22 tls Exp $
+#	$NetBSD: Makefile,v 1.11 2019/01/11 20:37:30 christos Exp $
 
 USE_FORT?= yes	# network server
 
@@ -6,7 +6,7 @@ LIB=	wrap
 
 SRCS=	hosts_access.c options.c shell_cmd.c rfc931.c eval.c hosts_ctl.c \
 	refuse.c percent_x.c clean_exit.c fix_options.c socket.c \
-	update.c misc.c diag.c
+	update.c misc.c diag.c expandm.c
 MAN=	hosts_access.3 hosts_access.5 hosts_options.5
 MLINKS+=hosts_access.5 hosts.allow.5
 MLINKS+=hosts_access.5 hosts.deny.5

Index: src/lib/libwrap/diag.c
diff -u src/lib/libwrap/diag.c:1.15 src/lib/libwrap/diag.c:1.16
--- src/lib/libwrap/diag.c:1.15	Fri Jan 11 11:15:20 2019
+++ src/lib/libwrap/diag.c	Fri Jan 11 15:37:30 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: diag.c,v 1.15 2019/01/11 16:15:20 christos Exp $	*/
+/*	$NetBSD: diag.c,v 1.16 2019/01/11 20:37:30 christos Exp $	*/
 
  /*
   * Routines to report various classes of problems. Each report is decorated
@@ -16,7 +16,7 @@
 #if 0
 static char sccsid[] = "@(#) diag.c 1.1 94/12/28 17:42:20";
 #else
-__RCSID("$NetBSD: diag.c,v 1.15 2019/01/11 16:15:20 christos Exp $");
+__RCSID("$NetBSD: diag.c,v 1.16 2019/01/11 20:37:30 christos Exp $");
 #endif
 #endif
 
@@ -33,6 +33,7 @@ __RCSID("$NetBSD: diag.c,v 1.15 2019/01/
 /* Local stuff */
 
 #include "tcpd.h"
+#include "expandm.h"
 
 struct tcpd_context tcpd_context;
 jmp_buf tcpd_buf;
@@ -45,25 +46,22 @@ static void tcpd_diag(int, const char *,
 static void
 tcpd_diag(int severity, const char *tag, const char *fmt, va_list ap)
 {
-char *buf;
-int e, oerrno = errno;
+char *buf2, *buf = expandm(fmt, NULL);
+
+if (vasprintf(, buf, ap) == -1)
+	buf2 = buf;
 
 /* contruct the tag for the log entry */
 if (tcpd_context.file)
-	e = asprintf(, "%s: %s, line %d: %s",
-	tag, tcpd_context.file, tcpd_context.line, fmt);
+	syslog(severity, "%s: %s, line %d: %s",
+	tag, tcpd_context.file, tcpd_context.line, buf2);
 else
-	e = asprintf(, "%s: %s", tag, fmt);
-
-if (e == -1)
-	buf = __UNCONST(fmt);
-
-errno = oerrno;
-
-vsyslog(severity, buf, ap);
+	syslog(severity, "%s: %s", tag, buf2);
 
 if (buf != fmt)
 free(buf);
+if (buf2 != buf)
+	free(buf2);
 }
 
 /* tcpd_warn - report problem of some sort and proceed */

Added files:

Index: src/lib/libwrap/expandm.c
diff -u /dev/null src/lib/libwrap/expandm.c:1.1
--- /dev/null	Fri Jan 11 15:37:30 2019
+++ src/lib/libwrap/expandm.c	Fri Jan 11 15:37:30 2019
@@ -0,0 +1,77 @@
+/*	$NetBSD: expandm.c,v 1.1 2019/01/11 20:37:30 christos Exp $	*/
+
+/*-
+ * Copyright (c) 2018 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Christos Zoulas.
+ *
+ * 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
+ */
+#include 
+__RCSID("$NetBSD: expandm.c,v 1.1 2019/01/11 20:37:30 christos Exp $");
+
+#include 

CVS commit: src/lib/libwrap

2019-01-11 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Jan 11 20:37:30 UTC 2019

Modified Files:
src/lib/libwrap: Makefile diag.c
Added Files:
src/lib/libwrap: expandm.c expandm.h

Log Message:
Use a utility function to expand %m correctly...


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/lib/libwrap/Makefile
cvs rdiff -u -r1.15 -r1.16 src/lib/libwrap/diag.c
cvs rdiff -u -r0 -r1.1 src/lib/libwrap/expandm.c src/lib/libwrap/expandm.h

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



Re: CVS commit: src/sys/kern

2019-01-11 Thread Christoph Badura
On Fri, Jan 11, 2019 at 12:41:36AM +0100, Michael van Elst wrote:
> On Thu, Jan 10, 2019 at 05:50:30PM +0100, Christoph Badura wrote:
> > 
> > If you hadn't reversed the order of
> > 
> > tftproot_dhcpboot()
> > if (md_is_root) ...
> > rootspec = bootspec
> > 
> > that would wouldn't have need fixing because tftproot_dhcpboot() sets
> > md_is_root.
> 
> It needed fixing because:

You are quoting slightly out of context, but it was poor wording on my
part too.  What I meant was "if you had not removed the old functionality
it wouldn't have need fixing".  Apologies.

> - md0 doesn't exist before it is opened for the first time.

Yes, that's why the old code did open it.  But you still haven't restored
the full functionality.  Or explained why you dropped it.

> - that's one reason why setting rootspec didn't work as intendend

> > Why was the order reversed anyway?  Can you please explain?
> 
> It's not about the order but about separating different cases.

Well, if it is not about the order, then you do not need to change the
order, don't you?

> The setroot code is riddled with side effects.

Sure it is.  A good starting point would have been to add comments that
explain the side effects.  And changing functions to not rely on side
effects.  All without changing functionality.

What exactly did your change do to improve the awareness of these side
effects?  I'm at a loss when it comes to that.

Here's more defects and functionality changes:

- The old code did "if (md_is_root) configure md0 as root or panic".  Now
  it does something different.
- The old code did "if (tftproot_dhcpboot(bootdv) != 0) boothowto |= 
RB_ASKNAME;".
  Now it does something different.  It isn't even guaranteed that
  RB_ASKNAME gets set, because bootdv is likely not null.
- tftproot_dhcpboot() returning 0 does not always indicate that the
  memory disk was successfully initialized.  md_is_root being set, however,
  reliably does.  Now md0 is configured anyway.
- The order *does* matter, because the first thing tftproot_dhcpboot()
  does is check for rootspec != NULL.  In the old code rootspec should
  only have been set by config(8).  Now it can be overridden by bootspec.
  Another functional change.
- Overriding rootspec with bootspec doesn't obey the necessary protocol.
  See my message to tech-kern from yesterday.  (This one is old, though.)

I'm getting the impression, that you do not understand the code very well.
It seems to me that you did not understand the protocol regarding changing
bootspec when you introduced the code to override it 4 years ago.
It seems to me that you did not test the changes related to md_is_root r1.221
at all.

> > Can you also please respond to the review remarks?
> I asked you for a review, it never appeared.

You asked me privately to review a file for you with no indication
whatsoever that there was any urgency to it or that you wanted to commit
soon.  Nevertheless I made time that same day to review it, but ran out of
time to write it up for you.  You didn't come back to me before
committing, so I commented publically.

https://mail-index.netbsd.org/source-changes-d/2019/01/05/msg010893.html

> I am working on this since a few months and committed it now before the branch
> to -9 after asking (several times) for a review.

You did ask several times for review?  Am I supposed to find these
requests in the tech-kern list archive?  Because I can't.  Of the 48
messages from you since 1/1/18 not one did so much as hint at you having
changes that you want reviewed or commit.

Anyway, what was the urgency?  Were you somehow under the impression that
the branch was taking place last weekend and you had to rush these
poorly tested and poorly understood changes in without you having the time to
contact the private reviewer about the status?

--chris


Re: CVS commit: src/lib/libwrap

2019-01-11 Thread Andreas Gustafsson
Christos,

I think libwrap/diag.c 1.15 will read random memory if either the tag
or tcpd_context.file contains "%s".  It's similar to 1.9 but lacks the
code in 1.9 to escape the percent signs (using fixed-length
buffers...).  Kludgy as it was, 1.13 seems like the least bad version
so far.
-- 
Andreas Gustafsson, g...@netbsd.org


CVS commit: src/lib/libwrap

2019-01-11 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Jan 11 16:15:20 UTC 2019

Modified Files:
src/lib/libwrap: diag.c

Log Message:
let's try one more time: prepare the format to pass to syslog instead
of trying to escape %m.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/lib/libwrap/diag.c

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



CVS commit: src/lib/libwrap

2019-01-11 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Jan 11 16:15:20 UTC 2019

Modified Files:
src/lib/libwrap: diag.c

Log Message:
let's try one more time: prepare the format to pass to syslog instead
of trying to escape %m.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/lib/libwrap/diag.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/libwrap/diag.c
diff -u src/lib/libwrap/diag.c:1.14 src/lib/libwrap/diag.c:1.15
--- src/lib/libwrap/diag.c:1.14	Fri Jan 11 08:05:57 2019
+++ src/lib/libwrap/diag.c	Fri Jan 11 11:15:20 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: diag.c,v 1.14 2019/01/11 13:05:57 christos Exp $	*/
+/*	$NetBSD: diag.c,v 1.15 2019/01/11 16:15:20 christos Exp $	*/
 
  /*
   * Routines to report various classes of problems. Each report is decorated
@@ -16,7 +16,7 @@
 #if 0
 static char sccsid[] = "@(#) diag.c 1.1 94/12/28 17:42:20";
 #else
-__RCSID("$NetBSD: diag.c,v 1.14 2019/01/11 13:05:57 christos Exp $");
+__RCSID("$NetBSD: diag.c,v 1.15 2019/01/11 16:15:20 christos Exp $");
 #endif
 #endif
 
@@ -45,33 +45,25 @@ static void tcpd_diag(int, const char *,
 static void
 tcpd_diag(int severity, const char *tag, const char *fmt, va_list ap)
 {
-char *buf, *buf2, *ptr;
-int oerrno = errno;
-
-if ((ptr = strstr(fmt, "%m")) != NULL) {
-	if (asprintf(, "%.*s%%%s", (int)(ptr - fmt), fmt, ptr) == -1)
-	buf = __UNCONST(fmt);
-} else {
-	buf = __UNCONST(fmt);
-}
+char *buf;
+int e, oerrno = errno;
 
+/* contruct the tag for the log entry */
+if (tcpd_context.file)
+	e = asprintf(, "%s: %s, line %d: %s",
+	tag, tcpd_context.file, tcpd_context.line, fmt);
+else
+	e = asprintf(, "%s: %s", tag, fmt);
 
-if (vasprintf(, buf, ap) == -1)
-	buf2 = buf;
+if (e == -1)
+	buf = __UNCONST(fmt);
 
 errno = oerrno;
 
-/* contruct the tag for the log entry */
-if (tcpd_context.file)
-	syslog(severity, "%s: %s, line %d: %s",
-	tag, tcpd_context.file, tcpd_context.line, buf2);
-else
-	syslog(severity, "%s: %s", tag, buf2);
+vsyslog(severity, buf, ap);
 
 if (buf != fmt)
 free(buf);
-if (buf2 != buf)
-	free(buf2);
 }
 
 /* tcpd_warn - report problem of some sort and proceed */



CVS commit: [netbsd-7] src/doc

2019-01-11 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Jan 11 15:58:54 UTC 2019

Modified Files:
src/doc [netbsd-7]: CHANGES-7.3

Log Message:
Ticket #1671


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.31 -r1.1.2.32 src/doc/CHANGES-7.3

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



CVS commit: [netbsd-7] src/doc

2019-01-11 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Jan 11 15:58:54 UTC 2019

Modified Files:
src/doc [netbsd-7]: CHANGES-7.3

Log Message:
Ticket #1671


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.31 -r1.1.2.32 src/doc/CHANGES-7.3

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

Modified files:

Index: src/doc/CHANGES-7.3
diff -u src/doc/CHANGES-7.3:1.1.2.31 src/doc/CHANGES-7.3:1.1.2.32
--- src/doc/CHANGES-7.3:1.1.2.31	Mon Jan  7 14:01:02 2019
+++ src/doc/CHANGES-7.3	Fri Jan 11 15:58:54 2019
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-7.3,v 1.1.2.31 2019/01/07 14:01:02 martin Exp $
+# $NetBSD: CHANGES-7.3,v 1.1.2.32 2019/01/11 15:58:54 martin Exp $
 
 A complete list of changes from the NetBSD 7.2 release to the NetBSD 7.3
 release:
@@ -380,3 +380,9 @@ doc/3RDPARTY	(patch)
 	Updated tzdata to 2018i.
 	[kre, ticket #1670]
 
+sys/dev/usb/usbdi.c1.181
+
+	Avoid use after free when closing interrupt pipe transfer by calling
+	upm_close before destroying the interupt pipe xfer.
+	[skrll, ticket #1671]
+



CVS commit: [netbsd-7] src/sys/dev/usb

2019-01-11 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Jan 11 15:58:23 UTC 2019

Modified Files:
src/sys/dev/usb [netbsd-7]: usbdi.c

Log Message:
Pull up following revision(s) (requested by skrll in ticket #1671):

sys/dev/usb/usbdi.c: revision 1.181

Avoid use after free when closing interrupt pipe transfer by calling
upm_close before destroying the interupt pipe xfer.

Found by kasan on wiz's machine.


To generate a diff of this commit:
cvs rdiff -u -r1.161.2.3 -r1.161.2.4 src/sys/dev/usb/usbdi.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/dev/usb/usbdi.c
diff -u src/sys/dev/usb/usbdi.c:1.161.2.3 src/sys/dev/usb/usbdi.c:1.161.2.4
--- src/sys/dev/usb/usbdi.c:1.161.2.3	Sat Aug 25 14:57:35 2018
+++ src/sys/dev/usb/usbdi.c	Fri Jan 11 15:58:23 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: usbdi.c,v 1.161.2.3 2018/08/25 14:57:35 martin Exp $	*/
+/*	$NetBSD: usbdi.c,v 1.161.2.4 2019/01/11 15:58:23 martin Exp $	*/
 
 /*
  * Copyright (c) 1998, 2012, 2015 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: usbdi.c,v 1.161.2.3 2018/08/25 14:57:35 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usbdi.c,v 1.161.2.4 2019/01/11 15:58:23 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -254,13 +254,14 @@ usbd_close_pipe(struct usbd_pipe *pipe)
 	LIST_REMOVE(pipe, up_next);
 	pipe->up_endpoint->ue_refcnt--;
 
+	pipe->up_methods->upm_close(pipe);
+
 	if (pipe->up_intrxfer != NULL) {
 		usbd_unlock_pipe(pipe);
 		usbd_destroy_xfer(pipe->up_intrxfer);
 		usbd_lock_pipe(pipe);
 	}
 
-	pipe->up_methods->upm_close(pipe);
 	usbd_unlock_pipe(pipe);
 	kmem_free(pipe, pipe->up_dev->ud_bus->ub_pipesize);
 



CVS commit: [netbsd-7] src/sys/dev/usb

2019-01-11 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Jan 11 15:58:23 UTC 2019

Modified Files:
src/sys/dev/usb [netbsd-7]: usbdi.c

Log Message:
Pull up following revision(s) (requested by skrll in ticket #1671):

sys/dev/usb/usbdi.c: revision 1.181

Avoid use after free when closing interrupt pipe transfer by calling
upm_close before destroying the interupt pipe xfer.

Found by kasan on wiz's machine.


To generate a diff of this commit:
cvs rdiff -u -r1.161.2.3 -r1.161.2.4 src/sys/dev/usb/usbdi.c

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



CVS commit: [netbsd-8] src/doc

2019-01-11 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Jan 11 15:56:48 UTC 2019

Modified Files:
src/doc [netbsd-8]: CHANGES-8.1

Log Message:
Tickets #1158, #1161 and #1162


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.87 -r1.1.2.88 src/doc/CHANGES-8.1

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



CVS commit: [netbsd-8] src/doc

2019-01-11 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Jan 11 15:56:48 UTC 2019

Modified Files:
src/doc [netbsd-8]: CHANGES-8.1

Log Message:
Tickets #1158, #1161 and #1162


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.87 -r1.1.2.88 src/doc/CHANGES-8.1

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

Modified files:

Index: src/doc/CHANGES-8.1
diff -u src/doc/CHANGES-8.1:1.1.2.87 src/doc/CHANGES-8.1:1.1.2.88
--- src/doc/CHANGES-8.1:1.1.2.87	Mon Jan  7 13:50:37 2019
+++ src/doc/CHANGES-8.1	Fri Jan 11 15:56:48 2019
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-8.1,v 1.1.2.87 2019/01/07 13:50:37 martin Exp $
+# $NetBSD: CHANGES-8.1,v 1.1.2.88 2019/01/11 15:56:48 martin Exp $
 
 A complete list of changes from the NetBSD 8.0 release to the NetBSD 8.1
 release:
@@ -2211,3 +2211,20 @@ sys/dev/pci/mpii.c1.19
 	Fix LUN handling (byte order issue).
 	[kardel, ticket #1157]
 
+distrib/common/cgdroot.rc			1.2-1.4
+
+	Add support cgd root on ld0 (not just wd0).
+	[sevan, ticket #1158]
+
+sys/dev/usb/usbdi.c1.181
+
+	Avoid use after free when closing interrupt pipe transfer by calling
+	upm_close before destroying the interupt pipe xfer.
+	[skrll, ticket #1161]
+
+sys/net/if_ppp.c1.162,1.163
+
+	Fix missing mutex_exit in ppp_create().
+	Fix missing splx in ppp_inproc().
+	[knakahara, ticket #1162]
+



CVS commit: [netbsd-8] src/sys/net

2019-01-11 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Jan 11 15:55:02 UTC 2019

Modified Files:
src/sys/net [netbsd-8]: if_ppp.c

Log Message:
Pull up following revision(s) (requested by knakahara in ticket #1162):

sys/net/if_ppp.c: revision 1.162
sys/net/if_ppp.c: revision 1.163

Fix missing mutex_exit in ppp_create().

Fix missing splx in ppp_inproc().


To generate a diff of this commit:
cvs rdiff -u -r1.158.8.1 -r1.158.8.2 src/sys/net/if_ppp.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/if_ppp.c
diff -u src/sys/net/if_ppp.c:1.158.8.1 src/sys/net/if_ppp.c:1.158.8.2
--- src/sys/net/if_ppp.c:1.158.8.1	Thu Jul 26 23:55:31 2018
+++ src/sys/net/if_ppp.c	Fri Jan 11 15:55:01 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ppp.c,v 1.158.8.1 2018/07/26 23:55:31 snj Exp $	*/
+/*	$NetBSD: if_ppp.c,v 1.158.8.2 2019/01/11 15:55:01 martin Exp $	*/
 /*	Id: if_ppp.c,v 1.6 1997/03/04 03:33:00 paulus Exp 	*/
 
 /*
@@ -102,7 +102,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_ppp.c,v 1.158.8.1 2018/07/26 23:55:31 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ppp.c,v 1.158.8.2 2019/01/11 15:55:01 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "ppp.h"
@@ -301,6 +301,7 @@ ppp_create(const char *name, int unit)
 break;
 			else if (unit == sci->sc_unit) {
 free(sc, M_DEVBUF);
+mutex_exit(_list_lock);
 return NULL;
 			}
 		}
@@ -1722,6 +1723,7 @@ ppp_inproc(struct ppp_softc *sc, struct 
 	/* pktq: inet or inet6 cases */
 	if (__predict_true(pktq)) {
 		if (__predict_false(!pktq_enqueue(pktq, m, 0))) {
+			splx(s);
 			ifp->if_iqdrops++;
 			goto bad;
 		}
@@ -1733,6 +1735,7 @@ ppp_inproc(struct ppp_softc *sc, struct 
 
 	/* ifq: other protocol cases */
 	if (!inq) {
+		splx(s);
 		goto bad;
 	}
 	if (IF_QFULL(inq)) {



CVS commit: [netbsd-8] src/sys/net

2019-01-11 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Jan 11 15:55:02 UTC 2019

Modified Files:
src/sys/net [netbsd-8]: if_ppp.c

Log Message:
Pull up following revision(s) (requested by knakahara in ticket #1162):

sys/net/if_ppp.c: revision 1.162
sys/net/if_ppp.c: revision 1.163

Fix missing mutex_exit in ppp_create().

Fix missing splx in ppp_inproc().


To generate a diff of this commit:
cvs rdiff -u -r1.158.8.1 -r1.158.8.2 src/sys/net/if_ppp.c

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



CVS commit: [netbsd-8] src/sys/dev/usb

2019-01-11 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Jan 11 15:52:24 UTC 2019

Modified Files:
src/sys/dev/usb [netbsd-8]: usbdi.c

Log Message:
Pull up following revision(s) (requested by skrll in ticket #1161):

sys/dev/usb/usbdi.c: revision 1.181

Avoid use after free when closing interrupt pipe transfer by calling
upm_close before destroying the interupt pipe xfer.

Found by kasan on wiz's machine.


To generate a diff of this commit:
cvs rdiff -u -r1.173.2.4 -r1.173.2.5 src/sys/dev/usb/usbdi.c

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



CVS commit: [netbsd-8] src/sys/dev/usb

2019-01-11 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Jan 11 15:52:24 UTC 2019

Modified Files:
src/sys/dev/usb [netbsd-8]: usbdi.c

Log Message:
Pull up following revision(s) (requested by skrll in ticket #1161):

sys/dev/usb/usbdi.c: revision 1.181

Avoid use after free when closing interrupt pipe transfer by calling
upm_close before destroying the interupt pipe xfer.

Found by kasan on wiz's machine.


To generate a diff of this commit:
cvs rdiff -u -r1.173.2.4 -r1.173.2.5 src/sys/dev/usb/usbdi.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/dev/usb/usbdi.c
diff -u src/sys/dev/usb/usbdi.c:1.173.2.4 src/sys/dev/usb/usbdi.c:1.173.2.5
--- src/sys/dev/usb/usbdi.c:1.173.2.4	Tue Nov 20 16:05:38 2018
+++ src/sys/dev/usb/usbdi.c	Fri Jan 11 15:52:24 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: usbdi.c,v 1.173.2.4 2018/11/20 16:05:38 martin Exp $	*/
+/*	$NetBSD: usbdi.c,v 1.173.2.5 2019/01/11 15:52:24 martin Exp $	*/
 
 /*
  * Copyright (c) 1998, 2012, 2015 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: usbdi.c,v 1.173.2.4 2018/11/20 16:05:38 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usbdi.c,v 1.173.2.5 2019/01/11 15:52:24 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -257,13 +257,14 @@ usbd_close_pipe(struct usbd_pipe *pipe)
 	LIST_REMOVE(pipe, up_next);
 	pipe->up_endpoint->ue_refcnt--;
 
+	pipe->up_methods->upm_close(pipe);
+
 	if (pipe->up_intrxfer != NULL) {
 		usbd_unlock_pipe(pipe);
 		usbd_destroy_xfer(pipe->up_intrxfer);
 		usbd_lock_pipe(pipe);
 	}
 
-	pipe->up_methods->upm_close(pipe);
 	usbd_unlock_pipe(pipe);
 	kmem_free(pipe, pipe->up_dev->ud_bus->ub_pipesize);
 



CVS commit: src/sys/dev/usb

2019-01-11 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Jan 11 15:43:51 UTC 2019

Modified Files:
src/sys/dev/usb: xhci.c

Log Message:
Add a bs_barrier to make ThunderX xhci work.  Not sure why this is needed,
but I'll work it out later.


To generate a diff of this commit:
cvs rdiff -u -r1.102 -r1.103 src/sys/dev/usb/xhci.c

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



CVS commit: src/sys/dev/usb

2019-01-11 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Jan 11 15:43:51 UTC 2019

Modified Files:
src/sys/dev/usb: xhci.c

Log Message:
Add a bs_barrier to make ThunderX xhci work.  Not sure why this is needed,
but I'll work it out later.


To generate a diff of this commit:
cvs rdiff -u -r1.102 -r1.103 src/sys/dev/usb/xhci.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/dev/usb/xhci.c
diff -u src/sys/dev/usb/xhci.c:1.102 src/sys/dev/usb/xhci.c:1.103
--- src/sys/dev/usb/xhci.c:1.102	Fri Jan 11 15:39:24 2019
+++ src/sys/dev/usb/xhci.c	Fri Jan 11 15:43:51 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: xhci.c,v 1.102 2019/01/11 15:39:24 skrll Exp $	*/
+/*	$NetBSD: xhci.c,v 1.103 2019/01/11 15:43:51 skrll Exp $	*/
 
 /*
  * Copyright (c) 2013 Jonathan A. Kollasch
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.102 2019/01/11 15:39:24 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.103 2019/01/11 15:43:51 skrll Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -345,6 +345,13 @@ xhci_op_write_8(const struct xhci_softc 
 	}
 }
 
+static inline void
+xhci_op_barrier(const struct xhci_softc * const sc, bus_size_t offset,
+bus_size_t len, int flags)
+{
+	bus_space_barrier(sc->sc_iot, sc->sc_obh, offset, len, flags);
+}
+
 static inline uint32_t
 xhci_rt_read_4(const struct xhci_softc * const sc, bus_size_t offset)
 {
@@ -1190,10 +1197,13 @@ xhci_init(struct xhci_softc *sc)
 	xhci_rt_write_8(sc, XHCI_ERSTBA(0), DMAADDR(>sc_eventst_dma, 0));
 	xhci_rt_write_8(sc, XHCI_ERDP(0), xhci_ring_trbp(>sc_er, 0) |
 	XHCI_ERDP_LO_BUSY);
+
 	xhci_op_write_8(sc, XHCI_DCBAAP, DMAADDR(>sc_dcbaa_dma, 0));
 	xhci_op_write_8(sc, XHCI_CRCR, xhci_ring_trbp(>sc_cr, 0) |
 	sc->sc_cr.xr_cs);
 
+	xhci_op_barrier(sc, 0, 4, BUS_SPACE_BARRIER_WRITE);
+
 	HEXDUMP("eventst", KERNADDR(>sc_eventst_dma, 0),
 	XHCI_ERSTE_SIZE * XHCI_EVENT_RING_SEGMENTS);
 



CVS commit: src/sys/dev/usb

2019-01-11 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Jan 11 15:39:24 UTC 2019

Modified Files:
src/sys/dev/usb: xhci.c

Log Message:
Style


To generate a diff of this commit:
cvs rdiff -u -r1.101 -r1.102 src/sys/dev/usb/xhci.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/dev/usb/xhci.c
diff -u src/sys/dev/usb/xhci.c:1.101 src/sys/dev/usb/xhci.c:1.102
--- src/sys/dev/usb/xhci.c:1.101	Mon Jan  7 03:00:39 2019
+++ src/sys/dev/usb/xhci.c	Fri Jan 11 15:39:24 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: xhci.c,v 1.101 2019/01/07 03:00:39 jakllsch Exp $	*/
+/*	$NetBSD: xhci.c,v 1.102 2019/01/11 15:39:24 skrll Exp $	*/
 
 /*
  * Copyright (c) 2013 Jonathan A. Kollasch
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.101 2019/01/07 03:00:39 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.102 2019/01/11 15:39:24 skrll Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -912,7 +912,8 @@ xhci_start(struct xhci_softc *sc)
 	aprint_debug_dev(sc->sc_dev, "current IMOD %u\n",
 	xhci_rt_read_4(sc, XHCI_IMOD(0)));
 
-	xhci_op_write_4(sc, XHCI_USBCMD, XHCI_CMD_INTE|XHCI_CMD_RS); /* Go! */
+	/* Go! */
+	xhci_op_write_4(sc, XHCI_USBCMD, XHCI_CMD_INTE|XHCI_CMD_RS);
 	aprint_debug_dev(sc->sc_dev, "USBCMD %08"PRIx32"\n",
 	xhci_op_read_4(sc, XHCI_USBCMD));
 }



CVS commit: src/sys/dev/usb

2019-01-11 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Jan 11 15:39:24 UTC 2019

Modified Files:
src/sys/dev/usb: xhci.c

Log Message:
Style


To generate a diff of this commit:
cvs rdiff -u -r1.101 -r1.102 src/sys/dev/usb/xhci.c

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



CVS commit: [netbsd-8] src/distrib/common

2019-01-11 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Jan 11 15:37:28 UTC 2019

Modified Files:
src/distrib/common [netbsd-8]: cgdroot.rc

Log Message:
Pull up following revision(s) (requested by sevan in ticket #1158):
distrib/common/cgdroot.rc: revision 1.2
distrib/common/cgdroot.rc: revision 1.3
distrib/common/cgdroot.rc: revision 1.4

Don't hardcode wd0a in cgdroot.kmod, try NAME=cgd.conf and ROOT.a.

 -

Break the loop after a successful mount.

 -

ROOT.a doesn't resolve to a useful partition, hardcode wd0a and ld0a for
now.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.1.24.1 src/distrib/common/cgdroot.rc

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

Modified files:

Index: src/distrib/common/cgdroot.rc
diff -u src/distrib/common/cgdroot.rc:1.1 src/distrib/common/cgdroot.rc:1.1.24.1
--- src/distrib/common/cgdroot.rc:1.1	Mon Jul 15 00:25:38 2013
+++ src/distrib/common/cgdroot.rc	Fri Jan 11 15:37:28 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: cgdroot.rc,v 1.1 2013/07/15 00:25:38 khorben Exp $
+#	$NetBSD: cgdroot.rc,v 1.1.24.1 2019/01/11 15:37:28 martin Exp $
 #
 # Copyright (c) 2013 Pierre Pronchery 
 # All rights reserved.
@@ -36,8 +36,14 @@ export EDITOR
 
 umask 022
 
-mount -o ro /dev/wd0a /etc/cgd
-if [ $? -ne 0 ]; then
+mounted=
+for dev in NAME=cgd.conf /dev/wd0a /dev/ld0a ; do
+	if mount -o ro $dev /etc/cgd 2>/dev/null ; then
+		mounted=$dev
+		break
+	fi
+done
+if [ -z "$mounted" ]; then
 	echo "Could not mount the boot partition" 1>&2
 	exit 2
 fi



CVS commit: [netbsd-8] src/distrib/common

2019-01-11 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Jan 11 15:37:28 UTC 2019

Modified Files:
src/distrib/common [netbsd-8]: cgdroot.rc

Log Message:
Pull up following revision(s) (requested by sevan in ticket #1158):
distrib/common/cgdroot.rc: revision 1.2
distrib/common/cgdroot.rc: revision 1.3
distrib/common/cgdroot.rc: revision 1.4

Don't hardcode wd0a in cgdroot.kmod, try NAME=cgd.conf and ROOT.a.

 -

Break the loop after a successful mount.

 -

ROOT.a doesn't resolve to a useful partition, hardcode wd0a and ld0a for
now.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.1.24.1 src/distrib/common/cgdroot.rc

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



Re: CVS commit: src/lib/libwrap

2019-01-11 Thread Valery Ushakov
On Fri, Jan 11, 2019 at 07:39:58 +0700, Robert Elz wrote:

> farily easy to add, if only gcc didn't go and do printf format string
> analysis and complain when it sees something it does not understand.

gcc has plugin API that lets you add support for custom format
languages.  We use it at work where we have effectively our own
superset of printf with lots of additional formatters.

-uwe


CVS commit: src/lib/libwrap

2019-01-11 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Jan 11 13:05:57 UTC 2019

Modified Files:
src/lib/libwrap: diag.c

Log Message:
instead of handling %m inline, escape it.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/lib/libwrap/diag.c

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



CVS commit: src/lib/libwrap

2019-01-11 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Jan 11 13:05:57 UTC 2019

Modified Files:
src/lib/libwrap: diag.c

Log Message:
instead of handling %m inline, escape it.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/lib/libwrap/diag.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/libwrap/diag.c
diff -u src/lib/libwrap/diag.c:1.13 src/lib/libwrap/diag.c:1.14
--- src/lib/libwrap/diag.c:1.13	Thu Jan 10 08:53:58 2019
+++ src/lib/libwrap/diag.c	Fri Jan 11 08:05:57 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: diag.c,v 1.13 2019/01/10 13:53:58 christos Exp $	*/
+/*	$NetBSD: diag.c,v 1.14 2019/01/11 13:05:57 christos Exp $	*/
 
  /*
   * Routines to report various classes of problems. Each report is decorated
@@ -16,7 +16,7 @@
 #if 0
 static char sccsid[] = "@(#) diag.c 1.1 94/12/28 17:42:20";
 #else
-__RCSID("$NetBSD: diag.c,v 1.13 2019/01/10 13:53:58 christos Exp $");
+__RCSID("$NetBSD: diag.c,v 1.14 2019/01/11 13:05:57 christos Exp $");
 #endif
 #endif
 
@@ -46,10 +46,10 @@ static void
 tcpd_diag(int severity, const char *tag, const char *fmt, va_list ap)
 {
 char *buf, *buf2, *ptr;
+int oerrno = errno;
 
 if ((ptr = strstr(fmt, "%m")) != NULL) {
-	if (asprintf(, "%.*s%s%s", (int)(ptr - fmt), fmt, strerror(errno),
-	ptr + 2) == -1)
+	if (asprintf(, "%.*s%%%s", (int)(ptr - fmt), fmt, ptr) == -1)
 	buf = __UNCONST(fmt);
 } else {
 	buf = __UNCONST(fmt);
@@ -59,6 +59,8 @@ tcpd_diag(int severity, const char *tag,
 if (vasprintf(, buf, ap) == -1)
 	buf2 = buf;
 
+errno = oerrno;
+
 /* contruct the tag for the log entry */
 if (tcpd_context.file)
 	syslog(severity, "%s: %s, line %d: %s",



CVS commit: src/sys/arch/playstation2/dev

2019-01-11 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri Jan 11 08:30:19 UTC 2019

Modified Files:
src/sys/arch/playstation2/dev: emac3.c

Log Message:
 Add missing semicolon.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/playstation2/dev/emac3.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/playstation2/dev/emac3.c
diff -u src/sys/arch/playstation2/dev/emac3.c:1.11 src/sys/arch/playstation2/dev/emac3.c:1.12
--- src/sys/arch/playstation2/dev/emac3.c:1.11	Sun Apr  3 10:03:04 2016
+++ src/sys/arch/playstation2/dev/emac3.c	Fri Jan 11 08:30:19 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: emac3.c,v 1.11 2016/04/03 10:03:04 martin Exp $	*/
+/*	$NetBSD: emac3.c,v 1.12 2019/01/11 08:30:19 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: emac3.c,v 1.11 2016/04/03 10:03:04 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: emac3.c,v 1.12 2019/01/11 08:30:19 msaitoh Exp $");
 
 #include "debug_playstation2.h"
 
@@ -248,7 +248,7 @@ allmulti:
 		ETHER_ADDR_LEN) != 0)
 			goto allmulti;
 
-		ETHER_NEXT_MULTI(step, enm)
+		ETHER_NEXT_MULTI(step, enm);
 	}
 
 	/* XXX always multicast promiscuous mode. XXX use hash table.. */



CVS commit: src/sys/arch/playstation2/dev

2019-01-11 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri Jan 11 08:30:19 UTC 2019

Modified Files:
src/sys/arch/playstation2/dev: emac3.c

Log Message:
 Add missing semicolon.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/playstation2/dev/emac3.c

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



CVS commit: src/usr.sbin/sysinst

2019-01-11 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Jan 11 08:14:50 UTC 2019

Modified Files:
src/usr.sbin/sysinst: msg.mi.pl

Log Message:
Some translation fixes/additions from Kamil


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/usr.sbin/sysinst/msg.mi.pl

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

Modified files:

Index: src/usr.sbin/sysinst/msg.mi.pl
diff -u src/usr.sbin/sysinst/msg.mi.pl:1.15 src/usr.sbin/sysinst/msg.mi.pl:1.16
--- src/usr.sbin/sysinst/msg.mi.pl:1.15	Thu Jan 10 19:00:17 2019
+++ src/usr.sbin/sysinst/msg.mi.pl	Fri Jan 11 08:14:50 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg.mi.pl,v 1.15 2019/01/10 19:00:17 martin Exp $	*/
+/*	$NetBSD: msg.mi.pl,v 1.16 2019/01/11 08:14:50 martin Exp $	*/
 /*	Based on english version: */
 /*	NetBSD: msg.mi.pl,v 1.36 2004/04/17 18:55:35 atatat Exp   */
 
@@ -920,9 +920,9 @@ message hidden {** ukryte **}
 message Host {Host}
 message Base_dir {Katalog}
 message Set_dir_src {Katalog pakiet binary} /* fix XLAT */
-message Set_dir_bin {Katalog pakiet source} /* fix XLAT */
-message Xfer_dir {Transfer Katalog} /* fix XLAT */
-message transfer_method {Download via}
+message Set_dir_bin {Katalog pkgsrc}
+message Xfer_dir {Katalog z plikami pobranymi}
+message transfer_method {Sposob pobrania}
 message User {Uzytkownik}
 message Password {Haslo}
 message Proxy {Proxy}
@@ -1009,13 +1009,13 @@ message enable_sshd {Wlacz sshd}
 message enable_ntpd {Wlacz ntpd}
 message run_ntpdate {uruchom ntpdate podczas startu systemu}
 message enable_mdnsd {Wlacz mdnsd}
-message enable_xdm {Enable xdm}
-message enable_cgd {Enable cgd}
-message enable_lvm {Enable lvm}
-message enable_raid {Enable raidframe}
-message add_a_user {Add a user}
+message enable_xdm {Wlacz xdm}
+message enable_cgd {Wlacz cgd}
+message enable_lvm {Wlacz lvm}
+message enable_raid {Wlacz raidframe}
+message add_a_user {Dodaj uzytkownika}
 message configmenu {Skonfiguruj dodatkowe elementy w razie potrzeby.}
-message doneconfig {Konfiguracja zakonczona}
+message doneconfig {Zakoncz konfiguracje}
 message Install_pkgin {Zainstaluj pkgin i uaktualnij podsumowanie pakietow}
 message binpkg_installed 
 {Skonfigurowales system tak aby wykorzystywal pkgin do instalacji pakietow



CVS commit: src/usr.sbin/sysinst

2019-01-11 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Jan 11 08:14:50 UTC 2019

Modified Files:
src/usr.sbin/sysinst: msg.mi.pl

Log Message:
Some translation fixes/additions from Kamil


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/usr.sbin/sysinst/msg.mi.pl

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



CVS commit: src/tests/net/if_ipsec

2019-01-11 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Fri Jan 11 08:05:53 UTC 2019

Modified Files:
src/tests/net/if_ipsec: t_ipsec.sh

Log Message:
workaround for PR kern/53848


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/tests/net/if_ipsec/t_ipsec.sh

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

Modified files:

Index: src/tests/net/if_ipsec/t_ipsec.sh
diff -u src/tests/net/if_ipsec/t_ipsec.sh:1.6 src/tests/net/if_ipsec/t_ipsec.sh:1.7
--- src/tests/net/if_ipsec/t_ipsec.sh:1.6	Thu Jan 10 00:45:08 2019
+++ src/tests/net/if_ipsec/t_ipsec.sh	Fri Jan 11 08:05:52 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: t_ipsec.sh,v 1.6 2019/01/10 00:45:08 knakahara Exp $
+#	$NetBSD: t_ipsec.sh,v 1.7 2019/01/11 08:05:52 knakahara Exp $
 #
 # Copyright (c) 2017 Internet Initiative Japan Inc.
 # All rights reserved.
@@ -62,7 +62,7 @@ ROUTER2_IPSECIP6_RECURSIVE1=fc00:104::1
 ROUTER2_IPSECIP6_RECURSIVE2=fc00:204::1
 
 DEBUG=${DEBUG:-false}
-TIMEOUT=7
+TIMEOUT=15
 
 atf_test_case ipsecif_create_destroy cleanup
 ipsecif_create_destroy_head()



CVS commit: src/tests/net/if_ipsec

2019-01-11 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Fri Jan 11 08:05:53 UTC 2019

Modified Files:
src/tests/net/if_ipsec: t_ipsec.sh

Log Message:
workaround for PR kern/53848


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/tests/net/if_ipsec/t_ipsec.sh

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