CVS commit: src/sys/netinet

2018-04-23 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Tue Apr 24 01:32:30 UTC 2018

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

Log Message:
Fix sys/netinet/in.c:r1.229 problem. I have missed FALLTHROUGH, sorry.


To generate a diff of this commit:
cvs rdiff -u -r1.229 -r1.230 src/sys/netinet/in.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.c
diff -u src/sys/netinet/in.c:1.229 src/sys/netinet/in.c:1.230
--- src/sys/netinet/in.c:1.229	Fri Apr 20 09:56:22 2018
+++ src/sys/netinet/in.c	Tue Apr 24 01:32:30 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: in.c,v 1.229 2018/04/20 09:56:22 knakahara Exp $	*/
+/*	$NetBSD: in.c,v 1.230 2018/04/24 01:32:30 knakahara Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -91,7 +91,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: in.c,v 1.229 2018/04/20 09:56:22 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in.c,v 1.230 2018/04/24 01:32:30 knakahara Exp $");
 
 #include "arp.h"
 
@@ -479,9 +479,14 @@ in_control0(struct socket *so, u_long cm
 		} else if (in_hosteq(ia->ia_addr.sin_addr,
 		   ifra->ifra_addr.sin_addr))
 			hostIsNew = 0;
+		if (ifra->ifra_addr.sin_family != AF_INET) {
+			error = EAFNOSUPPORT;
+			goto out;
+		}
 		/* FALLTHROUGH */
 	case SIOCSIFDSTADDR:
-		if (ifreq_getaddr(cmd, ifr)->sa_family != AF_INET) {
+		if (cmd == SIOCSIFDSTADDR &&
+		ifreq_getaddr(cmd, ifr)->sa_family != AF_INET) {
 			error = EAFNOSUPPORT;
 			goto out;
 		}



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

2018-04-23 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Mon Apr 23 22:53:04 UTC 2018

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

Log Message:
Adjust Xsyscall_svs to not use movq for 64bit immediates either.


To generate a diff of this commit:
cvs rdiff -u -r1.164 -r1.165 src/sys/arch/amd64/amd64/locore.S

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

Modified files:

Index: src/sys/arch/amd64/amd64/locore.S
diff -u src/sys/arch/amd64/amd64/locore.S:1.164 src/sys/arch/amd64/amd64/locore.S:1.165
--- src/sys/arch/amd64/amd64/locore.S:1.164	Sat Apr 21 23:25:01 2018
+++ src/sys/arch/amd64/amd64/locore.S	Mon Apr 23 22:53:04 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.S,v 1.164 2018/04/21 23:25:01 joerg Exp $	*/
+/*	$NetBSD: locore.S,v 1.165 2018/04/23 22:53:04 joerg Exp $	*/
 
 /*
  * Copyright-o-rama!
@@ -1388,8 +1388,8 @@ IDTVEC(\name)
 
 	/* Get the LWP's kernel stack pointer in %rax */
 	.if	\is_svs
-		movq	%rax,SVS_UTLS+UTLS_SCRATCH
-		movq	SVS_UTLS+UTLS_RSP0,%rax
+		movabs	%rax,SVS_UTLS+UTLS_SCRATCH
+		movabs	SVS_UTLS+UTLS_RSP0,%rax
 	.else
 		movq	%rax,CPUVAR(SCRATCH)
 		movq	CPUVAR(CURLWP),%rax
@@ -1407,7 +1407,7 @@ IDTVEC(\name)
 
 	/* Restore %rax */
 	.if	\is_svs
-		movq	SVS_UTLS+UTLS_SCRATCH,%rax
+		movabs	SVS_UTLS+UTLS_SCRATCH,%rax
 	.else
 		movq	CPUVAR(SCRATCH),%rax
 	.endif



CVS commit: src/sys/dev/usb

2018-04-23 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Mon Apr 23 19:55:00 UTC 2018

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

Log Message:
enable code to only trigger usb processing when EINT is set, to
avoid misinterpreting shared interrupt for another device

when clearing USBSTS, actually preserve the bits which spec requires to
preserve, and actually clear bit 1, which should be actually always
cleared to zero by spec

also #ifdef XHCI_DEBUG some unnecessary register reads

this should finally resolve PR kern/53066 also for Martin


To generate a diff of this commit:
cvs rdiff -u -r1.89 -r1.90 src/sys/dev/usb/xhci.c
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/usb/xhcireg.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/usb/xhci.c
diff -u src/sys/dev/usb/xhci.c:1.89 src/sys/dev/usb/xhci.c:1.90
--- src/sys/dev/usb/xhci.c:1.89	Sun Apr 22 07:47:14 2018
+++ src/sys/dev/usb/xhci.c	Mon Apr 23 19:55:00 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: xhci.c,v 1.89 2018/04/22 07:47:14 jdolecek Exp $	*/
+/*	$NetBSD: xhci.c,v 1.90 2018/04/23 19:55:00 jdolecek Exp $	*/
 
 /*
  * Copyright (c) 2013 Jonathan A. Kollasch
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.89 2018/04/22 07:47:14 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.90 2018/04/23 19:55:00 jdolecek Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -1262,24 +1262,36 @@ xhci_intr1(struct xhci_softc * const sc)
 
 	usbsts = xhci_op_read_4(sc, XHCI_USBSTS);
 	DPRINTFN(16, "USBSTS %08jx", usbsts, 0, 0, 0);
-#if 0
-	if ((usbsts & (XHCI_STS_EINT|XHCI_STS_PCD)) == 0) {
+	if ((usbsts & (XHCI_STS_HSE | XHCI_STS_EINT | XHCI_STS_PCD |
+	XHCI_STS_HCE)) == 0) {
+		DPRINTFN(16, "ignored intr not for %s",
+		device_xname(sc->sc_dev), 0, 0, 0);
 		return 0;
 	}
-#endif
-	xhci_op_write_4(sc, XHCI_USBSTS,
-	usbsts & (2|XHCI_STS_EINT|XHCI_STS_PCD)); /* XXX */
+
+	/*
+	 * Clear EINT and other transient flags, to not misenterpret
+	 * next shared interrupt. Also, to avoid race, EINT must be cleared
+	 * before XHCI_IMAN_INTR_PEND is cleared.
+	 */
+	xhci_op_write_4(sc, XHCI_USBSTS, usbsts & XHCI_STS_RSVDP0);
+
+#ifdef XHCI_DEBUG
 	usbsts = xhci_op_read_4(sc, XHCI_USBSTS);
 	DPRINTFN(16, "USBSTS %08jx", usbsts, 0, 0, 0);
+#endif
 
 	iman = xhci_rt_read_4(sc, XHCI_IMAN(0));
 	DPRINTFN(16, "IMAN0 %08jx", iman, 0, 0, 0);
 	iman |= XHCI_IMAN_INTR_PEND;
 	xhci_rt_write_4(sc, XHCI_IMAN(0), iman);
+
+#ifdef XHCI_DEBUG
 	iman = xhci_rt_read_4(sc, XHCI_IMAN(0));
 	DPRINTFN(16, "IMAN0 %08jx", iman, 0, 0, 0);
 	usbsts = xhci_op_read_4(sc, XHCI_USBSTS);
 	DPRINTFN(16, "USBSTS %08jx", usbsts, 0, 0, 0);
+#endif
 
 	return 1;
 }

Index: src/sys/dev/usb/xhcireg.h
diff -u src/sys/dev/usb/xhcireg.h:1.9 src/sys/dev/usb/xhcireg.h:1.10
--- src/sys/dev/usb/xhcireg.h:1.9	Thu Jan 19 16:05:00 2017
+++ src/sys/dev/usb/xhcireg.h	Mon Apr 23 19:55:00 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: xhcireg.h,v 1.9 2017/01/19 16:05:00 skrll Exp $ */
+/* $NetBSD: xhcireg.h,v 1.10 2018/04/23 19:55:00 jdolecek Exp $ */
 
 /*-
  * Copyright (c) 2010 Hans Petter Selasky. All rights reserved.
@@ -106,14 +106,17 @@
 
 #define	XHCI_USBSTS		0x04	/* XHCI status */
 #define	 XHCI_STS_HCH		0x0001	/* RO - Host Controller Halted */
+#define	 XHCI_STS_RSVDZ0	0x0002	/* RsvdZ - 2:2 */
 #define	 XHCI_STS_HSE		0x0004	/* RW - Host System Error */
 #define	 XHCI_STS_EINT		0x0008	/* RW - Event Interrupt */
 #define	 XHCI_STS_PCD		0x0010	/* RW - Port Change Detect */
+#define	 XHCI_STS_RSVDZ1	__BITS(5, 7)	/* RsvdZ - 5:7 */
 #define	 XHCI_STS_SSS		0x0100	/* RO - Save State Status */
 #define	 XHCI_STS_RSS		0x0200	/* RO - Restore State Status */
 #define	 XHCI_STS_SRE		0x0400	/* RW - Save/Restore Error */
 #define	 XHCI_STS_CNR		0x0800	/* RO - Controller Not Ready */
 #define	 XHCI_STS_HCE		0x1000	/* RO - Host Controller Error */
+#define	 XHCI_STS_RSVDP0	__BITS(13, 31)	/* RsvdP - 13:31 */
 
 #define	XHCI_PAGESIZE		0x08	/* XHCI page size mask */
 #define	 XHCI_PAGESIZE_4K	0x0001	/* 4K Page Size */



CVS commit: src/usr.sbin/traceroute6

2018-04-23 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Mon Apr 23 18:59:03 UTC 2018

Modified Files:
src/usr.sbin/traceroute6: traceroute6.c

Log Message:
Clean up the IPsec ifdefs, same as ping6.


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 src/usr.sbin/traceroute6/traceroute6.c

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

Modified files:

Index: src/usr.sbin/traceroute6/traceroute6.c
diff -u src/usr.sbin/traceroute6/traceroute6.c:1.50 src/usr.sbin/traceroute6/traceroute6.c:1.51
--- src/usr.sbin/traceroute6/traceroute6.c:1.50	Mon Apr 23 10:23:38 2018
+++ src/usr.sbin/traceroute6/traceroute6.c	Mon Apr 23 18:59:03 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: traceroute6.c,v 1.50 2018/04/23 10:23:38 maxv Exp $	*/
+/*	$NetBSD: traceroute6.c,v 1.51 2018/04/23 18:59:03 maxv Exp $	*/
 /*	$KAME: traceroute6.c,v 1.67 2004/01/25 03:24:39 itojun Exp $	*/
 
 /*
@@ -75,7 +75,7 @@ static char sccsid[] = "@(#)traceroute.c
 #else
 #include 
 #ifndef lint
-__RCSID("$NetBSD: traceroute6.c,v 1.50 2018/04/23 10:23:38 maxv Exp $");
+__RCSID("$NetBSD: traceroute6.c,v 1.51 2018/04/23 18:59:03 maxv Exp $");
 #endif
 #endif
 
@@ -312,10 +312,8 @@ static u_char	packet[512];		/* last inbo
 static struct opacket	*outpacket;	/* last output (udp) packet */
 
 static ssize_t	wait_for_reply(int, struct msghdr *);
