CVS commit: src

2017-12-10 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Mon Dec 11 05:47:18 UTC 2017

Modified Files:
src/sys/netinet: ip_output.c ip_var.h raw_ip.c udp_usrreq.c
src/tests/net/net: t_pktinfo_send.c

Log Message:
As is the case with IPV6_PKTINFO, IP_PKTINFO can be sent without EADDRINUSE
even if the UDP address:port in use is specified.


To generate a diff of this commit:
cvs rdiff -u -r1.285 -r1.286 src/sys/netinet/ip_output.c
cvs rdiff -u -r1.120 -r1.121 src/sys/netinet/ip_var.h
cvs rdiff -u -r1.166 -r1.167 src/sys/netinet/raw_ip.c
cvs rdiff -u -r1.235 -r1.236 src/sys/netinet/udp_usrreq.c
cvs rdiff -u -r1.1 -r1.2 src/tests/net/net/t_pktinfo_send.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.285 src/sys/netinet/ip_output.c:1.286
--- src/sys/netinet/ip_output.c:1.285	Fri Nov 17 07:37:12 2017
+++ src/sys/netinet/ip_output.c	Mon Dec 11 05:47:18 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip_output.c,v 1.285 2017/11/17 07:37:12 ozaki-r Exp $	*/
+/*	$NetBSD: ip_output.c,v 1.286 2017/12/11 05:47:18 ryo Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -91,7 +91,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ip_output.c,v 1.285 2017/11/17 07:37:12 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_output.c,v 1.286 2017/12/11 05:47:18 ryo Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1411,9 +1411,8 @@ ip_pktinfo_prepare(const struct in_pktin
  */
 int
 ip_setpktopts(struct mbuf *control, struct ip_pktopts *pktopts, int *flags,
-struct inpcb *inp, kauth_cred_t cred, int uproto)
+struct inpcb *inp, kauth_cred_t cred)
 {
-	struct inpcb *xinp;
 	struct cmsghdr *cm;
 	struct in_pktinfo *pktinfo;
 	int error;
@@ -1453,16 +1452,6 @@ ip_setpktopts(struct mbuf *control, stru
 			cred);
 			if (error != 0)
 return error;
-
-			if ((uproto == IPPROTO_UDP) &&
-			!in_nullhost(pktopts->ippo_laddr.sin_addr)) {
-/* Checking laddr:port already in use? */
-xinp = in_pcblookup_bind(,
-pktopts->ippo_laddr.sin_addr,
-inp->inp_lport);
-if ((xinp != NULL) && (xinp != inp))
-	return EADDRINUSE;
-			}
 			break;
 		default:
 			return ENOPROTOOPT;

Index: src/sys/netinet/ip_var.h
diff -u src/sys/netinet/ip_var.h:1.120 src/sys/netinet/ip_var.h:1.121
--- src/sys/netinet/ip_var.h:1.120	Thu Aug 10 04:31:58 2017
+++ src/sys/netinet/ip_var.h	Mon Dec 11 05:47:18 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip_var.h,v 1.120 2017/08/10 04:31:58 ryo Exp $	*/
+/*	$NetBSD: ip_var.h,v 1.121 2017/12/11 05:47:18 ryo Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1993
@@ -215,7 +215,7 @@ void	in_init(void);
 
 int	 ip_ctloutput(int, struct socket *, struct sockopt *);
 int	 ip_setpktopts(struct mbuf *, struct ip_pktopts *, int *,
-	struct inpcb *, kauth_cred_t, int);
+	struct inpcb *, kauth_cred_t);
 void	 ip_drain(void);
 void	 ip_drainstub(void);
 void	 ip_freemoptions(struct ip_moptions *);

Index: src/sys/netinet/raw_ip.c
diff -u src/sys/netinet/raw_ip.c:1.166 src/sys/netinet/raw_ip.c:1.167
--- src/sys/netinet/raw_ip.c:1.166	Thu Aug 10 04:31:58 2017
+++ src/sys/netinet/raw_ip.c	Mon Dec 11 05:47:18 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: raw_ip.c,v 1.166 2017/08/10 04:31:58 ryo Exp $	*/
+/*	$NetBSD: raw_ip.c,v 1.167 2017/12/11 05:47:18 ryo Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -65,7 +65,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: raw_ip.c,v 1.166 2017/08/10 04:31:58 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: raw_ip.c,v 1.167 2017/12/11 05:47:18 ryo Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -322,8 +322,7 @@ rip_output(struct mbuf *m, struct inpcb 
 
 	/* Setup IP outgoing packet options */
 	memset(, 0, sizeof(pktopts));
-	error = ip_setpktopts(control, , , inp, cred,
-	IPPROTO_RAW);
+	error = ip_setpktopts(control, , , inp, cred);
 	if (control != NULL)
 		m_freem(control);
 	if (error != 0)

Index: src/sys/netinet/udp_usrreq.c
diff -u src/sys/netinet/udp_usrreq.c:1.235 src/sys/netinet/udp_usrreq.c:1.236
--- src/sys/netinet/udp_usrreq.c:1.235	Thu Aug 10 04:31:58 2017
+++ src/sys/netinet/udp_usrreq.c	Mon Dec 11 05:47:18 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: udp_usrreq.c,v 1.235 2017/08/10 04:31:58 ryo Exp $	*/
+/*	$NetBSD: udp_usrreq.c,v 1.236 2017/12/11 05:47:18 ryo Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -66,7 +66,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: udp_usrreq.c,v 1.235 2017/08/10 04:31:58 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: udp_usrreq.c,v 1.236 2017/12/11 05:47:18 ryo Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -804,8 +804,7 @@ udp_output(struct mbuf *m, struct inpcb 
 
 	/* Setup IP outgoing packet options */
 	memset(, 0, sizeof(pktopts));
-	error = ip_setpktopts(control, , , inp, cred,
-	IPPROTO_UDP);
+	error = ip_setpktopts(control, , , inp, cred);
 	if (error != 

CVS commit: src/sys

2017-12-10 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Mon Dec 11 03:29:21 UTC 2017

Modified Files:
src/sys/net: if.c if.h if_bridge.c if_spppsubr.c if_vlan.c
src/sys/rump/net/lib/libnetinet: netinet_component.c

Log Message:
Wrap if_ioctl_lock with IFNET_* macros (NFC)

Also if_ioctl_lock perhaps needs to be renamed to something because it's now
not just for ioctl...


To generate a diff of this commit:
cvs rdiff -u -r1.412 -r1.413 src/sys/net/if.c
cvs rdiff -u -r1.252 -r1.253 src/sys/net/if.h
cvs rdiff -u -r1.144 -r1.145 src/sys/net/if_bridge.c
cvs rdiff -u -r1.176 -r1.177 src/sys/net/if_spppsubr.c
cvs rdiff -u -r1.118 -r1.119 src/sys/net/if_vlan.c
cvs rdiff -u -r1.9 -r1.10 src/sys/rump/net/lib/libnetinet/netinet_component.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.c
diff -u src/sys/net/if.c:1.412 src/sys/net/if.c:1.413
--- src/sys/net/if.c:1.412	Mon Dec 11 03:25:45 2017
+++ src/sys/net/if.c	Mon Dec 11 03:29:20 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if.c,v 1.412 2017/12/11 03:25:45 ozaki-r Exp $	*/
+/*	$NetBSD: if.c,v 1.413 2017/12/11 03:29:20 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.412 2017/12/11 03:25:45 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.413 2017/12/11 03:29:20 ozaki-r Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_inet.h"
@@ -1313,9 +1313,9 @@ if_detach(struct ifnet *ifp)
 	s = splnet();
 
 	sysctl_teardown(>if_sysctl_log);
-	mutex_enter(ifp->if_ioctl_lock);
+	IFNET_LOCK(ifp);
 	if_deactivate(ifp);
-	mutex_exit(ifp->if_ioctl_lock);
+	IFNET_UNLOCK(ifp);
 
 	IFNET_GLOBAL_LOCK();
 	ifindex2ifnet[ifp->if_index] = NULL;
@@ -1604,9 +1604,9 @@ if_clone_destroy(const char *name)
 		return ENXIO;
 
 	/* We have to disable ioctls here */
-	mutex_enter(ifp->if_ioctl_lock);
+	IFNET_LOCK(ifp);
 	ifp->if_ioctl = if_nullioctl;
-	mutex_exit(ifp->if_ioctl_lock);
+	IFNET_UNLOCK(ifp);
 
 	/*
 	 * We cannot call ifc_destroy with holding ifp.
@@ -2486,7 +2486,7 @@ void
 if_down_locked(struct ifnet *ifp)
 {
 
-	KASSERT(mutex_owned(ifp->if_ioctl_lock));
+	KASSERT(IFNET_LOCKED(ifp));
 	_if_down(ifp);
 }
 
@@ -2499,9 +2499,9 @@ void
 if_down(struct ifnet *ifp)
 {
 
-	mutex_enter(ifp->if_ioctl_lock);
+	IFNET_LOCK(ifp);
 	if_down_locked(ifp);
-	mutex_exit(ifp->if_ioctl_lock);
+	IFNET_UNLOCK(ifp);
 }
 
 /*
@@ -2515,7 +2515,7 @@ if_up_locked(struct ifnet *ifp)
 #endif
 	struct domain *dp;
 
-	KASSERT(mutex_owned(ifp->if_ioctl_lock));
+	KASSERT(IFNET_LOCKED(ifp));
 
 	KASSERT(!if_is_deactivated(ifp));
 	ifp->if_flags |= IFF_UP;
@@ -2571,9 +2571,9 @@ void
 if_up(struct ifnet *ifp)
 {
 
-	mutex_enter(ifp->if_ioctl_lock);
+	IFNET_LOCK(ifp);
 	if_up_locked(ifp);
-	mutex_exit(ifp->if_ioctl_lock);
+	IFNET_UNLOCK(ifp);
 }
 
 /*
@@ -2588,7 +2588,7 @@ ifpromisc_locked(struct ifnet *ifp, int 
 	int pcount, ret = 0;
 	short nflags;
 
-	KASSERT(mutex_owned(ifp->if_ioctl_lock));
+	KASSERT(IFNET_LOCKED(ifp));
 
 	pcount = ifp->if_pcount;
 	if (pswitch) {
@@ -2619,9 +2619,9 @@ ifpromisc(struct ifnet *ifp, int pswitch
 {
 	int e;
 
-	mutex_enter(ifp->if_ioctl_lock);
+	IFNET_LOCK(ifp);
 	e = ifpromisc_locked(ifp, pswitch);
-	mutex_exit(ifp->if_ioctl_lock);
+	IFNET_UNLOCK(ifp);
 
 	return e;
 }
@@ -3195,7 +3195,7 @@ doifioctl(struct socket *so, u_long cmd,
 	oif_flags = ifp->if_flags;
 
 	KERNEL_LOCK_UNLESS_IFP_MPSAFE(ifp);
-	mutex_enter(ifp->if_ioctl_lock);
+	IFNET_LOCK(ifp);
 
 	error = (*ifp->if_ioctl)(ifp, cmd, data);
 	if (error != ENOTTY)
@@ -3226,7 +3226,7 @@ doifioctl(struct socket *so, u_long cmd,
 		ifreqn2o(oifr, ifr);
 #endif
 
-	mutex_exit(ifp->if_ioctl_lock);
+	IFNET_UNLOCK(ifp);
 	KERNEL_UNLOCK_UNLESS_IFP_MPSAFE(ifp);
 out:
 	if_put(ifp, );
@@ -3484,7 +3484,7 @@ if_addr_init(ifnet_t *ifp, struct ifaddr
 {
 	int rc;
 
-	KASSERT(mutex_owned(ifp->if_ioctl_lock));
+	KASSERT(IFNET_LOCKED(ifp));
 	if (ifp->if_initaddr != NULL)
 		rc = (*ifp->if_initaddr)(ifp, ifa, src);
 	else if (src ||
@@ -3532,7 +3532,7 @@ if_flags_set(ifnet_t *ifp, const short f
 {
 	int rc;
 
-	KASSERT(mutex_owned(ifp->if_ioctl_lock));
+	KASSERT(IFNET_LOCKED(ifp));
 
 	if (ifp->if_setflags != NULL)
 		rc = (*ifp->if_setflags)(ifp, flags);

Index: src/sys/net/if.h
diff -u src/sys/net/if.h:1.252 src/sys/net/if.h:1.253
--- src/sys/net/if.h:1.252	Mon Dec 11 03:25:45 2017
+++ src/sys/net/if.h	Mon Dec 11 03:29:20 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if.h,v 1.252 2017/12/11 03:25:45 ozaki-r Exp $	*/
+/*	$NetBSD: if.h,v 1.253 2017/12/11 03:29:20 ozaki-r Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -1227,6 +1227,10 @@ __END_DECLS
 		}			\
 	} while (0)
 
+#define IFNET_LOCK(ifp)		mutex_enter((ifp)->if_ioctl_lock)
+#define IFNET_UNLOCK(ifp)	mutex_exit((ifp)->if_ioctl_lock)
+#define IFNET_LOCKED(ifp)	mutex_owned((ifp)->if_ioctl_lock)
+
 extern struct pslist_head 

CVS commit: src/sys/net

2017-12-10 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Mon Dec 11 03:25:46 UTC 2017

Modified Files:
src/sys/net: if.c if.h
src/sys/net/npf: npf_ifaddr.c npf_os.c

Log Message:
Rename IFNET_LOCK to IFNET_GLOBAL_LOCK

IFNET_LOCK will be used in another lock, if_ioctl_lock (might be renamed then).


To generate a diff of this commit:
cvs rdiff -u -r1.411 -r1.412 src/sys/net/if.c
cvs rdiff -u -r1.251 -r1.252 src/sys/net/if.h
cvs rdiff -u -r1.2 -r1.3 src/sys/net/npf/npf_ifaddr.c
cvs rdiff -u -r1.8 -r1.9 src/sys/net/npf/npf_os.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.c
diff -u src/sys/net/if.c:1.411 src/sys/net/if.c:1.412
--- src/sys/net/if.c:1.411	Fri Dec  8 05:22:23 2017
+++ src/sys/net/if.c	Mon Dec 11 03:25:45 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if.c,v 1.411 2017/12/08 05:22:23 ozaki-r Exp $	*/
+/*	$NetBSD: if.c,v 1.412 2017/12/11 03:25:45 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.411 2017/12/08 05:22:23 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.412 2017/12/11 03:25:45 ozaki-r Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_inet.h"
@@ -732,9 +732,9 @@ if_initialize(ifnet_t *ifp)
 	ifp->if_ioctl_lock = mutex_obj_alloc(MUTEX_DEFAULT, IPL_NONE);
 	LIST_INIT(>if_multiaddrs);
 
-	IFNET_LOCK();
+	IFNET_GLOBAL_LOCK();
 	if_getindex(ifp);
-	IFNET_UNLOCK();
+	IFNET_GLOBAL_UNLOCK();
 
 	return 0;
 
@@ -781,10 +781,10 @@ if_register(ifnet_t *ifp)
 	if (ifp->if_transmit == NULL || ifp->if_transmit == if_nulltransmit)
 		ifp->if_transmit = if_transmit;
 
-	IFNET_LOCK();
+	IFNET_GLOBAL_LOCK();
 	TAILQ_INSERT_TAIL(_list, ifp, if_list);
 	IFNET_WRITER_INSERT_TAIL(ifp);
-	IFNET_UNLOCK();
+	IFNET_GLOBAL_UNLOCK();
 }
 
 /*
@@ -1317,12 +1317,12 @@ if_detach(struct ifnet *ifp)
 	if_deactivate(ifp);
 	mutex_exit(ifp->if_ioctl_lock);
 
-	IFNET_LOCK();
+	IFNET_GLOBAL_LOCK();
 	ifindex2ifnet[ifp->if_index] = NULL;
 	TAILQ_REMOVE(_list, ifp, if_list);
 	IFNET_WRITER_REMOVE(ifp);
 	pserialize_perform(ifnet_psz);
-	IFNET_UNLOCK();
+	IFNET_GLOBAL_UNLOCK();
 
 	/* Wait for all readers to drain before freeing.  */
 	psref_target_destroy(>if_psref, ifnet_psref_class);
@@ -1793,11 +1793,11 @@ ifa_insert(struct ifnet *ifp, struct ifa
 
 	ifa->ifa_ifp = ifp;
 
-	IFNET_LOCK();
+	IFNET_GLOBAL_LOCK();
 	TAILQ_INSERT_TAIL(>if_addrlist, ifa, ifa_list);
 	IFADDR_ENTRY_INIT(ifa);
 	IFADDR_WRITER_INSERT_TAIL(ifp, ifa);
-	IFNET_UNLOCK();
+	IFNET_GLOBAL_UNLOCK();
 
 	ifaref(ifa);
 }
@@ -1808,13 +1808,13 @@ ifa_remove(struct ifnet *ifp, struct ifa
 
 	KASSERT(ifa->ifa_ifp == ifp);
 
-	IFNET_LOCK();
+	IFNET_GLOBAL_LOCK();
 	TAILQ_REMOVE(>if_addrlist, ifa, ifa_list);
 	IFADDR_WRITER_REMOVE(ifa);
 #ifdef NET_MPSAFE
 	pserialize_perform(ifnet_psz);
 #endif
-	IFNET_UNLOCK();
+	IFNET_GLOBAL_UNLOCK();
 
 #ifdef NET_MPSAFE
 	psref_target_destroy(>ifa_psref, ifa_psref_class);

Index: src/sys/net/if.h
diff -u src/sys/net/if.h:1.251 src/sys/net/if.h:1.252
--- src/sys/net/if.h:1.251	Fri Dec  8 05:22:23 2017
+++ src/sys/net/if.h	Mon Dec 11 03:25:45 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if.h,v 1.251 2017/12/08 05:22:23 ozaki-r Exp $	*/
+/*	$NetBSD: if.h,v 1.252 2017/12/11 03:25:45 ozaki-r Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -1185,9 +1185,9 @@ __END_DECLS
 		}			\
 	} while (0)
 
-#define	IFNET_LOCK()			mutex_enter(_mtx)
-#define	IFNET_UNLOCK()			mutex_exit(_mtx)
-#define	IFNET_LOCKED()			mutex_owned(_mtx)
+#define	IFNET_GLOBAL_LOCK()			mutex_enter(_mtx)
+#define	IFNET_GLOBAL_UNLOCK()			mutex_exit(_mtx)
+#define	IFNET_GLOBAL_LOCKED()			mutex_owned(_mtx)
 
 #define IFNET_READER_EMPTY() \
 	(PSLIST_READER_FIRST(_pslist, struct ifnet, if_pslist_entry) == NULL)

Index: src/sys/net/npf/npf_ifaddr.c
diff -u src/sys/net/npf/npf_ifaddr.c:1.2 src/sys/net/npf/npf_ifaddr.c:1.3
--- src/sys/net/npf/npf_ifaddr.c:1.2	Tue Jan  3 00:58:05 2017
+++ src/sys/net/npf/npf_ifaddr.c	Mon Dec 11 03:25:46 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: npf_ifaddr.c,v 1.2 2017/01/03 00:58:05 rmind Exp $	*/
+/*	$NetBSD: npf_ifaddr.c,v 1.3 2017/12/11 03:25:46 ozaki-r Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: npf_ifaddr.c,v 1.2 2017/01/03 00:58:05 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: npf_ifaddr.c,v 1.3 2017/12/11 03:25:46 ozaki-r Exp $");
 
 #include 
 #include 
@@ -170,11 +170,11 @@ npf_ifaddr_syncall(npf_t *npf)
 	ifnet_t *ifp;
 
 	KERNEL_LOCK(1, NULL);
-	IFNET_LOCK();
+	IFNET_GLOBAL_LOCK();
 	IFNET_WRITER_FOREACH(ifp) {
 		npf_ifaddr_sync(npf, ifp);
 	}
-	IFNET_UNLOCK();
+	IFNET_GLOBAL_UNLOCK();
 	KERNEL_UNLOCK_ONE(NULL);
 }
 

Index: src/sys/net/npf/npf_os.c
diff -u src/sys/net/npf/npf_os.c:1.8 src/sys/net/npf/npf_os.c:1.9
--- src/sys/net/npf/npf_os.c:1.8	Fri Nov 17 07:37:12 2017
+++ 

CVS commit: src/sys

2017-12-10 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Mon Dec 11 02:33:17 UTC 2017

Modified Files:
src/sys/kern: subr_psref.c
src/sys/sys: psref.h

Log Message:
Fix psref(9) part of PR kern/52515. It is complete to fix the PR now.

implementated by ozaki-r@n.o, reviewed by riastradh@n.o, thanks.

XXX need pullup-8


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/kern/subr_psref.c
cvs rdiff -u -r1.2 -r1.3 src/sys/sys/psref.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/kern/subr_psref.c
diff -u src/sys/kern/subr_psref.c:1.7 src/sys/kern/subr_psref.c:1.8
--- src/sys/kern/subr_psref.c:1.7	Thu Jun  1 02:45:13 2017
+++ src/sys/kern/subr_psref.c	Mon Dec 11 02:33:17 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_psref.c,v 1.7 2017/06/01 02:45:13 chs Exp $	*/
+/*	$NetBSD: subr_psref.c,v 1.8 2017/12/11 02:33:17 knakahara Exp $	*/
 
 /*-
  * Copyright (c) 2016 The NetBSD Foundation, Inc.
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: subr_psref.c,v 1.7 2017/06/01 02:45:13 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_psref.c,v 1.8 2017/12/11 02:33:17 knakahara Exp $");
 
 #include 
 #include 
@@ -78,7 +78,7 @@ __KERNEL_RCSID(0, "$NetBSD: subr_psref.c
 #include 
 #include 
 
-LIST_HEAD(psref_head, psref);
+SLIST_HEAD(psref_head, psref);
 
 static bool	_psref_held(const struct psref_target *, struct psref_class *,
 		bool);
@@ -135,7 +135,7 @@ psref_cpu_drained_p(void *p, void *cooki
 	const struct psref_cpu *pcpu = p;
 	bool *retp = cookie;
 
-	if (!LIST_EMPTY(>pcpu_head))
+	if (!SLIST_EMPTY(>pcpu_head))
 		*retp = false;
 }
 
@@ -194,7 +194,7 @@ psref_check_duplication(struct psref_cpu
 	bool found = false;
 	struct psref *_psref;
 
-	LIST_FOREACH(_psref, >pcpu_head, psref_entry) {
+	SLIST_FOREACH(_psref, >pcpu_head, psref_entry) {
 		if (_psref == psref &&
 		_psref->psref_target == target) {
 			found = true;
@@ -250,7 +250,7 @@ psref_acquire(struct psref *psref, const
 #endif
 
 	/* Record our reference.  */
-	LIST_INSERT_HEAD(>pcpu_head, psref, psref_entry);
+	SLIST_INSERT_HEAD(>pcpu_head, psref, psref_entry);
 	psref->psref_target = target;
 	psref->psref_lwp = curlwp;
 	psref->psref_cpu = curcpu();
@@ -273,6 +273,7 @@ void
 psref_release(struct psref *psref, const struct psref_target *target,
 struct psref_class *class)
 {
+	struct psref_cpu *pcpu;
 	int s;
 
 	KASSERTMSG((kpreempt_disabled() || cpu_softintr_p() ||
@@ -302,7 +303,9 @@ psref_release(struct psref *psref, const
 	 * (as does blocking interrupts).
 	 */
 	s = splraiseipl(class->prc_iplcookie);
-	LIST_REMOVE(psref, psref_entry);
+	pcpu = percpu_getref(class->prc_percpu);
+	SLIST_REMOVE(>pcpu_head, psref, psref, psref_entry);
+	percpu_putref(class->prc_percpu);
 	splx(s);
 
 	/* If someone is waiting for users to drain, notify 'em.  */
@@ -353,7 +356,7 @@ psref_copy(struct psref *pto, const stru
 	pcpu = percpu_getref(class->prc_percpu);
 
 	/* Record the new reference.  */
-	LIST_INSERT_HEAD(>pcpu_head, pto, psref_entry);
+	SLIST_INSERT_HEAD(>pcpu_head, pto, psref_entry);
 	pto->psref_target = pfrom->psref_target;
 	pto->psref_lwp = curlwp;
 	pto->psref_cpu = curcpu();
@@ -474,7 +477,7 @@ _psref_held(const struct psref_target *t
 	pcpu = percpu_getref(class->prc_percpu);
 
 	/* Search through all the references on this CPU.  */
-	LIST_FOREACH(psref, >pcpu_head, psref_entry) {
+	SLIST_FOREACH(psref, >pcpu_head, psref_entry) {
 		/* Sanity-check the reference's CPU.  */
 		KASSERTMSG((psref->psref_cpu == curcpu()),
 		"passive reference transferred from CPU %u to CPU %u",

Index: src/sys/sys/psref.h
diff -u src/sys/sys/psref.h:1.2 src/sys/sys/psref.h:1.3
--- src/sys/sys/psref.h:1.2	Fri Dec 16 20:12:11 2016
+++ src/sys/sys/psref.h	Mon Dec 11 02:33:17 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: psref.h,v 1.2 2016/12/16 20:12:11 christos Exp $	*/
+/*	$NetBSD: psref.h,v 1.3 2017/12/11 02:33:17 knakahara Exp $	*/
 
 /*-
  * Copyright (c) 2016 The NetBSD Foundation, Inc.
@@ -69,7 +69,9 @@ struct psref_target {
  *	written only on the local CPU.
  */
 struct psref {
-	LIST_ENTRY(psref)		psref_entry;
+	SLIST_ENTRY(psref)		psref_entry;
+	/* To keep ABI with LIST_ENTRY(psref) version. */
+	void*psref_unused0;
 	const struct psref_target	*psref_target;
 	struct lwp			*psref_lwp;
 	struct cpu_info			*psref_cpu;



CVS commit: src/sys

2017-12-10 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Mon Dec 11 02:17:35 UTC 2017

Modified Files:
src/sys/netinet: in_l2tp.c
src/sys/netinet6: in6_l2tp.c

Log Message:
fix pullup'ed mbuf leaks. pointed out by maxv@n.o, thanks.

XXX need pullup-8


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/netinet/in_l2tp.c
cvs rdiff -u -r1.7 -r1.8 src/sys/netinet6/in6_l2tp.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/in_l2tp.c
diff -u src/sys/netinet/in_l2tp.c:1.4 src/sys/netinet/in_l2tp.c:1.5
--- src/sys/netinet/in_l2tp.c:1.4	Wed Nov 15 10:42:41 2017
+++ src/sys/netinet/in_l2tp.c	Mon Dec 11 02:17:35 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: in_l2tp.c,v 1.4 2017/11/15 10:42:41 knakahara Exp $	*/
+/*	$NetBSD: in_l2tp.c,v 1.5 2017/12/11 02:17:35 knakahara Exp $	*/
 
 /*
  * Copyright (c) 2017 Internet Initiative Japan Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: in_l2tp.c,v 1.4 2017/11/15 10:42:41 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in_l2tp.c,v 1.5 2017/12/11 02:17:35 knakahara Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_l2tp.h"
@@ -368,13 +368,9 @@ in_l2tp_match(struct mbuf *m, int off, i
 
 	KASSERT(proto == IPPROTO_L2TP);
 
-	if (m->m_len < off + sizeof(uint32_t)) {
-		m = m_pullup(m, off + sizeof(uint32_t));
-		if (!m) {
-			/* if payload length < 4 octets */
-			return 0;
-		}
-}
+	/* if payload length < 4 octets */
+	if (m->m_len < off + sizeof(uint32_t))
+		return 0;
 
 	/* get L2TP session ID */
 	m_copydata(m, off, sizeof(uint32_t), (void *)_id);

Index: src/sys/netinet6/in6_l2tp.c
diff -u src/sys/netinet6/in6_l2tp.c:1.7 src/sys/netinet6/in6_l2tp.c:1.8
--- src/sys/netinet6/in6_l2tp.c:1.7	Wed Nov 15 10:42:41 2017
+++ src/sys/netinet6/in6_l2tp.c	Mon Dec 11 02:17:35 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: in6_l2tp.c,v 1.7 2017/11/15 10:42:41 knakahara Exp $	*/
+/*	$NetBSD: in6_l2tp.c,v 1.8 2017/12/11 02:17:35 knakahara Exp $	*/
 
 /*
  * Copyright (c) 2017 Internet Initiative Japan Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: in6_l2tp.c,v 1.7 2017/11/15 10:42:41 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in6_l2tp.c,v 1.8 2017/12/11 02:17:35 knakahara Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_l2tp.h"
@@ -360,13 +360,9 @@ in6_l2tp_match(struct mbuf *m, int off, 
 
 	KASSERT(proto == IPPROTO_L2TP);
 
-	if (m->m_len < off + sizeof(uint32_t)) {
-		m = m_pullup(m, off + sizeof(uint32_t));
-		if (!m) {
-			/* if payload length < 4 octets */
-			return 0;
-		}
-}
+	/* if payload length < 4 octets */
+	if (m->m_len < off + sizeof(uint32_t))
+		return 0;
 
 	/* get L2TP session ID */
 	m_copydata(m, off, sizeof(uint32_t), (void *)_id);



CVS commit: src/usr.sbin/npf

2017-12-10 Thread Mindaugas Rasiukevicius
Module Name:src
Committed By:   rmind
Date:   Sun Dec 10 22:04:41 UTC 2017

Modified Files:
src/usr.sbin/npf: npf.7
src/usr.sbin/npf/npfctl: npf.conf.5 npf_build.c npf_parse.y npf_scan.l
npf_show.c npfctl.8 npfctl.h todo

Log Message:
npfctl: add support for the 'no-ports' flag in the 'map' statements.
This allows us to create a NAT policy without the port translation.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/usr.sbin/npf/npf.7
cvs rdiff -u -r1.49 -r1.50 src/usr.sbin/npf/npfctl/npf.conf.5
cvs rdiff -u -r1.44 -r1.45 src/usr.sbin/npf/npfctl/npf_build.c \
src/usr.sbin/npf/npfctl/npfctl.h
cvs rdiff -u -r1.45 -r1.46 src/usr.sbin/npf/npfctl/npf_parse.y
cvs rdiff -u -r1.25 -r1.26 src/usr.sbin/npf/npfctl/npf_scan.l
cvs rdiff -u -r1.24 -r1.25 src/usr.sbin/npf/npfctl/npf_show.c
cvs rdiff -u -r1.19 -r1.20 src/usr.sbin/npf/npfctl/npfctl.8
cvs rdiff -u -r1.14 -r1.15 src/usr.sbin/npf/npfctl/todo

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/npf/npf.7
diff -u src/usr.sbin/npf/npf.7:1.3 src/usr.sbin/npf/npf.7:1.4
--- src/usr.sbin/npf/npf.7:1.3	Sun Jul 12 23:54:43 2015
+++ src/usr.sbin/npf/npf.7	Sun Dec 10 22:04:41 2017
@@ -1,4 +1,4 @@
-.\"	$NetBSD: npf.7,v 1.3 2015/07/12 23:54:43 rmind Exp $
+.\"	$NetBSD: npf.7,v 1.4 2017/12/10 22:04:41 rmind Exp $
 .\"
 .\" Copyright (c) 2009-2014 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -78,7 +78,8 @@ documentation and other manual pages.
 .Xr bpfjit 4 ,
 .Xr npf.conf 5 ,
 .Xr pcap-filter 7 ,
-.Xr npfctl 8
+.Xr npfctl 8 ,
+.Xr npfd 8
 .Pp
 .Lk http://www.netbsd.org/~rmind/npf/ "NPF documentation"
 .Sh HISTORY

Index: src/usr.sbin/npf/npfctl/npf.conf.5
diff -u src/usr.sbin/npf/npfctl/npf.conf.5:1.49 src/usr.sbin/npf/npfctl/npf.conf.5:1.50
--- src/usr.sbin/npf/npfctl/npf.conf.5:1.49	Mon Jul  3 21:35:31 2017
+++ src/usr.sbin/npf/npfctl/npf.conf.5	Sun Dec 10 22:04:41 2017
@@ -1,4 +1,4 @@
-.\"$NetBSD: npf.conf.5,v 1.49 2017/07/03 21:35:31 wiz Exp $
+.\"$NetBSD: npf.conf.5,v 1.50 2017/12/10 22:04:41 rmind Exp $
 .\"
 .\" Copyright (c) 2009-2017 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 January 19, 2017
+.Dd December 10, 2017
 .Dt NPF.CONF 5
 .Os
 .Sh NAME
@@ -233,6 +233,14 @@ procedure "someproc" {
 .Ed
 .Pp
 In this case, the procedure calls the logging and normalisation modules.
+The logging facility requires the npf_ext_log kernel module which would
+normally get auto-loaded by NPF.
+The specified npflog interface would also be auto-created once the
+configuration is loaded.
+The log packets can be written to a file using the
+.Xr npfd 8
+daemon.
+.Pp
 Traffic normalisation has a set of different mechanisms.
 In the example above, the normalisation procedure has arguments which
 apply the following mechanisms: IPv4 ID randomisation, Don't Fragment (DF)
@@ -248,8 +256,7 @@ i.e., the next line is considered an ext
 .Sh GRAMMAR
 The following is a non-formal BNF-like definition of the grammar.
 The definition is simplified and is intended to be human readable,
-therefore it does not strictly represent the full syntax, which
-is more flexible.
+therefore it does not strictly represent the formal grammar.
 .Bd -literal
 ; Syntax of a single line.  Lines can be separated by LF (\\n) or
 ; a semicolon.  Comments start with a hash (#) character.
@@ -279,10 +286,13 @@ table-def	= "table" table-id "type" ( "h
 ; Mapping for address translation.
 
 map		= "map" interface
-		  ( "static" [ "algo" algorithm ] | "dynamic" ) [ proto ]
+		  ( "static" [ "algo" algorithm ] | "dynamic" )
+		  [ map-flags ] [ proto ]
 		  net-seg ( "->" | "<-" | "<->" ) net-seg
 		  [ "pass" [ proto ] filt-opts ]
 
+map-flags	= "no-ports"
+
 ; Rule procedure definition.  The name should be in the double quotes.
 ;
 ; Each call can have its own options in a form of key-value pairs.
@@ -352,8 +362,7 @@ map $ext_if dynamic 10.1.1.0/24 -> $ext_
 map $ext_if dynamic proto tcp 10.1.1.2 port 22 <- $ext_if port 9022
 
 procedure "log" {
-	# Note: npf_ext_log kernel module should be loaded, if not built-in.
-	# Also, the interface created, e.g.: ifconfig npflog0 create
+	# The logging facility can be used together with npfd(8).
 	log: npflog0
 }
 
@@ -387,7 +396,8 @@ group default {
 .Xr bpf 4 ,
 .Xr npf 7 ,
 .Xr pcap-filter 7 ,
-.Xr npfctl 8
+.Xr npfctl 8 ,
+.Xr npfd 8
 .Sh HISTORY
 NPF first appeared in
 .Nx 6.0 .

Index: src/usr.sbin/npf/npfctl/npf_build.c
diff -u src/usr.sbin/npf/npfctl/npf_build.c:1.44 src/usr.sbin/npf/npfctl/npf_build.c:1.45
--- src/usr.sbin/npf/npfctl/npf_build.c:1.44	Thu Jan 19 20:18:17 2017
+++ src/usr.sbin/npf/npfctl/npf_build.c	Sun Dec 10 22:04:41 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: npf_build.c,v 1.44 2017/01/19 20:18:17 rmind Exp $	*/
+/*	$NetBSD: npf_build.c,v 

CVS commit: src/doc

2017-12-10 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Sun Dec 10 20:54:05 UTC 2017

Modified Files:
src/doc: CHANGES

Log Message:
ihidev(4), ims(4): Added drivers for i2c HID mice


To generate a diff of this commit:
cvs rdiff -u -r1.2337 -r1.2338 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/CHANGES
diff -u src/doc/CHANGES:1.2337 src/doc/CHANGES:1.2338
--- src/doc/CHANGES:1.2337	Wed Dec  6 10:37:08 2017
+++ src/doc/CHANGES	Sun Dec 10 20:54:05 2017
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2337 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2338 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -90,3 +90,4 @@ Changes from NetBSD 8.0 to NetBSD 9.0:
 		[jmcneill 20171125]
 	gdb(1): Updated to 8.0.1.  [christos 20171128]
 	dhcpcd(8): Import dhcpcd-7.0.0-rc4. [roy 20171206]
+	ihidev(4), ims(4): Added drivers for i2c HID mice. [bouyer 20171210]



CVS commit: src

2017-12-10 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Sun Dec 10 20:51:55 UTC 2017

Modified Files:
src/distrib/sets/lists/man: mi
src/share/man/man4: Makefile
Added Files:
src/share/man/man4: ihidev.4 ims.4

Log Message:
Add man pages for new ihidev and ims drivers.


To generate a diff of this commit:
cvs rdiff -u -r1.1565 -r1.1566 src/distrib/sets/lists/man/mi
cvs rdiff -u -r1.645 -r1.646 src/share/man/man4/Makefile
cvs rdiff -u -r0 -r1.1 src/share/man/man4/ihidev.4 src/share/man/man4/ims.4

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

Modified files:

Index: src/distrib/sets/lists/man/mi
diff -u src/distrib/sets/lists/man/mi:1.1565 src/distrib/sets/lists/man/mi:1.1566
--- src/distrib/sets/lists/man/mi:1.1565	Wed Nov 29 09:34:01 2017
+++ src/distrib/sets/lists/man/mi	Sun Dec 10 20:51:55 2017
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1565 2017/11/29 09:34:01 wiz Exp $
+# $NetBSD: mi,v 1.1566 2017/12/10 20:51:55 bouyer Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -1301,10 +1301,12 @@
 ./usr/share/man/cat4/igphy.0			man-sys-catman		.cat
 ./usr/share/man/cat4/igsfb.0			man-sys-catman		.cat
 ./usr/share/man/cat4/iha.0			man-sys-catman		.cat
+./usr/share/man/cat4/ihidev.0			man-sys-catman		.cat
 ./usr/share/man/cat4/ihphy.0			man-sys-catman		.cat
 ./usr/share/man/cat4/iic.0			man-sys-catman		.cat
 ./usr/share/man/cat4/ikphy.0			man-sys-catman		.cat
 ./usr/share/man/cat4/imp.0			man-obsolete		obsolete
+./usr/share/man/cat4/ims.0			man-sys-catman		.cat
 ./usr/share/man/cat4/inet.0			man-sys-catman		.cat
 ./usr/share/man/cat4/inet6.0			man-sys-catman		.cat
 ./usr/share/man/cat4/inphy.0			man-sys-catman		.cat
@@ -4391,9 +4393,11 @@
 ./usr/share/man/html4/igphy.html		man-sys-htmlman		html
 ./usr/share/man/html4/igsfb.html		man-sys-htmlman		html
 ./usr/share/man/html4/iha.html			man-sys-htmlman		html
+./usr/share/man/html4/ihidev.html		man-sys-htmlman		html
 ./usr/share/man/html4/ihphy.html		man-sys-htmlman		html
 ./usr/share/man/html4/iic.html			man-sys-htmlman		html
 ./usr/share/man/html4/ikphy.html		man-sys-htmlman		html
+./usr/share/man/html4/ims.html			man-sys-htmlman		html
 ./usr/share/man/html4/inet.html			man-sys-htmlman		html
 ./usr/share/man/html4/inet6.html		man-sys-htmlman		html
 ./usr/share/man/html4/inphy.html		man-sys-htmlman		html
@@ -7315,10 +7319,12 @@
 ./usr/share/man/man4/igphy.4			man-sys-man		.man
 ./usr/share/man/man4/igsfb.4			man-sys-man		.man
 ./usr/share/man/man4/iha.4			man-sys-man		.man
+./usr/share/man/man4/ihidev.4			man-sys-man		.man
 ./usr/share/man/man4/ihphy.4			man-sys-man		.man
 ./usr/share/man/man4/iic.4			man-sys-man		.man
 ./usr/share/man/man4/ikphy.4			man-sys-man		.man
 ./usr/share/man/man4/imp.4			man-obsolete		obsolete
+./usr/share/man/man4/ims.4			man-sys-man		.man
 ./usr/share/man/man4/inet.4			man-sys-man		.man
 ./usr/share/man/man4/inet6.4			man-sys-man		.man
 ./usr/share/man/man4/inphy.4			man-sys-man		.man

Index: src/share/man/man4/Makefile
diff -u src/share/man/man4/Makefile:1.645 src/share/man/man4/Makefile:1.646
--- src/share/man/man4/Makefile:1.645	Tue Nov 28 11:59:16 2017
+++ src/share/man/man4/Makefile	Sun Dec 10 20:51:55 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.645 2017/11/28 11:59:16 wiz Exp $
+#	$NetBSD: Makefile,v 1.646 2017/12/10 20:51:55 bouyer Exp $
 #	@(#)Makefile	8.1 (Berkeley) 6/18/93
 
 MAN=	aac.4 ac97.4 acardide.4 aceride.4 acphy.4 \
@@ -31,8 +31,8 @@ MAN=	aac.4 ac97.4 acardide.4 aceride.4 a
 	gphyter.4 gsip.4 \
 	hdaudio.4 hifn.4 hme.4 hpacel.4 hpqlb.4 hptide.4 hythygtemp.4 \
 	ibmcd.4 ibmhawk.4 ichsmb.4 icmp.4 icp.4 icsphy.4 iee.4 ieee80211.4 \
-	ifmedia.4 igmafb.4 igphy.4 igsfb.4 iha.4 ihphy.4 iic.4 inet.4 ikphy.4 \
-	inphy.4 intersil7170.4 \
+	ifmedia.4 igmafb.4 igphy.4 igsfb.4 iha.4 ihidev.4 ihphy.4 iic.4 ims.4 \
+	inet.4 ikphy.4 inphy.4 intersil7170.4 \
 	ioasic.4 ioat.4 iop.4 iophy.4 iopsp.4 ip.4 ipkdb.4 ipmi.4 ipw.4 \
 	irmce.4 isp.4 ismt.4 isv.4 itesio.4 iteide.4 iwi.4 iwm.4 iwn.4 ixg.4 \
 	ixpide.4 \

Added files:

Index: src/share/man/man4/ihidev.4
diff -u /dev/null src/share/man/man4/ihidev.4:1.1
--- /dev/null	Sun Dec 10 20:51:55 2017
+++ src/share/man/man4/ihidev.4	Sun Dec 10 20:51:55 2017
@@ -0,0 +1,60 @@
+.\" $NetBSD: ihidev.4,v 1.1 2017/12/10 20:51:55 bouyer Exp $
+.\"
+.\" Copyright (c) 2001,2017 The NetBSD Foundation, Inc.
+.\" All rights reserved.
+.\"
+.\" This code is derived from software contributed to The NetBSD Foundation
+.\" by Lennart Augustsson.
+.\"
+.\" 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 

CVS commit: src/usr.sbin/npf/npfctl

2017-12-10 Thread Leonardo Taccari
Module Name:src
Committed By:   leot
Date:   Sun Dec 10 20:45:26 UTC 2017

Modified Files:
src/usr.sbin/npf/npfctl: todo

Log Message:
Fix a typo


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/usr.sbin/npf/npfctl/todo

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/npf/npfctl/todo
diff -u src/usr.sbin/npf/npfctl/todo:1.13 src/usr.sbin/npf/npfctl/todo:1.14
--- src/usr.sbin/npf/npfctl/todo:1.13	Sun Dec 10 20:30:45 2017
+++ src/usr.sbin/npf/npfctl/todo	Sun Dec 10 20:45:26 2017
@@ -2,7 +2,7 @@
 -- have a way to use npflog to log packets to syslog
We have npfd that logs to a file
 -- have a way to match dropped packets to rules
-   We keep this information now and we pass it to nplog using the OpenBSD
+   We keep this information now and we pass it to npflog using the OpenBSD
pflog format.
 -- have a way to list the active nat sessions
Use "npfctl list"



CVS commit: src

2017-12-10 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Sun Dec 10 20:38:15 UTC 2017

Modified Files:
src/distrib/sets/lists/base: mi
src/distrib/sets/lists/comp: mi
src/etc/mtree: NetBSD.dist.base
src/lib/libusbhid: parse.c
src/sys/dev: Makefile
src/sys/dev/hid: hid.h
src/tests/dev/usb/libhid: Makefile
src/tests/dev/usb/t_hid: Makefile
src/usr.bin/usbhidaction: usbhidaction.c
src/usr.bin/usbhidctl: usbhid.c
src/usr.sbin/btdevctl: print.c sdp.c
Added Files:
src/sys/dev/hid: Makefile

Log Message:
Fix fallout from hid factorisation:
- need to install sys/dev/hid/hid.h for userland
- include it where needed - most of the time in place if usb/usbhid.h


To generate a diff of this commit:
cvs rdiff -u -r1.1164 -r1.1165 src/distrib/sets/lists/base/mi
cvs rdiff -u -r1.2161 -r1.2162 src/distrib/sets/lists/comp/mi
cvs rdiff -u -r1.163 -r1.164 src/etc/mtree/NetBSD.dist.base
cvs rdiff -u -r1.9 -r1.10 src/lib/libusbhid/parse.c
cvs rdiff -u -r1.38 -r1.39 src/sys/dev/Makefile
cvs rdiff -u -r0 -r1.1 src/sys/dev/hid/Makefile
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/hid/hid.h
cvs rdiff -u -r1.1 -r1.2 src/tests/dev/usb/libhid/Makefile
cvs rdiff -u -r1.1 -r1.2 src/tests/dev/usb/t_hid/Makefile
cvs rdiff -u -r1.27 -r1.28 src/usr.bin/usbhidaction/usbhidaction.c
cvs rdiff -u -r1.36 -r1.37 src/usr.bin/usbhidctl/usbhid.c
cvs rdiff -u -r1.10 -r1.11 src/usr.sbin/btdevctl/print.c
cvs rdiff -u -r1.9 -r1.10 src/usr.sbin/btdevctl/sdp.c

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

Modified files:

Index: src/distrib/sets/lists/base/mi
diff -u src/distrib/sets/lists/base/mi:1.1164 src/distrib/sets/lists/base/mi:1.1165
--- src/distrib/sets/lists/base/mi:1.1164	Tue Oct 24 02:22:09 2017
+++ src/distrib/sets/lists/base/mi	Sun Dec 10 20:38:13 2017
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1164 2017/10/24 02:22:09 kre Exp $
+# $NetBSD: mi,v 1.1165 2017/12/10 20:38:13 bouyer Exp $
 #
 # Note:	Don't delete entries from here - mark them as "obsolete" instead,
 #	unless otherwise stated below.
@@ -1069,6 +1069,7 @@
 ./usr/include/dev/filemon			base-c-usr
 ./usr/include/dev/hdaudio			base-c-usr
 ./usr/include/dev/hdmicec			base-c-usr
+./usr/include/dev/hidbase-c-usr
 ./usr/include/dev/hpcbase-c-usr
 ./usr/include/dev/i2cbase-c-usr
 ./usr/include/dev/i2obase-c-usr

Index: src/distrib/sets/lists/comp/mi
diff -u src/distrib/sets/lists/comp/mi:1.2161 src/distrib/sets/lists/comp/mi:1.2162
--- src/distrib/sets/lists/comp/mi:1.2161	Thu Nov 30 08:14:03 2017
+++ src/distrib/sets/lists/comp/mi	Sun Dec 10 20:38:14 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: mi,v 1.2161 2017/11/30 08:14:03 martin Exp $
+#	$NetBSD: mi,v 1.2162 2017/12/10 20:38:14 bouyer Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 ./etc/mtree/set.compcomp-sys-root
@@ -413,6 +413,7 @@
 ./usr/include/dev/hdaudio/hdaudioio.h		comp-c-include
 ./usr/include/dev/hdaudio/hdaudioreg.h		comp-c-include
 ./usr/include/dev/hdmicec/hdmicecio.h		comp-c-include
+./usr/include/dev/hid/hid.h			comp-c-include
 ./usr/include/dev/hpc/hpcfbio.h			comp-c-include
 ./usr/include/dev/i2c/i2c_bus.h			comp-obsolete		obsolete
 ./usr/include/dev/i2c/i2c_eeprom.h		comp-obsolete		obsolete

Index: src/etc/mtree/NetBSD.dist.base
diff -u src/etc/mtree/NetBSD.dist.base:1.163 src/etc/mtree/NetBSD.dist.base:1.164
--- src/etc/mtree/NetBSD.dist.base:1.163	Sat Oct 21 05:30:48 2017
+++ src/etc/mtree/NetBSD.dist.base	Sun Dec 10 20:38:14 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: NetBSD.dist.base,v 1.163 2017/10/21 05:30:48 kre Exp $
+#	$NetBSD: NetBSD.dist.base,v 1.164 2017/12/10 20:38:14 bouyer Exp $
 #	@(#)4.4BSD.dist	8.1 (Berkeley) 6/13/93
 
 # Do not customize this file as it may be overwritten on upgrades.
@@ -116,6 +116,7 @@
 ./usr/include/dev/dmover
 ./usr/include/dev/dtv
 ./usr/include/dev/filemon
+./usr/include/dev/hid
 ./usr/include/dev/hpc
 ./usr/include/dev/i2c
 ./usr/include/dev/i2o

Index: src/lib/libusbhid/parse.c
diff -u src/lib/libusbhid/parse.c:1.9 src/lib/libusbhid/parse.c:1.10
--- src/lib/libusbhid/parse.c:1.9	Thu Jan  7 16:10:49 2016
+++ src/lib/libusbhid/parse.c	Sun Dec 10 20:38:14 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: parse.c,v 1.9 2016/01/07 16:10:49 jakllsch Exp $	*/
+/*	$NetBSD: parse.c,v 1.10 2017/12/10 20:38:14 bouyer Exp $	*/
 
 /*
  * Copyright (c) 1999, 2001 Lennart Augustsson 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: parse.c,v 1.9 2016/01/07 16:10:49 jakllsch Exp $");
+__RCSID("$NetBSD: parse.c,v 1.10 2017/12/10 20:38:14 bouyer Exp $");
 
 #include 
 #include 
@@ -35,7 +35,7 @@ __RCSID("$NetBSD: parse.c,v 1.9 2016/01/
 #include 
 
 #include 
-#include 
+#include 
 
 #include "usbhid.h"
 #include "usbvar.h"

Index: src/sys/dev/Makefile
diff -u src/sys/dev/Makefile:1.38 src/sys/dev/Makefile:1.39
--- src/sys/dev/Makefile:1.38	Fri Dec  9 04:46:39 2016
+++ src/sys/dev/Makefile	Sun Dec 

CVS commit: src/usr.sbin/npf/npfctl

2017-12-10 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Dec 10 20:30:45 UTC 2017

Modified Files:
src/usr.sbin/npf/npfctl: todo

Log Message:
Add things implemented


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/usr.sbin/npf/npfctl/todo

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/npf/npfctl/todo
diff -u src/usr.sbin/npf/npfctl/todo:1.12 src/usr.sbin/npf/npfctl/todo:1.13
--- src/usr.sbin/npf/npfctl/todo:1.12	Tue Jan 10 21:13:54 2017
+++ src/usr.sbin/npf/npfctl/todo	Sun Dec 10 15:30:45 2017
@@ -1,7 +1,11 @@
 -- how to convert other packet filters to npf
 -- have a way to use npflog to log packets to syslog
+   We have npfd that logs to a file
 -- have a way to match dropped packets to rules
+   We keep this information now and we pass it to nplog using the OpenBSD
+   pflog format.
 -- have a way to list the active nat sessions
+   Use "npfctl list"
 -- npfctl start does not load the configuration if not loaded.
It is not clear you need to reload first. Or if it loads it should
print the error messages. Or it should be called enable/disable since



CVS commit: src/sys/dev/acpi

2017-12-10 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Sun Dec 10 18:52:41 UTC 2017

Modified Files:
src/sys/dev/acpi: acpi_util.c

Log Message:
Cast to uintptr_t before casting to void *; fix a warning on i386


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/acpi/acpi_util.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/acpi/acpi_util.c
diff -u src/sys/dev/acpi/acpi_util.c:1.9 src/sys/dev/acpi/acpi_util.c:1.10
--- src/sys/dev/acpi/acpi_util.c:1.9	Sun Dec 10 16:51:30 2017
+++ src/sys/dev/acpi/acpi_util.c	Sun Dec 10 18:52:41 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: acpi_util.c,v 1.9 2017/12/10 16:51:30 bouyer Exp $ */
+/*	$NetBSD: acpi_util.c,v 1.10 2017/12/10 18:52:41 bouyer Exp $ */
 
 /*-
  * Copyright (c) 2003, 2007 The NetBSD Foundation, Inc.
@@ -65,7 +65,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: acpi_util.c,v 1.9 2017/12/10 16:51:30 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_util.c,v 1.10 2017/12/10 18:52:41 bouyer Exp $");
 
 #include 
 #include 
@@ -520,7 +520,7 @@ acpi_intr_establish(device_t dev, uint64
 unsigned int (*intr)(void *), void *iarg)
 {
 	ACPI_STATUS rv;
-	ACPI_HANDLE hdl = (void *)c;
+	ACPI_HANDLE hdl = (void *)(uintptr_t)c;
 	struct acpi_resources res;
 	struct acpi_irq *irq;
 	struct acpi_irq_handler *aih = NULL;



CVS commit: src/sys/arch/i386/conf

2017-12-10 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Sun Dec 10 17:52:13 UTC 2017

Modified Files:
src/sys/arch/i386/conf: ALL

Log Message:
Add option XHCI_DEBUG.


To generate a diff of this commit:
cvs rdiff -u -r1.432 -r1.433 src/sys/arch/i386/conf/ALL

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/i386/conf/ALL
diff -u src/sys/arch/i386/conf/ALL:1.432 src/sys/arch/i386/conf/ALL:1.433
--- src/sys/arch/i386/conf/ALL:1.432	Sun Dec 10 17:19:48 2017
+++ src/sys/arch/i386/conf/ALL	Sun Dec 10 17:52:13 2017
@@ -1,4 +1,4 @@
-# $NetBSD: ALL,v 1.432 2017/12/10 17:19:48 bouyer Exp $
+# $NetBSD: ALL,v 1.433 2017/12/10 17:52:13 hannken Exp $
 # From NetBSD: GENERIC,v 1.787 2006/10/01 18:37:54 bouyer Exp
 #
 # ALL machine description file
@@ -17,7 +17,7 @@ include 	"arch/i386/conf/std.i386"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident		"ALL-$Revision: 1.432 $"
+#ident		"ALL-$Revision: 1.433 $"
 
 maxusers	64		# estimated number of users
 
@@ -2531,6 +2531,7 @@ options XENNET_DEBUG
 options XENNET_DEBUG_DUMP
 options XEN_CLOCK_DEBUG
 options XE_DEBUG
+options XHCI_DEBUG
 options ENDEBUG_LOW
 options XYC_DEBUG
 options ZSKBD_DEBUG



CVS commit: src/sys/dev/usb

2017-12-10 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Sun Dec 10 17:50:01 UTC 2017

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

Log Message:
Use USB_DEBUG, not XHCI_DEBUG to protect `dci', DPRINTFN() always uses it.


To generate a diff of this commit:
cvs rdiff -u -r1.80 -r1.81 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.80 src/sys/dev/usb/xhci.c:1.81
--- src/sys/dev/usb/xhci.c:1.80	Sat Dec  9 00:54:31 2017
+++ src/sys/dev/usb/xhci.c	Sun Dec 10 17:50:01 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: xhci.c,v 1.80 2017/12/09 00:54:31 christos Exp $	*/
+/*	$NetBSD: xhci.c,v 1.81 2017/12/10 17:50:01 hannken Exp $	*/
 
 /*
  * Copyright (c) 2013 Jonathan A. Kollasch
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.80 2017/12/09 00:54:31 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.81 2017/12/10 17:50:01 hannken Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -1341,7 +1341,7 @@ xhci_configure_endpoint(struct usbd_pipe
 {
 	struct xhci_softc * const sc = XHCI_PIPE2SC(pipe);
 	struct xhci_slot * const xs = pipe->up_dev->ud_hcpriv;
-#ifdef XHCI_DEBUG
+#ifdef USB_DEBUG
 	const u_int dci = xhci_ep_get_dci(pipe->up_endpoint->ue_edesc);
 #endif
 	struct xhci_trb trb;



CVS commit: src/sys/arch

2017-12-10 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Sun Dec 10 17:19:48 UTC 2017

Modified Files:
src/sys/arch/amd64/conf: ALL GENERIC XEN3_DOM0
src/sys/arch/i386/conf: ALL GENERIC XEN3_DOM0

Log Message:
Add dwiic, ihidev and ims


To generate a diff of this commit:
cvs rdiff -u -r1.74 -r1.75 src/sys/arch/amd64/conf/ALL
cvs rdiff -u -r1.474 -r1.475 src/sys/arch/amd64/conf/GENERIC
cvs rdiff -u -r1.141 -r1.142 src/sys/arch/amd64/conf/XEN3_DOM0
cvs rdiff -u -r1.431 -r1.432 src/sys/arch/i386/conf/ALL
cvs rdiff -u -r1.1173 -r1.1174 src/sys/arch/i386/conf/GENERIC
cvs rdiff -u -r1.123 -r1.124 src/sys/arch/i386/conf/XEN3_DOM0

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/conf/ALL
diff -u src/sys/arch/amd64/conf/ALL:1.74 src/sys/arch/amd64/conf/ALL:1.75
--- src/sys/arch/amd64/conf/ALL:1.74	Sat Dec  2 12:40:03 2017
+++ src/sys/arch/amd64/conf/ALL	Sun Dec 10 17:19:48 2017
@@ -1,4 +1,4 @@
-# $NetBSD: ALL,v 1.74 2017/12/02 12:40:03 maxv Exp $
+# $NetBSD: ALL,v 1.75 2017/12/10 17:19:48 bouyer Exp $
 # From NetBSD: GENERIC,v 1.787 2006/10/01 18:37:54 bouyer Exp
 #
 # ALL machine description file
@@ -17,7 +17,7 @@ include 	"arch/amd64/conf/std.amd64"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident		"ALL-$Revision: 1.74 $"
+#ident		"ALL-$Revision: 1.75 $"
 
 maxusers	64		# estimated number of users
 
@@ -628,6 +628,10 @@ iic*	at nfsmb?
 piixpm* at pci? dev ? function ?	# PIIX4 compatible PM controller
 iic*	at piixpm?			# SMBus on PIIX4
 
+# I2C controller as found in some Intel PCH devices.
+dwiic*		at pci?			# I2C controller
+iic*		at dwiic?
+
 # dbCool Thermal monitor and fan controller
 dbcool* at iic? addr 0x2C		# Unknown other motherboard(s)
 dbcool* at iic? addr 0x2D		# Tyan S2881
@@ -692,6 +696,13 @@ sdtemp* at iic? addr 0x1d
 sdtemp* at iic? addr 0x1e
 sdtemp* at iic? addr 0x1f
 
+# I2C HID devices
+ihidev* at iic?
+
+# I2C Mice
+ims*	at ihidev? reportid ?
+wsmouse* at ims? mux 0
+
 # I2O devices
 iop*	at pci? dev ? function ?	# I/O processor
 iopsp*	at iop? tid ?			# SCSI/FC-AL ports

Index: src/sys/arch/amd64/conf/GENERIC
diff -u src/sys/arch/amd64/conf/GENERIC:1.474 src/sys/arch/amd64/conf/GENERIC:1.475
--- src/sys/arch/amd64/conf/GENERIC:1.474	Sat Dec  9 00:29:32 2017
+++ src/sys/arch/amd64/conf/GENERIC	Sun Dec 10 17:19:48 2017
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.474 2017/12/09 00:29:32 riastradh Exp $
+# $NetBSD: GENERIC,v 1.475 2017/12/10 17:19:48 bouyer Exp $
 #
 # GENERIC machine description file
 #
@@ -22,7 +22,7 @@ include 	"arch/amd64/conf/std.amd64"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident		"GENERIC-$Revision: 1.474 $"
+#ident		"GENERIC-$Revision: 1.475 $"
 
 maxusers	64		# estimated number of users
 
@@ -510,6 +510,10 @@ iic*	at ichsmb?
 ismt* at pci? dev ? function ?
 iic*	at ismt?
 
+# I2C controller as found in some Intel PCH devices.
+dwiic*		at pci?			# I2C controller
+iic*		at dwiic?
+
 # Thermal monitor and fan controller
 #dbcool* at iic? addr 0x2C		# Unknown other motherboard(s)
 #dbcool* at iic? addr 0x2D		# Tyan S2881
@@ -545,6 +549,13 @@ iic*	at ismt?
 #sdtemp* at iic? addr 0x1e
 #sdtemp* at iic? addr 0x1f
 
+# I2C HID devices
+ihidev* at iic?
+
+# I2C Mice
+ims*	at ihidev? reportid ?
+wsmouse* at ims? mux 0
+
 # I2O devices
 iop*	at pci? dev ? function ?	# I/O processor
 iopsp*	at iop? tid ?			# SCSI/FC-AL ports

Index: src/sys/arch/amd64/conf/XEN3_DOM0
diff -u src/sys/arch/amd64/conf/XEN3_DOM0:1.141 src/sys/arch/amd64/conf/XEN3_DOM0:1.142
--- src/sys/arch/amd64/conf/XEN3_DOM0:1.141	Mon Nov  6 02:57:18 2017
+++ src/sys/arch/amd64/conf/XEN3_DOM0	Sun Dec 10 17:19:48 2017
@@ -1,4 +1,4 @@
-# $NetBSD: XEN3_DOM0,v 1.141 2017/11/06 02:57:18 rin Exp $
+# $NetBSD: XEN3_DOM0,v 1.142 2017/12/10 17:19:48 bouyer Exp $
 
 include 	"arch/amd64/conf/std.xen"
 
@@ -10,7 +10,7 @@ options 	INCLUDE_CONFIG_FILE	# embed con
 #options 	UVMHIST_PRINT
 #options 	SYSCALL_DEBUG
 
-#ident		"XEN3_DOM0-$Revision: 1.141 $"
+#ident		"XEN3_DOM0-$Revision: 1.142 $"
 
 maxusers	32		# estimated number of users
 
@@ -303,6 +303,10 @@ amdpm*	at pci? dev ? function ?	# RNG an
 ichsmb* at pci? dev ? function ?
 iic*	at ichsmb?
 
+# I2C controller as found in some Intel PCH devices.
+dwiic*		at pci?			# I2C controller
+iic*		at dwiic?
+
 # Thermal monitor and fan controller
 #dbcool* at iic? addr 0x2C		# Unknown other motherboard(s)
 #dbcool* at iic? addr 0x2D		# Tyan S2881
@@ -428,6 +432,13 @@ tqphy*	at mii? phy ?			# TDK Semiconduct
 ukphy*	at mii? phy ?			# generic unknown PHYs
 urlphy* at mii? phy ?			# Realtek RTL8150L internal PHYs
 
+# I2C HID devices
+ihidev* at iic?
+
+# I2C Mice
+ims*	at ihidev? reportid ?
+wsmouse* at ims? mux 0
+
 # I2O devices
 iop*	at pci? dev ? function ?	# I/O processor
 iopsp*	at iop? tid ?			# SCSI/FC-AL ports

Index: src/sys/arch/i386/conf/ALL
diff -u src/sys/arch/i386/conf/ALL:1.431 

CVS commit: src/sys

2017-12-10 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Sun Dec 10 17:12:54 UTC 2017

Modified Files:
src/sys/arch/x86/pci: files.pci
src/sys/conf: files
Added Files:
src/sys/arch/x86/pci: dwiic_pci.c lpssreg.h
src/sys/dev/ic: dwiic.c dwiic_var.h

Log Message:
Add support for I2C designware controllers (as found in Intel PCH devices),
with a pci front-end.
The pci front-end is tied to ACPI and Intel-specific, so it's in arch/x86/pci
and not dev/pci.
Core driver from OpenBSD, PCI front-end by me.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/arch/x86/pci/dwiic_pci.c \
src/sys/arch/x86/pci/lpssreg.h
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/x86/pci/files.pci
cvs rdiff -u -r1.1186 -r1.1187 src/sys/conf/files
cvs rdiff -u -r0 -r1.1 src/sys/dev/ic/dwiic.c src/sys/dev/ic/dwiic_var.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/x86/pci/files.pci
diff -u src/sys/arch/x86/pci/files.pci:1.20 src/sys/arch/x86/pci/files.pci:1.21
--- src/sys/arch/x86/pci/files.pci:1.20	Sun May  3 02:50:59 2015
+++ src/sys/arch/x86/pci/files.pci	Sun Dec 10 17:12:54 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: files.pci,v 1.20 2015/05/03 02:50:59 pgoyette Exp $
+#	$NetBSD: files.pci,v 1.21 2017/12/10 17:12:54 bouyer Exp $
 
 device 	aapic
 attach 	aapic at pci
@@ -39,6 +39,9 @@ device	amdtemp: sysmon_envsys
 attach	amdtemp at amdnb_miscbus
 file	arch/x86/pci/amdtemp.c		amdtemp
 
+attach  dwiic at pci with pcidwiic
+filearch/x86/pci/dwiic_pci.c	pcidwiic
+
 # PCI-LPC bridges
 device rdcpcib: isabus, sysmon_wdog
 attach rdcpcib at pci

Index: src/sys/conf/files
diff -u src/sys/conf/files:1.1186 src/sys/conf/files:1.1187
--- src/sys/conf/files:1.1186	Sun Dec 10 17:03:07 2017
+++ src/sys/conf/files	Sun Dec 10 17:12:54 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: files,v 1.1186 2017/12/10 17:03:07 bouyer Exp $
+#	$NetBSD: files,v 1.1187 2017/12/10 17:12:54 bouyer Exp $
 #	@(#)files.newconf	7.5 (Berkeley) 5/10/93
 
 version 	20171118
@@ -1128,6 +1128,11 @@ file	dev/ic/pcf8584.c		pcf8584
 define	pca9564
 file	dev/ic/pca9564.c		pca9564
 
+# Synopsys DesignWare I2C controller
+define	dwiic
+device dwiic: dwiic, i2cbus
+file	dev/ic/dwiic.c			dwiic
+
 # ACPI power management timer (hardware access, independent of ACPI)
 #
 define acpipmtimer

Added files:

Index: src/sys/arch/x86/pci/dwiic_pci.c
diff -u /dev/null src/sys/arch/x86/pci/dwiic_pci.c:1.1
--- /dev/null	Sun Dec 10 17:12:54 2017
+++ src/sys/arch/x86/pci/dwiic_pci.c	Sun Dec 10 17:12:54 2017
@@ -0,0 +1,213 @@
+/* $NetBSD: dwiic_pci.c,v 1.1 2017/12/10 17:12:54 bouyer Exp $ */
+
+/*-
+ * Copyright (c) 2017 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Manuel Bouyer.
+ *
+ * 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.
+ */
+/*
+ * Synopsys DesignWare I2C controller, PCI front-end
+ */
+
+#include 
+__KERNEL_RCSID(0, "$NetBSD: dwiic_pci.c,v 1.1 2017/12/10 17:12:54 bouyer Exp $");
+
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+//#define DWIIC_DEBUG
+
+#ifdef DWIIC_DEBUG
+#define DPRINTF(x) printf x
+#else
+#define DPRINTF(x)
+#endif
+
+struct pci_dwiic_softc {
+	struct dwiic_softc	sc_dwiic;
+	pci_chipset_tag_t	sc_pc;
+	pcitag_t		sc_ptag;
+	struct acpi_devnode	*sc_acpinode;
+};
+
+static uint32_t
+lpss_read(struct pci_dwiic_softc *sc, int offset)
+{
+	u_int32_t b = bus_space_read_4(sc->sc_dwiic.sc_iot, sc->sc_dwiic.sc_ioh,
+	 offset);
+	return b;
+}
+
+static void
+lpss_write(struct pci_dwiic_softc *sc, int offset, uint32_t 

CVS commit: src/sys/dev/i2c

2017-12-10 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Sun Dec 10 17:05:54 UTC 2017

Modified Files:
src/sys/dev/i2c: files.i2c
Added Files:
src/sys/dev/i2c: ihidev.c ihidev.h ims.c

Log Message:
Add drivers for HID over I2C devices, and a driver for I2C mices.
>From OpenBSD.


To generate a diff of this commit:
cvs rdiff -u -r1.78 -r1.79 src/sys/dev/i2c/files.i2c
cvs rdiff -u -r0 -r1.1 src/sys/dev/i2c/ihidev.c src/sys/dev/i2c/ihidev.h \
src/sys/dev/i2c/ims.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/i2c/files.i2c
diff -u src/sys/dev/i2c/files.i2c:1.78 src/sys/dev/i2c/files.i2c:1.79
--- src/sys/dev/i2c/files.i2c:1.78	Sat Oct  7 18:22:06 2017
+++ src/sys/dev/i2c/files.i2c	Sun Dec 10 17:05:54 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: files.i2c,v 1.78 2017/10/07 18:22:06 jmcneill Exp $
+#	$NetBSD: files.i2c,v 1.79 2017/12/10 17:05:54 bouyer Exp $
 
 obsolete defflag	opt_i2cbus.h		I2C_SCAN
 define	i2cbus { }
@@ -284,3 +284,22 @@ file	dev/i2c/tcagpio.c			tcagpio
 device	sy8106a
 attach	sy8106a at iic
 file	dev/i2c/sy8106a.c			sy8106a
+
+# HID over i2c
+# HID "bus"
+define  ihidbus {[ reportid = -1 ]}
+
+# HID root device for multiple report IDs
+device  ihidev: hid, ihidbus
+attach  ihidev at iic
+filedev/i2c/ihidev.c			ihidev
+
+#HID mice
+device	ims: hid, hidms, wsmousedev
+attach	ims at ihidbus
+file	dev/i2c/ims.cims
+
+#HID multitouch
+device	imt: hid, hidmt, wsmousedev
+attach	imt at ihidbus
+file	dev/i2c/imt.cimt

Added files:

Index: src/sys/dev/i2c/ihidev.c
diff -u /dev/null src/sys/dev/i2c/ihidev.c:1.1
--- /dev/null	Sun Dec 10 17:05:55 2017
+++ src/sys/dev/i2c/ihidev.c	Sun Dec 10 17:05:54 2017
@@ -0,0 +1,874 @@
+/* $NetBSD: ihidev.c,v 1.1 2017/12/10 17:05:54 bouyer Exp $ */
+/* $OpenBSD ihidev.c,v 1.13 2017/04/08 02:57:23 deraadt Exp $ */
+
+/*-
+ * Copyright (c) 2017 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Manuel Bouyer.
+ *
+ * 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.
+ */
+
+/*
+ * Copyright (c) 2015, 2016 joshua stein 
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * HID-over-i2c driver
+ *
+ * https://msdn.microsoft.com/en-us/library/windows/hardware/dn642101%28v=vs.85%29.aspx
+ *
+ */
+
+#include 
+__KERNEL_RCSID(0, "$NetBSD: ihidev.c,v 1.1 2017/12/10 17:05:54 bouyer Exp $");
+
+#include 
+#include 
+#include 
+#include 
+
+
+#include 
+#include 
+
+#include 
+
+#if defined(__i386__) || defined(__amd64__)
+#  include "acpica.h"
+#endif
+#if NACPICA > 0
+#include 
+#endif
+
+#include "locators.h"
+
+/* #define IHIDEV_DEBUG */
+
+#ifdef IHIDEV_DEBUG
+#define DPRINTF(x) printf x
+#else
+#define DPRINTF(x)
+#endif
+
+/* 7.2 */
+enum {
+	I2C_HID_CMD_DESCR	= 0x0,
+	I2C_HID_CMD_RESET	= 0x1,
+	I2C_HID_CMD_GET_REPORT	= 0x2,
+	I2C_HID_CMD_SET_REPORT	= 0x3,
+	I2C_HID_CMD_GET_IDLE	= 0x4,
+	I2C_HID_CMD_SET_IDLE	= 

CVS commit: src/sys

2017-12-10 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Sun Dec 10 17:03:07 UTC 2017

Modified Files:
src/sys/conf: files
src/sys/dev/bluetooth: bthidev.c btkbd.c btmagic.c btms.c
src/sys/dev/fdt: gpiokeys.c
src/sys/dev/i2c: tcakp.c
src/sys/dev/usb: files.usb uatp.c ucycom.c uhid.c uhidev.c ukbd.c ums.c
usbhid.h uthum.c uts.c uyurex.c
Added Files:
src/sys/dev/hid: files.hid hid.c hid.h hidkbdmap.c hidms.c hidms.h
Removed Files:
src/sys/dev/usb: hid.c hid.h ukbdmap.c

Log Message:
Factor out bus-independant HID code so that it can be shared by USB, bluetooth
and i2c.
dev/usb/ukbdmap.c is renamed to dev/hid/hidkbdmap.c
dev/usb/hid.[ch] moved to dev/hid/
usage pages moved from dev/usb/usbhid.h moved to dev/hid/hid.h,
and updated with OpenBSD entries.
bus-independant code moved from dev/usb/ums.c to dev/hid/hidms.c
(the same should be done for keyboard and touchpad drivers)

Needed for the upcoming HID over I2C support, proposed on tech-kern@
on Dec, 1.


To generate a diff of this commit:
cvs rdiff -u -r1.1185 -r1.1186 src/sys/conf/files
cvs rdiff -u -r1.29 -r1.30 src/sys/dev/bluetooth/bthidev.c
cvs rdiff -u -r1.17 -r1.18 src/sys/dev/bluetooth/btkbd.c
cvs rdiff -u -r1.16 -r1.17 src/sys/dev/bluetooth/btmagic.c
cvs rdiff -u -r1.12 -r1.13 src/sys/dev/bluetooth/btms.c
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/fdt/gpiokeys.c
cvs rdiff -u -r0 -r1.1 src/sys/dev/hid/files.hid src/sys/dev/hid/hid.c \
src/sys/dev/hid/hid.h src/sys/dev/hid/hidkbdmap.c src/sys/dev/hid/hidms.c \
src/sys/dev/hid/hidms.h
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/i2c/tcakp.c
cvs rdiff -u -r1.147 -r1.148 src/sys/dev/usb/files.usb
cvs rdiff -u -r1.47 -r0 src/sys/dev/usb/hid.c
cvs rdiff -u -r1.14 -r0 src/sys/dev/usb/hid.h
cvs rdiff -u -r1.14 -r1.15 src/sys/dev/usb/uatp.c
cvs rdiff -u -r1.45 -r1.46 src/sys/dev/usb/ucycom.c
cvs rdiff -u -r1.100 -r1.101 src/sys/dev/usb/uhid.c
cvs rdiff -u -r1.72 -r1.73 src/sys/dev/usb/uhidev.c
cvs rdiff -u -r1.138 -r1.139 src/sys/dev/usb/ukbd.c
cvs rdiff -u -r1.31 -r0 src/sys/dev/usb/ukbdmap.c
cvs rdiff -u -r1.90 -r1.91 src/sys/dev/usb/ums.c
cvs rdiff -u -r1.16 -r1.17 src/sys/dev/usb/usbhid.h
cvs rdiff -u -r1.13 -r1.14 src/sys/dev/usb/uthum.c
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/usb/uts.c
cvs rdiff -u -r1.12 -r1.13 src/sys/dev/usb/uyurex.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/conf/files
diff -u src/sys/conf/files:1.1185 src/sys/conf/files:1.1186
--- src/sys/conf/files:1.1185	Sat Nov 25 16:31:03 2017
+++ src/sys/conf/files	Sun Dec 10 17:03:07 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: files,v 1.1185 2017/11/25 16:31:03 jmcneill Exp $
+#	$NetBSD: files,v 1.1186 2017/12/10 17:03:07 bouyer Exp $
 #	@(#)files.newconf	7.5 (Berkeley) 5/10/93
 
 version 	20171118
@@ -379,6 +379,9 @@ file	dev/ic/nslm7x.c			lm			needs-flag
 device	spdmem
 file	dev/ic/spdmem.c			spdmem
 
+# Generic HID support (used by USB, bluetooth and i2c)
+include "dev/hid/files.hid"
+
 # I2C device support
 include "dev/i2c/files.i2c"
 
@@ -1291,10 +1294,6 @@ file	dev/ic/sl811hs.c		slhci			needs-fla
 #
 include "external/bsd/dwc2/conf/files.dwc2"
 
-# USB HID processing (as used by bluetooth and usb code)
-define	hid
-file	dev/usb/hid.c			hid
-
 # SD Host controller
 device	sdhc: sdmmcbus
 file	dev/sdmmc/sdhc.c		sdhc			needs-flag

Index: src/sys/dev/bluetooth/bthidev.c
diff -u src/sys/dev/bluetooth/bthidev.c:1.29 src/sys/dev/bluetooth/bthidev.c:1.30
--- src/sys/dev/bluetooth/bthidev.c:1.29	Tue Aug  5 07:55:31 2014
+++ src/sys/dev/bluetooth/bthidev.c	Sun Dec 10 17:03:07 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: bthidev.c,v 1.29 2014/08/05 07:55:31 rtr Exp $	*/
+/*	$NetBSD: bthidev.c,v 1.30 2017/12/10 17:03:07 bouyer Exp $	*/
 
 /*-
  * Copyright (c) 2006 Itronix Inc.
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bthidev.c,v 1.29 2014/08/05 07:55:31 rtr Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bthidev.c,v 1.30 2017/12/10 17:03:07 bouyer Exp $");
 
 #include 
 #include 
@@ -54,7 +54,7 @@ __KERNEL_RCSID(0, "$NetBSD: bthidev.c,v 
 #include 
 #include 
 
-#include 
+#include 
 #include 
 #include 
 #include 

Index: src/sys/dev/bluetooth/btkbd.c
diff -u src/sys/dev/bluetooth/btkbd.c:1.17 src/sys/dev/bluetooth/btkbd.c:1.18
--- src/sys/dev/bluetooth/btkbd.c:1.17	Sun Nov 16 16:20:00 2014
+++ src/sys/dev/bluetooth/btkbd.c	Sun Dec 10 17:03:07 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: btkbd.c,v 1.17 2014/11/16 16:20:00 ozaki-r Exp $	*/
+/*	$NetBSD: btkbd.c,v 1.18 2017/12/10 17:03:07 bouyer Exp $	*/
 
 /*
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: btkbd.c,v 1.17 2014/11/16 16:20:00 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: btkbd.c,v 1.18 2017/12/10 17:03:07 bouyer Exp $");
 
 #include 
 #include 
@@ -81,7 +81,7 @@ __KERNEL_RCSID(0, "$NetBSD: btkbd.c,v 1.
 #include 
 #include 
 
-#include 
+#include 
 #include 
 #include 
 
@@ 

CVS commit: src/sys/dev/i2c

2017-12-10 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Sun Dec 10 16:53:32 UTC 2017

Modified Files:
src/sys/dev/i2c: i2c.c i2cvar.h

Log Message:
For direct-config devices, pass the whole dictionary to the child as
ia_prop, so that chil drivers can look up device-specific properties.
Needed for the upcoming HID over I2C support, proposed on tech-kern@
on Dec, 1.


To generate a diff of this commit:
cvs rdiff -u -r1.56 -r1.57 src/sys/dev/i2c/i2c.c
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/i2c/i2cvar.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/dev/i2c/i2c.c
diff -u src/sys/dev/i2c/i2c.c:1.56 src/sys/dev/i2c/i2c.c:1.57
--- src/sys/dev/i2c/i2c.c:1.56	Sat Oct 28 04:53:55 2017
+++ src/sys/dev/i2c/i2c.c	Sun Dec 10 16:53:32 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: i2c.c,v 1.56 2017/10/28 04:53:55 riastradh Exp $	*/
+/*	$NetBSD: i2c.c,v 1.57 2017/12/10 16:53:32 bouyer Exp $	*/
 
 /*
  * Copyright (c) 2003 Wasabi Systems, Inc.
@@ -40,7 +40,7 @@
 #endif
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: i2c.c,v 1.56 2017/10/28 04:53:55 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i2c.c,v 1.57 2017/12/10 16:53:32 bouyer Exp $");
 
 #include 
 #include 
@@ -140,6 +140,7 @@ iic_search(device_t parent, cfdata_t cf,
 	ia.ia_name = NULL;
 	ia.ia_ncompat = 0;
 	ia.ia_compat = NULL;
+	ia.ia_prop = NULL;
 
 	for (ia.ia_addr = 0; ia.ia_addr <= I2C_MAX_ADDR; ia.ia_addr++) {
 		if (sc->sc_devices[ia.ia_addr] != NULL)
@@ -262,6 +263,7 @@ iic_attach(device_t parent, device_t sel
 			ia.ia_name = name;
 			ia.ia_cookie = cookie;
 			ia.ia_size = size;
+			ia.ia_prop = dev;
 
 			buf = NULL;
 			cdata = prop_dictionary_get(dev, "compatible");

Index: src/sys/dev/i2c/i2cvar.h
diff -u src/sys/dev/i2c/i2cvar.h:1.9 src/sys/dev/i2c/i2cvar.h:1.10
--- src/sys/dev/i2c/i2cvar.h:1.9	Sun Dec 13 17:14:56 2015
+++ src/sys/dev/i2c/i2cvar.h	Sun Dec 10 16:53:32 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: i2cvar.h,v 1.9 2015/12/13 17:14:56 jmcneill Exp $	*/
+/*	$NetBSD: i2cvar.h,v 1.10 2017/12/10 16:53:32 bouyer Exp $	*/
 
 /*
  * Copyright (c) 2003 Wasabi Systems, Inc.
@@ -125,6 +125,7 @@ struct i2c_attach_args {
 	int		ia_ncompat;	/* number of pointers in the
 	   ia_compat array */
 	const char **	ia_compat;	/* chip names */
+	prop_dictionary_t ia_prop;	/* dictionnary for this device */
 	/*
 	 * The following is of limited usefulness and should only be used
 	 * in rare cases where we really know what we are doing. Example:
@@ -134,6 +135,8 @@ struct i2c_attach_args {
 	 * may be present. Example: on OpenFirmware machines the device
 	 * tree OF node - if available. This info is hard to transport
 	 * down to MD drivers through the MI i2c bus otherwise.
+	 * 
+	 * On ACPI platforms this is the ACPI_HANDLE of the device.
 	 */
 	uintptr_t	ia_cookie;	/* OF node in openfirmware machines */
 };



CVS commit: src/sys/dev/acpi

2017-12-10 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Sun Dec 10 16:51:30 UTC 2017

Modified Files:
src/sys/dev/acpi: acpi_util.c files.acpi
Added Files:
src/sys/dev/acpi: acpi_i2c.c acpi_i2c.h acpi_intr.h

Log Message:
Implement a ACPI helper to fill the property array expected from our I2C
framework from the ACPI tables.
Also implement acpi_intr_establish(), acpi_intr_disestablish() and
acpi_intr_string().
Needed for the upcoming HID over I2C support, proposed on tech-kern@
on Dec, 1.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/dev/acpi/acpi_i2c.c \
src/sys/dev/acpi/acpi_i2c.h src/sys/dev/acpi/acpi_intr.h
cvs rdiff -u -r1.8 -r1.9 src/sys/dev/acpi/acpi_util.c
cvs rdiff -u -r1.99 -r1.100 src/sys/dev/acpi/files.acpi

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/acpi/acpi_util.c
diff -u src/sys/dev/acpi/acpi_util.c:1.8 src/sys/dev/acpi/acpi_util.c:1.9
--- src/sys/dev/acpi/acpi_util.c:1.8	Tue Jun 21 03:37:21 2011
+++ src/sys/dev/acpi/acpi_util.c	Sun Dec 10 16:51:30 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: acpi_util.c,v 1.8 2011/06/21 03:37:21 jruoho Exp $ */
+/*	$NetBSD: acpi_util.c,v 1.9 2017/12/10 16:51:30 bouyer Exp $ */
 
 /*-
  * Copyright (c) 2003, 2007 The NetBSD Foundation, Inc.
@@ -65,12 +65,14 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: acpi_util.c,v 1.8 2011/06/21 03:37:21 jruoho Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_util.c,v 1.9 2017/12/10 16:51:30 bouyer Exp $");
 
 #include 
+#include 
 
 #include 
 #include 
+#include 
 
 #define _COMPONENT	ACPI_BUS_COMPONENT
 ACPI_MODULE_NAME	("acpi_util")
@@ -506,3 +508,63 @@ out:
 
 	return ci;
 }
+
+struct acpi_irq_handler {
+	ACPI_HANDLE aih_hdl;
+	uint32_t aih_irq;
+	int (*aih_intr)(void *);
+};
+
+void *
+acpi_intr_establish(device_t dev, uint64_t c,
+unsigned int (*intr)(void *), void *iarg)
+{
+	ACPI_STATUS rv;
+	ACPI_HANDLE hdl = (void *)c;
+	struct acpi_resources res;
+	struct acpi_irq *irq;
+	struct acpi_irq_handler *aih = NULL;
+
+	rv = acpi_resource_parse(dev, hdl, "_CRS", ,
+	_resource_parse_ops_quiet);
+	if (ACPI_FAILURE(rv))
+		return NULL;
+
+	irq = acpi_res_irq(, 0);
+	if (irq == NULL)
+		goto end;
+
+	aih = kmem_alloc(sizeof(struct acpi_irq_handler), KM_NOSLEEP);
+	if (aih == NULL)
+		goto end;
+
+	aih->aih_hdl = hdl;
+	aih->aih_irq = irq->ar_irq;
+	rv = AcpiOsInstallInterruptHandler(irq->ar_irq, intr, iarg);
+	if (ACPI_FAILURE(rv)) {
+		kmem_free(aih, sizeof(struct acpi_irq_handler));
+		aih = NULL;
+	}
+end:
+	acpi_resource_cleanup();
+	return aih;
+}
+
+void
+acpi_intr_disestablish(void *c, unsigned int (*intr)(void *))
+{
+	struct acpi_irq_handler *aih = c;
+
+	AcpiOsRemoveInterruptHandler(aih->aih_irq, intr);
+	kmem_free(aih, sizeof(struct acpi_irq_handler));
+	return;
+}
+
+const char *
+acpi_intr_string(void *c, char *buf, size_t size)
+{
+	struct acpi_irq_handler *aih = c;
+	intr_handle_t ih = aih->aih_irq;
+
+	return intr_string(ih, buf, size);
+}

Index: src/sys/dev/acpi/files.acpi
diff -u src/sys/dev/acpi/files.acpi:1.99 src/sys/dev/acpi/files.acpi:1.100
--- src/sys/dev/acpi/files.acpi:1.99	Sat Nov 25 16:31:03 2017
+++ src/sys/dev/acpi/files.acpi	Sun Dec 10 16:51:30 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: files.acpi,v 1.99 2017/11/25 16:31:03 jmcneill Exp $
+#	$NetBSD: files.acpi,v 1.100 2017/12/10 16:51:30 bouyer Exp $
 
 include "dev/acpi/acpica/files.acpica"
 
@@ -18,6 +18,7 @@ device	acpi: acpica, acpiapmbus, acpinod
 attach	acpi at acpibus
 file	dev/acpi/acpi.c			acpi
 file	dev/acpi/acpi_debug.c		acpi
+file	dev/acpi/acpi_i2c.c		acpi
 file	dev/acpi/acpi_mcfg.c		acpi
 file	dev/acpi/acpi_pci.c		acpi
 file	dev/acpi/acpi_pci_link.c	acpi

Added files:

Index: src/sys/dev/acpi/acpi_i2c.c
diff -u /dev/null src/sys/dev/acpi/acpi_i2c.c:1.1
--- /dev/null	Sun Dec 10 16:51:31 2017
+++ src/sys/dev/acpi/acpi_i2c.c	Sun Dec 10 16:51:30 2017
@@ -0,0 +1,236 @@
+/* $NetBSD: acpi_i2c.c,v 1.1 2017/12/10 16:51:30 bouyer Exp $ */
+
+/*-
+ * Copyright (c) 2017 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Manuel Bouyer.
+ *
+ * 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 

CVS commit: src/distrib/sets/lists/debug

2017-12-10 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Dec 10 15:41:08 UTC 2017

Modified Files:
src/distrib/sets/lists/debug: mi

Log Message:
add new test.


To generate a diff of this commit:
cvs rdiff -u -r1.231 -r1.232 src/distrib/sets/lists/debug/mi

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

Modified files:

Index: src/distrib/sets/lists/debug/mi
diff -u src/distrib/sets/lists/debug/mi:1.231 src/distrib/sets/lists/debug/mi:1.232
--- src/distrib/sets/lists/debug/mi:1.231	Fri Dec  8 08:15:41 2017
+++ src/distrib/sets/lists/debug/mi	Sun Dec 10 10:41:08 2017
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.231 2017/12/08 13:15:41 christos Exp $
+# $NetBSD: mi,v 1.232 2017/12/10 15:41:08 christos Exp $
 ./etc/mtree/set.debug   comp-sys-root
 ./usr/lib	comp-sys-usr		compatdir
 ./usr/lib/i18n/libBIG5_g.a			comp-c-debuglib		debuglib,compatfile
@@ -1692,6 +1692,7 @@
 ./usr/libdata/debug/usr/tests/kernel/arch/i386/t_ptrace_wait6.debug	tests-obsolete		obsolete,compattestfile
 ./usr/libdata/debug/usr/tests/kernel/arch/i386/t_ptrace_waitid.debug	tests-obsolete		obsolete,compattestfile
 ./usr/libdata/debug/usr/tests/kernel/arch/i386/t_ptrace_waitpid.debug	tests-obsolete		obsolete,compattestfile
+./usr/libdata/debug/usr/tests/kernel/h_getprocpath.debug		tests-kernel-tests	debug,atf,compattestfile
 ./usr/libdata/debug/usr/tests/kernel/h_ps_strings1.debug		tests-kernel-tests	debug,atf,compattestfile
 ./usr/libdata/debug/usr/tests/kernel/h_ps_strings2.debug		tests-kernel-tests	debug,atf,compattestfile
 ./usr/libdata/debug/usr/tests/kernel/h_segv.debug			tests-kernel-tests	debug,atf,compattestfile



CVS commit: src/distrib/sets/lists/tests

2017-12-10 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Dec 10 15:39:37 UTC 2017

Modified Files:
src/distrib/sets/lists/tests: mi

Log Message:
new tests


To generate a diff of this commit:
cvs rdiff -u -r1.770 -r1.771 src/distrib/sets/lists/tests/mi

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

Modified files:

Index: src/distrib/sets/lists/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.770 src/distrib/sets/lists/tests/mi:1.771
--- src/distrib/sets/lists/tests/mi:1.770	Thu Dec  7 20:19:29 2017
+++ src/distrib/sets/lists/tests/mi	Sun Dec 10 10:39:37 2017
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.770 2017/12/08 01:19:29 christos Exp $
+# $NetBSD: mi,v 1.771 2017/12/10 15:39:37 christos Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -2118,6 +2118,8 @@
 ./usr/tests/kernel/arch/i386/t_ptrace_waitid	tests-obsolete		obsolete
 ./usr/tests/kernel/arch/i386/t_ptrace_waitpid	tests-obsolete		obsolete
 ./usr/tests/kernel/arch/x86			tests-obsolete		obsolete
+./usr/tests/kernel/h_getprocpath		tests-kernel-tests	compattestfile,atf
+./usr/tests/kernel/h_interpreter		tests-kernel-tests	compattestfile,atf
 ./usr/tests/kernel/h_ps_strings1		tests-kernel-tests	compattestfile,atf
 ./usr/tests/kernel/h_ps_strings2		tests-kernel-tests	compattestfile,atf
 ./usr/tests/kernel/h_segv			tests-kernel-tests	compattestfile,atf
@@ -2169,6 +2171,7 @@
 ./usr/tests/kernel/t_pollts			tests-obsolete		obsolete
 ./usr/tests/kernel/t_posix_fadvise		tests-obsolete		obsolete
 ./usr/tests/kernel/t_posix_fallocate		tests-obsolete		obsolete
+./usr/tests/kernel/t_procpath			tests-kernel-tests	compattestfile,atf
 ./usr/tests/kernel/t_ps_strings			tests-kernel-tests	compattestfile,atf
 ./usr/tests/kernel/t_ptrace			tests-obsolete		obsolete
 ./usr/tests/kernel/t_ptrace_wait		tests-obsolete		obsolete



CVS commit: src/tests/kernel

2017-12-10 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Dec 10 15:37:54 UTC 2017

Modified Files:
src/tests/kernel: Makefile
Added Files:
src/tests/kernel: h_getprocpath.c h_interpreter.sh t_procpath.sh

Log Message:
Add tests to make sure that the program name is what it is supposed to be.


To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 src/tests/kernel/Makefile
cvs rdiff -u -r0 -r1.1 src/tests/kernel/h_getprocpath.c \
src/tests/kernel/h_interpreter.sh src/tests/kernel/t_procpath.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/kernel/Makefile
diff -u src/tests/kernel/Makefile:1.49 src/tests/kernel/Makefile:1.50
--- src/tests/kernel/Makefile:1.49	Thu Dec  7 20:19:29 2017
+++ src/tests/kernel/Makefile	Sun Dec 10 10:37:54 2017
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.49 2017/12/08 01:19:29 christos Exp $
+# $NetBSD: Makefile,v 1.50 2017/12/10 15:37:54 christos Exp $
 
 NOMAN=		# defined
 
@@ -22,11 +22,15 @@ TESTS_SH+=	t_umountstress
 TESTS_SH+=	t_ps_strings
 TESTS_SH+=	t_trapsignal
 TESTS_SH+=	t_interp
+TESTS_SH+=	t_procpath
 
 BINDIR=		${TESTSDIR}
 PROGS=		h_ps_strings1
 PROGS+=		h_ps_strings2
 PROGS+=		h_segv
+PROGS+=		h_getprocpath
+PROGS+=		h_interpreter
+SRCS.h_interpreter += h_interpreter.sh
 
 LDADD.t_mqueue+= -lrt
 

Added files:

Index: src/tests/kernel/h_getprocpath.c
diff -u /dev/null src/tests/kernel/h_getprocpath.c:1.1
--- /dev/null	Sun Dec 10 10:37:54 2017
+++ src/tests/kernel/h_getprocpath.c	Sun Dec 10 10:37:54 2017
@@ -0,0 +1,59 @@
+/*-
+ * Copyright (c) 2017 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 
+#include 
+#include 
+#include 
+
+static int
+getprocpath(char *path, size_t len, pid_t pid)
+{
+	const int name[] = {
+	CTL_KERN, KERN_PROC_ARGS, pid, KERN_PROC_PATHNAME,
+	};
+ 	return sysctl(name, __arraycount(name), path, , NULL, 0);
+}
+
+int
+main(int argc, char *argv[])
+{
+	if (argc != 2) {
+		fprintf(stderr, "Usage: %s \n", getprogname());
+		return EXIT_FAILURE;
+	}
+
+	char buf[MAXPATHLEN];
+	pid_t pid = atoi(argv[1]);
+
+	if (getprocpath(buf, sizeof(buf), pid) == -1)
+		err(EXIT_FAILURE, "sysctl: %d", pid);
+	printf("%s\n", buf);
+	return EXIT_SUCCESS;
+}
Index: src/tests/kernel/h_interpreter.sh
diff -u /dev/null src/tests/kernel/h_interpreter.sh:1.1
--- /dev/null	Sun Dec 10 10:37:54 2017
+++ src/tests/kernel/h_interpreter.sh	Sun Dec 10 10:37:54 2017
@@ -0,0 +1,27 @@
+#!/bin/sh
+
+cmd=$1
+shift
+case "${cmd}" in
+interpreter)
+	"${1}" $$
+	;;
+dot)
+	cp "${1}" .
+	z="./$(basename "${1}")"
+	x=$(${z} -1)
+	case ${x} in
+	/*)	x=$(readlink "${x}");;
+	*)	echo "non absolute path" 1>&2; exit 1;;
+	esac
+
+	e=$(readlink "$(/bin/pwd)/${z}")
+	if [ "${x}" != "${e}" ]; then
+		echo bad: ${x} != ${e} 1>&2
+		exit 1
+	fi
+	;;
+*)
+	echo bad command ${cmd}
+esac
+		
Index: src/tests/kernel/t_procpath.sh
diff -u /dev/null src/tests/kernel/t_procpath.sh:1.1
--- /dev/null	Sun Dec 10 10:37:54 2017
+++ src/tests/kernel/t_procpath.sh	Sun Dec 10 10:37:54 2017
@@ -0,0 +1,72 @@
+# $NetBSD: t_procpath.sh,v 1.1 2017/12/10 15:37:54 christos Exp $
+#
+# Copyright (c) 2017 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 

CVS commit: src/share/mk

2017-12-10 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Dec 10 15:11:47 UTC 2017

Modified Files:
src/share/mk: bsd.prog.mk

Log Message:
don't try to build .debug files for shell scripts.


To generate a diff of this commit:
cvs rdiff -u -r1.308 -r1.309 src/share/mk/bsd.prog.mk

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

Modified files:

Index: src/share/mk/bsd.prog.mk
diff -u src/share/mk/bsd.prog.mk:1.308 src/share/mk/bsd.prog.mk:1.309
--- src/share/mk/bsd.prog.mk:1.308	Tue Oct 10 15:29:44 2017
+++ src/share/mk/bsd.prog.mk	Sun Dec 10 10:11:47 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: bsd.prog.mk,v 1.308 2017/10/10 19:29:44 christos Exp $
+#	$NetBSD: bsd.prog.mk,v 1.309 2017/12/10 15:11:47 christos Exp $
 #	@(#)bsd.prog.mk	8.2 (Berkeley) 4/2/94
 
 .ifndef HOSTPROG
@@ -431,7 +431,8 @@ _CCLINK.${_P}=	${CXX} ${_CCLINKFLAGS}
 BINDIR.${_P}?=		${BINDIR}
 PROGNAME.${_P}?=	${_P}
 
-.if ${MKDEBUG:Uno} != "no" && !defined(NODEBUG) && !commands(${_P})
+.if ${MKDEBUG:Uno} != "no" && !defined(NODEBUG) && !commands(${_P}) && \
+!empty(OBJS.${_P})
 _PROGDEBUG.${_P}:=	${PROGNAME.${_P}}.debug
 .endif
 



CVS commit: src/sys

2017-12-10 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Dec 10 14:29:47 UTC 2017

Modified Files:
src/sys/arch/aarch64/conf: Makefile.aarch64
src/sys/arch/i386/conf: Makefile.i386
src/sys/arch/sparc64/conf: Makefile.sparc64
src/sys/arch/usermode/conf: Makefile.usermode
src/sys/arch/xen/conf: Makefile.xen
src/sys/conf: dts.mk

Log Message:
- Allow multiple .BEGIN targets
- Make their protection consistent


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/aarch64/conf/Makefile.aarch64
cvs rdiff -u -r1.186 -r1.187 src/sys/arch/i386/conf/Makefile.i386
cvs rdiff -u -r1.83 -r1.84 src/sys/arch/sparc64/conf/Makefile.sparc64
cvs rdiff -u -r1.39 -r1.40 src/sys/arch/usermode/conf/Makefile.usermode
cvs rdiff -u -r1.42 -r1.43 src/sys/arch/xen/conf/Makefile.xen
cvs rdiff -u -r1.7 -r1.8 src/sys/conf/dts.mk

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/aarch64/conf/Makefile.aarch64
diff -u src/sys/arch/aarch64/conf/Makefile.aarch64:1.7 src/sys/arch/aarch64/conf/Makefile.aarch64:1.8
--- src/sys/arch/aarch64/conf/Makefile.aarch64:1.7	Thu May  5 17:14:14 2016
+++ src/sys/arch/aarch64/conf/Makefile.aarch64	Sun Dec 10 09:29:47 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.aarch64,v 1.7 2016/05/05 21:14:14 rjs Exp $
+#	$NetBSD: Makefile.aarch64,v 1.8 2017/12/10 14:29:47 christos Exp $
 
 # Makefile for NetBSD
 #
@@ -92,9 +92,9 @@ spl.o vectors.o: assym.h
 # would be defined
 .MAIN: all
 
-.if make(depend) || make(all) || make(dependall)
-.BEGIN:
-	@rm -f arm && \
+.if !make(obj) && !make(clean) && !make(cleandir)
+.BEGIN::
+	-@rm -f arm && \
 		ln -s $S/arch/arm/include arm
 .endif
 

Index: src/sys/arch/i386/conf/Makefile.i386
diff -u src/sys/arch/i386/conf/Makefile.i386:1.186 src/sys/arch/i386/conf/Makefile.i386:1.187
--- src/sys/arch/i386/conf/Makefile.i386:1.186	Wed Aug  9 15:11:13 2017
+++ src/sys/arch/i386/conf/Makefile.i386	Sun Dec 10 09:29:47 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.i386,v 1.186 2017/08/09 19:11:13 maxv Exp $
+#	$NetBSD: Makefile.i386,v 1.187 2017/12/10 14:29:47 christos Exp $
 
 # Makefile for NetBSD
 #
@@ -94,8 +94,8 @@ acpi_wakeup_low.o busfunc.o: assym.h
 ##
 
 .if !make(obj) && !make(clean) && !make(cleandir)
-.BEGIN:
-	@rm -f i386 && \
+.BEGIN::
+	-@rm -f i386 && \
 		ln -s $S/arch/i386/include i386
 .endif
 

Index: src/sys/arch/sparc64/conf/Makefile.sparc64
diff -u src/sys/arch/sparc64/conf/Makefile.sparc64:1.83 src/sys/arch/sparc64/conf/Makefile.sparc64:1.84
--- src/sys/arch/sparc64/conf/Makefile.sparc64:1.83	Mon Dec  4 04:44:33 2017
+++ src/sys/arch/sparc64/conf/Makefile.sparc64	Sun Dec 10 09:29:47 2017
@@ -1,4 +1,4 @@
-# 	$NetBSD: Makefile.sparc64,v 1.83 2017/12/04 09:44:33 martin Exp $
+# 	$NetBSD: Makefile.sparc64,v 1.84 2017/12/10 14:29:47 christos Exp $
 
 #=
 #
@@ -138,9 +138,9 @@ cpu_in_cksum.o lock_stubs.o: assym.h
 # would be defined
 .MAIN: all
 
-.if make(depend) || make(all) || make(dependall)
-.BEGIN:
-	@rm -f sparc && \
+.if !make(obj) && !make(clean) && !make(cleandir)
+.BEGIN::
+	-@rm -f sparc && \
 		ln -s $S/arch/sparc/include sparc
 .endif
 

Index: src/sys/arch/usermode/conf/Makefile.usermode
diff -u src/sys/arch/usermode/conf/Makefile.usermode:1.39 src/sys/arch/usermode/conf/Makefile.usermode:1.40
--- src/sys/arch/usermode/conf/Makefile.usermode:1.39	Wed Aug 26 23:20:13 2015
+++ src/sys/arch/usermode/conf/Makefile.usermode	Sun Dec 10 09:29:47 2017
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.usermode,v 1.39 2015/08/27 03:20:13 uebayasi Exp $
+# $NetBSD: Makefile.usermode,v 1.40 2017/12/10 14:29:47 christos Exp $
 
 USETOOLS?=			no
 NEED_OWN_INSTALL_TARGET?=	no
@@ -86,12 +86,12 @@ NVFLAGS=	-n
 ##
 
 .if !make(obj) && !make(clean) && !make(cleandir)
-.BEGIN:
-	@rm -f i386 && \
+.BEGIN::
+	-@rm -f i386 && \
 		ln -s $S/arch/i386/include i386
-	@rm -f amd64 && \
+	-@rm -f amd64 && \
 		ln -s $S/arch/amd64/include amd64
-	@rm -f arm && \
+	-@rm -f arm && \
 		ln -s $S/arch/arm/include arm
 .endif
 

Index: src/sys/arch/xen/conf/Makefile.xen
diff -u src/sys/arch/xen/conf/Makefile.xen:1.42 src/sys/arch/xen/conf/Makefile.xen:1.43
--- src/sys/arch/xen/conf/Makefile.xen:1.42	Wed Aug  9 15:11:13 2017
+++ src/sys/arch/xen/conf/Makefile.xen	Sun Dec 10 09:29:47 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.xen,v 1.42 2017/08/09 19:11:13 maxv Exp $
+#	$NetBSD: Makefile.xen,v 1.43 2017/12/10 14:29:47 christos Exp $
 #	NetBSD: Makefile.i386,v 1.132 2003/07/05 16:56:10 simonb Exp 
 
 # Makefile for NetBSD
@@ -86,16 +86,15 @@ vector.o: $S/arch/${XEN_BUILD}/${XEN_BUI
 	${NORMAL_S}
 .ifndef noBEGIN
 .if !make(obj) && !make(clean) && !make(cleandir)
-.BEGIN:
+.BEGIN::
 .for A in ${XEN_MACHINE_ARCHS}
-	rm -f ${A}
-	ln -s $S/arch/${A}/include ${A}
+	-@rm -f ${A} && \
+	ln -s $S/arch/${A}/include ${A}
 .endfor
-	-rm -rf xen-ma
-	mkdir xen-ma
-	ln -s 

CVS commit: src/tests/lib/libc/sys

2017-12-10 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Dec 10 14:09:42 UTC 2017

Modified Files:
src/tests/lib/libc/sys: t_ptrace_wait.c

Log Message:
Remove expected failure (fixed in kern_sig.c 1.339)


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/tests/lib/libc/sys/t_ptrace_wait.c

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

Modified files:

Index: src/tests/lib/libc/sys/t_ptrace_wait.c
diff -u src/tests/lib/libc/sys/t_ptrace_wait.c:1.11 src/tests/lib/libc/sys/t_ptrace_wait.c:1.12
--- src/tests/lib/libc/sys/t_ptrace_wait.c:1.11	Mon Dec  4 07:53:46 2017
+++ src/tests/lib/libc/sys/t_ptrace_wait.c	Sun Dec 10 09:09:42 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_ptrace_wait.c,v 1.11 2017/12/04 12:53:46 kamil Exp $	*/
+/*	$NetBSD: t_ptrace_wait.c,v 1.12 2017/12/10 14:09:42 christos Exp $	*/
 
 /*-
  * Copyright (c) 2016 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: t_ptrace_wait.c,v 1.11 2017/12/04 12:53:46 kamil Exp $");
+__RCSID("$NetBSD: t_ptrace_wait.c,v 1.12 2017/12/10 14:09:42 christos Exp $");
 
 #include 
 #include 
@@ -5843,8 +5843,6 @@ ATF_TC_BODY(signal4, tc)
 #if defined(__arm__)
 	/* PT_STEP not supported on arm 32-bit */
 	atf_tc_expect_fail("PR kern/51918 PR kern/52119");
-#else
-	atf_tc_expect_fail("PR kern/52118");
 #endif
 
 	printf("Before forking process PID=%d\n", getpid());



CVS commit: src/sys/netinet

2017-12-10 Thread Robert Swindells
Module Name:src
Committed By:   rjs
Date:   Sun Dec 10 11:52:14 UTC 2017

Modified Files:
src/sys/netinet: sctp_indata.c sctp_output.c sctp_uio.h sctp_usrreq.c

Log Message:
Improve compliance to RFC 6458.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/netinet/sctp_indata.c
cvs rdiff -u -r1.11 -r1.12 src/sys/netinet/sctp_output.c
cvs rdiff -u -r1.2 -r1.3 src/sys/netinet/sctp_uio.h
cvs rdiff -u -r1.8 -r1.9 src/sys/netinet/sctp_usrreq.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/sctp_indata.c
diff -u src/sys/netinet/sctp_indata.c:1.4 src/sys/netinet/sctp_indata.c:1.5
--- src/sys/netinet/sctp_indata.c:1.4	Mon Apr 25 21:21:02 2016
+++ src/sys/netinet/sctp_indata.c	Sun Dec 10 11:52:14 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: sctp_indata.c,v 1.4 2016/04/25 21:21:02 rjs Exp $ */
+/*	$NetBSD: sctp_indata.c,v 1.5 2017/12/10 11:52:14 rjs Exp $ */
 /*	$KAME: sctp_indata.c,v 1.36 2005/03/06 16:04:17 itojun Exp $	*/
 
 /*
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sctp_indata.c,v 1.4 2016/04/25 21:21:02 rjs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sctp_indata.c,v 1.5 2017/12/10 11:52:14 rjs Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ipsec.h"
@@ -205,7 +205,7 @@ sctp_build_ctl_nchunk(struct sctp_tcb *s
 	outinfo->sinfo_stream = stream_no;
 	outinfo->sinfo_ssn = stream_seq;
 	if (flags & SCTP_DATA_UNORDERED) {
-		outinfo->sinfo_flags = MSG_UNORDERED;
+		outinfo->sinfo_flags = SCTP_UNORDERED;
 	} else {
 		outinfo->sinfo_flags = 0;
 	}
@@ -256,7 +256,7 @@ sctp_build_ctl(struct sctp_tcb *stcb, st
 	outinfo->sinfo_stream = chk->rec.data.stream_number;
 	outinfo->sinfo_ssn = chk->rec.data.stream_seq;
 	if (chk->rec.data.rcv_flags & SCTP_DATA_UNORDERED) {
-		outinfo->sinfo_flags = MSG_UNORDERED;
+		outinfo->sinfo_flags = SCTP_UNORDERED;
 	} else {
 		outinfo->sinfo_flags = 0;
 	}

Index: src/sys/netinet/sctp_output.c
diff -u src/sys/netinet/sctp_output.c:1.11 src/sys/netinet/sctp_output.c:1.12
--- src/sys/netinet/sctp_output.c:1.11	Tue Jun 27 13:54:56 2017
+++ src/sys/netinet/sctp_output.c	Sun Dec 10 11:52:14 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: sctp_output.c,v 1.11 2017/06/27 13:54:56 rjs Exp $ */
+/*	$NetBSD: sctp_output.c,v 1.12 2017/12/10 11:52:14 rjs Exp $ */
 /*	$KAME: sctp_output.c,v 1.48 2005/06/16 18:29:24 jinmei Exp $	*/
 
 /*
@@ -30,7 +30,7 @@
  * SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sctp_output.c,v 1.11 2017/06/27 13:54:56 rjs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sctp_output.c,v 1.12 2017/12/10 11:52:14 rjs Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ipsec.h"
@@ -4006,7 +4006,7 @@ sctp_prepare_chunk(struct sctp_tmit_chun
 	memset(template, 0, sizeof(struct sctp_tmit_chunk));
 	template->sent = SCTP_DATAGRAM_UNSENT;
 	if ((stcb->asoc.peer_supports_prsctp) &&
-	(srcv->sinfo_flags & (MSG_PR_SCTP_TTL|MSG_PR_SCTP_BUF)) &&
+	(srcv->sinfo_flags & (SCTP_PR_SCTP_TTL|SCTP_PR_SCTP_BUF)) &&
 	(srcv->sinfo_timetolive > 0)
 		) {
 		/* If:
@@ -4016,7 +4016,7 @@ sctp_prepare_chunk(struct sctp_tmit_chun
 		 * to mean a reliable send for both buffer/time
 		 * related one.
 		 */
-		if (srcv->sinfo_flags & MSG_PR_SCTP_BUF) {
+		if (srcv->sinfo_flags & SCTP_PR_SCTP_BUF) {
 			/*
 			 * Time to live is a priority stored in tv_sec
 			 * when doing the buffer drop thing.
@@ -4036,7 +4036,7 @@ sctp_prepare_chunk(struct sctp_tmit_chun
 #endif
 		}
 	}
-	if ((srcv->sinfo_flags & MSG_UNORDERED) == 0) {
+	if ((srcv->sinfo_flags & SCTP_UNORDERED) == 0) {
 		template->rec.data.stream_seq = strq->next_sequence_sent;
 	} else {
 		template->rec.data.stream_seq = 0;
@@ -4049,7 +4049,7 @@ sctp_prepare_chunk(struct sctp_tmit_chun
 	template->rec.data.doing_fast_retransmit = 0;
 	template->rec.data.ect_nonce = 0;   /* ECN Nonce */
 
-	if (srcv->sinfo_flags & MSG_ADDR_OVER) {
+	if (srcv->sinfo_flags & SCTP_ADDR_OVER) {
 		template->whoTo = net;
 	} else {
 		if (stcb->asoc.primary_destination)
@@ -4060,7 +4060,7 @@ sctp_prepare_chunk(struct sctp_tmit_chun
 		}
 	}
 	/* the actual chunk flags */
-	if (srcv->sinfo_flags & MSG_UNORDERED) {
+	if (srcv->sinfo_flags & SCTP_UNORDERED) {
 		template->rec.data.rcv_flags = SCTP_DATA_UNORDERED;
 	} else {
 		template->rec.data.rcv_flags = 0;
@@ -4076,10 +4076,10 @@ sctp_prepare_chunk(struct sctp_tmit_chun
 			 * Zero is reserved specifically to be
 			 * EXCLUDED and sent reliable.
 			 */
-			if (srcv->sinfo_flags & MSG_PR_SCTP_TTL) {
+			if (srcv->sinfo_flags & SCTP_PR_SCTP_TTL) {
 template->flags |= SCTP_PR_SCTP_ENABLED;
 			}
-			if (srcv->sinfo_flags & MSG_PR_SCTP_BUF) {
+			if (srcv->sinfo_flags & SCTP_PR_SCTP_BUF) {
 template->flags |= SCTP_PR_SCTP_BUFFER;
 			}
 		}
@@ -4160,7 +4160,7 @@ sctp_msg_append(struct sctp_tcb *stcb,
 	}
 	so = stcb->sctp_socket;
 	asoc = >asoc;
-	if (srcv->sinfo_flags & MSG_ABORT) {
+	if (srcv->sinfo_flags & SCTP_ABORT) {
 		if ((SCTP_GET_STATE(asoc) != 

CVS commit: src/sys/netinet

2017-12-10 Thread Robert Swindells
Module Name:src
Committed By:   rjs
Date:   Sun Dec 10 11:03:59 UTC 2017

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

Log Message:
Add ipsec option header.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/netinet/sctp_timer.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/sctp_timer.c
diff -u src/sys/netinet/sctp_timer.c:1.3 src/sys/netinet/sctp_timer.c:1.4
--- src/sys/netinet/sctp_timer.c:1.3	Thu Dec  8 05:16:33 2016
+++ src/sys/netinet/sctp_timer.c	Sun Dec 10 11:03:58 2017
@@ -1,5 +1,5 @@
 /*	$KAME: sctp_timer.c,v 1.30 2005/06/16 18:29:25 jinmei Exp $	*/
-/*	$NetBSD: sctp_timer.c,v 1.3 2016/12/08 05:16:33 ozaki-r Exp $	*/
+/*	$NetBSD: sctp_timer.c,v 1.4 2017/12/10 11:03:58 rjs Exp $	*/
 
 /*
  * Copyright (C) 2002, 2003, 2004 Cisco Systems Inc,
@@ -30,11 +30,12 @@
  * SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sctp_timer.c,v 1.3 2016/12/08 05:16:33 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sctp_timer.c,v 1.4 2017/12/10 11:03:58 rjs Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
 #include "opt_sctp.h"
+#include "opt_ipsec.h"
 #endif /* _KERNEL_OPT */
 
 #include 



CVS commit: src/sys/sys

2017-12-10 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Dec 10 10:56:50 UTC 2017

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

Log Message:
PR kern/52805: fix copy & pasto, from Onno van der Linden.


To generate a diff of this commit:
cvs rdiff -u -r1.60 -r1.61 src/sys/sys/ptrace.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/ptrace.h
diff -u src/sys/sys/ptrace.h:1.60 src/sys/sys/ptrace.h:1.61
--- src/sys/sys/ptrace.h:1.60	Fri Mar 24 17:40:44 2017
+++ src/sys/sys/ptrace.h	Sun Dec 10 10:56:50 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ptrace.h,v 1.60 2017/03/24 17:40:44 christos Exp $	*/
+/*	$NetBSD: ptrace.h,v 1.61 2017/12/10 10:56:50 martin Exp $	*/
 
 /*-
  * Copyright (c) 1984, 1993
@@ -176,7 +176,7 @@ struct fpreg;
 #endif
 
 #if defined(PT_GETDBREGS) || defined(PT_SETDBREGS)
-struct fpreg;
+struct dbreg;
 #ifndef process_dbreg32
 #define process_dbreg32 struct dbreg
 #endif



CVS commit: [netbsd-8] src/doc

2017-12-10 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sun Dec 10 10:33:40 UTC 2017

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

Log Message:
390, 417, 418, 419, 420, 424, 426, 427, 432, 433


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.91 -r1.1.2.92 src/doc/CHANGES-8.0

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.0
diff -u src/doc/CHANGES-8.0:1.1.2.91 src/doc/CHANGES-8.0:1.1.2.92
--- src/doc/CHANGES-8.0:1.1.2.91	Fri Dec  8 06:19:01 2017
+++ src/doc/CHANGES-8.0	Sun Dec 10 10:33:40 2017
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-8.0,v 1.1.2.91 2017/12/08 06:19:01 msaitoh Exp $
+# $NetBSD: CHANGES-8.0,v 1.1.2.92 2017/12/10 10:33:40 snj Exp $
 
 A complete list of changes from the initial NetBSD 8.0 branch on 2017-06-04
 until the 8.0 release:
@@ -8315,3 +8315,134 @@ sys/net/if_pppoe.c1.133
 
 	Remove wrong assertions. From s-yamaguchi@IIJ.
 	[ozaki-r, ticket #431]
+
+sys/netinet/ip_input.c1.363
+sys/netinet6/in6_src.c1.83-1.84
+sys/netinet6/ip6_input.c			1.184-1.185
+sys/netinet6/ip6_output.c			1.194-1.195
+
+	Allow local communication over DETACHED addresses.
+	Allow binding to DETACHED or TENTATIVE addresses as we deny
+	sending upstream from them anyway.
+	Prefer non DETACHED or TENTATIVE addresses.
+	[roy, ticket #390]
+
+sys/kern/kern_lwp.c1.191
+
+	Also wait interruptibly when exiting. Avoids deadlocked on exit
+	processes create by golang.
+	[christos, ticket #417]
+
+sys/compat/common/vfs_syscalls_12.c		1.35
+sys/compat/common/vfs_syscalls_43.c		1.62
+
+	Zero out the rest of the directory record.
+	[christos, ticket #418]
+
+sys/net/if_stf.c1.103
+sys/net/if_stf.h1.8
+sys/netinet/in_gif.c1.89
+sys/netinet/in_gif.h1.17
+sys/netinet/in_l2tp.c1.4
+sys/netinet/ip_encap.c1.66
+sys/netinet/ip_encap.h1.23
+sys/netinet/ip_mroute.c1.148
+sys/netinet6/in6_gif.c1.87
+sys/netinet6/in6_gif.h1.16
+sys/netinet6/in6_l2tp.c1.7
+sys/netipsec/xform.h1.13
+sys/netipsec/xform_ipip.c			1.55
+
+	Add argument to encapsw->pr_input() instead of m_tag.
+	[knakahara, ticket #419]
+
+etc/rc.d/sshd	1.25
+
+	Do away with (not well specified, even if it happens to work)
+	absurd 15 arg test ([ ]) expression, and replace it with several
+	well defined 2 arg tests, combined with (also well defined) sh
+	syntax.
+	[sevan, ticket #420]
+
+sys/dev/pci/if_wm.c1.545-1.546
+
+	- Don't allocate MSI-X interrupt on 82583. 82583 chip has a
+	  MSI-X capability in the PCI configuration space but it doesn't
+	  support it. At least the document doesn't say anything about
+	  MSI-X.  Fixes PR#52767.
+	- 82583 supports jumbo frame. Fixes PR#52773.
+	- Cleanup comment.
+	[msaitoh, ticket #424]
+
+sys/dev/pcmcia/if_malo_pcmcia.c			1.14
+
+	Fix two spl leaks.
+	[msaitoh, ticket #426]
+
+sys/arch/amiga/dev/if_bah_zbus.c		1.17
+sys/arch/arm/broadcom/bcm53xx_eth.c		1.30
+sys/arch/powerpc/booke/dev/pq3etsec.c		1.32
+sys/arch/usermode/dev/if_veth.c			1.9
+sys/dev/ic/an.c	1.66
+sys/dev/ic/athn.c1.17
+sys/dev/ic/atw.c1.162
+sys/dev/ic/bwi.c1.33
+sys/dev/ic/dwc_gmac.c1.41-1.42
+sys/dev/ic/malo.c1.10
+sys/dev/ic/rt2560.c1.31
+sys/dev/ic/rt2661.c1.36
+sys/dev/ic/rt2860.c1.29
+sys/dev/ic/rtw.c1.127
+sys/dev/ic/rtwvar.h1.46
+sys/dev/ic/smc90cx6.c1.71
+sys/dev/ic/smc90cx6var.h			1.12
+sys/dev/ic/wi.c	1.244
+sys/dev/pci/if_ipw.c1.66
+sys/dev/pci/if_iwi.c1.104
+sys/dev/pci/if_iwm.c1.76
+sys/dev/pci/if_iwn.c1.86
+sys/dev/pci/if_rtwn.c1.13
+sys/dev/pci/if_wm.c1.541
+sys/dev/pci/if_wpi.c1.79
+sys/dev/pci/ixgbe/ixgbe.c			1.106
+sys/dev/pci/ixgbe/ixv.c1.73 via patch
+sys/dev/pcmcia/if_malo_pcmcia.c			1.15
+sys/dev/scsipi/if_se.c1.95
+sys/dev/usb/if_upl.c1.60
+sys/net/if.c	1.396
+sys/net/if.h	1.241
+sys/net/if_arc.h1.23
+sys/net/if_arcsubr.c1.78
+sys/net/if_bridge.c1.136-1.137
+sys/net/if_etherip.c1.39
+sys/net/if_faith.c1.56
+sys/net/if_gif.c1.131
+sys/net/if_loop.c1.96
+sys/net/if_mpls.c1.30
+sys/net/if_pppoe.c1.129
+sys/net/if_srt.c1.27
+sys/net/if_stf.c1.102
+sys/net/if_tap.c1.100
+sys/net/if_vlan.c1.105
+sys/netinet/ip_carp.c1.91
+sys/rump/net/lib/libshmif/if_shmem.c		1.73-1.74
+sys/rump/net/lib/libvirtif/if_virt.c		1.55-1.56
+
+	- When resource shortage occurred in if_initialize() or
+	  if_attach(), don't panic. Instead return error code.
+	- If if_initialize() or if_attach failed in a attach function,
+	  free resources and return.
+	- Add some missing frees in a detach function.
+	- KNF
+	[msaitoh, ticket #427]
+
+sys/dev/pci/if_wm.c1.548
+
+	Fix a bug that 8257[56] can't receive packet.  PR#52717.
+	[msaitoh, ticket #432]
+
+lib/libc/gen/signal.31.28
+
+	The list of async-signal-safe functions is in sigaction(2).
+	[dholland, ticket #433]
+



CVS commit: [netbsd-8] src/lib/libc/gen

2017-12-10 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sun Dec 10 10:18:22 UTC 2017

Modified Files:
src/lib/libc/gen [netbsd-8]: signal.3

Log Message:
Pull up following revision(s) (requested by dholland in ticket #433):
lib/libc/gen/signal.3: revision 1.28
The list of async-signal-safe functions got moved to sigaction(2).


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.27.8.1 src/lib/libc/gen/signal.3

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/signal.3
diff -u src/lib/libc/gen/signal.3:1.27 src/lib/libc/gen/signal.3:1.27.8.1
--- src/lib/libc/gen/signal.3:1.27	Mon Jun  6 08:28:18 2016
+++ src/lib/libc/gen/signal.3	Sun Dec 10 10:18:22 2017
@@ -1,4 +1,4 @@
-.\"	$NetBSD: signal.3,v 1.27 2016/06/06 08:28:18 wiz Exp $
+.\"	$NetBSD: signal.3,v 1.27.8.1 2017/12/10 10:18:22 snj Exp $
 .\"
 .\" Copyright (c) 1980, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -149,7 +149,7 @@ ignored signals remain ignored.
 .Pp
 Only functions that are async-signal-safe can safely be used in signal
 handlers, see
-.Xr signal 7
+.Xr sigaction 2
 for a complete list.
 .Sh RETURN VALUES
 The previous action is returned on a successful call.



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

2017-12-10 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sun Dec 10 10:16:09 UTC 2017

Modified Files:
src/sys/dev/pci [netbsd-8]: if_wm.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #432):
sys/dev/pci/if_wm.c: revision 1.548
Fix a bug that 8257[56] can't receive packet reported by Bert Kiers in
PR#52717. For 82575 and 82576, the RX descriptors must be initialized after
the setting of RCTL.EN in wm_set_filter(). This bug was added in if_wm.c
rev. 1.515.


To generate a diff of this commit:
cvs rdiff -u -r1.508.4.9 -r1.508.4.10 src/sys/dev/pci/if_wm.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/pci/if_wm.c
diff -u src/sys/dev/pci/if_wm.c:1.508.4.9 src/sys/dev/pci/if_wm.c:1.508.4.10
--- src/sys/dev/pci/if_wm.c:1.508.4.9	Sun Dec 10 10:10:24 2017
+++ src/sys/dev/pci/if_wm.c	Sun Dec 10 10:16:09 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.508.4.9 2017/12/10 10:10:24 snj Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.508.4.10 2017/12/10 10:16:09 snj Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -83,7 +83,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.508.4.9 2017/12/10 10:10:24 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.508.4.10 2017/12/10 10:16:09 snj Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -5814,6 +5814,14 @@ wm_init_locked(struct ifnet *ifp)
 		break;
 	}
 
+	/*
+	 * Set the receive filter.
+	 *
+	 * For 82575 and 82576, the RX descriptors must be initialized after
+	 * the setting of RCTL.EN in wm_set_filter()
+	 */
+	wm_set_filter(sc);
+
 	/* On 575 and later set RDT only if RX enabled */
 	if ((sc->sc_flags & WM_F_NEWQUEUE) != 0) {
 		int qidx;
@@ -5828,9 +5836,6 @@ wm_init_locked(struct ifnet *ifp)
 		}
 	}
 
-	/* Set the receive filter. */
-	wm_set_filter(sc);
-
 	wm_unset_stopping_flags(sc);
 
 	/* Start the one second link check clock. */
@@ -6688,13 +6693,13 @@ wm_init_rx_buffer(struct wm_softc *sc, s
 return ENOMEM;
 			}
 		} else {
-			if ((sc->sc_flags & WM_F_NEWQUEUE) == 0)
-wm_init_rxdesc(rxq, i);
 			/*
-			 * For 82575 and newer device, the RX descriptors
-			 * must be initialized after the setting of RCTL.EN in
+			 * For 82575 and 82576, the RX descriptors must be
+			 * initialized after the setting of RCTL.EN in
 			 * wm_set_filter()
 			 */
+			if ((sc->sc_flags & WM_F_NEWQUEUE) == 0)
+wm_init_rxdesc(rxq, i);
 		}
 	}
 	rxq->rxq_ptr = 0;



CVS commit: [netbsd-8] src/sys

2017-12-10 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sun Dec 10 10:10:25 UTC 2017

Modified Files:
src/sys/arch/amiga/dev [netbsd-8]: if_bah_zbus.c
src/sys/arch/arm/broadcom [netbsd-8]: bcm53xx_eth.c
src/sys/arch/powerpc/booke/dev [netbsd-8]: pq3etsec.c
src/sys/arch/usermode/dev [netbsd-8]: if_veth.c
src/sys/dev/ic [netbsd-8]: an.c athn.c atw.c bwi.c dwc_gmac.c malo.c
rt2560.c rt2661.c rt2860.c rtw.c rtwvar.h smc90cx6.c smc90cx6var.h
wi.c
src/sys/dev/pci [netbsd-8]: if_ipw.c if_iwi.c if_iwm.c if_iwn.c
if_rtwn.c if_wm.c if_wpi.c
src/sys/dev/pci/ixgbe [netbsd-8]: ixgbe.c ixv.c
src/sys/dev/pcmcia [netbsd-8]: if_malo_pcmcia.c
src/sys/dev/scsipi [netbsd-8]: if_se.c
src/sys/dev/usb [netbsd-8]: if_upl.c
src/sys/net [netbsd-8]: if.c if.h if_arc.h if_arcsubr.c if_bridge.c
if_etherip.c if_faith.c if_gif.c if_loop.c if_mpls.c if_pppoe.c
if_srt.c if_stf.c if_tap.c if_vlan.c
src/sys/netinet [netbsd-8]: ip_carp.c
src/sys/rump/net/lib/libshmif [netbsd-8]: if_shmem.c
src/sys/rump/net/lib/libvirtif [netbsd-8]: if_virt.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #427):
sys/arch/amiga/dev/if_bah_zbus.c: 1.17
sys/arch/arm/broadcom/bcm53xx_eth.c: 1.30
sys/arch/powerpc/booke/dev/pq3etsec.c: 1.32
sys/arch/usermode/dev/if_veth.c: 1.9
sys/dev/ic/an.c: 1.66
sys/dev/ic/athn.c: 1.17
sys/dev/ic/atw.c: 1.162
sys/dev/ic/bwi.c: 1.33
sys/dev/ic/dwc_gmac.c: 1.41-1.42
sys/dev/ic/malo.c: 1.10
sys/dev/ic/rt2560.c: 1.31
sys/dev/ic/rt2661.c: 1.36
sys/dev/ic/rt2860.c: 1.29
sys/dev/ic/rtw.c: 1.127
sys/dev/ic/rtwvar.h: 1.46
sys/dev/ic/smc90cx6.c: 1.71
sys/dev/ic/smc90cx6var.h: 1.12
sys/dev/ic/wi.c: 1.244
sys/dev/pci/if_ipw.c: 1.66
sys/dev/pci/if_iwi.c: 1.104
sys/dev/pci/if_iwm.c: 1.76
sys/dev/pci/if_iwn.c: 1.86
sys/dev/pci/if_rtwn.c: 1.13
sys/dev/pci/if_wm.c: 1.541
sys/dev/pci/if_wpi.c: 1.79
sys/dev/pci/ixgbe/ixgbe.c: 1.106
sys/dev/pci/ixgbe/ixv.c: 1.73 via patch
sys/dev/pcmcia/if_malo_pcmcia.c: 1.15
sys/dev/scsipi/if_se.c: 1.95
sys/dev/usb/if_upl.c: 1.60
sys/net/if.c: 1.396
sys/net/if.h: 1.241
sys/net/if_arc.h: 1.23
sys/net/if_arcsubr.c: 1.78
sys/net/if_bridge.c: 1.136-1.137
sys/net/if_etherip.c: 1.39
sys/net/if_faith.c: 1.56
sys/net/if_gif.c: 1.131
sys/net/if_loop.c: 1.96
sys/net/if_mpls.c: 1.30
sys/net/if_pppoe.c: 1.129
sys/net/if_srt.c: 1.27
sys/net/if_stf.c: 1.102
sys/net/if_tap.c: 1.100
sys/net/if_vlan.c: 1.105
sys/netinet/ip_carp.c: 1.91
sys/rump/net/lib/libshmif/if_shmem.c: 1.73-1.74
sys/rump/net/lib/libvirtif/if_virt.c: 1.55-1.56
 if_initalize() and if_attach() failed when resource allocation failed
(e.g. allocating softint). Without this change, it panics. It's bad because
resource shortage really occured when a lot of pseudo interface is created.
To avoid this problem, don't panic and change return value of if_initialize()
and if_attach() to int. Caller fanction will be recover from error cleanly by
checking the return value.
 Return if bah_attach_subr() failed.
 If if_attach() failed in the attach function, return.
- If if_initialize() failed in the attach function, free resources and return.
- Add some missing frees in bridge_clone_destroy().
- KNF
 If error occured in bcmeth_ccb_attach(), free resources and return.
 If error occured in pq3etsec_attach(), free resources and return.
 If error occured in the attach function, free resources and return.
- If if_initialize() failed in athn_attach(), free resources and return.
- Add missing pmf_event_deregister() in athn_detach().
- Free resources correctly on some errors in atw_attach().
- Use apint*() insread of printf() in the attach function.
 If if_initialize() failed in the attach function, return.
- If if_initialize() failed in the attach function, free resources and return.
- Add missing dwc_gmac_free_dma_rings() and mutex_destroy() when attach
   failed.
- If if_initialize() failed in the attach function, free resources and return.
- ifp is always not NULL in iwi_detach(). Check correctly with ifp->if_softc.
- If if_initialize() failed in the attach function, free resources and return.
- Fix error path in the attach function correctly.
 If if_initialize() failed in the attach function, free resources and return.
 If if_attach() failed in the attach function, free resources and return.
 - If if_initialize() failed in the attach function, free resources and return.
 - KNF
 - If if_attach() failed in the attach function, free resources and return.
 - KNF
 Fix compile error.
 Fix compile error.
We don't 

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

2017-12-10 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sun Dec 10 09:50:59 UTC 2017

Modified Files:
src/sys/dev/pcmcia [netbsd-8]: if_malo_pcmcia.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #426):
sys/dev/pcmcia/if_malo_pcmcia.c: revision 1.14
two spl leaks, found by Mootja


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.13.6.1 src/sys/dev/pcmcia/if_malo_pcmcia.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/pcmcia/if_malo_pcmcia.c
diff -u src/sys/dev/pcmcia/if_malo_pcmcia.c:1.13 src/sys/dev/pcmcia/if_malo_pcmcia.c:1.13.6.1
--- src/sys/dev/pcmcia/if_malo_pcmcia.c:1.13	Thu Feb  2 10:05:35 2017
+++ src/sys/dev/pcmcia/if_malo_pcmcia.c	Sun Dec 10 09:50:59 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_malo_pcmcia.c,v 1.13 2017/02/02 10:05:35 nonaka Exp $	*/
+/*	$NetBSD: if_malo_pcmcia.c,v 1.13.6.1 2017/12/10 09:50:59 snj Exp $	*/
 /*  $OpenBSD: if_malo.c,v 1.65 2009/03/29 21:53:53 sthen Exp $ */
 
 /*
@@ -18,7 +18,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_malo_pcmcia.c,v 1.13 2017/02/02 10:05:35 nonaka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_malo_pcmcia.c,v 1.13.6.1 2017/12/10 09:50:59 snj Exp $");
 
 #ifdef _MODULE
 #include 
@@ -242,6 +242,7 @@ malo_pcmcia_activate(device_t dev, devac
 		if_deactivate(ifp);
 		break;
 	default:
+		splx(s);
 		return EOPNOTSUPP;
 	}
 	splx(s);
@@ -1983,6 +1984,7 @@ cmalo_cmd_response(struct malo_softc *sc
 	if (psize > MALO_CMD_BUFFER_SIZE) {
 		aprint_error_dev(sc->sc_dev,
 		"command response too large: %dbyte\n", psize);
+		splx(s);
 		return EIO;
 	}
 



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

2017-12-10 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sun Dec 10 09:48:04 UTC 2017

Modified Files:
src/sys/dev/pci [netbsd-8]: if_wm.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #424):
sys/dev/pci/if_wm.c: 1.545-1.546
  Don't allocate MSI-X interrupt on 82583. 82583 chip has a MSI-X capability in
the PCI configuration space but it doesn't support it. At least the document
doesn't say anything about MSI-X. Fixes PR#52767 reported by
Shinichi Doyashiki.
--
- 82583 supports jumbo frame. Fixes PR#52773 reported by Shinichi Doyashiki.
- Cleanup comment.


To generate a diff of this commit:
cvs rdiff -u -r1.508.4.7 -r1.508.4.8 src/sys/dev/pci/if_wm.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/pci/if_wm.c
diff -u src/sys/dev/pci/if_wm.c:1.508.4.7 src/sys/dev/pci/if_wm.c:1.508.4.8
--- src/sys/dev/pci/if_wm.c:1.508.4.7	Fri Nov 24 08:39:09 2017
+++ src/sys/dev/pci/if_wm.c	Sun Dec 10 09:48:04 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.508.4.7 2017/11/24 08:39:09 martin Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.508.4.8 2017/12/10 09:48:04 snj Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -83,7 +83,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.508.4.7 2017/11/24 08:39:09 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.508.4.8 2017/12/10 09:48:04 snj Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -1853,7 +1853,13 @@ wm_attach(device_t parent, device_t self
 
 	/* Allocation settings */
 	max_type = PCI_INTR_TYPE_MSIX;
-	counts[PCI_INTR_TYPE_MSIX] = sc->sc_nqueues + 1;
+	/*
+	 * 82583 has a MSI-X capability in the PCI configuration space but
+	 * it doesn't support it. At least the document doesn't say anything
+	 * about MSI-X.
+	 */
+	counts[PCI_INTR_TYPE_MSIX]
+	= (sc->sc_type == WM_T_82583) ? 0 : sc->sc_nqueues + 1;
 	counts[PCI_INTR_TYPE_MSI] = 1;
 	counts[PCI_INTR_TYPE_INTX] = 1;
 	/* overridden by disable flags */
@@ -2670,11 +2676,12 @@ alloc_retry:
 	case WM_T_82571:
 	case WM_T_82572:
 	case WM_T_82574:
+	case WM_T_82583:
 	case WM_T_82575:
 	case WM_T_82576:
 	case WM_T_82580:
 	case WM_T_I350:
-	case WM_T_I354: /*  ok? */
+	case WM_T_I354:
 	case WM_T_I210:
 	case WM_T_I211:
 	case WM_T_80003:
@@ -2692,7 +2699,6 @@ alloc_retry:
 		break;
 	case WM_T_82542_2_0:
 	case WM_T_82542_2_1:
-	case WM_T_82583:
 	case WM_T_ICH8:
 		/* No support for jumbo frame */
 		break;



CVS commit: [netbsd-8] src/etc/rc.d

2017-12-10 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sun Dec 10 09:44:49 UTC 2017

Modified Files:
src/etc/rc.d [netbsd-8]: sshd

Log Message:
Pull up following revision(s) (requested by sevan in ticket #420):
etc/rc.d/sshd: revision 1.25
Do away with (not well specified, even if it happens to work) absurd
15 arg test ([ ]) expression, and replace it with several well defined
2 arg tests, combined with (also well defined) sh syntax.


To generate a diff of this commit:
cvs rdiff -u -r1.23.8.1 -r1.23.8.2 src/etc/rc.d/sshd

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

Modified files:

Index: src/etc/rc.d/sshd
diff -u src/etc/rc.d/sshd:1.23.8.1 src/etc/rc.d/sshd:1.23.8.2
--- src/etc/rc.d/sshd:1.23.8.1	Mon Dec  4 10:59:46 2017
+++ src/etc/rc.d/sshd	Sun Dec 10 09:44:48 2017
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: sshd,v 1.23.8.1 2017/12/04 10:59:46 snj Exp $
+# $NetBSD: sshd,v 1.23.8.2 2017/12/10 09:44:48 snj Exp $
 #
 
 # PROVIDE: sshd
@@ -45,10 +45,10 @@ _EOF
 
 sshd_precmd()
 {
-	if [ ! -f /etc/ssh/ssh_host_dsa_key -o \
-	! -f /etc/ssh/ssh_host_ecdsa_key -o \
-	! -f /etc/ssh/ssh_host_ed25519_key -o \
-	! -f /etc/ssh/ssh_host_rsa_key ]; then
+	if ! [ -f /etc/ssh/ssh_host_dsa_key ]	  ||
+	   ! [ -f /etc/ssh/ssh_host_ecdsa_key ]	  ||
+	   ! [ -f /etc/ssh/ssh_host_ed25519_key ] ||
+	   ! [ -f /etc/ssh/ssh_host_rsa_key ];	then
 		run_rc_command keygen
 	fi
 }



CVS commit: [netbsd-8] src/sys

2017-12-10 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sun Dec 10 09:41:32 UTC 2017

Modified Files:
src/sys/net [netbsd-8]: if_stf.c if_stf.h
src/sys/netinet [netbsd-8]: in_gif.c in_gif.h in_l2tp.c ip_encap.c
ip_encap.h ip_mroute.c
src/sys/netinet6 [netbsd-8]: in6_gif.c in6_gif.h in6_l2tp.c
src/sys/netipsec [netbsd-8]: xform.h xform_ipip.c

Log Message:
Pull up following revision(s) (requested by knakahara in ticket #419):
sys/net/if_stf.c: revision 1.103
sys/net/if_stf.h: revision 1.8
sys/netinet/in_gif.c: revision 1.89
sys/netinet/in_gif.h: revision 1.17
sys/netinet/in_l2tp.c: revision 1.4
sys/netinet/ip_encap.c: revision 1.66
sys/netinet/ip_encap.h: revision 1.23
sys/netinet/ip_mroute.c: revision 1.148
sys/netinet6/in6_gif.c: revision 1.87
sys/netinet6/in6_gif.h: revision 1.16
sys/netinet6/in6_l2tp.c: revision 1.7
sys/netipsec/xform.h: revision 1.13
sys/netipsec/xform_ipip.c: revision 1.55
Add argument to encapsw->pr_input() instead of m_tag.


To generate a diff of this commit:
cvs rdiff -u -r1.101 -r1.101.8.1 src/sys/net/if_stf.c
cvs rdiff -u -r1.7 -r1.7.8.1 src/sys/net/if_stf.h
cvs rdiff -u -r1.87.8.1 -r1.87.8.2 src/sys/netinet/in_gif.c
cvs rdiff -u -r1.16 -r1.16.10.1 src/sys/netinet/in_gif.h
cvs rdiff -u -r1.2.8.1 -r1.2.8.2 src/sys/netinet/in_l2tp.c
cvs rdiff -u -r1.65 -r1.65.2.1 src/sys/netinet/ip_encap.c
cvs rdiff -u -r1.22 -r1.22.10.1 src/sys/netinet/ip_encap.h
cvs rdiff -u -r1.146 -r1.146.6.1 src/sys/netinet/ip_mroute.c
cvs rdiff -u -r1.85.6.1 -r1.85.6.2 src/sys/netinet6/in6_gif.c
cvs rdiff -u -r1.15 -r1.15.10.1 src/sys/netinet6/in6_gif.h
cvs rdiff -u -r1.5.8.1 -r1.5.8.2 src/sys/netinet6/in6_l2tp.c
cvs rdiff -u -r1.8.10.1 -r1.8.10.2 src/sys/netipsec/xform.h
cvs rdiff -u -r1.49.2.1 -r1.49.2.2 src/sys/netipsec/xform_ipip.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_stf.c
diff -u src/sys/net/if_stf.c:1.101 src/sys/net/if_stf.c:1.101.8.1
--- src/sys/net/if_stf.c:1.101	Mon Dec 12 03:55:57 2016
+++ src/sys/net/if_stf.c	Sun Dec 10 09:41:31 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_stf.c,v 1.101 2016/12/12 03:55:57 ozaki-r Exp $	*/
+/*	$NetBSD: if_stf.c,v 1.101.8.1 2017/12/10 09:41:31 snj Exp $	*/
 /*	$KAME: if_stf.c,v 1.62 2001/06/07 22:32:16 itojun Exp $ */
 
 /*
@@ -75,7 +75,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_stf.c,v 1.101 2016/12/12 03:55:57 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_stf.c,v 1.101.8.1 2017/12/10 09:41:31 snj Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -582,16 +582,18 @@ stf_checkaddr6(struct stf_softc *sc, con
 }
 
 void
-in_stf_input(struct mbuf *m, int off, int proto)
+in_stf_input(struct mbuf *m, int off, int proto, void *eparg)
 {
 	int s;
-	struct stf_softc *sc;
+	struct stf_softc *sc = eparg;
 	struct ip *ip;
 	struct ip6_hdr *ip6;
 	uint8_t otos, itos;
 	struct ifnet *ifp;
 	size_t pktlen;
 
+	KASSERT(sc != NULL);
+
 	if (proto != IPPROTO_IPV6) {
 		m_freem(m);
 		return;
@@ -599,9 +601,7 @@ in_stf_input(struct mbuf *m, int off, in
 
 	ip = mtod(m, struct ip *);
 
-	sc = (struct stf_softc *)encap_getarg(m);
-
-	if (sc == NULL || (sc->sc_if.if_flags & IFF_UP) == 0) {
+	if ((sc->sc_if.if_flags & IFF_UP) == 0) {
 		m_freem(m);
 		return;
 	}

Index: src/sys/net/if_stf.h
diff -u src/sys/net/if_stf.h:1.7 src/sys/net/if_stf.h:1.7.8.1
--- src/sys/net/if_stf.h:1.7	Thu Aug 18 11:38:58 2016
+++ src/sys/net/if_stf.h	Sun Dec 10 09:41:31 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_stf.h,v 1.7 2016/08/18 11:38:58 knakahara Exp $	*/
+/*	$NetBSD: if_stf.h,v 1.7.8.1 2017/12/10 09:41:31 snj Exp $	*/
 /*	$KAME: if_stf.h,v 1.3 2000/03/25 07:23:33 sumikawa Exp $	*/
 
 /*
@@ -39,6 +39,6 @@
 #define	STF_MTU_MIN	(1280)	/* Minimum MTU */
 #define	STF_MTU_MAX	(8192)	/* Maximum MTU */
 
-void	in_stf_input(struct mbuf *, int, int);
+void	in_stf_input(struct mbuf *, int, int, void *);
 
 #endif /* !_NET_IF_STF_H_ */

Index: src/sys/netinet/in_gif.c
diff -u src/sys/netinet/in_gif.c:1.87.8.1 src/sys/netinet/in_gif.c:1.87.8.2
--- src/sys/netinet/in_gif.c:1.87.8.1	Tue Oct 24 08:47:24 2017
+++ src/sys/netinet/in_gif.c	Sun Dec 10 09:41:31 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: in_gif.c,v 1.87.8.1 2017/10/24 08:47:24 snj Exp $	*/
+/*	$NetBSD: in_gif.c,v 1.87.8.2 2017/12/10 09:41:31 snj Exp $	*/
 /*	$KAME: in_gif.c,v 1.66 2001/07/29 04:46:09 itojun Exp $	*/
 
 /*
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: in_gif.c,v 1.87.8.1 2017/10/24 08:47:24 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in_gif.c,v 1.87.8.2 2017/12/10 09:41:31 snj Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -195,19 +195,18 @@ in_gif_output(struct ifnet *ifp, int fam
 }
 
 void
-in_gif_input(struct mbuf *m, int off, int proto)
+in_gif_input(struct mbuf *m, int off, int proto, void *eparg)
 {
-	struct ifnet *gifp = NULL;
+	struct ifnet 

CVS commit: [netbsd-8] src/sys/compat/common

2017-12-10 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sun Dec 10 09:36:36 UTC 2017

Modified Files:
src/sys/compat/common [netbsd-8]: vfs_syscalls_12.c vfs_syscalls_43.c

Log Message:
Pull up following revision(s) (requested by christos in ticket #418):
sys/compat/common/vfs_syscalls_12.c: revision 1.35
sys/compat/common/vfs_syscalls_43.c: revision 1.62
Make code look the same, in particular zero out the rest of the directory
record.


To generate a diff of this commit:
cvs rdiff -u -r1.33.8.1 -r1.33.8.2 src/sys/compat/common/vfs_syscalls_12.c
cvs rdiff -u -r1.59.8.1 -r1.59.8.2 src/sys/compat/common/vfs_syscalls_43.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/vfs_syscalls_12.c
diff -u src/sys/compat/common/vfs_syscalls_12.c:1.33.8.1 src/sys/compat/common/vfs_syscalls_12.c:1.33.8.2
--- src/sys/compat/common/vfs_syscalls_12.c:1.33.8.1	Wed Aug  9 05:12:18 2017
+++ src/sys/compat/common/vfs_syscalls_12.c	Sun Dec 10 09:36:36 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_syscalls_12.c,v 1.33.8.1 2017/08/09 05:12:18 snj Exp $	*/
+/*	$NetBSD: vfs_syscalls_12.c,v 1.33.8.2 2017/12/10 09:36:36 snj Exp $	*/
 
 /*
  * Copyright (c) 1989, 1993
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_12.c,v 1.33.8.1 2017/08/09 05:12:18 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_12.c,v 1.33.8.2 2017/12/10 09:36:36 snj Exp $");
 
 #include 
 #include 
@@ -183,6 +183,10 @@ again:
 off += reclen;
 			continue;
 		}
+		if (bdp->d_namlen >= sizeof(idb.d_name))
+			idb.d_namlen = sizeof(idb.d_name) - 1;
+		else
+			idb.d_namlen = bdp->d_namlen;
 		old_reclen = _DIRENT_RECLEN(, bdp->d_namlen);
 		if (reclen > len || resid < old_reclen) {
 			/* entry too big for buffer, so just stop */
@@ -197,9 +201,9 @@ again:
 		idb.d_fileno = (uint32_t)bdp->d_fileno;
 		idb.d_reclen = (uint16_t)old_reclen;
 		idb.d_type = (uint8_t)bdp->d_type;
-		idb.d_namlen = (uint8_t)bdp->d_namlen;
-		memcpy(idb.d_name, bdp->d_name, MIN(sizeof(idb.d_name),
-		bdp->d_namlen));
+		(void)memcpy(idb.d_name, bdp->d_name, idb.d_namlen);
+		memset(idb.d_name + idb.d_namlen, 0,
+		idb.d_reclen - _DIRENT_NAMEOFF() - idb.d_namlen);
 		if ((error = copyout(, outp, old_reclen)))
 			goto out;
 		/* advance past this real entry */

Index: src/sys/compat/common/vfs_syscalls_43.c
diff -u src/sys/compat/common/vfs_syscalls_43.c:1.59.8.1 src/sys/compat/common/vfs_syscalls_43.c:1.59.8.2
--- src/sys/compat/common/vfs_syscalls_43.c:1.59.8.1	Wed Aug  9 05:12:18 2017
+++ src/sys/compat/common/vfs_syscalls_43.c	Sun Dec 10 09:36:36 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_syscalls_43.c,v 1.59.8.1 2017/08/09 05:12:18 snj Exp $	*/
+/*	$NetBSD: vfs_syscalls_43.c,v 1.59.8.2 2017/12/10 09:36:36 snj Exp $	*/
 
 /*
  * Copyright (c) 1989, 1993
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_43.c,v 1.59.8.1 2017/08/09 05:12:18 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_43.c,v 1.59.8.2 2017/12/10 09:36:36 snj Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -463,6 +463,10 @@ again:
 off += reclen;
 			continue;
 		}
+		if (bdp->d_namlen >= sizeof(idb.d_name))
+			idb.d_namlen = sizeof(idb.d_name) - 1;
+		else
+			idb.d_namlen = bdp->d_namlen;
 		old_reclen = _DIRENT_RECLEN(, bdp->d_namlen);
 		if (reclen > len || resid < old_reclen) {
 			/* entry too big for buffer, so just stop */
@@ -476,9 +480,10 @@ again:
 		 */
 		idb.d_fileno = (uint32_t)bdp->d_fileno;
 		idb.d_reclen = (uint16_t)old_reclen;
-		idb.d_namlen = (uint16_t)bdp->d_namlen;
-		memcpy(idb.d_name, bdp->d_name, MIN(sizeof(idb.d_name),
-		idb.d_namlen));
+		idb.d_fileno = (uint32_t)bdp->d_fileno;
+		(void)memcpy(idb.d_name, bdp->d_name, idb.d_namlen);
+		memset(idb.d_name + idb.d_namlen, 0,
+		idb.d_reclen - _DIRENT_NAMEOFF() - idb.d_namlen);
 		if ((error = copyout(, outp, old_reclen)))
 			goto out;
 		/* advance past this real entry */



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

2017-12-10 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sun Dec 10 09:35:04 UTC 2017

Modified Files:
src/sys/kern [netbsd-8]: kern_lwp.c

Log Message:
Pull up following revision(s) (requested by christos in ticket #417):
sys/kern/kern_lwp.c: revision 1.191
Also wait interruptibly when exiting. Avoids deadlocked on exit processes
create by golang.


To generate a diff of this commit:
cvs rdiff -u -r1.189 -r1.189.2.1 src/sys/kern/kern_lwp.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/kern_lwp.c
diff -u src/sys/kern/kern_lwp.c:1.189 src/sys/kern/kern_lwp.c:1.189.2.1
--- src/sys/kern/kern_lwp.c:1.189	Thu Jun  1 02:45:13 2017
+++ src/sys/kern/kern_lwp.c	Sun Dec 10 09:35:03 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_lwp.c,v 1.189 2017/06/01 02:45:13 chs Exp $	*/
+/*	$NetBSD: kern_lwp.c,v 1.189.2.1 2017/12/10 09:35:03 snj Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2006, 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -211,7 +211,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_lwp.c,v 1.189 2017/06/01 02:45:13 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_lwp.c,v 1.189.2.1 2017/12/10 09:35:03 snj Exp $");
 
 #include "opt_ddb.h"
 #include "opt_lockdebug.h"
@@ -645,8 +645,9 @@ lwp_wait(struct lwp *l, lwpid_t lid, lwp
 		 */
 		if (exiting) {
 			KASSERT(p->p_nlwps > 1);
-			cv_wait(>p_lwpcv, p->p_lock);
-			error = EAGAIN;
+			error = cv_wait_sig(>p_lwpcv, p->p_lock);
+			if (error == 0)
+error = EAGAIN;
 			break;
 		}
 



CVS commit: src/sys/netinet6

2017-12-10 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sun Dec 10 09:06:47 UTC 2017

Modified Files:
src/sys/netinet6: ip6_flow.c

Log Message:
Fix use-after-free: if m_pullup fails the (freed) mbuf is pushed on the
ip6_pktq queue and re-processed later. Return 1 to say "processed and
freed".


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/netinet6/ip6_flow.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/netinet6/ip6_flow.c
diff -u src/sys/netinet6/ip6_flow.c:1.35 src/sys/netinet6/ip6_flow.c:1.36
--- src/sys/netinet6/ip6_flow.c:1.35	Fri Nov 17 07:37:12 2017
+++ src/sys/netinet6/ip6_flow.c	Sun Dec 10 09:06:46 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip6_flow.c,v 1.35 2017/11/17 07:37:12 ozaki-r Exp $	*/
+/*	$NetBSD: ip6_flow.c,v 1.36 2017/12/10 09:06:46 maxv Exp $	*/
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ip6_flow.c,v 1.35 2017/11/17 07:37:12 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip6_flow.c,v 1.36 2017/12/10 09:06:46 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -285,12 +285,8 @@ ip6flow_fastforward(struct mbuf **mp)
 
 	if (IP6_HDR_ALIGNED_P(mtod(m, const void *)) == 0) {
 		if ((m = m_copyup(m, sizeof(struct ip6_hdr),
-(max_linkhdr + 3) & ~3)) == NULL) {
-			goto out;
-		}
-		*mp = m;
-	} else if (__predict_false(m->m_len < sizeof(struct ip6_hdr))) {
-		if ((m = m_pullup(m, sizeof(struct ip6_hdr))) == NULL) {
+		(max_linkhdr + 3) & ~3)) == NULL) {
+			ret = 1;
 			goto out;
 		}
 		*mp = m;



CVS commit: src/sys/net80211

2017-12-10 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sun Dec 10 08:56:24 UTC 2017

Modified Files:
src/sys/net80211: ieee80211_crypto.c ieee80211_crypto.h
ieee80211_input.c

Log Message:
Fix use-after-free: ieee80211_crypto_decap does a pullup on the mbuf but
the updated pointer is not passed back. Looks like it is triggerable
remotely.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/net80211/ieee80211_crypto.c
cvs rdiff -u -r1.11 -r1.12 src/sys/net80211/ieee80211_crypto.h
cvs rdiff -u -r1.90 -r1.91 src/sys/net80211/ieee80211_input.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/net80211/ieee80211_crypto.c
diff -u src/sys/net80211/ieee80211_crypto.c:1.17 src/sys/net80211/ieee80211_crypto.c:1.18
--- src/sys/net80211/ieee80211_crypto.c:1.17	Mon Aug 24 22:21:26 2015
+++ src/sys/net80211/ieee80211_crypto.c	Sun Dec 10 08:56:23 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ieee80211_crypto.c,v 1.17 2015/08/24 22:21:26 pooka Exp $	*/
+/*	$NetBSD: ieee80211_crypto.c,v 1.18 2017/12/10 08:56:23 maxv Exp $	*/
 /*-
  * Copyright (c) 2001 Atsushi Onoe
  * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting
@@ -36,7 +36,7 @@
 __FBSDID("$FreeBSD: src/sys/net80211/ieee80211_crypto.c,v 1.12 2005/08/08 18:46:35 sam Exp $");
 #endif
 #ifdef __NetBSD__
-__KERNEL_RCSID(0, "$NetBSD: ieee80211_crypto.c,v 1.17 2015/08/24 22:21:26 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ieee80211_crypto.c,v 1.18 2017/12/10 08:56:23 maxv Exp $");
 #endif
 
 #ifdef _KERNEL_OPT
@@ -565,7 +565,7 @@ ieee80211_crypto_encap(struct ieee80211c
  */
 struct ieee80211_key *
 ieee80211_crypto_decap(struct ieee80211com *ic,
-	struct ieee80211_node *ni, struct mbuf *m, int hdrlen)
+	struct ieee80211_node *ni, struct mbuf **mp, int hdrlen)
 {
 #define	IEEE80211_WEP_HDRLEN	(IEEE80211_WEP_IVLEN + IEEE80211_WEP_KIDLEN)
 #define	IEEE80211_WEP_MINLEN \
@@ -574,6 +574,7 @@ ieee80211_crypto_decap(struct ieee80211c
 	struct ieee80211_key *k;
 	struct ieee80211_frame *wh;
 	const struct ieee80211_cipher *cip;
+	struct mbuf *m = *mp;
 	u_int8_t keyid;
 
 	/* NB: this minimum size data frame could be bigger */
@@ -605,6 +606,7 @@ ieee80211_crypto_decap(struct ieee80211c
 	cip = k->wk_cipher;
 	if (m->m_len < hdrlen + cip->ic_header &&
 	(m = m_pullup(m, hdrlen + cip->ic_header)) == NULL) {
+		*mp = NULL;
 		IEEE80211_DPRINTF(ic, IEEE80211_MSG_CRYPTO,
 		"[%s] unable to pullup %s header\n",
 		ether_sprintf(wh->i_addr2), cip->ic_name);

Index: src/sys/net80211/ieee80211_crypto.h
diff -u src/sys/net80211/ieee80211_crypto.h:1.11 src/sys/net80211/ieee80211_crypto.h:1.12
--- src/sys/net80211/ieee80211_crypto.h:1.11	Sat Jan  3 03:43:23 2009
+++ src/sys/net80211/ieee80211_crypto.h	Sun Dec 10 08:56:23 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ieee80211_crypto.h,v 1.11 2009/01/03 03:43:23 yamt Exp $	*/
+/*	$NetBSD: ieee80211_crypto.h,v 1.12 2017/12/10 08:56:23 maxv Exp $	*/
 /*-
  * Copyright (c) 2001 Atsushi Onoe
  * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting
@@ -181,7 +181,7 @@ int	ieee80211_crypto_available(u_int cip
 struct ieee80211_key *ieee80211_crypto_encap(struct ieee80211com *,
 		struct ieee80211_node *, struct mbuf *);
 struct ieee80211_key *ieee80211_crypto_decap(struct ieee80211com *,
-		struct ieee80211_node *, struct mbuf *, int);
+		struct ieee80211_node *, struct mbuf **, int);
 
 /*
  * Check and remove any MIC.

Index: src/sys/net80211/ieee80211_input.c
diff -u src/sys/net80211/ieee80211_input.c:1.90 src/sys/net80211/ieee80211_input.c:1.91
--- src/sys/net80211/ieee80211_input.c:1.90	Sun Dec 10 08:48:15 2017
+++ src/sys/net80211/ieee80211_input.c	Sun Dec 10 08:56:23 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ieee80211_input.c,v 1.90 2017/12/10 08:48:15 maxv Exp $	*/
+/*	$NetBSD: ieee80211_input.c,v 1.91 2017/12/10 08:56:23 maxv Exp $	*/
 /*-
  * Copyright (c) 2001 Atsushi Onoe
  * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting
@@ -36,7 +36,7 @@
 __FBSDID("$FreeBSD: src/sys/net80211/ieee80211_input.c,v 1.81 2005/08/10 16:22:29 sam Exp $");
 #endif
 #ifdef __NetBSD__
-__KERNEL_RCSID(0, "$NetBSD: ieee80211_input.c,v 1.90 2017/12/10 08:48:15 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ieee80211_input.c,v 1.91 2017/12/10 08:56:23 maxv Exp $");
 #endif
 
 #ifdef _KERNEL_OPT
@@ -454,7 +454,7 @@ ieee80211_input(struct ieee80211com *ic,
 IEEE80211_NODE_STAT(ni, rx_noprivacy);
 goto out;
 			}
-			key = ieee80211_crypto_decap(ic, ni, m, hdrspace);
+			key = ieee80211_crypto_decap(ic, ni, , hdrspace);
 			if (key == NULL) {
 /* NB: stats+msgs handled in crypto_decap */
 IEEE80211_NODE_STAT(ni, rx_wepfail);
@@ -595,7 +595,7 @@ ieee80211_input(struct ieee80211com *ic,
 goto out;
 			}
 			hdrspace = ieee80211_hdrspace(ic, wh);
-			key = ieee80211_crypto_decap(ic, ni, m, hdrspace);
+			key = ieee80211_crypto_decap(ic, ni, , hdrspace);
 			if (key == NULL) {
 /* NB: stats+msgs handled in crypto_decap */

CVS commit: src/sys/net80211

2017-12-10 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sun Dec 10 08:48:15 UTC 2017

Modified Files:
src/sys/net80211: ieee80211_input.c

Log Message:
Update the pointer after m_pullup, otherwise possible use-after-free.


To generate a diff of this commit:
cvs rdiff -u -r1.89 -r1.90 src/sys/net80211/ieee80211_input.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/net80211/ieee80211_input.c
diff -u src/sys/net80211/ieee80211_input.c:1.89 src/sys/net80211/ieee80211_input.c:1.90
--- src/sys/net80211/ieee80211_input.c:1.89	Tue Sep 26 07:42:06 2017
+++ src/sys/net80211/ieee80211_input.c	Sun Dec 10 08:48:15 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ieee80211_input.c,v 1.89 2017/09/26 07:42:06 knakahara Exp $	*/
+/*	$NetBSD: ieee80211_input.c,v 1.90 2017/12/10 08:48:15 maxv Exp $	*/
 /*-
  * Copyright (c) 2001 Atsushi Onoe
  * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting
@@ -36,7 +36,7 @@
 __FBSDID("$FreeBSD: src/sys/net80211/ieee80211_input.c,v 1.81 2005/08/10 16:22:29 sam Exp $");
 #endif
 #ifdef __NetBSD__
-__KERNEL_RCSID(0, "$NetBSD: ieee80211_input.c,v 1.89 2017/09/26 07:42:06 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ieee80211_input.c,v 1.90 2017/12/10 08:48:15 maxv Exp $");
 #endif
 
 #ifdef _KERNEL_OPT
@@ -358,6 +358,8 @@ ieee80211_input(struct ieee80211com *ic,
 			ic->ic_stats.is_rx_tooshort++;
 			goto out;		/* XXX */
 		}
+		wh = mtod(m, struct ieee80211_frame *);
+
 		switch (ic->ic_opmode) {
 		case IEEE80211_M_STA:
 			if (dir != IEEE80211_FC1_DIR_FROMDS) {