-#ifdef IPSEC
-#ifdef IPSEC_POLICY_IPSEC
-static int	setpolicy(int so, const char *policy);
-#endif
+#if defined(IPSEC) && defined(IPSEC_POLICY_IPSEC)
+static int	setpolicy(int, const char *);
 #endif
 static void send_probe(int, u_long);
 static struct udphdr *get_udphdr(struct ip6_hdr *, u_char *);
@@ -555,38 +553,13 @@ main(int argc, char *argv[])
 	if (options & SO_DONTROUTE)
 		(void) setsockopt(rcvsock, SOL_SOCKET, SO_DONTROUTE,
 		(char *)&on, sizeof(on));
-#ifdef IPSEC
-#ifdef IPSEC_POLICY_IPSEC
-	/*
-	 * do not raise error even if setsockopt fails, kernel may have ipsec
-	 * turned off.
-	 */
+
+#if defined(IPSEC) && defined(IPSEC_POLICY_IPSEC)
 	if (setpolicy(rcvsock, "in bypass") < 0)
 		errx(1, "%s", ipsec_strerror());
 	if (setpolicy(rcvsock, "out bypass") < 0)
 		errx(1, "%s", ipsec_strerror());
-#else
-{
-	int level = IPSEC_LEVEL_NONE;
-
-	(void)setsockopt(rcvsock, IPPROTO_IPV6, IPV6_ESP_TRANS_LEVEL, &level,
-	sizeof(level));
-	(void)setsockopt(rcvsock, IPPROTO_IPV6, IPV6_ESP_NETWORK_LEVEL, &level,
-	sizeof(level));
-#ifdef IP_AUTH_TRANS_LEVEL
-	(void)setsockopt(rcvsock, IPPROTO_IPV6, IPV6_AUTH_TRANS_LEVEL, &level,
-	sizeof(level));
-#else
-	(void)setsockopt(rcvsock, IPPROTO_IPV6, IPV6_AUTH_LEVEL, &level,
-	sizeof(level));
-#endif
-#ifdef IP_AUTH_NETWORK_LEVEL
-	(void)setsockopt(rcvsock, IPPROTO_IPV6, IPV6_AUTH_NETWORK_LEVEL, &level,
-	sizeof(level));
 #endif
-}
-#endif /*IPSEC_POLICY_IPSEC*/
-#endif /*IPSEC*/
 
 	/*
 	 * Send UDP or ICMP
@@ -597,12 +570,12 @@ main(int argc, char *argv[])
 		if ((sndsock = socket(AF_INET6, SOCK_DGRAM, 0)) < 0)
 			err(5, "socket(SOCK_DGRAM)");
 	}
-#ifdef SO_SNDBUF
+
 	i = datalen;
 	if (setsockopt(sndsock, SOL_SOCKET, SO_SNDBUF, (char *)&i,
 	sizeof(i)) < 0)
 		err(6, "setsockopt(SO_SNDBUF)");
-#endif /* SO_SNDBUF */
+
 	if (options & SO_DEBUG)
 		(void) setsockopt(sndsock, SOL_SOCKET, SO_DEBUG,
 		(char *)&on, sizeof(on));
@@ -610,38 +583,12 @@ main(int argc, char *argv[])
 		(void) setsockopt(sndsock, SOL_SOCKET, SO_DONTROUTE,
 		(char *)&on, sizeof(on));
 
-#ifdef IPSEC
-#ifdef IPSEC_POLICY_IPSEC
-	/*
-	 * do not raise error even if setsockopt fails, kernel may have ipsec
-	 * turned off.
-	 */
+#if defined(IPSEC) && defined(IPSEC_POLICY_IPSEC)
 	if (setpolicy(sndsock, "in bypass") < 0)
 		errx(1, "%s", ipsec_strerror());
 	if (setpolicy(sndsock, "out bypass") < 0)
 		errx(1, "%s", ipsec_strerror());
-#else
-{
-	int level = IPSEC_LEVEL_BYPASS;
-
-	(void)setsockopt(sndsock, IPPROTO_IPV6, IPV6_ESP_TRANS_LEVEL, &level,
-	sizeof(level));
-	(void)setsockopt(sndsock, IPPROTO_IPV6, IPV6_ESP_NETWORK_LEVEL, &level,
-	sizeof(level));
-#ifdef IP_AUTH_TRANS_LEVEL
-	(void)setsockopt(sndsock, IPPROTO_IPV6, IPV6_AUTH_TRANS_LEVEL, &level,
-	sizeof(level));
-#else
-	(void)setsockopt(sndsock, IPPROTO_IPV6, IPV6_AUTH_LEVEL, &level,
-	sizeof(level));
 #endif
-#ifdef IP_AUTH_NETWORK_LEVEL
-	(void)setsockopt(sndsock, IPPROTO_IPV6, IPV6_AUTH_NETWORK_LEVEL, &level,
-	sizeof(level));
-#endif
-}
-#endif /*IPSEC_POLICY_IPSEC*/
-#endif /*IPSEC*/
 
 	/*
 	 * Source selection
@@ -832,13 +779,16 @@ wait_for_reply(int sock, struct msghdr *
 #endif
 }
 
-#ifdef IPSEC
-#ifdef IPSEC_POLICY_IPSEC
+#if defined(IPSEC) && defined(IPSEC_POLICY_IPSEC)
 static int
 setpolicy(int so, const char *policy)
 {
 	char *buf;
 
+	/*
+	 * do not raise error even if setsockopt fails, kernel may have ipsec
+	 * turned off.
+	 */
 	buf = ipsec_set_policy(policy, strlen(policy));
 	if (buf == NULL) {
 		warnx("%s", ipsec_strerror());
@@ -852,7 +802,6 @@ setpolicy(int so, con

CVS commit: src/sbin/ping6

2018-04-23 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Mon Apr 23 18:48:30 UTC 2018

Modified Files:
src/sbin/ping6: ping6.c

Log Message:
Remove double include and unused macros.


To generate a diff of this commit:
cvs rdiff -u -r1.100 -r1.101 src/sbin/ping6/ping6.c

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

Modified files:

Index: src/sbin/ping6/ping6.c
diff -u src/sbin/ping6/ping6.c:1.100 src/sbin/ping6/ping6.c:1.101
--- src/sbin/ping6/ping6.c:1.100	Mon Apr 23 18:44:39 2018
+++ src/sbin/ping6/ping6.c	Mon Apr 23 18:48:30 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ping6.c,v 1.100 2018/04/23 18:44:39 maxv Exp $	*/
+/*	$NetBSD: ping6.c,v 1.101 2018/04/23 18:48:30 maxv Exp $	*/
 /*	$KAME: ping6.c,v 1.164 2002/11/16 14:05:37 itojun Exp $	*/
 
 /*
@@ -77,7 +77,7 @@ static char sccsid[] = "@(#)ping.c	8.1 (
 #else
 #include 
 #ifndef lint
-__RCSID("$NetBSD: ping6.c,v 1.100 2018/04/23 18:44:39 maxv Exp $");
+__RCSID("$NetBSD: ping6.c,v 1.101 2018/04/23 18:48:30 maxv Exp $");
 #endif
 #endif
 
@@ -133,7 +133,6 @@ __RCSID("$NetBSD: ping6.c,v 1.100 2018/0
 #include 
 
 #ifdef IPSEC
-#include 
 #include 
 #endif
 
@@ -168,7 +167,6 @@ struct tv32 {
 #define	F_INTERVAL	0x0002
 #define	F_PINGFILLED	0x0008
 #define	F_QUIET		0x0010
-#define	F_RROUTE	0x0020
 #define	F_SO_DEBUG	0x0040
 #define	F_VERBOSE	0x0100
 #if defined(IPSEC) && defined(IPSEC_POLICY_IPSEC)
@@ -182,17 +180,12 @@ struct tv32 {
 #define F_FQDNOLD	0x2
 #define F_NIGROUP	0x4
 #define F_SUPTYPES	0x8
-#define F_NOMINMTU	0x10
 #define F_ONCE		0x20
 #define F_NOUSERDATA	(F_NODEADDR | F_FQDN | F_FQDNOLD | F_SUPTYPES)
 static u_int options;
 
-#define IN6LEN		sizeof(struct in6_addr)
-#define SA6LEN		sizeof(struct sockaddr_in6)
 #define DUMMY_PORT	10101
 
-#define SIN6(s)	((struct sockaddr_in6 *)(s))
-
 /*
  * MAX_DUP_CHK is the number of bits in received table, i.e. the maximum
  * number of received sequence numbers we can keep track of.  Change 128



CVS commit: src/sbin/ping6

2018-04-23 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Mon Apr 23 18:44:39 UTC 2018

Modified Files:
src/sbin/ping6: ping6.8 ping6.c

Log Message:
Remove the "-R" option. It uses IPV6_REACHCONF, but we've never had
this.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sbin/ping6/ping6.8
cvs rdiff -u -r1.99 -r1.100 src/sbin/ping6/ping6.c

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

Modified files:

Index: src/sbin/ping6/ping6.8
diff -u src/sbin/ping6/ping6.8:1.32 src/sbin/ping6/ping6.8:1.33
--- src/sbin/ping6/ping6.8:1.32	Mon Apr 23 07:25:36 2018
+++ src/sbin/ping6/ping6.8	Mon Apr 23 18:44:39 2018
@@ -1,4 +1,4 @@
-.\"	$NetBSD: ping6.8,v 1.32 2018/04/23 07:25:36 wiz Exp $
+.\"	$NetBSD: ping6.8,v 1.33 2018/04/23 18:44:39 maxv Exp $
 .\"	$KAME: ping6.8,v 1.57 2002/05/26 13:18:25 itojun Exp $
 .\"
 .\" Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -37,7 +37,7 @@
 .Sh SYNOPSIS
 .Nm ping6
 .\" without IPsec, or new IPsec
-.Op Fl dfHmnNoqRtvwW
+.Op Fl dfHmnNoqtvwW
 .\" old IPsec
 .\" .Op Fl AdEfnNqRtvwW
 .Op Fl a Ar addrtype
@@ -207,13 +207,6 @@ ones.
 Quiet output.
 Nothing is displayed except the summary lines at startup time and
 when finished.
-.It Fl R
-Make the kernel believe that the target
-.Ar host
-is reachable, by injecting upper-layer reachability confirmation hint.
-The option is meaningful only if the target
-.Ar host
-is a neighbor.
 .It Fl S Ar sourceaddr
 Specifies the source address of request packets.
 The source address must be one of the unicast addresses of the sending node,

Index: src/sbin/ping6/ping6.c
diff -u src/sbin/ping6/ping6.c:1.99 src/sbin/ping6/ping6.c:1.100
--- src/sbin/ping6/ping6.c:1.99	Mon Apr 23 18:37:19 2018
+++ src/sbin/ping6/ping6.c	Mon Apr 23 18:44:39 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ping6.c,v 1.99 2018/04/23 18:37:19 maxv Exp $	*/
+/*	$NetBSD: ping6.c,v 1.100 2018/04/23 18:44:39 maxv Exp $	*/
 /*	$KAME: ping6.c,v 1.164 2002/11/16 14:05:37 itojun Exp $	*/
 
 /*
@@ -77,7 +77,7 @@ static char sccsid[] = "@(#)ping.c	8.1 (
 #else
 #include 
 #ifndef lint
-__RCSID("$NetBSD: ping6.c,v 1.99 2018/04/23 18:37:19 maxv Exp $");
+__RCSID("$NetBSD: ping6.c,v 1.100 2018/04/23 18:44:39 maxv Exp $");
 #endif
 #endif
 
@@ -178,9 +178,6 @@ struct tv32 {
 #define F_FQDN		0x1000
 #define F_INTERFACE	0x2000
 #define F_SRCADDR	0x4000
-#ifdef IPV6_REACHCONF
-#define F_REACHCONF	0x8000
-#endif
 #define F_HOSTNAME	0x1
 #define F_FQDNOLD	0x2
 #define F_NIGROUP	0x4
@@ -325,7 +322,7 @@ main(int argc, char *argv[])
 		err(EXIT_FAILURE, "init failed");
 
 	while ((ch = getopt(argc, argv,
-	"a:b:c:dfHg:h:I:i:l:mnNop:qRS:s:tvwWx:X:" ADDOPTS)) != -1) {
+	"a:b:c:dfHg:h:I:i:l:mnNop:qS:s:tvwWx:X:" ADDOPTS)) != -1) {
 #undef ADDOPTS
 		switch (ch) {
 		case 'a':
@@ -484,13 +481,6 @@ main(int argc, char *argv[])
 		case 'q':
 			options |= F_QUIET;
 			break;
-		case 'R':
-#ifdef IPV6_REACHCONF
-			options |= F_REACHCONF;
-			break;
-#else
-			errx(1, "-R is not supported in this configuration");
-#endif
 		case 'S':
 			memset(&hints, 0, sizeof(struct addrinfo));
 			hints.ai_flags = AI_NUMERICHOST; /* allow hostname? */
@@ -778,11 +768,6 @@ main(int argc, char *argv[])
 	if (hoplimit != -1)
 		ip6optlen += CMSG_SPACE(sizeof(int));
 
-#ifdef IPV6_REACHCONF
-	if (options & F_REACHCONF)
-		ip6optlen += CMSG_SPACE(0);
-#endif
-
 	/* set IP6 packet options */
 	if (ip6optlen) {
 		if ((scmsg = (char *)malloc(ip6optlen)) == 0)
@@ -819,15 +804,6 @@ main(int argc, char *argv[])
 
 		scmsgp = CMSG_NXTHDR(&smsghdr, scmsgp);
 	}
-#ifdef IPV6_REACHCONF
-	if (options & F_REACHCONF) {
-		scmsgp->cmsg_len = CMSG_LEN(0);
-		scmsgp->cmsg_level = IPPROTO_IPV6;
-		scmsgp->cmsg_type = IPV6_REACHCONF;
-
-		scmsgp = CMSG_NXTHDR(&smsghdr, scmsgp);
-	}
-#endif
 
 	if (!(options & F_SRCADDR)) {
 		/*
@@ -2546,14 +2522,9 @@ static void
 usage(void)
 {
 	(void)fprintf(stderr,
-	"usage: ping6 [-"
-	"dfHmNnq"
-#ifdef IPV6_REACHCONF
-	"R"
-#endif
-	"tvWw"
-	"] [-a addrtype] [-b bufsize] [-c count] [-g gateway]\n"
-"\t[-h hoplimit] [-I interface] [-i wait] [-l preload]"
+	"usage: ping6 [-dfHmNnqtvWw] [-a addrtype] [-b bufsize]\n"
+	"\t[-c count] [-g gateway] [-h hoplimit] [-I interface]\n"
+	"\t[-i wait] [-l preload]"
 #if defined(IPSEC) && defined(IPSEC_POLICY_IPSEC)
 	" [-P policy]"
 #endif



CVS commit: src/sbin/ping6

2018-04-23 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Mon Apr 23 18:37:20 UTC 2018

Modified Files:
src/sbin/ping6: ping6.c

Log Message:
Fix usage(), A/E don't exist.


To generate a diff of this commit:
cvs rdiff -u -r1.98 -r1.99 src/sbin/ping6/ping6.c

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

Modified files:

Index: src/sbin/ping6/ping6.c
diff -u src/sbin/ping6/ping6.c:1.98 src/sbin/ping6/ping6.c:1.99
--- src/sbin/ping6/ping6.c:1.98	Mon Apr 23 18:32:18 2018
+++ src/sbin/ping6/ping6.c	Mon Apr 23 18:37:19 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ping6.c,v 1.98 2018/04/23 18:32:18 maxv Exp $	*/
+/*	$NetBSD: ping6.c,v 1.99 2018/04/23 18:37:19 maxv Exp $	*/
 /*	$KAME: ping6.c,v 1.164 2002/11/16 14:05:37 itojun Exp $	*/
 
 /*
@@ -77,7 +77,7 @@ static char sccsid[] = "@(#)ping.c	8.1 (
 #else
 #include 
 #ifndef lint
-__RCSID("$NetBSD: ping6.c,v 1.98 2018/04/23 18:32:18 maxv Exp $");
+__RCSID("$NetBSD: ping6.c,v 1.99 2018/04/23 18:37:19 maxv Exp $");
 #endif
 #endif
 
@@ -2547,13 +2547,7 @@ usage(void)
 {
 	(void)fprintf(stderr,
 	"usage: ping6 [-"
-#if defined(IPSEC) && defined(IPSEC_POLICY_IPSEC)
-	"dfH"
-#else
-	"AdEfH"
-#endif
-	"m"
-	"Nnq"
+	"dfHmNnq"
 #ifdef IPV6_REACHCONF
 	"R"
 #endif



CVS commit: src/sbin/ping6

2018-04-23 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Mon Apr 23 18:32:18 UTC 2018

Modified Files:
src/sbin/ping6: ping6.c

Log Message:
Simplify: remove #ifdefs for constants that are always defined, and
remove their #else's (some of which can't compile, since they use values
that since got removed).


To generate a diff of this commit:
cvs rdiff -u -r1.97 -r1.98 src/sbin/ping6/ping6.c

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

Modified files:

Index: src/sbin/ping6/ping6.c
diff -u src/sbin/ping6/ping6.c:1.97 src/sbin/ping6/ping6.c:1.98
--- src/sbin/ping6/ping6.c:1.97	Mon Apr 23 10:35:20 2018
+++ src/sbin/ping6/ping6.c	Mon Apr 23 18:32:18 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ping6.c,v 1.97 2018/04/23 10:35:20 maxv Exp $	*/
+/*	$NetBSD: ping6.c,v 1.98 2018/04/23 18:32:18 maxv Exp $	*/
 /*	$KAME: ping6.c,v 1.164 2002/11/16 14:05:37 itojun Exp $	*/
 
 /*
@@ -77,7 +77,7 @@ static char sccsid[] = "@(#)ping.c	8.1 (
 #else
 #include 
 #ifndef lint
-__RCSID("$NetBSD: ping6.c,v 1.97 2018/04/23 10:35:20 maxv Exp $");
+__RCSID("$NetBSD: ping6.c,v 1.98 2018/04/23 18:32:18 maxv Exp $");
 #endif
 #endif
 
@@ -171,14 +171,9 @@ struct tv32 {
 #define	F_RROUTE	0x0020
 #define	F_SO_DEBUG	0x0040
 #define	F_VERBOSE	0x0100
-#ifdef IPSEC
-#ifdef IPSEC_POLICY_IPSEC
+#if defined(IPSEC) && defined(IPSEC_POLICY_IPSEC)
 #define	F_POLICY	0x0400
-#else
-#define F_AUTHHDR	0x0200
-#define F_ENCRYPT	0x0400
-#endif /*IPSEC_POLICY_IPSEC*/
-#endif /*IPSEC*/
+#endif
 #define F_NODEADDR	0x0800
 #define F_FQDN		0x1000
 #define F_INTERFACE	0x2000
@@ -282,11 +277,9 @@ static int	 pr_bitrange(u_int32_t, int, 
 static void	 pr_retip(struct ip6_hdr *, u_char *);
 static void	 summary(void);
 static void	 tvsub(struct timeval *, struct timeval *);
-#ifdef IPSEC
-#ifdef IPSEC_POLICY_IPSEC
+#if defined(IPSEC) && defined(IPSEC_POLICY_IPSEC)
 static int	 setpolicy(int, char *);
-#endif	/* IPSEC_POLICY_IPSEC */
-#endif	/* IPSEC */
+#endif
 static char	*nigroup(char *);
 static double	timespec_to_sec(const struct timespec *tp);
 static double	diffsec(struct timespec *, struct timespec *);
@@ -303,10 +296,8 @@ main(int argc, char *argv[])
 	char *e, *target, *ifname = NULL, *gateway = NULL;
 	int ip6optlen = 0;
 	struct cmsghdr *scmsgp = NULL;
-#if defined(SO_SNDBUF) && defined(SO_RCVBUF)
 	u_long lsockbufsize;
 	int sockbufsize = 0;
-#endif
 	int usepktinfo = 0;
 	struct in6_pktinfo *pktinfo = NULL;
 	struct ip6_rthdr *rthdr = NULL;
@@ -315,9 +306,7 @@ main(int argc, char *argv[])
 	char *policy_out = NULL;
 #endif
 	double intval;
-#ifdef IPV6_USE_MIN_MTU
 	int mflag = 0;
-#endif
 
 	/* just to be sure */
 	memset(&smsghdr, 0, sizeof(smsghdr));
@@ -325,14 +314,11 @@ main(int argc, char *argv[])
 
 	preload = 0;
 	datap = &outpack[ICMP6ECHOLEN + ICMP6ECHOTMLEN];
-#ifndef IPSEC
-#define ADDOPTS
-#else
-#ifdef IPSEC_POLICY_IPSEC
+
+#if defined(IPSEC) && defined(IPSEC_POLICY_IPSEC)
 #define ADDOPTS	"P:"
 #else
-#define ADDOPTS	"AE"
-#endif /*IPSEC_POLICY_IPSEC*/
+#define ADDOPTS
 #endif
 
 	if (prog_init && prog_init() == -1)
@@ -386,7 +372,6 @@ main(int argc, char *argv[])
 			break;
 		}
 		case 'b':
-#if defined(SO_SNDBUF) && defined(SO_RCVBUF)
 			errno = 0;
 			e = NULL;
 			lsockbufsize = strtoul(optarg, &e, 10);
@@ -394,10 +379,6 @@ main(int argc, char *argv[])
 			if (errno || !*optarg || *e ||
 			(u_long)sockbufsize != lsockbufsize)
 errx(1, "invalid socket buffer size");
-#else
-			errx(1,
-"-b option ignored: SO_SNDBUF/SO_RCVBUF socket options not supported");
-#endif
 			break;
 		case 'c':
 			l = strtol(optarg, &e, 10);
@@ -485,13 +466,8 @@ main(int argc, char *argv[])
 			preload = l;
 			break;
 		case 'm':
-#ifdef IPV6_USE_MIN_MTU
 			mflag++;
 			break;
-#else
-			errx(1, "-%c is not supported on this platform", ch);
-			/*NOTREACHED*/
-#endif
 		case 'n':
 			options &= ~F_HOSTNAME;
 			break;
@@ -573,8 +549,8 @@ main(int argc, char *argv[])
 errx(EXIT_FAILURE, "Bad/invalid deadline time: "
 "%s", optarg);
 break;
-#ifdef IPSEC
-#ifdef IPSEC_POLICY_IPSEC
+
+#if defined(IPSEC) && defined(IPSEC_POLICY_IPSEC)
 		case 'P':
 			options |= F_POLICY;
 			if (!strncmp("in", optarg, 2)) {
@@ -586,15 +562,7 @@ main(int argc, char *argv[])
 			} else
 errx(1, "invalid security policy");
 			break;
-#else
-		case 'A':
-			options |= F_AUTHHDR;
-			break;
-		case 'E':
-			options |= F_ENCRYPT;
-			break;
-#endif /*IPSEC_POLICY_IPSEC*/
-#endif /*IPSEC*/
+#endif
 		default:
 			usage();
 			/*NOTREACHED*/
@@ -758,34 +726,13 @@ main(int argc, char *argv[])
 			err(1, "setsockopt(IPV6_RECVPATHMTU)");
 	}
 
-#ifdef IPSEC
-#ifdef IPSEC_POLICY_IPSEC
+#if defined(IPSEC) && defined(IPSEC_POLICY_IPSEC)
 	if (options & F_POLICY) {
 		if (setpolicy(s, policy_in) < 0)
 			errx(1, "%s", ipsec_strerror());
 		if (setpolicy(s, policy_out) < 0)
 			errx(1, "%s", ipsec_strerror());
 	}
-#else
-	if (options & F_AUTHHDR) {
-		optval = IPSEC_LEVE

CVS commit: src/sys/kern

2018-04-23 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Apr 23 15:51:00 UTC 2018

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

Log Message:
PR/kern/53202: Kernel hangs running t_ptrace_wait:resume1 test, revert
previous.


To generate a diff of this commit:
cvs rdiff -u -r1.191 -r1.192 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.191 src/sys/kern/kern_lwp.c:1.192
--- src/sys/kern/kern_lwp.c:1.191	Sat Dec  2 17:51:22 2017
+++ src/sys/kern/kern_lwp.c	Mon Apr 23 11:51:00 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_lwp.c,v 1.191 2017/12/02 22:51:22 christos Exp $	*/
+/*	$NetBSD: kern_lwp.c,v 1.192 2018/04/23 15:51:00 christos 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.191 2017/12/02 22:51:22 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_lwp.c,v 1.192 2018/04/23 15:51:00 christos Exp $");
 
 #include "opt_ddb.h"
 #include "opt_lockdebug.h"
@@ -645,9 +645,8 @@ lwp_wait(struct lwp *l, lwpid_t lid, lwp
 		 */
 		if (exiting) {
 			KASSERT(p->p_nlwps > 1);
-			error = cv_wait_sig(&p->p_lwpcv, p->p_lock);
-			if (error == 0)
-error = EAGAIN;
+			cv_wait(&p->p_lwpcv, p->p_lock);
+			error = EAGAIN;
 			break;
 		}
 



CVS commit: src/sys/arch/riscv/riscv

2018-04-23 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Apr 23 15:40:33 UTC 2018

Modified Files:
src/sys/arch/riscv/riscv: db_machdep.c

Log Message:
PR/53206: David Binderman: fix array bounds comparison in KASSERT.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/riscv/riscv/db_machdep.c

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

Modified files:

Index: src/sys/arch/riscv/riscv/db_machdep.c
diff -u src/sys/arch/riscv/riscv/db_machdep.c:1.1 src/sys/arch/riscv/riscv/db_machdep.c:1.2
--- src/sys/arch/riscv/riscv/db_machdep.c:1.1	Sat Mar 28 12:13:56 2015
+++ src/sys/arch/riscv/riscv/db_machdep.c	Mon Apr 23 11:40:33 2018
@@ -29,7 +29,7 @@
 
 #include 
 
-__RCSID("$NetBSD: db_machdep.c,v 1.1 2015/03/28 16:13:56 matt Exp $");
+__RCSID("$NetBSD: db_machdep.c,v 1.2 2018/04/23 15:40:33 christos Exp $");
 
 #include 
 
@@ -86,7 +86,7 @@ int
 db_rw_ddbreg(const struct db_variable *vp, db_expr_t *valp, int rw)
 {
 	struct trapframe * const tf = curcpu()->ci_ddb_regs;
-	KASSERT(db_regs <= vp && vp < db_regs);
+	KASSERT(db_regs <= vp && vp < db_regs + __arraycount(db_regs));
 	const uintptr_t addr = (uintptr_t)tf + (uintptr_t)vp->valuep; 
 	if (vp->modif != NULL && vp->modif[0] == 'i') {
 		if (rw == DB_VAR_GET) {



CVS commit: src/sys/net/npf

2018-04-23 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Apr 23 15:36:30 UTC 2018

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

Log Message:
PR/53207: David Binderman: Use logical and


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/sys/net/npf/npf_nat.c

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

Modified files:

Index: src/sys/net/npf/npf_nat.c
diff -u src/sys/net/npf/npf_nat.c:1.41 src/sys/net/npf/npf_nat.c:1.42
--- src/sys/net/npf/npf_nat.c:1.41	Mon Dec 26 18:05:06 2016
+++ src/sys/net/npf/npf_nat.c	Mon Apr 23 11:36:30 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: npf_nat.c,v 1.41 2016/12/26 23:05:06 christos Exp $	*/
+/*	$NetBSD: npf_nat.c,v 1.42 2018/04/23 15:36:30 christos Exp $	*/
 
 /*-
  * Copyright (c) 2014 Mindaugas Rasiukevicius 
@@ -72,7 +72,7 @@
 
 #ifdef _KERNEL
 #include 
-__KERNEL_RCSID(0, "$NetBSD: npf_nat.c,v 1.41 2016/12/26 23:05:06 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: npf_nat.c,v 1.42 2018/04/23 15:36:30 christos Exp $");
 
 #include 
 #include 
@@ -890,7 +890,7 @@ npf_nat_import(npf_t *npf, prop_dictiona
 	prop_dictionary_get_uint16(natdict, "tport", &nt->nt_tport);
 
 	/* Take a specific port from port-map. */
-	if ((np->n_flags & NPF_NAT_PORTMAP) != 0 && nt->nt_tport &
+	if ((np->n_flags & NPF_NAT_PORTMAP) != 0 && nt->nt_tport &&
 	!npf_nat_takeport(np, nt->nt_tport)) {
 		pool_cache_put(nat_cache, nt);
 		return NULL;



CVS commit: src/external/gpl3/gdb/dist/gdb

2018-04-23 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Apr 23 14:53:07 UTC 2018

Modified Files:
src/external/gpl3/gdb/dist/gdb: amd64-nbsd-tdep.c i386-nbsd-tdep.c

Log Message:
Add "Xhandle*" interrupt handling.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/external/gpl3/gdb/dist/gdb/amd64-nbsd-tdep.c \
src/external/gpl3/gdb/dist/gdb/i386-nbsd-tdep.c

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

Modified files:

Index: src/external/gpl3/gdb/dist/gdb/amd64-nbsd-tdep.c
diff -u src/external/gpl3/gdb/dist/gdb/amd64-nbsd-tdep.c:1.3 src/external/gpl3/gdb/dist/gdb/amd64-nbsd-tdep.c:1.4
--- src/external/gpl3/gdb/dist/gdb/amd64-nbsd-tdep.c:1.3	Wed Nov 29 13:15:29 2017
+++ src/external/gpl3/gdb/dist/gdb/amd64-nbsd-tdep.c	Mon Apr 23 10:53:07 2018
@@ -148,10 +148,21 @@ amd64nbsd_trapframe_cache(struct frame_i
 
   /* There is an extra 'call' in the interrupt sequence - ignore the extra
* return address */
-  if (name && strncmp (name, "Xintr", 5) == 0)
-addr = sp + 8;		/* It's an interrupt frame.  */
-  else
-addr = sp;
+
+  addr = sp;
+  if (name) {
+	if (strncmp (name, "Xintr", 5) == 0
+	 || strncmp (name, "Xhandle", 7) == 0) {
+		addr += 8;		/* It's an interrupt frame.  */
+	}
+  }
+
+#ifdef DEBUG_TRAPFRAME
+  for (i = 0; i < 50; i++) {
+cs = read_memory_unsigned_integer (addr + i * 8, 8, byte_order);
+printf("%s i=%d r=%#jx\n", name, i, (intmax_t)cs);
+  }
+#endif
 
   for (i = 0; i < ARRAY_SIZE (amd64nbsd_tf_reg_offset); i++)
 if (amd64nbsd_tf_reg_offset[i] != -1)
@@ -163,6 +174,10 @@ amd64nbsd_trapframe_cache(struct frame_i
   rip = read_memory_unsigned_integer (addr
 + amd64nbsd_tf_reg_offset[AMD64_RIP_REGNUM], 8, byte_order);
 
+#ifdef DEBUG_TRAPFRAME
+  printf("%s cs=%#jx rip=%#jx\n", name, (intmax_t)cs, (intmax_t)rip);
+#endif
+
   /* The trap frame layout was changed lf the %rip value is less than 2^16 it
* is almost certainly the %ss of the old format. */
   if (rip < (1 << 16))
@@ -243,16 +258,20 @@ amd64nbsd_trapframe_sniffer (const struc
 
   find_pc_partial_function (get_frame_pc (this_frame), &name, NULL, NULL);
   return (name && ((strcmp (name, "alltraps") == 0)
-		   || (strcmp (name, "calltrap") == 0)
-		   || (strncmp (name, "Xtrap", 5) == 0)
-		   || (strcmp (name, "osyscall1") == 0)
-		   || (strcmp (name, "Xsyscall") == 0)
-		   || (strncmp (name, "Xintr", 5) == 0)
-		   || (strncmp (name, "Xresume", 7) == 0)
-		   || (strncmp (name, "Xstray", 6) == 0)
-		   || (strncmp (name, "Xrecurse", 8) == 0)
-		   || (strncmp (name, "Xsoft", 5) == 0)
-		   || (strcmp (name, "Xdoreti") == 0)));
+	|| (strcmp (name, "calltrap") == 0)
+	|| (strcmp (name, "handle_syscall") == 0)
+		|| (strcmp (name, "Xdoreti") == 0)
+		|| (strcmp (name, "Xspllower") == 0)
+		|| (strncmp (name, "Xhandle", 7) == 0)
+		|| (strncmp (name, "Xintr", 5) == 0)
+		|| (strncmp (name, "Xpreempt", 8) == 0)
+		|| (strncmp (name, "Xrecurse", 8) == 0)
+		|| (strncmp (name, "Xresume", 7) == 0)
+		|| (strncmp (name, "Xsoft", 5) == 0)
+		|| (strncmp (name, "Xstray", 6) == 0)
+		|| (strncmp (name, "Xsyscall", 8) == 0)
+		|| (strncmp (name, "Xtrap", 5) == 0)
+	));
 }
 
 static const struct frame_unwind amd64nbsd_trapframe_unwind = {
Index: src/external/gpl3/gdb/dist/gdb/i386-nbsd-tdep.c
diff -u src/external/gpl3/gdb/dist/gdb/i386-nbsd-tdep.c:1.3 src/external/gpl3/gdb/dist/gdb/i386-nbsd-tdep.c:1.4
--- src/external/gpl3/gdb/dist/gdb/i386-nbsd-tdep.c:1.3	Wed Nov 29 13:15:29 2017
+++ src/external/gpl3/gdb/dist/gdb/i386-nbsd-tdep.c	Mon Apr 23 10:53:07 2018
@@ -312,7 +312,8 @@ i386nbsd_trapframe_cache(struct frame_in
   sp = get_frame_register_unsigned (this_frame, I386_ESP_REGNUM);
 
   find_pc_partial_function (func, &name, NULL, NULL);
-  if (name && strncmp (name, "Xintr", 5) == 0)
+  if (name && (strncmp (name, "Xintr", 5) == 0 ||
+   strncmp (name, "Xhandle", 7) == 0))
 {
   /* It's an interrupt frame. */
   tmp = read_memory_unsigned_integer (sp + 4, 4, byte_order);
@@ -391,16 +392,19 @@ i386nbsd_trapframe_sniffer (const struct
 
   find_pc_partial_function (get_frame_pc (this_frame), &name, NULL, NULL);
   return (name && ((strcmp (name, "alltraps") == 0)
-		   || (strcmp (name, "calltrap") == 0)
-		   || (strncmp (name, "Xtrap", 5) == 0)
-		   || (strcmp (name, "syscall1") == 0)
-		   || (strcmp (name, "Xsyscall") == 0)
-		   || (strncmp (name, "Xintr", 5) == 0)
-		   || (strncmp (name, "Xresume", 7) == 0)
-		   || (strncmp (name, "Xstray", 6) == 0)
-		   || (strncmp (name, "Xrecurse", 8) == 0)
-		   || (strncmp (name, "Xsoft", 5) == 0)
-		   || (strncmp (name, "Xdoreti", 5) == 0)));
+	|| (strcmp (name, "calltrap") == 0)
+		|| (strcmp (name, "syscall1") == 0)
+		|| (strcmp (name, "Xdoreti") == 0)
+		|| (strncmp (name, "Xintr", 5) == 0)
+		|| (strncmp (name, "Xhandle", 7) == 0)
+		|| (strncmp (name, "Xpreempt", 8) == 0)
+		|| (strncmp (name, "Xrecurse",

CVS commit: src/sbin/ping6

2018-04-23 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Mon Apr 23 10:35:21 UTC 2018

Modified Files:
src/sbin/ping6: ping6.c

Log Message:
Remove dead/broken code, we want to favor RFC3542 over RFC2292. No
functional change. traceroute6 and rtadvd did the same.


To generate a diff of this commit:
cvs rdiff -u -r1.96 -r1.97 src/sbin/ping6/ping6.c

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

Modified files:

Index: src/sbin/ping6/ping6.c
diff -u src/sbin/ping6/ping6.c:1.96 src/sbin/ping6/ping6.c:1.97
--- src/sbin/ping6/ping6.c:1.96	Mon Apr 23 07:25:36 2018
+++ src/sbin/ping6/ping6.c	Mon Apr 23 10:35:20 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ping6.c,v 1.96 2018/04/23 07:25:36 wiz Exp $	*/
+/*	$NetBSD: ping6.c,v 1.97 2018/04/23 10:35:20 maxv Exp $	*/
 /*	$KAME: ping6.c,v 1.164 2002/11/16 14:05:37 itojun Exp $	*/
 
 /*
@@ -77,7 +77,7 @@ static char sccsid[] = "@(#)ping.c	8.1 (
 #else
 #include 
 #ifndef lint
-__RCSID("$NetBSD: ping6.c,v 1.96 2018/04/23 07:25:36 wiz Exp $");
+__RCSID("$NetBSD: ping6.c,v 1.97 2018/04/23 10:35:20 maxv Exp $");
 #endif
 #endif
 
@@ -681,24 +681,14 @@ main(int argc, char *argv[])
 	if ((options & F_VERBOSE) != 0) {
 		int opton = 1;
 
-#ifdef IPV6_RECVHOPOPTS
 		if (prog_setsockopt(s, IPPROTO_IPV6, IPV6_RECVHOPOPTS, &opton,
 		sizeof(opton)))
 			err(1, "setsockopt(IPV6_RECVHOPOPTS)");
-#else  /* old adv. API */
-		if (prog_setsockopt(s, IPPROTO_IPV6, IPV6_HOPOPTS, &opton,
-		sizeof(opton)))
-			err(1, "setsockopt(IPV6_HOPOPTS)");
-#endif
-#ifdef IPV6_RECVDSTOPTS
+
 		if (prog_setsockopt(s, IPPROTO_IPV6, IPV6_RECVDSTOPTS, &opton,
 		sizeof(opton)))
 			err(1, "setsockopt(IPV6_RECVDSTOPTS)");
-#else  /* old adv. API */
-		if (prog_setsockopt(s, IPPROTO_IPV6, IPV6_DSTOPTS, &opton,
-		sizeof(opton)))
-			err(1, "setsockopt(IPV6_DSTOPTS)");
-#endif
+
 #ifdef IPV6_RECVRTHDRDSTOPTS
 		if (prog_setsockopt(s, IPPROTO_IPV6, IPV6_RECVRTHDRDSTOPTS, &opton,
 		sizeof(opton)))
@@ -754,23 +744,19 @@ main(int argc, char *argv[])
 		if (prog_setsockopt(s, IPPROTO_IPV6, IPV6_MULTICAST_HOPS,
 		&optval, sizeof(optval)) == -1)
 			err(1, "IPV6_MULTICAST_HOPS");
-#ifdef IPV6_USE_MIN_MTU
+
 	if (mflag != 1) {
 		optval = mflag > 1 ? 0 : 1;
 
 		if (prog_setsockopt(s, IPPROTO_IPV6, IPV6_USE_MIN_MTU,
 		&optval, sizeof(optval)) == -1)
 			err(1, "setsockopt(IPV6_USE_MIN_MTU)");
-	}
-#ifdef IPV6_RECVPATHMTU
-	else {
+	} else {
 		optval = 1;
 		if (prog_setsockopt(s, IPPROTO_IPV6, IPV6_RECVPATHMTU,
 		&optval, sizeof(optval)) == -1)
 			err(1, "setsockopt(IPV6_RECVPATHMTU)");
 	}
-#endif /* IPV6_RECVPATHMTU */
-#endif /* IPV6_USE_MIN_MTU */
 
 #ifdef IPSEC
 #ifdef IPSEC_POLICY_IPSEC
@@ -825,15 +811,9 @@ main(int argc, char *argv[])
 	if ((options & F_VERBOSE) != 0) {
 		int opton = 1;
 
-#ifdef IPV6_RECVRTHDR
 		if (prog_setsockopt(s, IPPROTO_IPV6, IPV6_RECVRTHDR, &opton,
 		sizeof(opton)))
 			err(1, "setsockopt(IPV6_RECVRTHDR)");
-#else  /* old adv. API */
-		if (prog_setsockopt(s, IPPROTO_IPV6, IPV6_RTHDR, &opton,
-		sizeof(opton)))
-			err(1, "setsockopt(IPV6_RTHDR)");
-#endif
 	}
 
 /*
@@ -975,25 +955,14 @@ main(int argc, char *argv[])
 
 	optval = 1;
 #ifndef USE_SIN6_SCOPE_ID
-#ifdef IPV6_RECVPKTINFO
 	if (prog_setsockopt(s, IPPROTO_IPV6, IPV6_RECVPKTINFO, &optval,
 	sizeof(optval)) < 0)
 		warn("setsockopt(IPV6_RECVPKTINFO)"); /* XXX err? */
-#else  /* old adv. API */
-	if (prog_setsockopt(s, IPPROTO_IPV6, IPV6_PKTINFO, &optval,
-	sizeof(optval)) < 0)
-		warn("setsockopt(IPV6_PKTINFO)"); /* XXX err? */
 #endif
-#endif /* USE_SIN6_SCOPE_ID */
-#ifdef IPV6_RECVHOPLIMIT
+
 	if (prog_setsockopt(s, IPPROTO_IPV6, IPV6_RECVHOPLIMIT, &optval,
 	sizeof(optval)) < 0)
 		warn("setsockopt(IPV6_RECVHOPLIMIT)"); /* XXX err? */
-#else  /* old adv. API */
-	if (prog_setsockopt(s, IPPROTO_IPV6, IPV6_HOPLIMIT, &optval,
-	sizeof(optval)) < 0)
-		warn("setsockopt(IPV6_HOPLIMIT)"); /* XXX err? */
-#endif
 
 	printf("PING6(%lu=40+8+%lu bytes) ", (unsigned long)(40 + pingerlen()),
 	(unsigned long)(pingerlen() - 8));



CVS commit: src/usr.sbin/traceroute6

2018-04-23 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Mon Apr 23 10:23:38 UTC 2018

Modified Files:
src/usr.sbin/traceroute6: traceroute6.c

Log Message:
... another occurrence of OLDRAWSOCKET ...


To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 src/usr.sbin/traceroute6/traceroute6.c

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

Modified files:

Index: src/usr.sbin/traceroute6/traceroute6.c
diff -u src/usr.sbin/traceroute6/traceroute6.c:1.49 src/usr.sbin/traceroute6/traceroute6.c:1.50
--- src/usr.sbin/traceroute6/traceroute6.c:1.49	Mon Apr 23 10:22:18 2018
+++ src/usr.sbin/traceroute6/traceroute6.c	Mon Apr 23 10:23:38 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: traceroute6.c,v 1.49 2018/04/23 10:22:18 maxv Exp $	*/
+/*	$NetBSD: traceroute6.c,v 1.50 2018/04/23 10:23:38 maxv Exp $	*/
 /*	$KAME: traceroute6.c,v 1.67 2004/01/25 03:24:39 itojun Exp $	*/
 
 /*
@@ -75,7 +75,7 @@ static char sccsid[] = "@(#)traceroute.c
 #else
 #include 
 #ifndef lint
-__RCSID("$NetBSD: traceroute6.c,v 1.49 2018/04/23 10:22:18 maxv Exp $");
+__RCSID("$NetBSD: traceroute6.c,v 1.50 2018/04/23 10:23:38 maxv Exp $");
 #endif
 #endif
 
@@ -1138,15 +1138,9 @@ print(struct msghdr *mhdr, int cc)
 		printf(" %s", inetname((struct sockaddr *)from));
 
 	if (verbose) {
-#ifdef OLDRAWSOCKET
-		printf(" %d bytes to %s", cc,
-		rcvpktinfo ? inet_ntop(AF_INET6, &rcvpktinfo->ipi6_addr,
-		hbuf, sizeof(hbuf)) : "?");
-#else
 		printf(" %d bytes of data to %s", cc,
 		rcvpktinfo ?  inet_ntop(AF_INET6, &rcvpktinfo->ipi6_addr,
 		hbuf, sizeof(hbuf)) : "?");
-#endif
 	}
 }
 



CVS commit: src/usr.sbin/traceroute6

2018-04-23 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Mon Apr 23 10:22:18 UTC 2018

Modified Files:
src/usr.sbin/traceroute6: traceroute6.c

Log Message:
Remove dead code.


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/usr.sbin/traceroute6/traceroute6.c

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

Modified files:

Index: src/usr.sbin/traceroute6/traceroute6.c
diff -u src/usr.sbin/traceroute6/traceroute6.c:1.48 src/usr.sbin/traceroute6/traceroute6.c:1.49
--- src/usr.sbin/traceroute6/traceroute6.c:1.48	Mon Apr 23 10:14:12 2018
+++ src/usr.sbin/traceroute6/traceroute6.c	Mon Apr 23 10:22:18 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: traceroute6.c,v 1.48 2018/04/23 10:14:12 maxv Exp $	*/
+/*	$NetBSD: traceroute6.c,v 1.49 2018/04/23 10:22:18 maxv Exp $	*/
 /*	$KAME: traceroute6.c,v 1.67 2004/01/25 03:24:39 itojun Exp $	*/
 
 /*
@@ -75,7 +75,7 @@ static char sccsid[] = "@(#)traceroute.c
 #else
 #include 
 #ifndef lint
-__RCSID("$NetBSD: traceroute6.c,v 1.48 2018/04/23 10:14:12 maxv Exp $");
+__RCSID("$NetBSD: traceroute6.c,v 1.49 2018/04/23 10:22:18 maxv Exp $");
 #endif
 #endif
 
@@ -980,27 +980,6 @@ packet_ok(struct msghdr *mhdr, ssize_t c
 	int *hlimp;
 	char hbuf[NI_MAXHOST];
 
-#ifdef OLDRAWSOCKET
-	int hlen;
-	struct ip6_hdr *ip;
-#endif
-
-#ifdef OLDRAWSOCKET
-	ip = (struct ip6_hdr *) buf;
-	hlen = sizeof(struct ip6_hdr);
-	if (cc < hlen + sizeof(struct icmp6_hdr)) {
-		if (verbose) {
-			if (getnameinfo((struct sockaddr *)from, from->sin6_len,
-			hbuf, sizeof(hbuf), NULL, 0, NI_NUMERICHOST) != 0)
-strlcpy(hbuf, "invalid", sizeof(hbuf));
-			printf("packet too short (%d bytes) from %s\n", cc,
-			hbuf);
-		}
-		return 0;
-	}
-	cc -= hlen;
-	icp = (struct icmp6_hdr *)(buf + hlen);
-#else
 	if (cc < (ssize_t)sizeof(struct icmp6_hdr)) {
 		if (verbose) {
 			if (getnameinfo((struct sockaddr *)from, from->sin6_len,
@@ -1012,7 +991,7 @@ packet_ok(struct msghdr *mhdr, ssize_t c
 		return 0;
 	}
 	icp = (struct icmp6_hdr *)buf;
-#endif
+
 	/* get optional information via advanced API */
 	rcvpktinfo = NULL;
 	hlimp = NULL;



CVS commit: src/usr.sbin/traceroute6

2018-04-23 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Mon Apr 23 10:19:11 UTC 2018

Modified Files:
src/usr.sbin/traceroute6: Makefile

Log Message:
Remove CPPFLAGS+=-DUSE_RFC3542, it's not used anymore.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/usr.sbin/traceroute6/Makefile

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/traceroute6/Makefile
diff -u src/usr.sbin/traceroute6/Makefile:1.9 src/usr.sbin/traceroute6/Makefile:1.10
--- src/usr.sbin/traceroute6/Makefile:1.9	Tue May 10 01:52:49 2011
+++ src/usr.sbin/traceroute6/Makefile	Mon Apr 23 10:19:11 2018
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.9 2011/05/10 01:52:49 christos Exp $
+# $NetBSD: Makefile,v 1.10 2018/04/23 10:19:11 maxv Exp $
 
 USE_FORT?= yes	# network client
 
@@ -12,7 +12,6 @@ BINMODE=4555
 BINOWN=	root
 
 CPPFLAGS+=-DINET6 -DIPSEC
-CPPFLAGS+=-DUSE_RFC3542
 LDADD+=	-lipsec
 DPADD+=	${LIBIPSEC}
 



CVS commit: src/usr.sbin/traceroute6

2018-04-23 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Mon Apr 23 10:14:12 UTC 2018

Modified Files:
src/usr.sbin/traceroute6: traceroute6.c

Log Message:
Remove dead/broken code. We want to favor RFC3542 over RFC2292. No
functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/usr.sbin/traceroute6/traceroute6.c

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

Modified files:

Index: src/usr.sbin/traceroute6/traceroute6.c
diff -u src/usr.sbin/traceroute6/traceroute6.c:1.47 src/usr.sbin/traceroute6/traceroute6.c:1.48
--- src/usr.sbin/traceroute6/traceroute6.c:1.47	Mon Apr 23 09:58:35 2018
+++ src/usr.sbin/traceroute6/traceroute6.c	Mon Apr 23 10:14:12 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: traceroute6.c,v 1.47 2018/04/23 09:58:35 maxv Exp $	*/
+/*	$NetBSD: traceroute6.c,v 1.48 2018/04/23 10:14:12 maxv Exp $	*/
 /*	$KAME: traceroute6.c,v 1.67 2004/01/25 03:24:39 itojun Exp $	*/
 
 /*
@@ -75,7 +75,7 @@ static char sccsid[] = "@(#)traceroute.c
 #else
 #include 
 #ifndef lint
-__RCSID("$NetBSD: traceroute6.c,v 1.47 2018/04/23 09:58:35 maxv Exp $");
+__RCSID("$NetBSD: traceroute6.c,v 1.48 2018/04/23 10:14:12 maxv Exp $");
 #endif
 #endif
 
@@ -384,26 +384,14 @@ main(int argc, char *argv[])
 	max_hops = i;
 
 	/* specify to tell receiving interface */
-#ifdef IPV6_RECVPKTINFO
 	if (setsockopt(rcvsock, IPPROTO_IPV6, IPV6_RECVPKTINFO, &on,
 	sizeof(on)) < 0)
 		err(1, "setsockopt(IPV6_RECVPKTINFO)");
-#else  /* old adv. API */
-	if (setsockopt(rcvsock, IPPROTO_IPV6, IPV6_PKTINFO, &on,
-	sizeof(on)) < 0)
-		err(1, "setsockopt(IPV6_PKTINFO)");
-#endif
 
 	/* specify to tell value of hoplimit field of received IP6 hdr */
-#ifdef IPV6_RECVHOPLIMIT
 	if (setsockopt(rcvsock, IPPROTO_IPV6, IPV6_RECVHOPLIMIT, &on,
 	sizeof(on)) < 0)
 		err(1, "setsockopt(IPV6_RECVHOPLIMIT)");
-#else  /* old adv. API */
-	if (setsockopt(rcvsock, IPPROTO_IPV6, IPV6_HOPLIMIT, &on,
-	sizeof(on)) < 0)
-		err(1, "setsockopt(IPV6_HOPLIMIT)");
-#endif
 
 	seq = 0;
 



CVS commit: src/usr.sbin/traceroute6

2018-04-23 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Mon Apr 23 09:58:35 UTC 2018

Modified Files:
src/usr.sbin/traceroute6: traceroute6.c

Log Message:
Remove dead code.


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/usr.sbin/traceroute6/traceroute6.c

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

Modified files:

Index: src/usr.sbin/traceroute6/traceroute6.c
diff -u src/usr.sbin/traceroute6/traceroute6.c:1.46 src/usr.sbin/traceroute6/traceroute6.c:1.47
--- src/usr.sbin/traceroute6/traceroute6.c:1.46	Mon Apr 23 09:47:03 2018
+++ src/usr.sbin/traceroute6/traceroute6.c	Mon Apr 23 09:58:35 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: traceroute6.c,v 1.46 2018/04/23 09:47:03 maxv Exp $	*/
+/*	$NetBSD: traceroute6.c,v 1.47 2018/04/23 09:58:35 maxv Exp $	*/
 /*	$KAME: traceroute6.c,v 1.67 2004/01/25 03:24:39 itojun Exp $	*/
 
 /*
@@ -75,7 +75,7 @@ static char sccsid[] = "@(#)traceroute.c
 #else
 #include 
 #ifndef lint
-__RCSID("$NetBSD: traceroute6.c,v 1.46 2018/04/23 09:47:03 maxv Exp $");
+__RCSID("$NetBSD: traceroute6.c,v 1.47 2018/04/23 09:58:35 maxv Exp $");
 #endif
 #endif
 
@@ -319,9 +319,6 @@ static int	setpolicy(int so, const char 
 #endif
 static void send_probe(int, u_long);
 static struct udphdr *get_udphdr(struct ip6_hdr *, u_char *);
-#if 0
-static int get_hoplim(struct msghdr *);
-#endif
 static double deltaT(struct timeval *, struct timeval *);
 static const char *pr_type(int);
 static int packet_ok(struct msghdr *, ssize_t, int);
@@ -915,24 +912,6 @@ send_probe(int seq, u_long hops)
 	}
 }
 
-#if 0
-static int
-get_hoplim(struct msghdr *mhdr)
-{
-	struct cmsghdr *cm;
-
-	for (cm = (struct cmsghdr *)CMSG_FIRSTHDR(mhdr); cm;
-	cm = (struct cmsghdr *)CMSG_NXTHDR(mhdr, cm)) {
-		if (cm->cmsg_level == IPPROTO_IPV6 &&
-		cm->cmsg_type == IPV6_HOPLIMIT &&
-		cm->cmsg_len == CMSG_LEN(sizeof(int)))
-			return *(int *)CMSG_DATA(cm);
-	}
-
-	return -1;
-}
-#endif
-
 static double
 deltaT(struct timeval *t1p, struct timeval *t2p)
 {



CVS commit: src/usr.sbin/traceroute6

2018-04-23 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Mon Apr 23 09:47:03 UTC 2018

Modified Files:
src/usr.sbin/traceroute6: traceroute6.c

Log Message:
Remove now unused code.


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/usr.sbin/traceroute6/traceroute6.c

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

Modified files:

Index: src/usr.sbin/traceroute6/traceroute6.c
diff -u src/usr.sbin/traceroute6/traceroute6.c:1.45 src/usr.sbin/traceroute6/traceroute6.c:1.46
--- src/usr.sbin/traceroute6/traceroute6.c:1.45	Mon Apr 23 06:42:02 2018
+++ src/usr.sbin/traceroute6/traceroute6.c	Mon Apr 23 09:47:03 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: traceroute6.c,v 1.45 2018/04/23 06:42:02 maxv Exp $	*/
+/*	$NetBSD: traceroute6.c,v 1.46 2018/04/23 09:47:03 maxv Exp $	*/
 /*	$KAME: traceroute6.c,v 1.67 2004/01/25 03:24:39 itojun Exp $	*/
 
 /*
@@ -75,7 +75,7 @@ static char sccsid[] = "@(#)traceroute.c
 #else
 #include 
 #ifndef lint
-__RCSID("$NetBSD: traceroute6.c,v 1.45 2018/04/23 06:42:02 maxv Exp $");
+__RCSID("$NetBSD: traceroute6.c,v 1.46 2018/04/23 09:47:03 maxv Exp $");
 #endif
 #endif
 
@@ -340,10 +340,6 @@ static struct in6_pktinfo *rcvpktinfo;
 static struct sockaddr_in6 Src, Dst, Rcv;
 static u_long datalen;			/* How much data */
 #define	ICMP6ECHOLEN	8
-#ifdef USE_RFC3542
-static struct ip6_rthdr *rth;
-#endif
-static struct cmsghdr *cmsg;
 
 static char *source;
 static char *hostname;
@@ -628,21 +624,7 @@ main(int argc, char *argv[])
 	if (options & SO_DONTROUTE)
 		(void) setsockopt(sndsock, SOL_SOCKET, SO_DONTROUTE,
 		(char *)&on, sizeof(on));
-#ifdef USE_RFC3542
-	if (rth) {/* XXX: there is no library to finalize the header... */
-		rth->ip6r_len = rth->ip6r_segleft * 2;
-		if (setsockopt(sndsock, IPPROTO_IPV6, IPV6_RTHDR,
-		(void *)rth, (rth->ip6r_len + 1) << 3))
-			err(1, "setsockopt(IPV6_RTHDR)");
-	}
-#else  /* old advanced API */
-	if (cmsg != NULL) {
-		inet6_rthdr_lasthop(cmsg, IPV6_RTHDR_LOOSE);
-		if (setsockopt(sndsock, IPPROTO_IPV6, IPV6_PKTOPTIONS,
-		rtbuf, cmsg->cmsg_len) < 0)
-			err(1, "setsockopt(IPV6_PKTOPTIONS)");
-	}
-#endif /* USE_RFC3542 */
+
 #ifdef IPSEC
 #ifdef IPSEC_POLICY_IPSEC
 	/*
@@ -703,9 +685,7 @@ main(int argc, char *argv[])
 
 		Nxt = Dst;
 		Nxt.sin6_port = htons(DUMMY_PORT);
-		if (cmsg != NULL)
-			memcpy( &Nxt.sin6_addr, inet6_rthdr_getaddr(cmsg, 1),
-			sizeof(Nxt.sin6_addr));
+
 		if ((dummy = socket(AF_INET6, SOCK_DGRAM, 0)) < 0)
 			err(1, "socket");
 		if (connect(dummy, (struct sockaddr *)&Nxt, Nxt.sin6_len) < 0)



CVS commit: [netbsd-8] src/doc

2018-04-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Apr 23 09:22:14 UTC 2018

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

Log Message:
Fix revision confusion between CHANGES.prev and CHANGES in the
processing of ticket #602: the pullup asked for rev 1.138 of CHANGES.prev
to be applied to CHANGES, not rev 1.138 of CHANGES to be pulled up.


To generate a diff of this commit:
cvs rdiff -u -r1.2286.2.3 -r1.2286.2.4 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.2286.2.3 src/doc/CHANGES:1.2286.2.4
--- src/doc/CHANGES:1.2286.2.3	Tue Mar  6 09:52:09 2018
+++ src/doc/CHANGES	Mon Apr 23 09:22:14 2018
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2286.2.3 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2286.2.4 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -355,8 +355,6 @@ Changes from NetBSD 7.0 to NetBSD 8.0:
 	amd64: Use fine-grained permissions for architecture-specific memory
 		areas (W^X). [maxv 20160725]
 	sdtemp(4): Add support for Atmel AT30TS00, AT30TSE004, Giantec
-	kernel: SMBFS uses low-overhead NT Directory Change Notify SMB to watch
-		for vnode kqueue(2) events on directories [jdolecek 20030407]
 		GT30TS00, GT34TS02, Microchip MCP9804, MCP98244, IDT
 		TS3000GB[02], TS3001GB2, TSE200[24]GB2 and On Semiconductor
 		CAT34TS04. [msaitoh 20160726]
@@ -470,8 +468,6 @@ Changes from NetBSD 7.0 to NetBSD 8.0:
 	libc: Add accept4 function for compatibility [maya 20170208]
 	file(1): Upgraded to 5.30. [christos 20170210]
 	byacc: update to 20170201 [christos 20170211]
-	ptrace(2): Add signal mask information accessors API:
-		PT_GET_SIGMASK and PT_SET_SIGMASK [kamil 20170212]
 	postfix(1): Import version 3.1.4. [christos 20170213]
 	l2tp(4): Add L2TPv3 interface. [knakahara 20170216]
 	siginfo(2): Add new si_code for SIGTRAP: TRAP_DBREG [kamil 20170217]



CVS commit: src/sbin/ping6

2018-04-23 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Mon Apr 23 07:25:36 UTC 2018

Modified Files:
src/sbin/ping6: ping6.8 ping6.c

Log Message:
Sort options. Sort option descriptions. Remove Tn.
Sync usage (more) with man page.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sbin/ping6/ping6.8
cvs rdiff -u -r1.95 -r1.96 src/sbin/ping6/ping6.c

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

Modified files:

Index: src/sbin/ping6/ping6.8
diff -u src/sbin/ping6/ping6.8:1.31 src/sbin/ping6/ping6.8:1.32
--- src/sbin/ping6/ping6.8:1.31	Mon Apr 23 06:51:25 2018
+++ src/sbin/ping6/ping6.8	Mon Apr 23 07:25:36 2018
@@ -1,4 +1,4 @@
-.\"	$NetBSD: ping6.8,v 1.31 2018/04/23 06:51:25 maxv Exp $
+.\"	$NetBSD: ping6.8,v 1.32 2018/04/23 07:25:36 wiz Exp $
 .\"	$KAME: ping6.8,v 1.57 2002/05/26 13:18:25 itojun Exp $
 .\"
 .\" Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -33,9 +33,7 @@
 .Os
 .Sh NAME
 .Nm ping6
-.Nd send
-.Tn ICMPv6 ECHO_REQUEST
-packets to network hosts
+.Nd send ICMPv6 ECHO_REQUEST packets to network hosts
 .Sh SYNOPSIS
 .Nm ping6
 .\" without IPsec, or new IPsec
@@ -50,28 +48,24 @@ packets to network hosts
 .Op Fl I Ar interface
 .Op Fl i Ar wait
 .Op Fl l Ar preload
-.Op Fl p Ar pattern
 .\" new IPsec
 .Op Fl P Ar policy
+.Op Fl p Ar pattern
 .Op Fl S Ar sourceaddr
 .Op Fl s Ar packetsize
-.Op Fl x Ar maxwait
 .Op Fl X Ar deadline
+.Op Fl x Ar maxwait
 .Ar host
 .Sh DESCRIPTION
 .Nm
-uses the
-.Tn ICMPv6
-protocol's mandatory
-.Tn ICMP6_ECHO_REQUEST
+uses the ICMPv6 protocol's mandatory
+.Dv ICMP6_ECHO_REQUEST
 datagram to elicit an
-.Tn ICMP6_ECHO_REPLY
+.Dv ICMP6_ECHO_REPLY
 from a host or gateway.
-.Tn ICMP6_ECHO_REQUEST
+.Dv ICMP6_ECHO_REQUEST
 datagrams (``pings'') have an IPv6 header,
-and
-.Tn ICMPv6
-header formatted as documented in RFC 2463.
+and ICMPv6 header formatted as documented in RFC 2463.
 The options are as follows:
 .Bl -tag -width Ds
 .\" old IPsec
@@ -110,7 +104,7 @@ Set socket buffer size.
 Stop after sending
 .Pq and receiving
 .Ar count
-.Tn ECHO_RESPONSE
+.Dv ECHO_RESPONSE
 packets.
 .It Fl d
 Set the
@@ -124,11 +118,11 @@ Flood ping.
 Outputs packets as fast as they come back or one hundred times per second,
 whichever is more.
 For every
-.Tn ECHO_REQUEST
+.Dv ECHO_REQUEST
 sent a period
 .Dq \&.
 is printed, while for every
-.Tn ECHO_REPLY
+.Dv ECHO_REPLY
 received a backspace is printed.
 This provides a rapid display of how many packets are being dropped.
 Only the super-user may use this option.
@@ -178,9 +172,6 @@ when the option is specified once, the b
 unicast packets.
 When the option is specified more than once, it will be disabled for both
 unicast and multicast packets.
-.It Fl n
-Numeric output only.
-No attempt will be made to lookup symbolic names from addresses in the reply.
 .It Fl N
 Probe node information multicast group
 .Pq Li ff02::2:: .
@@ -194,8 +185,14 @@ Since node information multicast group i
 outgoing interface needs to be specified by
 .Fl I
 option.
+.It Fl n
+Numeric output only.
+No attempt will be made to lookup symbolic names from addresses in the reply.
 .It Fl o
 Exit successfully after receiving one reply packet.
+.It Fl P Ar policy
+.Ar policy
+specifies IPsec policy to be used for the probe.
 .It Fl p Ar pattern
 You may specify up to 16
 .Dq pad
@@ -206,9 +203,6 @@ For example,
 will cause the sent packet to be filled with all
 ones.
 .\" new IPsec
-.It Fl P Ar policy
-.Ar policy
-specifies IPsec policy to be used for the probe.
 .It Fl q
 Quiet output.
 Nothing is displayed except the summary lines at startup time and
@@ -226,12 +220,8 @@ The source address must be one of the un
 and must be numeric.
 .It Fl s Ar packetsize
 Specifies the number of data bytes to be sent.
-The default is 56, which translates into 64
-.Tn ICMP
-data bytes when combined
-with the 8 bytes of
-.Tn ICMP
-header data.
+The default is 56, which translates into 64 ICMP data bytes when combined
+with the 8 bytes of ICMP header data.
 You may need to specify
 .Fl b
 as well to extend socket buffer size.
@@ -244,16 +234,9 @@ has no effect if
 is specified.
 .It Fl v
 Verbose output.
-.Tn ICMP
-packets other than
-.Tn ECHO_RESPONSE
+ICMP packets other than
+.Dv ECHO_RESPONSE
 that are received are listed.
-.It Fl w
-Generate ICMPv6 Node Information DNS Name query, rather than echo-request.
-.Fl s
-has no effect if
-.Fl w
-is specified.
 .It Fl W
 Same as
 .Fl w ,
@@ -263,13 +246,19 @@ This option is present for backward comp
 has no effect if
 .Fl w
 is specified.
-.It Fl x Ar maxwait
-Time in milliseconds to wait for a reply for each packet sent.
+.It Fl w
+Generate ICMPv6 Node Information DNS Name query, rather than echo-request.
+.Fl s
+has no effect if
+.Fl w
+is specified.
 .It Fl X Ar deadline
 Specify a timeout, in seconds, before ping exits regardless of
 how many packets have been received.
 .It Ar host
 IPv6 address of the final destination 

CVS commit: src/sys

2018-04-23 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Mon Apr 23 07:22:54 UTC 2018

Modified Files:
src/sys/netinet6: ip6_output.c
src/sys/netipsec: xform_ah.c

Log Message:
Remove the kernel RH0 code. RH0 is deprecated by RFC5095, for security
reasons. RH0 was already removed in the kernel's input path, but some
parts were still present in the output path: they are now removed.

Sent on tech-net@ a few days ago.


To generate a diff of this commit:
cvs rdiff -u -r1.204 -r1.205 src/sys/netinet6/ip6_output.c
cvs rdiff -u -r1.92 -r1.93 src/sys/netipsec/xform_ah.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_output.c
diff -u src/sys/netinet6/ip6_output.c:1.204 src/sys/netinet6/ip6_output.c:1.205
--- src/sys/netinet6/ip6_output.c:1.204	Wed Apr 18 07:17:49 2018
+++ src/sys/netinet6/ip6_output.c	Mon Apr 23 07:22:54 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip6_output.c,v 1.204 2018/04/18 07:17:49 maxv Exp $	*/
+/*	$NetBSD: ip6_output.c,v 1.205 2018/04/23 07:22:54 maxv Exp $	*/
 /*	$KAME: ip6_output.c,v 1.172 2001/03/25 09:55:56 itojun Exp $	*/
 
 /*
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ip6_output.c,v 1.204 2018/04/18 07:17:49 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip6_output.c,v 1.205 2018/04/23 07:22:54 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -143,34 +143,11 @@ static int ip6_pcbopts(struct ip6_pktopt
 static int
 ip6_handle_rthdr(struct ip6_rthdr *rh, struct ip6_hdr *ip6)
 {
-	struct ip6_rthdr0 *rh0;
-	struct in6_addr *addr;
-	struct sockaddr_in6 sa;
 	int error = 0;
 
 	switch (rh->ip6r_type) {
 	case IPV6_RTHDR_TYPE_0:
-		rh0 = (struct ip6_rthdr0 *)rh;
-		addr = (struct in6_addr *)(rh0 + 1);
-
-		/*
-		 * construct a sockaddr_in6 form of the first hop.
-		 *
-		 * XXX we may not have enough information about its scope zone;
-		 * there is no standard API to pass the information from the
-		 * application.
-		 */
-		sockaddr_in6_init(&sa, addr, 0, 0, 0);
-		error = sa6_embedscope(&sa, ip6_use_defzone);
-		if (error != 0)
-			break;
-		memmove(&addr[0], &addr[1],
-		sizeof(struct in6_addr) * (rh0->ip6r0_segleft - 1));
-		addr[rh0->ip6r0_segleft - 1] = ip6->ip6_dst;
-		ip6->ip6_dst = sa.sin6_addr;
-		/* XXX */
-		in6_clearscope(addr + rh0->ip6r0_segleft - 1);
-		break;
+		/* Dropped, RFC5095. */
 	default:	/* is it possible? */
 		error = EINVAL;
 	}
@@ -3205,13 +3182,7 @@ ip6_setpktopt(int optname, u_char *buf, 
 			return (EINVAL);
 		switch (rth->ip6r_type) {
 		case IPV6_RTHDR_TYPE_0:
-			if (rth->ip6r_len == 0)	/* must contain one addr */
-return (EINVAL);
-			if (rth->ip6r_len % 2) /* length must be even */
-return (EINVAL);
-			if (rth->ip6r_len / 2 != rth->ip6r_segleft)
-return (EINVAL);
-			break;
+			/* Dropped, RFC5095. */
 		default:
 			return (EINVAL);	/* not supported */
 		}

Index: src/sys/netipsec/xform_ah.c
diff -u src/sys/netipsec/xform_ah.c:1.92 src/sys/netipsec/xform_ah.c:1.93
--- src/sys/netipsec/xform_ah.c:1.92	Thu Apr 19 08:27:39 2018
+++ src/sys/netipsec/xform_ah.c	Mon Apr 23 07:22:54 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: xform_ah.c,v 1.92 2018/04/19 08:27:39 maxv Exp $	*/
+/*	$NetBSD: xform_ah.c,v 1.93 2018/04/23 07:22:54 maxv Exp $	*/
 /*	$FreeBSD: xform_ah.c,v 1.1.4.1 2003/01/24 05:11:36 sam Exp $	*/
 /*	$OpenBSD: ip_ah.c,v 1.63 2001/06/26 06:18:58 angelos Exp $ */
 /*
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xform_ah.c,v 1.92 2018/04/19 08:27:39 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xform_ah.c,v 1.93 2018/04/23 07:22:54 maxv Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_inet.h"
@@ -273,7 +273,6 @@ ah_massage_headers(struct mbuf **m0, int
 #ifdef INET6
 	struct ip6_ext *ip6e;
 	struct ip6_hdr ip6;
-	struct ip6_rthdr *rh;
 	int alloc, nxt;
 #endif
 
@@ -475,42 +474,7 @@ ah_massage_headers(struct mbuf **m0, int
 break;
 
 			case IPPROTO_ROUTING:
-/*
- * Always include routing headers in
- * computation.
- */
 ip6e = (struct ip6_ext *)(ptr + off);
-rh = (struct ip6_rthdr *)(ptr + off);
-/*
- * must adjust content to make it look like
- * its final form (as seen at the final
- * destination).
- * we only know how to massage type 0 routing
- * header.
- */
-if (out && rh->ip6r_type == IPV6_RTHDR_TYPE_0) {
-	struct ip6_rthdr0 *rh0;
-	struct in6_addr *addr, finaldst;
-	int i;
-
-	rh0 = (struct ip6_rthdr0 *)rh;
-	addr = (struct in6_addr *)(rh0 + 1);
-
-	for (i = 0; i < rh0->ip6r0_segleft; i++)
-		in6_clearscope(&addr[i]);
-
-	finaldst = addr[rh0->ip6r0_segleft - 1];
-	memmove(&addr[1], &addr[0],
-		sizeof(struct in6_addr) *
-		(rh0->ip6r0_segleft - 1));
-
-	m_copydata(m, 0, sizeof(ip6), &ip6);
-	addr[0] = ip6.ip6_dst;
-	ip6.ip6_dst = finaldst;
-	m_copyback(m, 0, sizeof(ip6), &ip6);
-
-	rh0->ip6r0_segleft = 0;
-}
 
 /* advance */
 off +

CVS commit: src/usr.sbin/traceroute6

2018-04-23 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Mon Apr 23 07:13:50 UTC 2018

Modified Files:
src/usr.sbin/traceroute6: traceroute6.8

Log Message:
Remove -g from SYNOPSIS.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/usr.sbin/traceroute6/traceroute6.8

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/traceroute6/traceroute6.8
diff -u src/usr.sbin/traceroute6/traceroute6.8:1.18 src/usr.sbin/traceroute6/traceroute6.8:1.19
--- src/usr.sbin/traceroute6/traceroute6.8:1.18	Mon Apr 23 06:42:02 2018
+++ src/usr.sbin/traceroute6/traceroute6.8	Mon Apr 23 07:13:50 2018
@@ -1,4 +1,4 @@
-.\"	$NetBSD: traceroute6.8,v 1.18 2018/04/23 06:42:02 maxv Exp $
+.\"	$NetBSD: traceroute6.8,v 1.19 2018/04/23 07:13:50 wiz Exp $
 .\"	$KAME: traceroute6.8,v 1.8 2000/06/12 16:29:18 itojun Exp $
 .\"
 .\" Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -41,7 +41,6 @@
 .Op Fl adIlnrv
 .Op Fl A Ar as_server
 .Op Fl f Ar firsthop
-.Op Fl g Ar gateway
 .Op Fl m Ar hoplimit
 .Op Fl p Ar port
 .Op Fl q Ar probes