CVS commit: src/sys/netinet

2018-02-12 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Tue Feb 13 07:51:24 UTC 2018

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

Log Message:
Fix three things in arpintr():

 * mtod can't return NULL.

 * It is wrong to kick the packet if m->m_len < arplen. While this check
   always returns false for native Ethernet interfaces, it may not if the
   frame is encapsulated in EtherIP/L2TP. Use m_pullup instead.

 * Remove XXX, it is fine. Reduce the indentation level afterwards.


To generate a diff of this commit:
cvs rdiff -u -r1.257 -r1.258 src/sys/netinet/if_arp.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/if_arp.c
diff -u src/sys/netinet/if_arp.c:1.257 src/sys/netinet/if_arp.c:1.258
--- src/sys/netinet/if_arp.c:1.257	Tue Feb 13 07:44:25 2018
+++ src/sys/netinet/if_arp.c	Tue Feb 13 07:51:24 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_arp.c,v 1.257 2018/02/13 07:44:25 maxv Exp $	*/
+/*	$NetBSD: if_arp.c,v 1.258 2018/02/13 07:51:24 maxv Exp $	*/
 
 /*
  * Copyright (c) 1998, 2000, 2008 The NetBSD Foundation, Inc.
@@ -68,7 +68,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.257 2018/02/13 07:44:25 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.258 2018/02/13 07:51:24 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -939,12 +939,10 @@ arpintr(void)
 		MCLAIM(m, _mowner);
 		ARP_STATINC(ARP_STAT_RCVTOTAL);
 
-		/*
-		 * First, make sure we have at least struct arphdr.
-		 */
-		if (m->m_len < sizeof(struct arphdr) ||
-		(ar = mtod(m, struct arphdr *)) == NULL)
+		arplen = sizeof(struct arphdr);
+		if (m->m_len < arplen && (m = m_pullup(m, arplen)) == NULL)
 			goto badlen;
+		ar = mtod(m, struct arphdr *);
 
 		rcvif = m_get_rcvif(m, );
 		if (__predict_false(rcvif == NULL)) {
@@ -963,23 +961,26 @@ arpintr(void)
 		}
 		m_put_rcvif(rcvif, );
 
-		if (/* XXX ntohs(ar->ar_hrd) == ARPHRD_ETHER && */
-		m->m_len >= arplen)
-			switch (ntohs(ar->ar_pro)) {
-			case ETHERTYPE_IP:
-			case ETHERTYPE_IPTRAILERS:
-in_arpinput(m);
-continue;
-			default:
-ARP_STATINC(ARP_STAT_RCVBADPROTO);
-			}
-		else {
-badlen:
-			ARP_STATINC(ARP_STAT_RCVBADLEN);
+		if (m->m_len < arplen && (m = m_pullup(m, arplen)) == NULL)
+			goto badlen;
+		ar = mtod(m, struct arphdr *);
+
+		switch (ntohs(ar->ar_pro)) {
+		case ETHERTYPE_IP:
+		case ETHERTYPE_IPTRAILERS:
+			in_arpinput(m);
+			continue;
+		default:
+			ARP_STATINC(ARP_STAT_RCVBADPROTO);
+			goto free;
 		}
+
+badlen:
+		ARP_STATINC(ARP_STAT_RCVBADLEN);
 free:
 		m_freem(m);
 	}
+
 out:
 	SOFTNET_KERNEL_UNLOCK_UNLESS_NET_MPSAFE();
 	return; /* XXX gcc */



CVS commit: src/sys/netinet

2018-02-12 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Tue Feb 13 07:51:24 UTC 2018

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

Log Message:
Fix three things in arpintr():

 * mtod can't return NULL.

 * It is wrong to kick the packet if m->m_len < arplen. While this check
   always returns false for native Ethernet interfaces, it may not if the
   frame is encapsulated in EtherIP/L2TP. Use m_pullup instead.

 * Remove XXX, it is fine. Reduce the indentation level afterwards.


To generate a diff of this commit:
cvs rdiff -u -r1.257 -r1.258 src/sys/netinet/if_arp.c

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



CVS commit: src/sys/netinet

2018-02-12 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Tue Feb 13 07:44:25 UTC 2018

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

Log Message:
Style, no functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.256 -r1.257 src/sys/netinet/if_arp.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/if_arp.c
diff -u src/sys/netinet/if_arp.c:1.256 src/sys/netinet/if_arp.c:1.257
--- src/sys/netinet/if_arp.c:1.256	Tue Jan 16 08:13:47 2018
+++ src/sys/netinet/if_arp.c	Tue Feb 13 07:44:25 2018
@@ -1,6 +1,6 @@
-/*	$NetBSD: if_arp.c,v 1.256 2018/01/16 08:13:47 ozaki-r Exp $	*/
+/*	$NetBSD: if_arp.c,v 1.257 2018/02/13 07:44:25 maxv Exp $	*/
 
-/*-
+/*
  * Copyright (c) 1998, 2000, 2008 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
@@ -68,7 +68,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.256 2018/01/16 08:13:47 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.257 2018/02/13 07:44:25 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -140,38 +140,38 @@ __KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1
 #define ETHERTYPE_IPTRAILERS ETHERTYPE_TRAIL
 
 /* timer values */
-static int	arpt_keep = (20*60);	/* once resolved, good for 20 more minutes */
-static int	arpt_down = 20;		/* once declared down, don't send for 20 secs */
-static int	arp_maxhold = 1;	/* number of packets to hold per ARP entry */
+static int arpt_keep = (20*60);	/* once resolved, good for 20 more minutes */
+static int arpt_down = 20;		/* once declared down, don't send for 20 secs */
+static int arp_maxhold = 1;	/* number of packets to hold per ARP entry */
 #define	rt_expire rt_rmx.rmx_expire
 #define	rt_pksent rt_rmx.rmx_pksent
 
-int		ip_dad_count = PROBE_NUM;
+int ip_dad_count = PROBE_NUM;
 #ifdef ARP_DEBUG
-int		arp_debug = 1;
+int arp_debug = 1;
 #else
-int		arp_debug = 0;
+int arp_debug = 0;
 #endif
 
-static	void arp_init(void);
+static void arp_init(void);
 
-static	void arprequest(struct ifnet *,
+static void arprequest(struct ifnet *,
 const struct in_addr *, const struct in_addr *,
 const u_int8_t *);
-static	void arpannounce1(struct ifaddr *);
-static	struct sockaddr *arp_setgate(struct rtentry *, struct sockaddr *,
-	const struct sockaddr *);
-static	void arptimer(void *);
-static	void arp_settimer(struct llentry *, int);
-static	struct llentry *arplookup(struct ifnet *, struct mbuf *,
-	const struct in_addr *, const struct sockaddr *, int);
-static	struct llentry *arpcreate(struct ifnet *, struct mbuf *,
-	const struct in_addr *, const struct sockaddr *, int);
-static	void in_arpinput(struct mbuf *);
-static	void in_revarpinput(struct mbuf *);
-static	void revarprequest(struct ifnet *);
+static void arpannounce1(struct ifaddr *);
+static struct sockaddr *arp_setgate(struct rtentry *, struct sockaddr *,
+const struct sockaddr *);
+static void arptimer(void *);
+static void arp_settimer(struct llentry *, int);
+static struct llentry *arplookup(struct ifnet *, struct mbuf *,
+const struct in_addr *, const struct sockaddr *, int);
+static struct llentry *arpcreate(struct ifnet *, struct mbuf *,
+const struct in_addr *, const struct sockaddr *, int);
+static void in_arpinput(struct mbuf *);
+static void in_revarpinput(struct mbuf *);
+static void revarprequest(struct ifnet *);
 
-static	void arp_drainstub(void);
+static void arp_drainstub(void);
 
 struct dadq;
 static void arp_dad_timer(struct dadq *);
@@ -184,15 +184,15 @@ static void arp_init_llentry(struct ifne
 static void arp_free_llentry_tokenring(struct llentry *);
 #endif
 
-struct	ifqueue arpintrq = {
+struct ifqueue arpintrq = {
 	.ifq_head = NULL,
 	.ifq_tail = NULL,
 	.ifq_len = 0,
 	.ifq_maxlen = 50,
 	.ifq_drops = 0,
 };
-static int	arp_maxtries = 5;
-static int	useloopback = 1;	/* use loopback interface for local traffic */
+static int arp_maxtries = 5;
+static int useloopback = 1;	/* use loopback interface for local traffic */
 
 static percpu_t *arpstat_percpu;
 
@@ -203,10 +203,10 @@ static percpu_t *arpstat_percpu;
 #define	ARP_STATADD(x, v)	_NET_STATADD(arpstat_percpu, x, v)
 
 /* revarp state */
-static struct	in_addr myip, srv_ip;
-static int	myip_initialized = 0;
-static int	revarp_in_progress = 0;
-static struct	ifnet *myip_ifp = NULL;
+static struct in_addr myip, srv_ip;
+static int myip_initialized = 0;
+static int revarp_in_progress = 0;
+static struct ifnet *myip_ifp = NULL;
 
 static int arp_drainwanted;
 
@@ -257,18 +257,19 @@ arp_fasttimo(void)
 }
 
 const struct protosw arpsw[] = {
-	{ .pr_type = 0,
-	  .pr_domain = ,
-	  .pr_protocol = 0,
-	  .pr_flags = 0,
-	  .pr_input = 0,
-	  .pr_ctlinput = 0,
-	  .pr_ctloutput = 0,
-	  .pr_usrreqs = 0,
-	  .pr_init = arp_init,
-	  .pr_fasttimo = arp_fasttimo,
-	  .pr_slowtimo = 0,
-	  .pr_drain = arp_drainstub,
+	{
+		.pr_type = 0,
+		.pr_domain = ,
+		.pr_protocol = 0,
+		.pr_flags = 0,
+		.pr_input = 0,
+		.pr_ctlinput = 

CVS commit: src/sys/netinet

2018-02-12 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Tue Feb 13 07:44:25 UTC 2018

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

Log Message:
Style, no functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.256 -r1.257 src/sys/netinet/if_arp.c

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



CVS commit: src/sys/dev/i2c

2018-02-12 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Tue Feb 13 07:21:19 UTC 2018

Modified Files:
src/sys/dev/i2c: files.i2c

Log Message:
Disable the 'define dbcool {}' line - it's not needed, and causes
problems with config(1) and gcc6.  See PR toolchain/530223 for more
info.


To generate a diff of this commit:
cvs rdiff -u -r1.82 -r1.83 src/sys/dev/i2c/files.i2c

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



CVS commit: src/sys/dev/i2c

2018-02-12 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Tue Feb 13 07:21:19 UTC 2018

Modified Files:
src/sys/dev/i2c: files.i2c

Log Message:
Disable the 'define dbcool {}' line - it's not needed, and causes
problems with config(1) and gcc6.  See PR toolchain/530223 for more
info.


To generate a diff of this commit:
cvs rdiff -u -r1.82 -r1.83 src/sys/dev/i2c/files.i2c

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.82 src/sys/dev/i2c/files.i2c:1.83
--- src/sys/dev/i2c/files.i2c:1.82	Thu Feb  1 21:44:17 2018
+++ src/sys/dev/i2c/files.i2c	Tue Feb 13 07:21:19 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: files.i2c,v 1.82 2018/02/01 21:44:17 macallan Exp $
+#	$NetBSD: files.i2c,v 1.83 2018/02/13 07:21:19 pgoyette Exp $
 
 obsolete defflag	opt_i2cbus.h		I2C_SCAN
 define	i2cbus { }
@@ -130,7 +130,7 @@ attach	xrtc at iic
 file	dev/i2c/x1226.cxrtc
 
 # Analog Devices dBCool family of thermal monitors / fan controllers
-define dbcool {}
+#define dbcool {}
 device dbcool: sysmon_envsys
 attach dbcool at iic
 file dev/i2c/dbcool.c			dbcool



Re: CVS commit: src/lib/libc/arch/aarch64/gen

2018-02-12 Thread Nick Hudson



On 12/02/2018 22:31, Jonathan A. Kollasch wrote:

@@ -47,6 +47,6 @@ END(__sigsetjmp14)
  
  ENTRY(__siglongjmp14)

ldr x3, [x0, #_JB_MAGIC]
-   tbz x3, #0, _C_LABEL(__longjmp14)
+   tbnzx3, #0, _C_LABEL(__longjmp14)
b   _C_LABEL(_longjmp)
  END(__siglongjmp14)


I don't think this is correct.

Should compare against _JB_MAGIC_AARCH64__SETJMP / 
_JB_MAGIC_AARCH64_SETJMP and branch appropriately


Nick



CVS commit: src/sys/arch

2018-02-12 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Tue Feb 13 06:44:13 UTC 2018

Modified Files:
src/sys/arch/amd64/amd64: db_interface.c
src/sys/arch/i386/i386: db_interface.c

Log Message:
Remove double declaration; 'ddb_regs' is already declared as a macro
in db_machdep.h if MULTIPROCESSOR is on, and the macro has higher
priority.

Don't declare 'ddb_regs' locally in this case, because it is misleading.
Part of PR/52964.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/amd64/amd64/db_interface.c
cvs rdiff -u -r1.80 -r1.81 src/sys/arch/i386/i386/db_interface.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/amd64/amd64/db_interface.c
diff -u src/sys/arch/amd64/amd64/db_interface.c:1.31 src/sys/arch/amd64/amd64/db_interface.c:1.32
--- src/sys/arch/amd64/amd64/db_interface.c:1.31	Tue Feb 13 04:11:28 2018
+++ src/sys/arch/amd64/amd64/db_interface.c	Tue Feb 13 06:44:13 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_interface.c,v 1.31 2018/02/13 04:11:28 ozaki-r Exp $	*/
+/*	$NetBSD: db_interface.c,v 1.32 2018/02/13 06:44:13 maxv Exp $	*/
 
 /*
  * Mach Operating System
@@ -33,7 +33,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.31 2018/02/13 04:11:28 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.32 2018/02/13 06:44:13 maxv Exp $");
 
 #include "opt_ddb.h"
 #include "opt_multiprocessor.h"
@@ -67,9 +67,11 @@ extern const char *const trap_type[];
 extern int trap_types;
 
 int	db_active = 0;
-db_regs_t ddb_regs;	/* register state */
 #ifdef MULTIPROCESSOR
+/* ddb_regs defined as a macro */
 db_regs_t *ddb_regp = NULL;
+#else
+db_regs_t ddb_regs;
 #endif
 
 void db_mach_cpu (db_expr_t, bool, db_expr_t, const char *);

Index: src/sys/arch/i386/i386/db_interface.c
diff -u src/sys/arch/i386/i386/db_interface.c:1.80 src/sys/arch/i386/i386/db_interface.c:1.81
--- src/sys/arch/i386/i386/db_interface.c:1.80	Tue Feb 13 04:11:28 2018
+++ src/sys/arch/i386/i386/db_interface.c	Tue Feb 13 06:44:13 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_interface.c,v 1.80 2018/02/13 04:11:28 ozaki-r Exp $	*/
+/*	$NetBSD: db_interface.c,v 1.81 2018/02/13 06:44:13 maxv Exp $	*/
 
 /*
  * Mach Operating System
@@ -33,7 +33,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.80 2018/02/13 04:11:28 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.81 2018/02/13 06:44:13 maxv Exp $");
 
 #include "opt_ddb.h"
 #include "opt_multiprocessor.h"
@@ -72,9 +72,11 @@ extern const char *const trap_type[];
 extern int trap_types;
 
 int	db_active = 0;
-db_regs_t ddb_regs;	/* register state */
 #ifdef MULTIPROCESSOR
+/* ddb_regs defined as a macro */
 db_regs_t *ddb_regp = NULL;
+#else
+db_regs_t ddb_regs;
 #endif
 
 void db_mach_cpu (db_expr_t, bool, db_expr_t, const char *);



CVS commit: src/sys/arch

2018-02-12 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Tue Feb 13 06:44:13 UTC 2018

Modified Files:
src/sys/arch/amd64/amd64: db_interface.c
src/sys/arch/i386/i386: db_interface.c

Log Message:
Remove double declaration; 'ddb_regs' is already declared as a macro
in db_machdep.h if MULTIPROCESSOR is on, and the macro has higher
priority.

Don't declare 'ddb_regs' locally in this case, because it is misleading.
Part of PR/52964.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/amd64/amd64/db_interface.c
cvs rdiff -u -r1.80 -r1.81 src/sys/arch/i386/i386/db_interface.c

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



CVS commit: src

2018-02-12 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Tue Feb 13 04:36:00 UTC 2018

Modified Files:
src: UPDATING

Log Message:
note that openssl and GCC may upset your builds.


To generate a diff of this commit:
cvs rdiff -u -r1.290 -r1.291 src/UPDATING

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

Modified files:

Index: src/UPDATING
diff -u src/UPDATING:1.290 src/UPDATING:1.291
--- src/UPDATING:1.290	Wed Dec 27 08:29:02 2017
+++ src/UPDATING	Tue Feb 13 04:36:00 2018
@@ -1,4 +1,4 @@
-$NetBSD: UPDATING,v 1.290 2017/12/27 08:29:02 martin Exp $
+$NetBSD: UPDATING,v 1.291 2018/02/13 04:36:00 mrg Exp $
 
 This file (UPDATING) is intended to be a brief reference to recent
 changes that might cause problems in the build process, and a guide for
@@ -19,6 +19,12 @@ See also: BUILDING, build.sh, Makefile.
 Recent changes:
 ^^^
 
+20180212:
+	between OpenSSL and GCC updates, many things may fail to build.
+	any failure that looks like GCC or openssl is best handled by
+	a clean destdir and objdir.  Full cleandir and destdir deletion
+	is recommended if build failures occur.
+
 20171225:
 	removal of the vadvise syscall requires manual removal of all
 	associated files from the libc build object directory (including



CVS commit: src

2018-02-12 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Tue Feb 13 04:36:00 UTC 2018

Modified Files:
src: UPDATING

Log Message:
note that openssl and GCC may upset your builds.


To generate a diff of this commit:
cvs rdiff -u -r1.290 -r1.291 src/UPDATING

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



CVS commit: src/sys/arch

2018-02-12 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Tue Feb 13 04:11:28 UTC 2018

Modified Files:
src/sys/arch/amd64/amd64: db_interface.c
src/sys/arch/i386/i386: db_interface.c

Log Message:
Define ddb_regp only if MULTIPROCESSOR (NFC)


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/amd64/amd64/db_interface.c
cvs rdiff -u -r1.79 -r1.80 src/sys/arch/i386/i386/db_interface.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/amd64/amd64/db_interface.c
diff -u src/sys/arch/amd64/amd64/db_interface.c:1.30 src/sys/arch/amd64/amd64/db_interface.c:1.31
--- src/sys/arch/amd64/amd64/db_interface.c:1.30	Tue Feb 13 04:10:41 2018
+++ src/sys/arch/amd64/amd64/db_interface.c	Tue Feb 13 04:11:28 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_interface.c,v 1.30 2018/02/13 04:10:41 ozaki-r Exp $	*/
+/*	$NetBSD: db_interface.c,v 1.31 2018/02/13 04:11:28 ozaki-r Exp $	*/
 
 /*
  * Mach Operating System
@@ -33,7 +33,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.30 2018/02/13 04:10:41 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.31 2018/02/13 04:11:28 ozaki-r Exp $");
 
 #include "opt_ddb.h"
 #include "opt_multiprocessor.h"
@@ -68,7 +68,9 @@ extern int trap_types;
 
 int	db_active = 0;
 db_regs_t ddb_regs;	/* register state */
+#ifdef MULTIPROCESSOR
 db_regs_t *ddb_regp = NULL;
+#endif
 
 void db_mach_cpu (db_expr_t, bool, db_expr_t, const char *);
 
@@ -244,7 +246,9 @@ kdb_trap(int type, int code, db_regs_t *
 #endif
 
 	*regs = ddb_regs;
+#ifdef MULTIPROCESSOR
 	ddb_regp = NULL;
+#endif
 
 	return (1);
 }

Index: src/sys/arch/i386/i386/db_interface.c
diff -u src/sys/arch/i386/i386/db_interface.c:1.79 src/sys/arch/i386/i386/db_interface.c:1.80
--- src/sys/arch/i386/i386/db_interface.c:1.79	Tue Feb 13 04:10:41 2018
+++ src/sys/arch/i386/i386/db_interface.c	Tue Feb 13 04:11:28 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_interface.c,v 1.79 2018/02/13 04:10:41 ozaki-r Exp $	*/
+/*	$NetBSD: db_interface.c,v 1.80 2018/02/13 04:11:28 ozaki-r Exp $	*/
 
 /*
  * Mach Operating System
@@ -33,7 +33,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.79 2018/02/13 04:10:41 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.80 2018/02/13 04:11:28 ozaki-r Exp $");
 
 #include "opt_ddb.h"
 #include "opt_multiprocessor.h"
@@ -73,7 +73,9 @@ extern int trap_types;
 
 int	db_active = 0;
 db_regs_t ddb_regs;	/* register state */
+#ifdef MULTIPROCESSOR
 db_regs_t *ddb_regp = NULL;
+#endif
 
 void db_mach_cpu (db_expr_t, bool, db_expr_t, const char *);
 
@@ -279,7 +281,9 @@ kdb_trap(int type, int code, db_regs_t *
 		regs->tf_ss = ddb_regs.tf_ss;
 	}
 
+#ifdef MULTIPROCESSOR
 	ddb_regp = NULL;
+#endif
 
 	return (1);
 }



CVS commit: src/sys/arch

2018-02-12 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Tue Feb 13 04:11:28 UTC 2018

Modified Files:
src/sys/arch/amd64/amd64: db_interface.c
src/sys/arch/i386/i386: db_interface.c

Log Message:
Define ddb_regp only if MULTIPROCESSOR (NFC)


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/amd64/amd64/db_interface.c
cvs rdiff -u -r1.79 -r1.80 src/sys/arch/i386/i386/db_interface.c

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



CVS commit: src/sys/arch

2018-02-12 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Tue Feb 13 04:10:41 UTC 2018

Modified Files:
src/sys/arch/amd64/amd64: db_interface.c
src/sys/arch/i386/i386: db_interface.c

Log Message:
Fix NULL pointer dereference via ddb_regs

ddb_regs can be *ddb_regp (see db_machdep.h) so ddb_regp should be NULL-ed
after dereference to ddb_regs.

Also dbreg should be restored to ddb_regp because ddb_regp can be changed
by db_mach_cpu during db_trap.

Fix PR 52964
Helped by nonaka@


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/amd64/amd64/db_interface.c
cvs rdiff -u -r1.78 -r1.79 src/sys/arch/i386/i386/db_interface.c

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



CVS commit: src/sys/arch

2018-02-12 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Tue Feb 13 04:10:41 UTC 2018

Modified Files:
src/sys/arch/amd64/amd64: db_interface.c
src/sys/arch/i386/i386: db_interface.c

Log Message:
Fix NULL pointer dereference via ddb_regs

ddb_regs can be *ddb_regp (see db_machdep.h) so ddb_regp should be NULL-ed
after dereference to ddb_regs.

Also dbreg should be restored to ddb_regp because ddb_regp can be changed
by db_mach_cpu during db_trap.

Fix PR 52964
Helped by nonaka@


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/amd64/amd64/db_interface.c
cvs rdiff -u -r1.78 -r1.79 src/sys/arch/i386/i386/db_interface.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/amd64/amd64/db_interface.c
diff -u src/sys/arch/amd64/amd64/db_interface.c:1.29 src/sys/arch/amd64/amd64/db_interface.c:1.30
--- src/sys/arch/amd64/amd64/db_interface.c:1.29	Sat Feb 10 03:55:58 2018
+++ src/sys/arch/amd64/amd64/db_interface.c	Tue Feb 13 04:10:41 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_interface.c,v 1.29 2018/02/10 03:55:58 christos Exp $	*/
+/*	$NetBSD: db_interface.c,v 1.30 2018/02/13 04:10:41 ozaki-r Exp $	*/
 
 /*
  * Mach Operating System
@@ -33,7 +33,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.29 2018/02/10 03:55:58 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.30 2018/02/13 04:10:41 ozaki-r Exp $");
 
 #include "opt_ddb.h"
 #include "opt_multiprocessor.h"
@@ -189,6 +189,9 @@ int
 kdb_trap(int type, int code, db_regs_t *regs)
 {
 	int s;
+#ifdef MULTIPROCESSOR
+	db_regs_t dbreg;
+#endif
 
 	switch (type) {
 	case T_NMI:	/* NMI */
@@ -210,7 +213,6 @@ kdb_trap(int type, int code, db_regs_t *
 	}
 
 #ifdef MULTIPROCESSOR
-	db_regs_t dbreg;
 	if (!db_suspend_others()) {
 		ddb_suspend(regs);
 	} else {
@@ -237,10 +239,12 @@ kdb_trap(int type, int code, db_regs_t *
 #ifdef MULTIPROCESSOR
 	db_resume_others();
 	}
+	/* Restore dbreg because ddb_regp can be changed by db_mach_cpu */
+	ddb_regp = 
 #endif
-	ddb_regp = NULL;
 
 	*regs = ddb_regs;
+	ddb_regp = NULL;
 
 	return (1);
 }

Index: src/sys/arch/i386/i386/db_interface.c
diff -u src/sys/arch/i386/i386/db_interface.c:1.78 src/sys/arch/i386/i386/db_interface.c:1.79
--- src/sys/arch/i386/i386/db_interface.c:1.78	Sat Feb 10 11:50:39 2018
+++ src/sys/arch/i386/i386/db_interface.c	Tue Feb 13 04:10:41 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_interface.c,v 1.78 2018/02/10 11:50:39 kre Exp $	*/
+/*	$NetBSD: db_interface.c,v 1.79 2018/02/13 04:10:41 ozaki-r Exp $	*/
 
 /*
  * Mach Operating System
@@ -33,7 +33,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.78 2018/02/10 11:50:39 kre Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.79 2018/02/13 04:10:41 ozaki-r Exp $");
 
 #include "opt_ddb.h"
 #include "opt_multiprocessor.h"
@@ -255,8 +255,9 @@ kdb_trap(int type, int code, db_regs_t *
 #ifdef MULTIPROCESSOR
 	db_resume_others();
 	}
+	/* Restore dbreg because ddb_regp can be changed by db_mach_cpu */
+	ddb_regp = 
 #endif
-	ddb_regp = NULL;
 
 	regs->tf_gs = ddb_regs.tf_gs;
 	regs->tf_fs = ddb_regs.tf_fs;
@@ -278,6 +279,8 @@ kdb_trap(int type, int code, db_regs_t *
 		regs->tf_ss = ddb_regs.tf_ss;
 	}
 
+	ddb_regp = NULL;
+
 	return (1);
 }
 



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

2018-02-12 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Feb 13 01:05:18 UTC 2018

Modified Files:
src/sys/arch/i386/i386: trap.c

Log Message:
Unconditionally print the trap like we do for amdt64 (Dimitris Karagkasidis)


To generate a diff of this commit:
cvs rdiff -u -r1.292 -r1.293 src/sys/arch/i386/i386/trap.c

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



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

2018-02-12 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Feb 13 01:05:18 UTC 2018

Modified Files:
src/sys/arch/i386/i386: trap.c

Log Message:
Unconditionally print the trap like we do for amdt64 (Dimitris Karagkasidis)


To generate a diff of this commit:
cvs rdiff -u -r1.292 -r1.293 src/sys/arch/i386/i386/trap.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/i386/i386/trap.c
diff -u src/sys/arch/i386/i386/trap.c:1.292 src/sys/arch/i386/i386/trap.c:1.293
--- src/sys/arch/i386/i386/trap.c:1.292	Sat Jan 27 04:33:25 2018
+++ src/sys/arch/i386/i386/trap.c	Mon Feb 12 20:05:18 2018
@@ -1,5 +1,5 @@
 
-/*	$NetBSD: trap.c,v 1.292 2018/01/27 09:33:25 maxv Exp $	*/
+/*	$NetBSD: trap.c,v 1.293 2018/02/13 01:05:18 christos Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2000, 2005, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -69,7 +69,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.292 2018/01/27 09:33:25 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.293 2018/02/13 01:05:18 christos Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -307,8 +307,7 @@ trap(struct trapframe *frame)
 
 	default:
 	we_re_toast:
-		if (type != T_TRCTRAP)
-			trap_print(frame, l);
+		trap_print(frame, l);
 
 		if (kdb_trap(type, 0, frame))
 			return;



CVS commit: src/sbin/gpt

2018-02-12 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Tue Feb 13 00:34:11 UTC 2018

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

Log Message:
Spelling


To generate a diff of this commit:
cvs rdiff -u -r1.73 -r1.74 src/sbin/gpt/gpt.c

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



CVS commit: src/sbin/gpt

2018-02-12 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Tue Feb 13 00:34:11 UTC 2018

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

Log Message:
Spelling


To generate a diff of this commit:
cvs rdiff -u -r1.73 -r1.74 src/sbin/gpt/gpt.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/gpt/gpt.c
diff -u src/sbin/gpt/gpt.c:1.73 src/sbin/gpt/gpt.c:1.74
--- src/sbin/gpt/gpt.c:1.73	Thu Sep  7 10:23:33 2017
+++ src/sbin/gpt/gpt.c	Tue Feb 13 00:34:11 2018
@@ -35,7 +35,7 @@
 __FBSDID("$FreeBSD: src/sbin/gpt/gpt.c,v 1.16 2006/07/07 02:44:23 marcel Exp $");
 #endif
 #ifdef __RCSID
-__RCSID("$NetBSD: gpt.c,v 1.73 2017/09/07 10:23:33 christos Exp $");
+__RCSID("$NetBSD: gpt.c,v 1.74 2018/02/13 00:34:11 sevan Exp $");
 #endif
 
 #include 
@@ -1165,7 +1165,7 @@ gpt_attr_get(gpt_t gpt, uint64_t *attrib
 			if (strcmp(gpt_attr[i].name, ptr) == 0)
 break;
 		if (i == __arraycount(gpt_attr)) {
-			gpt_warnx(gpt, "Unregognized attribute `%s'", ptr);
+			gpt_warnx(gpt, "Unrecognized attribute `%s'", ptr);
 			rv = -1;
 		} else
 			*attributes |= gpt_attr[i].mask;



CVS commit: src/sys

2018-02-12 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Mon Feb 12 23:11:00 UTC 2018

Modified Files:
src/sys/arch/amd64/conf: ALL
src/sys/conf: files
src/sys/dev/ic: ciss.c cissvar.h
src/sys/dev/pci: ciss_pci.c

Log Message:
Add a new option CISS_NO_INTERRUPT_HACK for driving ciss(4) by callouts.
This is intended as workaround for certain Xen issues with dom0 kernels
and will likely want to have a high HZ value as well for decent
performance.


To generate a diff of this commit:
cvs rdiff -u -r1.80 -r1.81 src/sys/arch/amd64/conf/ALL
cvs rdiff -u -r1.1193 -r1.1194 src/sys/conf/files
cvs rdiff -u -r1.37 -r1.38 src/sys/dev/ic/ciss.c
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/ic/cissvar.h
cvs rdiff -u -r1.13 -r1.14 src/sys/dev/pci/ciss_pci.c

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



CVS commit: src/sys

2018-02-12 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Mon Feb 12 23:11:00 UTC 2018

Modified Files:
src/sys/arch/amd64/conf: ALL
src/sys/conf: files
src/sys/dev/ic: ciss.c cissvar.h
src/sys/dev/pci: ciss_pci.c

Log Message:
Add a new option CISS_NO_INTERRUPT_HACK for driving ciss(4) by callouts.
This is intended as workaround for certain Xen issues with dom0 kernels
and will likely want to have a high HZ value as well for decent
performance.


To generate a diff of this commit:
cvs rdiff -u -r1.80 -r1.81 src/sys/arch/amd64/conf/ALL
cvs rdiff -u -r1.1193 -r1.1194 src/sys/conf/files
cvs rdiff -u -r1.37 -r1.38 src/sys/dev/ic/ciss.c
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/ic/cissvar.h
cvs rdiff -u -r1.13 -r1.14 src/sys/dev/pci/ciss_pci.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/amd64/conf/ALL
diff -u src/sys/arch/amd64/conf/ALL:1.80 src/sys/arch/amd64/conf/ALL:1.81
--- src/sys/arch/amd64/conf/ALL:1.80	Sat Jan 27 21:46:54 2018
+++ src/sys/arch/amd64/conf/ALL	Mon Feb 12 23:11:00 2018
@@ -1,4 +1,4 @@
-# $NetBSD: ALL,v 1.80 2018/01/27 21:46:54 pgoyette Exp $
+# $NetBSD: ALL,v 1.81 2018/02/12 23:11:00 joerg 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.80 $"
+#ident		"ALL-$Revision: 1.81 $"
 
 maxusers	64		# estimated number of users
 
@@ -808,6 +808,8 @@ amr*	at pci? dev ? function ?	# AMI/LSI 
 arcmsr* at pci? dev ? function ?	# Areca SATA RAID controllers
 cac*	at pci? dev ? function ?	# Compaq PCI array controllers
 ciss*	at pci? dev ? function ?	# HP Smart Array controllers
+options CISS_NO_INTERRUPT_HACK
+
 icp*	at pci? dev ? function ?	# ICP-Vortex GDT & Intel RAID
 mlx*	at pci? dev ? function ?	# Mylex DAC960 & DEC SWXCR family
 twa*	at pci? dev ? function ?	# 3ware Escalade 95xx RAID controllers

Index: src/sys/conf/files
diff -u src/sys/conf/files:1.1193 src/sys/conf/files:1.1194
--- src/sys/conf/files:1.1193	Sun Feb  4 17:31:51 2018
+++ src/sys/conf/files	Mon Feb 12 23:11:00 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: files,v 1.1193 2018/02/04 17:31:51 maxv Exp $
+#	$NetBSD: files,v 1.1194 2018/02/12 23:11:00 joerg Exp $
 #	@(#)files.newconf	7.5 (Berkeley) 5/10/93
 
 version 	20171118
@@ -518,6 +518,7 @@ file	dev/ic/ld_cac.c			ld_cac
 
 # HP/Compaq Command Interface for SCSI-3 Support
 #
+defflag	opt_ciss.h			CISS_NO_INTERRUPT_HACK
 device ciss: scsi
 file	dev/ic/ciss.c			ciss
 

Index: src/sys/dev/ic/ciss.c
diff -u src/sys/dev/ic/ciss.c:1.37 src/sys/dev/ic/ciss.c:1.38
--- src/sys/dev/ic/ciss.c:1.37	Fri Jul 28 14:49:55 2017
+++ src/sys/dev/ic/ciss.c	Mon Feb 12 23:11:00 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ciss.c,v 1.37 2017/07/28 14:49:55 riastradh Exp $	*/
+/*	$NetBSD: ciss.c,v 1.38 2018/02/12 23:11:00 joerg Exp $	*/
 /*	$OpenBSD: ciss.c,v 1.68 2013/05/30 16:15:02 deraadt Exp $	*/
 
 /*
@@ -19,7 +19,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ciss.c,v 1.37 2017/07/28 14:49:55 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ciss.c,v 1.38 2018/02/12 23:11:00 joerg Exp $");
 
 #include "bio.h"
 
@@ -593,9 +593,11 @@ ciss_cmd(struct ciss_ccb *ccb, int flags
 	bus_dmamap_sync(sc->sc_dmat, sc->cmdmap, 0, sc->cmdmap->dm_mapsize,
 	BUS_DMASYNC_PREWRITE);
 
+#ifndef CISS_NO_INTERRUPT_HACK
 	if ((wait & (XS_CTL_POLL|XS_CTL_NOSLEEP)) == (XS_CTL_POLL|XS_CTL_NOSLEEP))
 		bus_space_write_4(sc->sc_iot, sc->sc_ioh, CISS_IMR,
 		bus_space_read_4(sc->sc_iot, sc->sc_ioh, CISS_IMR) | sc->iem);
+#endif
 
 	mutex_enter(>sc_mutex);
 	TAILQ_INSERT_TAIL(>sc_ccbq, ccb, ccb_link);
@@ -637,9 +639,11 @@ ciss_cmd(struct ciss_ccb *ccb, int flags
 		ccb->ccb_err.cmd_stat, ccb->ccb_err.scsi_stat));
 	}
 
+#ifndef CISS_NO_INTERRUPT_HACK
 	if ((wait & (XS_CTL_POLL|XS_CTL_NOSLEEP)) == (XS_CTL_POLL|XS_CTL_NOSLEEP))
 		bus_space_write_4(sc->sc_iot, sc->sc_ioh, CISS_IMR,
 		bus_space_read_4(sc->sc_iot, sc->sc_ioh, CISS_IMR) & ~sc->iem);
+#endif
 
 	return (error);
 }

Index: src/sys/dev/ic/cissvar.h
diff -u src/sys/dev/ic/cissvar.h:1.6 src/sys/dev/ic/cissvar.h:1.7
--- src/sys/dev/ic/cissvar.h:1.6	Sat Oct 12 16:52:21 2013
+++ src/sys/dev/ic/cissvar.h	Mon Feb 12 23:11:00 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: cissvar.h,v 1.6 2013/10/12 16:52:21 christos Exp $	*/
+/*	$NetBSD: cissvar.h,v 1.7 2018/02/12 23:11:00 joerg Exp $	*/
 /*	$OpenBSD: cissvar.h,v 1.15 2013/05/30 16:15:02 deraadt Exp $	*/
 
 /*
@@ -24,6 +24,8 @@
 #include 
 #include 
 
+#include "opt_ciss.h"
+
 struct ciss_ld {
 	struct ciss_blink bling;	/* a copy of blink state */
 	char	xname[16];		/* copy of the sdN name */
@@ -43,6 +45,9 @@ struct ciss_softc {
 	void			*sc_sh;		/* shutdown hook */
 	struct proc		*sc_thread;
 	int			sc_flush;
+#ifdef CISS_NO_INTERRUPT_HACK
+	struct callout		sc_interrupt_hack;
+#endif
 
 	struct 

CVS commit: src/lib/libc/arch/aarch64/gen

2018-02-12 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Mon Feb 12 22:31:04 UTC 2018

Modified Files:
src/lib/libc/arch/aarch64/gen: sigsetjmp.S

Log Message:
Fix __siglongjmp14().

Fixes SIGINT causing ksh to "longjmp botch", presumably due to incorrect
magic number.
cvs: --


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/lib/libc/arch/aarch64/gen/sigsetjmp.S

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



CVS commit: src/lib/libc/arch/aarch64/gen

2018-02-12 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Mon Feb 12 22:31:04 UTC 2018

Modified Files:
src/lib/libc/arch/aarch64/gen: sigsetjmp.S

Log Message:
Fix __siglongjmp14().

Fixes SIGINT causing ksh to "longjmp botch", presumably due to incorrect
magic number.
cvs: --


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/lib/libc/arch/aarch64/gen/sigsetjmp.S

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/arch/aarch64/gen/sigsetjmp.S
diff -u src/lib/libc/arch/aarch64/gen/sigsetjmp.S:1.1 src/lib/libc/arch/aarch64/gen/sigsetjmp.S:1.2
--- src/lib/libc/arch/aarch64/gen/sigsetjmp.S:1.1	Sun Aug 10 05:47:36 2014
+++ src/lib/libc/arch/aarch64/gen/sigsetjmp.S	Mon Feb 12 22:31:04 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: sigsetjmp.S,v 1.1 2014/08/10 05:47:36 matt Exp $ */
+/* $NetBSD: sigsetjmp.S,v 1.2 2018/02/12 22:31:04 jakllsch Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -47,6 +47,6 @@ END(__sigsetjmp14)
 
 ENTRY(__siglongjmp14)
 	ldr	x3, [x0, #_JB_MAGIC]
-	tbz	x3, #0, _C_LABEL(__longjmp14)
+	tbnz	x3, #0, _C_LABEL(__longjmp14)
 	b	_C_LABEL(_longjmp)
 END(__siglongjmp14)



CVS commit: src/sys/modules/pf

2018-02-12 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Mon Feb 12 22:18:36 UTC 2018

Modified Files:
src/sys/modules/pf: Makefile

Log Message:
Simplify and make the GCC check more precise at the same time.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/modules/pf/Makefile

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



CVS commit: src/usr.bin/make

2018-02-12 Thread Simon J. Gerraty
Module Name:src
Committed By:   sjg
Date:   Mon Feb 12 21:38:09 UTC 2018

Modified Files:
src/usr.bin/make: make.h parse.c

Log Message:
Do not treat .info as warning for -W

Reported by: lwhsu at FreeBSD.org


To generate a diff of this commit:
cvs rdiff -u -r1.103 -r1.104 src/usr.bin/make/make.h
cvs rdiff -u -r1.225 -r1.226 src/usr.bin/make/parse.c

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



CVS commit: src/usr.bin/make

2018-02-12 Thread Simon J. Gerraty
Module Name:src
Committed By:   sjg
Date:   Mon Feb 12 21:38:09 UTC 2018

Modified Files:
src/usr.bin/make: make.h parse.c

Log Message:
Do not treat .info as warning for -W

Reported by: lwhsu at FreeBSD.org


To generate a diff of this commit:
cvs rdiff -u -r1.103 -r1.104 src/usr.bin/make/make.h
cvs rdiff -u -r1.225 -r1.226 src/usr.bin/make/parse.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.bin/make/make.h
diff -u src/usr.bin/make/make.h:1.103 src/usr.bin/make/make.h:1.104
--- src/usr.bin/make/make.h:1.103	Thu Jul 20 19:29:54 2017
+++ src/usr.bin/make/make.h	Mon Feb 12 21:38:09 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: make.h,v 1.103 2017/07/20 19:29:54 sjg Exp $	*/
+/*	$NetBSD: make.h,v 1.104 2018/02/12 21:38:09 sjg Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -330,6 +330,7 @@ typedef struct GNode {
  * once the makefile has been parsed. PARSE_WARNING means it can. Passed
  * as the first argument to Parse_Error.
  */
+#define PARSE_INFO	3
 #define PARSE_WARNING	2
 #define PARSE_FATAL	1
 

Index: src/usr.bin/make/parse.c
diff -u src/usr.bin/make/parse.c:1.225 src/usr.bin/make/parse.c:1.226
--- src/usr.bin/make/parse.c:1.225	Mon Apr 17 13:29:07 2017
+++ src/usr.bin/make/parse.c	Mon Feb 12 21:38:09 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: parse.c,v 1.225 2017/04/17 13:29:07 maya Exp $	*/
+/*	$NetBSD: parse.c,v 1.226 2018/02/12 21:38:09 sjg Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: parse.c,v 1.225 2017/04/17 13:29:07 maya Exp $";
+static char rcsid[] = "$NetBSD: parse.c,v 1.226 2018/02/12 21:38:09 sjg Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)parse.c	8.3 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: parse.c,v 1.225 2017/04/17 13:29:07 maya Exp $");
+__RCSID("$NetBSD: parse.c,v 1.226 2018/02/12 21:38:09 sjg Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -703,6 +703,8 @@ ParseVErrorInternal(FILE *f, const char 
 	(void)vfprintf(f, fmt, ap);
 	(void)fprintf(f, "\n");
 	(void)fflush(f);
+	if (type == PARSE_INFO)
+		return;
 	if (type == PARSE_FATAL || parseWarnFatal)
 		fatals += 1;
 	if (parseWarnFatal && !fatal_warning_error_printed) {
@@ -795,7 +797,7 @@ ParseMessage(char *line)
 
 switch(*line) {
 case 'i':
-	mtype = 0;
+	mtype = PARSE_INFO;
 	break;
 case 'w':
 	mtype = PARSE_WARNING;



CVS commit: src/sys/modules/pf

2018-02-12 Thread Adam Ciarcinski
Module Name:src
Committed By:   adam
Date:   Mon Feb 12 20:47:09 UTC 2018

Modified Files:
src/sys/modules/pf: Makefile

Log Message:
Fix building with MKGCC=no


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/modules/pf/Makefile

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

Modified files:

Index: src/sys/modules/pf/Makefile
diff -u src/sys/modules/pf/Makefile:1.6 src/sys/modules/pf/Makefile:1.7
--- src/sys/modules/pf/Makefile:1.6	Tue Feb  6 12:58:17 2018
+++ src/sys/modules/pf/Makefile	Mon Feb 12 20:47:09 2018
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.6 2018/02/06 12:58:17 martin Exp $
+# $NetBSD: Makefile,v 1.7 2018/02/12 20:47:09 adam Exp $
 
 .include "../Makefile.inc"
 
@@ -20,7 +20,7 @@ SRCS+=	tcp_rndiss.c
 
 CPPFLAGS+=	-I${S}/dist/pf -I${S} -DINET6 -DINET
 
-.if ${HAVE_GCC} != 5
+.if defined(HAVE_GCC) && ${HAVE_GCC} != 5
 COPTS.pf_table.c+=	-Wno-error=shift-negative-value
 .endif
 



CVS commit: src/sys/modules/pf

2018-02-12 Thread Adam Ciarcinski
Module Name:src
Committed By:   adam
Date:   Mon Feb 12 20:47:09 UTC 2018

Modified Files:
src/sys/modules/pf: Makefile

Log Message:
Fix building with MKGCC=no


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/modules/pf/Makefile

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



CVS commit: src/share/misc

2018-02-12 Thread Brian Ginsbach
Module Name:src
Committed By:   ginsbach
Date:   Mon Feb 12 20:43:17 UTC 2018

Modified Files:
src/share/misc: acronyms.comp

Log Message:
Add CSDL


To generate a diff of this commit:
cvs rdiff -u -r1.190 -r1.191 src/share/misc/acronyms.comp

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



CVS commit: src/share/misc

2018-02-12 Thread Brian Ginsbach
Module Name:src
Committed By:   ginsbach
Date:   Mon Feb 12 20:43:17 UTC 2018

Modified Files:
src/share/misc: acronyms.comp

Log Message:
Add CSDL


To generate a diff of this commit:
cvs rdiff -u -r1.190 -r1.191 src/share/misc/acronyms.comp

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

Modified files:

Index: src/share/misc/acronyms.comp
diff -u src/share/misc/acronyms.comp:1.190 src/share/misc/acronyms.comp:1.191
--- src/share/misc/acronyms.comp:1.190	Tue Jan 30 22:45:12 2018
+++ src/share/misc/acronyms.comp	Mon Feb 12 20:43:17 2018
@@ -1,4 +1,4 @@
-$NetBSD: acronyms.comp,v 1.190 2018/01/30 22:45:12 ginsbach Exp $
+$NetBSD: acronyms.comp,v 1.191 2018/02/12 20:43:17 ginsbach Exp $
 3WHS	three-way handshake
 8VSB	8-state vestigial side band modulation
 AA	anti-aliasing
@@ -249,6 +249,7 @@ CS	cable select
 CS	chip select
 CS	code segment
 CS	computer science
+CSDL	common schema definition language
 CSI	channel state information
 CSI	common system interface
 CSMA	carrier sense multiple access



CVS commit: [netbsd-8] src/doc

2018-02-12 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Mon Feb 12 20:32:59 UTC 2018

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

Log Message:
546, 547


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

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



CVS commit: [netbsd-8] src/doc

2018-02-12 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Mon Feb 12 20:32:59 UTC 2018

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

Log Message:
546, 547


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.122 -r1.1.2.123 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.122 src/doc/CHANGES-8.0:1.1.2.123
--- src/doc/CHANGES-8.0:1.1.2.122	Mon Feb 12 05:40:25 2018
+++ src/doc/CHANGES-8.0	Mon Feb 12 20:32:59 2018
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-8.0,v 1.1.2.122 2018/02/12 05:40:25 snj Exp $
+# $NetBSD: CHANGES-8.0,v 1.1.2.123 2018/02/12 20:32:59 snj Exp $
 
 A complete list of changes from the initial NetBSD 8.0 branch on 2017-06-04
 until the 8.0 release:
@@ -9631,3 +9631,14 @@ sys/dev/dkwedge/dkwedge_gpt.c			1.19-1.2
 	Fix termination of gpt labels.  PR kern/52522.
 	[christos, ticket #545]
 
+sys/net/if_mpls.c1.31-1.33
+sys/netmpls/mpls_ttl.c1.9-1.11 via patch
+
+	Sync MPLS with NetBSD-current, fix several bugs.
+	[maxv, ticket #546]
+
+sys/netinet/ip_input.c1.366
+
+	Don't allow source-routed packets by default.
+	[maxv, ticket #547]
+



CVS commit: [netbsd-7] src/doc

2018-02-12 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Mon Feb 12 18:44:14 UTC 2018

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

Log Message:
1548, 1551, 1552


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.65 -r1.1.2.66 src/doc/CHANGES-7.2

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

Modified files:

Index: src/doc/CHANGES-7.2
diff -u src/doc/CHANGES-7.2:1.1.2.65 src/doc/CHANGES-7.2:1.1.2.66
--- src/doc/CHANGES-7.2:1.1.2.65	Sat Feb 10 04:22:50 2018
+++ src/doc/CHANGES-7.2	Mon Feb 12 18:44:13 2018
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-7.2,v 1.1.2.65 2018/02/10 04:22:50 snj Exp $
+# $NetBSD: CHANGES-7.2,v 1.1.2.66 2018/02/12 18:44:13 snj Exp $
 
 A complete list of changes from the NetBSD 7.1 release to the NetBSD 7.2
 release:
@@ -5093,3 +5093,21 @@ sys/dist/pf/net/pf.c1.78 via patch
 	Fix signedness bug in PF. PR/44059.
 	[maxv, ticket #1565]
 
+external/bsd/blacklist/bin/blacklistd.c		1.35
+external/bsd/blacklist/bin/state.c		1.19
+
+	Fix blacklistd -r.
+	[christos, ticket #1548]
+
+sys/netinet6/ip6_forward.c			1.89-1.90 via patch
+
+	Fix use-after-free of mbuf by ip6flow_create.
+	[ozaki-r, ticket #1551]
+
+sys/arch/sparc/sparc/timer.c			1.33-1.34
+sys/arch/sparc/sparc/timer_sun4m.c		1.31
+sys/arch/sparc/sparc/timerreg.h			1.10
+
+	Fix time goes backwards problems on sparc.
+	[mrg, ticket #1552]
+



CVS commit: [netbsd-7-0] src/doc

2018-02-12 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Mon Feb 12 18:44:38 UTC 2018

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

Log Message:
1551, 1552


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.79 -r1.1.2.80 src/doc/CHANGES-7.0.3

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



CVS commit: [netbsd-7-0] src/doc

2018-02-12 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Mon Feb 12 18:44:38 UTC 2018

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

Log Message:
1551, 1552


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.79 -r1.1.2.80 src/doc/CHANGES-7.0.3

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

Modified files:

Index: src/doc/CHANGES-7.0.3
diff -u src/doc/CHANGES-7.0.3:1.1.2.79 src/doc/CHANGES-7.0.3:1.1.2.80
--- src/doc/CHANGES-7.0.3:1.1.2.79	Sat Feb 10 04:22:10 2018
+++ src/doc/CHANGES-7.0.3	Mon Feb 12 18:44:38 2018
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-7.0.3,v 1.1.2.79 2018/02/10 04:22:10 snj Exp $
+# $NetBSD: CHANGES-7.0.3,v 1.1.2.80 2018/02/12 18:44:38 snj Exp $
 
 A complete list of changes from the NetBSD 7.0.2 release to the NetBSD 7.0.3
 release:
@@ -5222,3 +5222,15 @@ sys/dist/pf/net/pf.c1.78 via patch
 	Fix signedness bug in PF. PR/44059.
 	[maxv, ticket #1565]
 
+sys/netinet6/ip6_forward.c			1.89-1.90 via patch
+
+	Fix use-after-free of mbuf by ip6flow_create.
+	[ozaki-r, ticket #1551]
+
+sys/arch/sparc/sparc/timer.c			1.33-1.34
+sys/arch/sparc/sparc/timer_sun4m.c		1.31
+sys/arch/sparc/sparc/timerreg.h			1.10
+
+	Fix time goes backwards problems on sparc.
+	[mrg, ticket #1552]
+



CVS commit: [netbsd-7-1] src/doc

2018-02-12 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Mon Feb 12 18:44:28 UTC 2018

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

Log Message:
1551, 1552


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.9 -r1.1.2.10 src/doc/CHANGES-7.1.2

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

Modified files:

Index: src/doc/CHANGES-7.1.2
diff -u src/doc/CHANGES-7.1.2:1.1.2.9 src/doc/CHANGES-7.1.2:1.1.2.10
--- src/doc/CHANGES-7.1.2:1.1.2.9	Sat Feb 10 04:22:31 2018
+++ src/doc/CHANGES-7.1.2	Mon Feb 12 18:44:28 2018
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-7.1.2,v 1.1.2.9 2018/02/10 04:22:31 snj Exp $
+# $NetBSD: CHANGES-7.1.2,v 1.1.2.10 2018/02/12 18:44:28 snj Exp $
 
 A complete list of changes from the NetBSD 7.1.1 release to the NetBSD 7.1.2
 release:
@@ -110,3 +110,15 @@ sys/dist/pf/net/pf.c1.78 via patch
 	Fix signedness bug in PF. PR/44059.
 	[maxv, ticket #1565]
 
+sys/netinet6/ip6_forward.c			1.89-1.90 via patch
+
+	Fix use-after-free of mbuf by ip6flow_create.
+	[ozaki-r, ticket #1551]
+
+sys/arch/sparc/sparc/timer.c			1.33-1.34
+sys/arch/sparc/sparc/timer_sun4m.c		1.31
+sys/arch/sparc/sparc/timerreg.h			1.10
+
+	Fix time goes backwards problems on sparc.
+	[mrg, ticket #1552]
+



CVS commit: [netbsd-7-1] src/doc

2018-02-12 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Mon Feb 12 18:44:28 UTC 2018

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

Log Message:
1551, 1552


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.9 -r1.1.2.10 src/doc/CHANGES-7.1.2

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



CVS commit: [netbsd-7] src/doc

2018-02-12 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Mon Feb 12 18:44:14 UTC 2018

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

Log Message:
1548, 1551, 1552


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.65 -r1.1.2.66 src/doc/CHANGES-7.2

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



CVS commit: [netbsd-7-1] src/sys/arch/sparc/sparc

2018-02-12 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Mon Feb 12 18:42:18 UTC 2018

Modified Files:
src/sys/arch/sparc/sparc [netbsd-7-1]: timer.c timer_sun4m.c timerreg.h

Log Message:
Pull up following revision(s) (requested by mrg in ticket #1552):
sys/arch/sparc/sparc/timer.c: 1.33-1.34
sys/arch/sparc/sparc/timer_sun4m.c: 1.31
sys/arch/sparc/sparc/timerreg.h: 1.10
fix time goes backwards problems on sparc.
there are a few things here:
- there's a race between reading the limit register (which clears
  the interrupt and the limit bit) and increasing the latest offset.
  this can happen easily if an interrupt comes between the read and
  the call to tickle_tc() that increases the offset (i obverved this
  actually happening.)
- in early boot, sometimes the counter can cycle twice before the
  tickle happens.
to handle these issues, add two workarounds:
- if the limit bit isn't set, but the counter value is less than
  the previous value, and the offset hasn't changed, use the same
  fixup as if the limit bit was set.  this handles the first case
  above.
- add a hard-workaround for never allowing returning a smaller
  value (except during 32 bit overflow): if the result is less than
  the last result, add fixups until it does (or until it would
  overflow.)
the first workaround fixes general run-time issues, and the second
fixes issues only seen during boot.
also expand some comments in timer_sun4m.c and re-enable the sun4m
sub-microsecond tmr_ustolim4m() support (but it's always called with
at least 'tick' microseconds, so the end result is the same.)
--
fix hang at 4B microseconds (1h12 or so), and simplify part of the previous


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.32.16.1 src/sys/arch/sparc/sparc/timer.c
cvs rdiff -u -r1.30 -r1.30.16.1 src/sys/arch/sparc/sparc/timer_sun4m.c
cvs rdiff -u -r1.9 -r1.9.152.1 src/sys/arch/sparc/sparc/timerreg.h

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



CVS commit: [netbsd-7] src/sys/arch/sparc/sparc

2018-02-12 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Mon Feb 12 18:42:20 UTC 2018

Modified Files:
src/sys/arch/sparc/sparc [netbsd-7]: timer.c timer_sun4m.c timerreg.h

Log Message:
Pull up following revision(s) (requested by mrg in ticket #1552):
sys/arch/sparc/sparc/timer.c: 1.33-1.34
sys/arch/sparc/sparc/timer_sun4m.c: 1.31
sys/arch/sparc/sparc/timerreg.h: 1.10
fix time goes backwards problems on sparc.
there are a few things here:
- there's a race between reading the limit register (which clears
  the interrupt and the limit bit) and increasing the latest offset.
  this can happen easily if an interrupt comes between the read and
  the call to tickle_tc() that increases the offset (i obverved this
  actually happening.)
- in early boot, sometimes the counter can cycle twice before the
  tickle happens.
to handle these issues, add two workarounds:
- if the limit bit isn't set, but the counter value is less than
  the previous value, and the offset hasn't changed, use the same
  fixup as if the limit bit was set.  this handles the first case
  above.
- add a hard-workaround for never allowing returning a smaller
  value (except during 32 bit overflow): if the result is less than
  the last result, add fixups until it does (or until it would
  overflow.)
the first workaround fixes general run-time issues, and the second
fixes issues only seen during boot.
also expand some comments in timer_sun4m.c and re-enable the sun4m
sub-microsecond tmr_ustolim4m() support (but it's always called with
at least 'tick' microseconds, so the end result is the same.)
--
fix hang at 4B microseconds (1h12 or so), and simplify part of the previous


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.32.4.1 src/sys/arch/sparc/sparc/timer.c
cvs rdiff -u -r1.30 -r1.30.4.1 src/sys/arch/sparc/sparc/timer_sun4m.c
cvs rdiff -u -r1.9 -r1.9.140.1 src/sys/arch/sparc/sparc/timerreg.h

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



CVS commit: [netbsd-7-0] src/sys/arch/sparc/sparc

2018-02-12 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Mon Feb 12 18:42:16 UTC 2018

Modified Files:
src/sys/arch/sparc/sparc [netbsd-7-0]: timer.c timer_sun4m.c timerreg.h

Log Message:
Pull up following revision(s) (requested by mrg in ticket #1552):
sys/arch/sparc/sparc/timer.c: 1.33-1.34
sys/arch/sparc/sparc/timer_sun4m.c: 1.31
sys/arch/sparc/sparc/timerreg.h: 1.10
fix time goes backwards problems on sparc.
there are a few things here:
- there's a race between reading the limit register (which clears
  the interrupt and the limit bit) and increasing the latest offset.
  this can happen easily if an interrupt comes between the read and
  the call to tickle_tc() that increases the offset (i obverved this
  actually happening.)
- in early boot, sometimes the counter can cycle twice before the
  tickle happens.
to handle these issues, add two workarounds:
- if the limit bit isn't set, but the counter value is less than
  the previous value, and the offset hasn't changed, use the same
  fixup as if the limit bit was set.  this handles the first case
  above.
- add a hard-workaround for never allowing returning a smaller
  value (except during 32 bit overflow): if the result is less than
  the last result, add fixups until it does (or until it would
  overflow.)
the first workaround fixes general run-time issues, and the second
fixes issues only seen during boot.
also expand some comments in timer_sun4m.c and re-enable the sun4m
sub-microsecond tmr_ustolim4m() support (but it's always called with
at least 'tick' microseconds, so the end result is the same.)
--
fix hang at 4B microseconds (1h12 or so), and simplify part of the previous


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.32.8.1 src/sys/arch/sparc/sparc/timer.c
cvs rdiff -u -r1.30 -r1.30.8.1 src/sys/arch/sparc/sparc/timer_sun4m.c
cvs rdiff -u -r1.9 -r1.9.144.1 src/sys/arch/sparc/sparc/timerreg.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/sparc/sparc/timer.c
diff -u src/sys/arch/sparc/sparc/timer.c:1.32 src/sys/arch/sparc/sparc/timer.c:1.32.8.1
--- src/sys/arch/sparc/sparc/timer.c:1.32	Sun Jan 19 00:22:33 2014
+++ src/sys/arch/sparc/sparc/timer.c	Mon Feb 12 18:42:16 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: timer.c,v 1.32 2014/01/19 00:22:33 mrg Exp $ */
+/*	$NetBSD: timer.c,v 1.32.8.1 2018/02/12 18:42:16 snj Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -60,7 +60,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: timer.c,v 1.32 2014/01/19 00:22:33 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: timer.c,v 1.32.8.1 2018/02/12 18:42:16 snj Exp $");
 
 #include 
 #include 
@@ -85,55 +85,92 @@ void *sched_cookie;
  * timecounter local state
  */
 static struct counter {
-	volatile u_int *cntreg;	/* counter register */
+	__cpu_simple_lock_t lock; /* protects access to offset, reg, last* */
+	volatile u_int *cntreg;	/* counter register to read */
 	u_int limit;		/* limit we count up to */
 	u_int offset;		/* accumulated offset due to wraps */
 	u_int shift;		/* scaling for valid bits */
 	u_int mask;		/* valid bit mask */
-} cntr;
+	u_int lastcnt;		/* the last* values are used to notice */
+	u_int lastres;		/* and fix up cases where it would appear */
+	u_int lastoffset;	/* time went backwards. */
+} cntr __aligned(CACHE_LINE_SIZE);
 
 /*
  * define timecounter
  */
 
 static struct timecounter counter_timecounter = {
-	timer_get_timecount,	/* get_timecount */
-	0,			/* no poll_pps */
-	~0u,			/* counter_mask */
-	0,  /* frequency - set at initialisation */
-	"timer-counter",	/* name */
-	100,			/* quality */
-/* private reference */
+	.tc_get_timecount =	timer_get_timecount,
+	.tc_poll_pps =		NULL,
+	.tc_counter_mask =	~0u,
+	.tc_frequency =		0,
+	.tc_name =		"timer-counter",
+	.tc_quality =		100,
+	.tc_priv =		,
 };
 
 /*
  * timer_get_timecount provide current counter value
  */
+__attribute__((__optimize__("Os")))
 static u_int
 timer_get_timecount(struct timecounter *tc)
 {
-	struct counter *ctr = (struct counter *)tc->tc_priv;
-
-	u_int c, res, r;
+	u_int cnt, res, fixup, offset;
 	int s;
 
+	/*
+	 * We use splhigh/__cpu_simple_lock here as we don't want
+	 * any mutex or lockdebug overhead.  The lock protects a
+	 * bunch of the members of cntr that are written here to
+	 * deal with the various minor races to be observed and
+	 * worked around.
+	 */
 	s = splhigh();
-
-	res = c = *ctr->cntreg;
+	__cpu_simple_lock();
+	res = cnt = *cntr.cntreg;
 
 	res &= ~TMR_LIMIT;
+	offset = cntr.offset;
 
-	if (c != res) {
-		r = ctr->limit;
+	/*
+	 * There are 3 cases here:
+	 * - limit reached, interrupt not yet processed.
+	 * - count reset but offset the same, race between handling
+	 *   the interrupt and tickle_tc() updating the offset.
+	 * - normal case.
+	 *
+	 * For the first two cases, add the limit so that we avoid
+	 * time going backwards.
+	 */
+	if (cnt != res) {
+		fixup = 

CVS commit: [netbsd-7-1] src/sys/arch/sparc/sparc

2018-02-12 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Mon Feb 12 18:42:18 UTC 2018

Modified Files:
src/sys/arch/sparc/sparc [netbsd-7-1]: timer.c timer_sun4m.c timerreg.h

Log Message:
Pull up following revision(s) (requested by mrg in ticket #1552):
sys/arch/sparc/sparc/timer.c: 1.33-1.34
sys/arch/sparc/sparc/timer_sun4m.c: 1.31
sys/arch/sparc/sparc/timerreg.h: 1.10
fix time goes backwards problems on sparc.
there are a few things here:
- there's a race between reading the limit register (which clears
  the interrupt and the limit bit) and increasing the latest offset.
  this can happen easily if an interrupt comes between the read and
  the call to tickle_tc() that increases the offset (i obverved this
  actually happening.)
- in early boot, sometimes the counter can cycle twice before the
  tickle happens.
to handle these issues, add two workarounds:
- if the limit bit isn't set, but the counter value is less than
  the previous value, and the offset hasn't changed, use the same
  fixup as if the limit bit was set.  this handles the first case
  above.
- add a hard-workaround for never allowing returning a smaller
  value (except during 32 bit overflow): if the result is less than
  the last result, add fixups until it does (or until it would
  overflow.)
the first workaround fixes general run-time issues, and the second
fixes issues only seen during boot.
also expand some comments in timer_sun4m.c and re-enable the sun4m
sub-microsecond tmr_ustolim4m() support (but it's always called with
at least 'tick' microseconds, so the end result is the same.)
--
fix hang at 4B microseconds (1h12 or so), and simplify part of the previous


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.32.16.1 src/sys/arch/sparc/sparc/timer.c
cvs rdiff -u -r1.30 -r1.30.16.1 src/sys/arch/sparc/sparc/timer_sun4m.c
cvs rdiff -u -r1.9 -r1.9.152.1 src/sys/arch/sparc/sparc/timerreg.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/sparc/sparc/timer.c
diff -u src/sys/arch/sparc/sparc/timer.c:1.32 src/sys/arch/sparc/sparc/timer.c:1.32.16.1
--- src/sys/arch/sparc/sparc/timer.c:1.32	Sun Jan 19 00:22:33 2014
+++ src/sys/arch/sparc/sparc/timer.c	Mon Feb 12 18:42:17 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: timer.c,v 1.32 2014/01/19 00:22:33 mrg Exp $ */
+/*	$NetBSD: timer.c,v 1.32.16.1 2018/02/12 18:42:17 snj Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -60,7 +60,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: timer.c,v 1.32 2014/01/19 00:22:33 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: timer.c,v 1.32.16.1 2018/02/12 18:42:17 snj Exp $");
 
 #include 
 #include 
@@ -85,55 +85,92 @@ void *sched_cookie;
  * timecounter local state
  */
 static struct counter {
-	volatile u_int *cntreg;	/* counter register */
+	__cpu_simple_lock_t lock; /* protects access to offset, reg, last* */
+	volatile u_int *cntreg;	/* counter register to read */
 	u_int limit;		/* limit we count up to */
 	u_int offset;		/* accumulated offset due to wraps */
 	u_int shift;		/* scaling for valid bits */
 	u_int mask;		/* valid bit mask */
-} cntr;
+	u_int lastcnt;		/* the last* values are used to notice */
+	u_int lastres;		/* and fix up cases where it would appear */
+	u_int lastoffset;	/* time went backwards. */
+} cntr __aligned(CACHE_LINE_SIZE);
 
 /*
  * define timecounter
  */
 
 static struct timecounter counter_timecounter = {
-	timer_get_timecount,	/* get_timecount */
-	0,			/* no poll_pps */
-	~0u,			/* counter_mask */
-	0,  /* frequency - set at initialisation */
-	"timer-counter",	/* name */
-	100,			/* quality */
-/* private reference */
+	.tc_get_timecount =	timer_get_timecount,
+	.tc_poll_pps =		NULL,
+	.tc_counter_mask =	~0u,
+	.tc_frequency =		0,
+	.tc_name =		"timer-counter",
+	.tc_quality =		100,
+	.tc_priv =		,
 };
 
 /*
  * timer_get_timecount provide current counter value
  */
+__attribute__((__optimize__("Os")))
 static u_int
 timer_get_timecount(struct timecounter *tc)
 {
-	struct counter *ctr = (struct counter *)tc->tc_priv;
-
-	u_int c, res, r;
+	u_int cnt, res, fixup, offset;
 	int s;
 
+	/*
+	 * We use splhigh/__cpu_simple_lock here as we don't want
+	 * any mutex or lockdebug overhead.  The lock protects a
+	 * bunch of the members of cntr that are written here to
+	 * deal with the various minor races to be observed and
+	 * worked around.
+	 */
 	s = splhigh();
-
-	res = c = *ctr->cntreg;
+	__cpu_simple_lock();
+	res = cnt = *cntr.cntreg;
 
 	res &= ~TMR_LIMIT;
+	offset = cntr.offset;
 
-	if (c != res) {
-		r = ctr->limit;
+	/*
+	 * There are 3 cases here:
+	 * - limit reached, interrupt not yet processed.
+	 * - count reset but offset the same, race between handling
+	 *   the interrupt and tickle_tc() updating the offset.
+	 * - normal case.
+	 *
+	 * For the first two cases, add the limit so that we avoid
+	 * time going backwards.
+	 */
+	if (cnt != res) {
+		fixup = 

CVS commit: [netbsd-7] src/sys/arch/sparc/sparc

2018-02-12 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Mon Feb 12 18:42:20 UTC 2018

Modified Files:
src/sys/arch/sparc/sparc [netbsd-7]: timer.c timer_sun4m.c timerreg.h

Log Message:
Pull up following revision(s) (requested by mrg in ticket #1552):
sys/arch/sparc/sparc/timer.c: 1.33-1.34
sys/arch/sparc/sparc/timer_sun4m.c: 1.31
sys/arch/sparc/sparc/timerreg.h: 1.10
fix time goes backwards problems on sparc.
there are a few things here:
- there's a race between reading the limit register (which clears
  the interrupt and the limit bit) and increasing the latest offset.
  this can happen easily if an interrupt comes between the read and
  the call to tickle_tc() that increases the offset (i obverved this
  actually happening.)
- in early boot, sometimes the counter can cycle twice before the
  tickle happens.
to handle these issues, add two workarounds:
- if the limit bit isn't set, but the counter value is less than
  the previous value, and the offset hasn't changed, use the same
  fixup as if the limit bit was set.  this handles the first case
  above.
- add a hard-workaround for never allowing returning a smaller
  value (except during 32 bit overflow): if the result is less than
  the last result, add fixups until it does (or until it would
  overflow.)
the first workaround fixes general run-time issues, and the second
fixes issues only seen during boot.
also expand some comments in timer_sun4m.c and re-enable the sun4m
sub-microsecond tmr_ustolim4m() support (but it's always called with
at least 'tick' microseconds, so the end result is the same.)
--
fix hang at 4B microseconds (1h12 or so), and simplify part of the previous


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.32.4.1 src/sys/arch/sparc/sparc/timer.c
cvs rdiff -u -r1.30 -r1.30.4.1 src/sys/arch/sparc/sparc/timer_sun4m.c
cvs rdiff -u -r1.9 -r1.9.140.1 src/sys/arch/sparc/sparc/timerreg.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/sparc/sparc/timer.c
diff -u src/sys/arch/sparc/sparc/timer.c:1.32 src/sys/arch/sparc/sparc/timer.c:1.32.4.1
--- src/sys/arch/sparc/sparc/timer.c:1.32	Sun Jan 19 00:22:33 2014
+++ src/sys/arch/sparc/sparc/timer.c	Mon Feb 12 18:42:19 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: timer.c,v 1.32 2014/01/19 00:22:33 mrg Exp $ */
+/*	$NetBSD: timer.c,v 1.32.4.1 2018/02/12 18:42:19 snj Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -60,7 +60,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: timer.c,v 1.32 2014/01/19 00:22:33 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: timer.c,v 1.32.4.1 2018/02/12 18:42:19 snj Exp $");
 
 #include 
 #include 
@@ -85,55 +85,92 @@ void *sched_cookie;
  * timecounter local state
  */
 static struct counter {
-	volatile u_int *cntreg;	/* counter register */
+	__cpu_simple_lock_t lock; /* protects access to offset, reg, last* */
+	volatile u_int *cntreg;	/* counter register to read */
 	u_int limit;		/* limit we count up to */
 	u_int offset;		/* accumulated offset due to wraps */
 	u_int shift;		/* scaling for valid bits */
 	u_int mask;		/* valid bit mask */
-} cntr;
+	u_int lastcnt;		/* the last* values are used to notice */
+	u_int lastres;		/* and fix up cases where it would appear */
+	u_int lastoffset;	/* time went backwards. */
+} cntr __aligned(CACHE_LINE_SIZE);
 
 /*
  * define timecounter
  */
 
 static struct timecounter counter_timecounter = {
-	timer_get_timecount,	/* get_timecount */
-	0,			/* no poll_pps */
-	~0u,			/* counter_mask */
-	0,  /* frequency - set at initialisation */
-	"timer-counter",	/* name */
-	100,			/* quality */
-/* private reference */
+	.tc_get_timecount =	timer_get_timecount,
+	.tc_poll_pps =		NULL,
+	.tc_counter_mask =	~0u,
+	.tc_frequency =		0,
+	.tc_name =		"timer-counter",
+	.tc_quality =		100,
+	.tc_priv =		,
 };
 
 /*
  * timer_get_timecount provide current counter value
  */
+__attribute__((__optimize__("Os")))
 static u_int
 timer_get_timecount(struct timecounter *tc)
 {
-	struct counter *ctr = (struct counter *)tc->tc_priv;
-
-	u_int c, res, r;
+	u_int cnt, res, fixup, offset;
 	int s;
 
+	/*
+	 * We use splhigh/__cpu_simple_lock here as we don't want
+	 * any mutex or lockdebug overhead.  The lock protects a
+	 * bunch of the members of cntr that are written here to
+	 * deal with the various minor races to be observed and
+	 * worked around.
+	 */
 	s = splhigh();
-
-	res = c = *ctr->cntreg;
+	__cpu_simple_lock();
+	res = cnt = *cntr.cntreg;
 
 	res &= ~TMR_LIMIT;
+	offset = cntr.offset;
 
-	if (c != res) {
-		r = ctr->limit;
+	/*
+	 * There are 3 cases here:
+	 * - limit reached, interrupt not yet processed.
+	 * - count reset but offset the same, race between handling
+	 *   the interrupt and tickle_tc() updating the offset.
+	 * - normal case.
+	 *
+	 * For the first two cases, add the limit so that we avoid
+	 * time going backwards.
+	 */
+	if (cnt != res) {
+		fixup = 

CVS commit: [netbsd-7-0] src/sys/arch/sparc/sparc

2018-02-12 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Mon Feb 12 18:42:16 UTC 2018

Modified Files:
src/sys/arch/sparc/sparc [netbsd-7-0]: timer.c timer_sun4m.c timerreg.h

Log Message:
Pull up following revision(s) (requested by mrg in ticket #1552):
sys/arch/sparc/sparc/timer.c: 1.33-1.34
sys/arch/sparc/sparc/timer_sun4m.c: 1.31
sys/arch/sparc/sparc/timerreg.h: 1.10
fix time goes backwards problems on sparc.
there are a few things here:
- there's a race between reading the limit register (which clears
  the interrupt and the limit bit) and increasing the latest offset.
  this can happen easily if an interrupt comes between the read and
  the call to tickle_tc() that increases the offset (i obverved this
  actually happening.)
- in early boot, sometimes the counter can cycle twice before the
  tickle happens.
to handle these issues, add two workarounds:
- if the limit bit isn't set, but the counter value is less than
  the previous value, and the offset hasn't changed, use the same
  fixup as if the limit bit was set.  this handles the first case
  above.
- add a hard-workaround for never allowing returning a smaller
  value (except during 32 bit overflow): if the result is less than
  the last result, add fixups until it does (or until it would
  overflow.)
the first workaround fixes general run-time issues, and the second
fixes issues only seen during boot.
also expand some comments in timer_sun4m.c and re-enable the sun4m
sub-microsecond tmr_ustolim4m() support (but it's always called with
at least 'tick' microseconds, so the end result is the same.)
--
fix hang at 4B microseconds (1h12 or so), and simplify part of the previous


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.32.8.1 src/sys/arch/sparc/sparc/timer.c
cvs rdiff -u -r1.30 -r1.30.8.1 src/sys/arch/sparc/sparc/timer_sun4m.c
cvs rdiff -u -r1.9 -r1.9.144.1 src/sys/arch/sparc/sparc/timerreg.h

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



CVS commit: [netbsd-7] src/sys/netinet6

2018-02-12 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Mon Feb 12 18:37:51 UTC 2018

Modified Files:
src/sys/netinet6 [netbsd-7]: ip6_forward.c

Log Message:
Pull up following revision(s) (requested by ozaki-r in ticket #1551):
sys/netinet6/ip6_forward.c: 1.89-1.90 via patch
Fix use-after-free of mbuf by ip6flow_create
This fixes recent failures of some ATF tests such as t_ipsec_tunnel_odd.
--
Fix use-after-free of mbuf by ip6flow_create (one more)


To generate a diff of this commit:
cvs rdiff -u -r1.73.2.1 -r1.73.2.2 src/sys/netinet6/ip6_forward.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_forward.c
diff -u src/sys/netinet6/ip6_forward.c:1.73.2.1 src/sys/netinet6/ip6_forward.c:1.73.2.2
--- src/sys/netinet6/ip6_forward.c:1.73.2.1	Sat Jan 17 12:10:54 2015
+++ src/sys/netinet6/ip6_forward.c	Mon Feb 12 18:37:51 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip6_forward.c,v 1.73.2.1 2015/01/17 12:10:54 martin Exp $	*/
+/*	$NetBSD: ip6_forward.c,v 1.73.2.2 2018/02/12 18:37:51 snj Exp $	*/
 /*	$KAME: ip6_forward.c,v 1.109 2002/09/11 08:10:17 sakane Exp $	*/
 
 /*
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ip6_forward.c,v 1.73.2.1 2015/01/17 12:10:54 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip6_forward.c,v 1.73.2.2 2018/02/12 18:37:51 snj Exp $");
 
 #include "opt_gateway.h"
 #include "opt_ipsec.h"
@@ -406,8 +406,8 @@ ip6_forward(struct mbuf *m, int srcrt)
 			IP6_STATINC(IP6_STAT_REDIRECTSENT);
 		else {
 #ifdef GATEWAY
-			if (m->m_flags & M_CANFASTFWD)
-ip6flow_create(_forward_rt, m);
+			if (mcopy->m_flags & M_CANFASTFWD)
+ip6flow_create(_forward_rt, mcopy);
 #endif
 			if (mcopy)
 goto freecopy;



CVS commit: [netbsd-7-1] src/sys/netinet6

2018-02-12 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Mon Feb 12 18:37:50 UTC 2018

Modified Files:
src/sys/netinet6 [netbsd-7-1]: ip6_forward.c

Log Message:
Pull up following revision(s) (requested by ozaki-r in ticket #1551):
sys/netinet6/ip6_forward.c: 1.89-1.90 via patch
Fix use-after-free of mbuf by ip6flow_create
This fixes recent failures of some ATF tests such as t_ipsec_tunnel_odd.
--
Fix use-after-free of mbuf by ip6flow_create (one more)


To generate a diff of this commit:
cvs rdiff -u -r1.73.2.1 -r1.73.2.1.6.1 src/sys/netinet6/ip6_forward.c

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



CVS commit: [netbsd-7-0] src/sys/netinet6

2018-02-12 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Mon Feb 12 18:37:48 UTC 2018

Modified Files:
src/sys/netinet6 [netbsd-7-0]: ip6_forward.c

Log Message:
Pull up following revision(s) (requested by ozaki-r in ticket #1551):
sys/netinet6/ip6_forward.c: 1.89-1.90 via patch
Fix use-after-free of mbuf by ip6flow_create
This fixes recent failures of some ATF tests such as t_ipsec_tunnel_odd.
--
Fix use-after-free of mbuf by ip6flow_create (one more)


To generate a diff of this commit:
cvs rdiff -u -r1.73.2.1 -r1.73.2.1.2.1 src/sys/netinet6/ip6_forward.c

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



CVS commit: [netbsd-7] src/sys/netinet6

2018-02-12 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Mon Feb 12 18:37:51 UTC 2018

Modified Files:
src/sys/netinet6 [netbsd-7]: ip6_forward.c

Log Message:
Pull up following revision(s) (requested by ozaki-r in ticket #1551):
sys/netinet6/ip6_forward.c: 1.89-1.90 via patch
Fix use-after-free of mbuf by ip6flow_create
This fixes recent failures of some ATF tests such as t_ipsec_tunnel_odd.
--
Fix use-after-free of mbuf by ip6flow_create (one more)


To generate a diff of this commit:
cvs rdiff -u -r1.73.2.1 -r1.73.2.2 src/sys/netinet6/ip6_forward.c

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



CVS commit: [netbsd-7-1] src/sys/netinet6

2018-02-12 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Mon Feb 12 18:37:50 UTC 2018

Modified Files:
src/sys/netinet6 [netbsd-7-1]: ip6_forward.c

Log Message:
Pull up following revision(s) (requested by ozaki-r in ticket #1551):
sys/netinet6/ip6_forward.c: 1.89-1.90 via patch
Fix use-after-free of mbuf by ip6flow_create
This fixes recent failures of some ATF tests such as t_ipsec_tunnel_odd.
--
Fix use-after-free of mbuf by ip6flow_create (one more)


To generate a diff of this commit:
cvs rdiff -u -r1.73.2.1 -r1.73.2.1.6.1 src/sys/netinet6/ip6_forward.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_forward.c
diff -u src/sys/netinet6/ip6_forward.c:1.73.2.1 src/sys/netinet6/ip6_forward.c:1.73.2.1.6.1
--- src/sys/netinet6/ip6_forward.c:1.73.2.1	Sat Jan 17 12:10:54 2015
+++ src/sys/netinet6/ip6_forward.c	Mon Feb 12 18:37:49 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip6_forward.c,v 1.73.2.1 2015/01/17 12:10:54 martin Exp $	*/
+/*	$NetBSD: ip6_forward.c,v 1.73.2.1.6.1 2018/02/12 18:37:49 snj Exp $	*/
 /*	$KAME: ip6_forward.c,v 1.109 2002/09/11 08:10:17 sakane Exp $	*/
 
 /*
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ip6_forward.c,v 1.73.2.1 2015/01/17 12:10:54 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip6_forward.c,v 1.73.2.1.6.1 2018/02/12 18:37:49 snj Exp $");
 
 #include "opt_gateway.h"
 #include "opt_ipsec.h"
@@ -406,8 +406,8 @@ ip6_forward(struct mbuf *m, int srcrt)
 			IP6_STATINC(IP6_STAT_REDIRECTSENT);
 		else {
 #ifdef GATEWAY
-			if (m->m_flags & M_CANFASTFWD)
-ip6flow_create(_forward_rt, m);
+			if (mcopy->m_flags & M_CANFASTFWD)
+ip6flow_create(_forward_rt, mcopy);
 #endif
 			if (mcopy)
 goto freecopy;



CVS commit: [netbsd-7-0] src/sys/netinet6

2018-02-12 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Mon Feb 12 18:37:48 UTC 2018

Modified Files:
src/sys/netinet6 [netbsd-7-0]: ip6_forward.c

Log Message:
Pull up following revision(s) (requested by ozaki-r in ticket #1551):
sys/netinet6/ip6_forward.c: 1.89-1.90 via patch
Fix use-after-free of mbuf by ip6flow_create
This fixes recent failures of some ATF tests such as t_ipsec_tunnel_odd.
--
Fix use-after-free of mbuf by ip6flow_create (one more)


To generate a diff of this commit:
cvs rdiff -u -r1.73.2.1 -r1.73.2.1.2.1 src/sys/netinet6/ip6_forward.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_forward.c
diff -u src/sys/netinet6/ip6_forward.c:1.73.2.1 src/sys/netinet6/ip6_forward.c:1.73.2.1.2.1
--- src/sys/netinet6/ip6_forward.c:1.73.2.1	Sat Jan 17 12:10:54 2015
+++ src/sys/netinet6/ip6_forward.c	Mon Feb 12 18:37:48 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip6_forward.c,v 1.73.2.1 2015/01/17 12:10:54 martin Exp $	*/
+/*	$NetBSD: ip6_forward.c,v 1.73.2.1.2.1 2018/02/12 18:37:48 snj Exp $	*/
 /*	$KAME: ip6_forward.c,v 1.109 2002/09/11 08:10:17 sakane Exp $	*/
 
 /*
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ip6_forward.c,v 1.73.2.1 2015/01/17 12:10:54 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip6_forward.c,v 1.73.2.1.2.1 2018/02/12 18:37:48 snj Exp $");
 
 #include "opt_gateway.h"
 #include "opt_ipsec.h"
@@ -406,8 +406,8 @@ ip6_forward(struct mbuf *m, int srcrt)
 			IP6_STATINC(IP6_STAT_REDIRECTSENT);
 		else {
 #ifdef GATEWAY
-			if (m->m_flags & M_CANFASTFWD)
-ip6flow_create(_forward_rt, m);
+			if (mcopy->m_flags & M_CANFASTFWD)
+ip6flow_create(_forward_rt, mcopy);
 #endif
 			if (mcopy)
 goto freecopy;



CVS commit: [netbsd-7] src/external/bsd/blacklist/bin

2018-02-12 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Mon Feb 12 18:30:22 UTC 2018

Modified Files:
src/external/bsd/blacklist/bin [netbsd-7]: blacklistd.c state.c

Log Message:
Pull up following revision(s) (requested by christos in ticket #1548):
external/bsd/blacklist/bin/blacklistd.c: 1.35
external/bsd/blacklist/bin/state.c: 1.19
restore rules after the database is open, add error message to prevent
silent failure in the future. (Kurt Lidl)


To generate a diff of this commit:
cvs rdiff -u -r1.32.2.3 -r1.32.2.4 \
src/external/bsd/blacklist/bin/blacklistd.c
cvs rdiff -u -r1.15.2.3 -r1.15.2.4 src/external/bsd/blacklist/bin/state.c

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

Modified files:

Index: src/external/bsd/blacklist/bin/blacklistd.c
diff -u src/external/bsd/blacklist/bin/blacklistd.c:1.32.2.3 src/external/bsd/blacklist/bin/blacklistd.c:1.32.2.4
--- src/external/bsd/blacklist/bin/blacklistd.c:1.32.2.3	Fri Aug  7 04:10:23 2015
+++ src/external/bsd/blacklist/bin/blacklistd.c	Mon Feb 12 18:30:22 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: blacklistd.c,v 1.32.2.3 2015/08/07 04:10:23 snj Exp $	*/
+/*	$NetBSD: blacklistd.c,v 1.32.2.4 2018/02/12 18:30:22 snj Exp $	*/
 
 /*-
  * Copyright (c) 2015 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
 #include "config.h"
 #endif
 #include 
-__RCSID("$NetBSD: blacklistd.c,v 1.32.2.3 2015/08/07 04:10:23 snj Exp $");
+__RCSID("$NetBSD: blacklistd.c,v 1.32.2.4 2018/02/12 18:30:22 snj Exp $");
 
 #include 
 #include 
@@ -470,9 +470,6 @@ main(int argc, char *argv[])
 		flags |= O_TRUNC;
 	}
 
-	if (restore)
-		rules_restore();
-
 	struct pollfd *pfd = NULL;
 	bl_t *bl = NULL;
 	size_t nfd = 0;
@@ -497,6 +494,9 @@ main(int argc, char *argv[])
 	if (state == NULL)
 		return EXIT_FAILURE;
 
+	if (restore)
+		rules_restore();
+
 	if (!debug) {
 		if (daemon(0, 0) == -1)
 			err(EXIT_FAILURE, "daemon failed");

Index: src/external/bsd/blacklist/bin/state.c
diff -u src/external/bsd/blacklist/bin/state.c:1.15.2.3 src/external/bsd/blacklist/bin/state.c:1.15.2.4
--- src/external/bsd/blacklist/bin/state.c:1.15.2.3	Fri Aug  7 04:10:23 2015
+++ src/external/bsd/blacklist/bin/state.c	Mon Feb 12 18:30:22 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: state.c,v 1.15.2.3 2015/08/07 04:10:23 snj Exp $	*/
+/*	$NetBSD: state.c,v 1.15.2.4 2018/02/12 18:30:22 snj Exp $	*/
 
 /*-
  * Copyright (c) 2015 The NetBSD Foundation, Inc.
@@ -33,7 +33,7 @@
 #endif
 
 #include 
-__RCSID("$NetBSD: state.c,v 1.15.2.3 2015/08/07 04:10:23 snj Exp $");
+__RCSID("$NetBSD: state.c,v 1.15.2.4 2018/02/12 18:30:22 snj Exp $");
 
 #include 
 #include 
@@ -200,8 +200,10 @@ state_iterate(DB *db, struct conf *c, st
 	int rv;
 	DBT k, v;
 
-	if (db == NULL)
+	if (db == NULL) {
+		(*lfun)(LOG_ERR, "%s: called with no database file", __func__);
 		return -1;
+	}
 
 	first = first ? R_FIRST : R_NEXT;
 



CVS commit: [netbsd-7] src/external/bsd/blacklist/bin

2018-02-12 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Mon Feb 12 18:30:22 UTC 2018

Modified Files:
src/external/bsd/blacklist/bin [netbsd-7]: blacklistd.c state.c

Log Message:
Pull up following revision(s) (requested by christos in ticket #1548):
external/bsd/blacklist/bin/blacklistd.c: 1.35
external/bsd/blacklist/bin/state.c: 1.19
restore rules after the database is open, add error message to prevent
silent failure in the future. (Kurt Lidl)


To generate a diff of this commit:
cvs rdiff -u -r1.32.2.3 -r1.32.2.4 \
src/external/bsd/blacklist/bin/blacklistd.c
cvs rdiff -u -r1.15.2.3 -r1.15.2.4 src/external/bsd/blacklist/bin/state.c

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



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

2018-02-12 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Mon Feb 12 18:23:29 UTC 2018

Modified Files:
src/sys/netinet [netbsd-8]: ip_input.c

Log Message:
Pull up following revision(s) (requested by maxv in ticket #547):
sys/netinet/ip_input.c: 1.366
Disable ip_allowsrcrt and ip_forwsrcrt. Enabling them by default was a
completely dumb idea, because they have security implications.
By sending an IPv4 packet containing an LSRR option, an attacker will
cause the system to forward the packet to another IPv4 address - and
this way he white-washes the source of the packet.
It is also possible for an attacker to reach hidden networks: if a server
has a public address, and a private one on an internal network (network
which has several internal machines connected), the attacker can send a
packet with:
source = 0.0.0.0
destination = public address of the server
LSRR first address = address of a machine on the internal network
And the packet will be forwarded, by the server, to the internal machine,
in some cases even with the internal IP address of the server as a source.


To generate a diff of this commit:
cvs rdiff -u -r1.355.2.3 -r1.355.2.4 src/sys/netinet/ip_input.c

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



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

2018-02-12 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Mon Feb 12 18:23:29 UTC 2018

Modified Files:
src/sys/netinet [netbsd-8]: ip_input.c

Log Message:
Pull up following revision(s) (requested by maxv in ticket #547):
sys/netinet/ip_input.c: 1.366
Disable ip_allowsrcrt and ip_forwsrcrt. Enabling them by default was a
completely dumb idea, because they have security implications.
By sending an IPv4 packet containing an LSRR option, an attacker will
cause the system to forward the packet to another IPv4 address - and
this way he white-washes the source of the packet.
It is also possible for an attacker to reach hidden networks: if a server
has a public address, and a private one on an internal network (network
which has several internal machines connected), the attacker can send a
packet with:
source = 0.0.0.0
destination = public address of the server
LSRR first address = address of a machine on the internal network
And the packet will be forwarded, by the server, to the internal machine,
in some cases even with the internal IP address of the server as a source.


To generate a diff of this commit:
cvs rdiff -u -r1.355.2.3 -r1.355.2.4 src/sys/netinet/ip_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/netinet/ip_input.c
diff -u src/sys/netinet/ip_input.c:1.355.2.3 src/sys/netinet/ip_input.c:1.355.2.4
--- src/sys/netinet/ip_input.c:1.355.2.3	Tue Jan  2 10:20:34 2018
+++ src/sys/netinet/ip_input.c	Mon Feb 12 18:23:29 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip_input.c,v 1.355.2.3 2018/01/02 10:20:34 snj Exp $	*/
+/*	$NetBSD: ip_input.c,v 1.355.2.4 2018/02/12 18:23:29 snj Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -91,7 +91,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ip_input.c,v 1.355.2.3 2018/01/02 10:20:34 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_input.c,v 1.355.2.4 2018/02/12 18:23:29 snj Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -162,10 +162,10 @@ __KERNEL_RCSID(0, "$NetBSD: ip_input.c,v
 #define	IPSENDREDIRECTS	1
 #endif
 #ifndef IPFORWSRCRT
-#define	IPFORWSRCRT	1	/* forward source-routed packets */
+#define	IPFORWSRCRT	0	/* forward source-routed packets */
 #endif
 #ifndef IPALLOWSRCRT
-#define	IPALLOWSRCRT	1	/* allow source-routed packets */
+#define	IPALLOWSRCRT	0	/* allow source-routed packets */
 #endif
 #ifndef IPMTUDISC
 #define IPMTUDISC	1



CVS commit: src/sys/netinet

2018-02-12 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Feb 12 18:19:12 UTC 2018

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

Log Message:
Keep a pointer to the interface of the multicast membership, because the
multicast element itself might go away in in_delmulti (but the interface
can't because we hold the lock). From ozaki-r@


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

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

Modified files:

Index: src/sys/netinet/ip_output.c
diff -u src/sys/netinet/ip_output.c:1.294 src/sys/netinet/ip_output.c:1.295
--- src/sys/netinet/ip_output.c:1.294	Wed Feb  7 01:21:23 2018
+++ src/sys/netinet/ip_output.c	Mon Feb 12 13:19:12 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip_output.c,v 1.294 2018/02/07 06:21:23 mrg Exp $	*/
+/*	$NetBSD: ip_output.c,v 1.295 2018/02/12 18:19:12 christos Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -91,7 +91,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ip_output.c,v 1.294 2018/02/07 06:21:23 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_output.c,v 1.295 2018/02/12 18:19:12 christos Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1927,9 +1927,10 @@ ip_drop_membership(struct ip_moptions *i
 	 * Give up the multicast address record to which the
 	 * membership points.
 	 */
-	IFNET_LOCK(imo->imo_membership[i]->inm_ifp);
+	struct ifnet *inm_ifp = imo->imo_membership[i]->inm_ifp;
+	IFNET_LOCK(inm_ifp);
 	in_delmulti(imo->imo_membership[i]);
-	IFNET_UNLOCK(imo->imo_membership[i]->inm_ifp);
+	IFNET_UNLOCK(inm_ifp);
 
 	/*
 	 * Remove the gap in the membership array.



CVS commit: src/sys/netinet

2018-02-12 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Feb 12 18:19:12 UTC 2018

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

Log Message:
Keep a pointer to the interface of the multicast membership, because the
multicast element itself might go away in in_delmulti (but the interface
can't because we hold the lock). From ozaki-r@


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

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



CVS commit: [netbsd-8] src/sys

2018-02-12 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Mon Feb 12 18:18:00 UTC 2018

Modified Files:
src/sys/net [netbsd-8]: if_mpls.c
src/sys/netmpls [netbsd-8]: mpls_ttl.c

Log Message:
Pull up following revision(s) (requested by maxv in ticket #546):
sys/net/if_mpls.c: 1.31-1.33
sys/netmpls/mpls_ttl.c: 1.9-1.11
Style, and fix several bugs:
 - ip4_check(), mpls_unlabel_inet() and mpls_unlabel_inet6() perform
   pullups, so we need to pass the updated pointers back
 - in mpls_lse() the route is not always freed
Looks a little better now.
--
Kick MPLS packets earlier.
--
Several changes:
 * Declare TRIM_LABEL as a function.
 * In mpls_unlabel_inet, copy the label locally. It's not incorrect to
   keep a pointer on the mbuf, but it's bug-friendly.
 * In mpls_label_inetX, fix the length check. Meanwhile add an XXX: we
   just want to make sure that m_copydata won't fail, but if we were
   guaranteed that m has M_PKTHDR set, we could simply check the length
   against m->m_pkthdr.len.
--
Style in MPLS.
--
Add XXX.


To generate a diff of this commit:
cvs rdiff -u -r1.29.8.1 -r1.29.8.2 src/sys/net/if_mpls.c
cvs rdiff -u -r1.8 -r1.8.10.1 src/sys/netmpls/mpls_ttl.c

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



CVS commit: [netbsd-8] src/sys

2018-02-12 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Mon Feb 12 18:18:00 UTC 2018

Modified Files:
src/sys/net [netbsd-8]: if_mpls.c
src/sys/netmpls [netbsd-8]: mpls_ttl.c

Log Message:
Pull up following revision(s) (requested by maxv in ticket #546):
sys/net/if_mpls.c: 1.31-1.33
sys/netmpls/mpls_ttl.c: 1.9-1.11
Style, and fix several bugs:
 - ip4_check(), mpls_unlabel_inet() and mpls_unlabel_inet6() perform
   pullups, so we need to pass the updated pointers back
 - in mpls_lse() the route is not always freed
Looks a little better now.
--
Kick MPLS packets earlier.
--
Several changes:
 * Declare TRIM_LABEL as a function.
 * In mpls_unlabel_inet, copy the label locally. It's not incorrect to
   keep a pointer on the mbuf, but it's bug-friendly.
 * In mpls_label_inetX, fix the length check. Meanwhile add an XXX: we
   just want to make sure that m_copydata won't fail, but if we were
   guaranteed that m has M_PKTHDR set, we could simply check the length
   against m->m_pkthdr.len.
--
Style in MPLS.
--
Add XXX.


To generate a diff of this commit:
cvs rdiff -u -r1.29.8.1 -r1.29.8.2 src/sys/net/if_mpls.c
cvs rdiff -u -r1.8 -r1.8.10.1 src/sys/netmpls/mpls_ttl.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_mpls.c
diff -u src/sys/net/if_mpls.c:1.29.8.1 src/sys/net/if_mpls.c:1.29.8.2
--- src/sys/net/if_mpls.c:1.29.8.1	Sun Dec 10 10:10:25 2017
+++ src/sys/net/if_mpls.c	Mon Feb 12 18:18:00 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_mpls.c,v 1.29.8.1 2017/12/10 10:10:25 snj Exp $ */
+/*	$NetBSD: if_mpls.c,v 1.29.8.2 2018/02/12 18:18:00 snj Exp $ */
 
 /*
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_mpls.c,v 1.29.8.1 2017/12/10 10:10:25 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_mpls.c,v 1.29.8.2 2018/02/12 18:18:00 snj Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -74,37 +74,27 @@ __KERNEL_RCSID(0, "$NetBSD: if_mpls.c,v 
 
 #include "ioconf.h"
 
-#define TRIM_LABEL do { \
-	m_adj(m, sizeof(union mpls_shim)); \
-	if (m->m_len < sizeof(union mpls_shim) && \
-	(m = m_pullup(m, sizeof(union mpls_shim))) == NULL) \
-		goto done; \
-	dst.smpls_addr.s_addr = ntohl(mtod(m, union mpls_shim *)->s_addr); \
-	} while (/* CONSTCOND */ 0)
-
-
 static int mpls_clone_create(struct if_clone *, int);
 static int mpls_clone_destroy(struct ifnet *);
 
 static struct if_clone mpls_if_cloner =
 	IF_CLONE_INITIALIZER("mpls", mpls_clone_create, mpls_clone_destroy);
 
-
 static void mpls_input(struct ifnet *, struct mbuf *);
 static int mpls_output(struct ifnet *, struct mbuf *, const struct sockaddr *,
-	const struct rtentry *);
+const struct rtentry *);
 static int mpls_ioctl(struct ifnet *, u_long, void *);
 static int mpls_send_frame(struct mbuf *, struct ifnet *,
 const struct rtentry *);
 static int mpls_lse(struct mbuf *);
 
 #ifdef INET
-static int mpls_unlabel_inet(struct mbuf *);
+static struct mbuf *mpls_unlabel_inet(struct mbuf *, int *error);
 static struct mbuf *mpls_label_inet(struct mbuf *, union mpls_shim *, uint);
 #endif
 
 #ifdef INET6
-static int mpls_unlabel_inet6(struct mbuf *);
+static struct mbuf *mpls_unlabel_inet6(struct mbuf *, int *error);
 static struct mbuf *mpls_label_inet6(struct mbuf *, union mpls_shim *, uint);
 #endif
 
@@ -211,7 +201,6 @@ mpls_input(struct ifnet *ifp, struct mbu
 void
 mplsintr(void)
 {
-
 	struct mbuf *m;
 
 	for (;;) {
@@ -279,7 +268,7 @@ mpls_output(struct ifnet *ifp, struct mb
 		psize += sizeof(mh);
 	}
 
-	switch(dst->sa_family) {
+	switch (dst->sa_family) {
 #ifdef INET
 	case AF_INET:
 		m = mpls_label_inet(m, , psize - sizeof(struct sockaddr_mpls));
@@ -304,7 +293,7 @@ mpls_output(struct ifnet *ifp, struct mb
 	ifp->if_opackets++;
 	ifp->if_obytes += m->m_pkthdr.len;
 
-	if ((rt1=rtalloc1(rt->rt_gateway, 1)) == NULL) {
+	if ((rt1 = rtalloc1(rt->rt_gateway, 1)) == NULL) {
 		m_freem(m);
 		return EHOSTUNREACH;
 	}
@@ -348,6 +337,20 @@ mpls_ioctl(struct ifnet *ifp, u_long cmd
 	return error;
 }
 
+static inline struct mbuf *
+mpls_trim_label(struct mbuf *m, union mpls_shim *sh)
+{
+	m_adj(m, sizeof(union mpls_shim));
+
+	if (m->m_len < sizeof(union mpls_shim) &&
+	(m = m_pullup(m, sizeof(union mpls_shim))) == NULL)
+		return NULL;
+
+	sh->s_addr = ntohl(mtod(m, union mpls_shim *)->s_addr);
+
+	return m;
+}
+
 /*
  * MPLS Label Switch Engine
  */
@@ -361,6 +364,12 @@ mpls_lse(struct mbuf *m)
 	uint psize = sizeof(struct sockaddr_mpls);
 	bool push_back_alert = false;
 
+	/* If we're not accepting MPLS frames, leave now. */
+	if (!mpls_frame_accept) {
+		error = EINVAL;
+		goto done;
+	}
+
 	if (m->m_len < sizeof(union mpls_shim) &&
 	(m = m_pullup(m, sizeof(union mpls_shim))) == NULL)
 		goto done;
@@ -369,26 +378,31 @@ mpls_lse(struct mbuf *m)
 	dst.smpls_family = AF_MPLS;
 	dst.smpls_addr.s_addr = ntohl(mtod(m, union mpls_shim *)->s_addr);
 

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

2018-02-12 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Mon Feb 12 17:04:58 UTC 2018

Modified Files:
src/sys/arch/arm/sunxi: sun4i_emac.c

Log Message:
Another missing NULL-check.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/sunxi/sun4i_emac.c

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

Modified files:

Index: src/sys/arch/arm/sunxi/sun4i_emac.c
diff -u src/sys/arch/arm/sunxi/sun4i_emac.c:1.2 src/sys/arch/arm/sunxi/sun4i_emac.c:1.3
--- src/sys/arch/arm/sunxi/sun4i_emac.c:1.2	Thu Nov 30 18:29:25 2017
+++ src/sys/arch/arm/sunxi/sun4i_emac.c	Mon Feb 12 17:04:58 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: sun4i_emac.c,v 1.2 2017/11/30 18:29:25 jmcneill Exp $ */
+/* $NetBSD: sun4i_emac.c,v 1.3 2018/02/12 17:04:58 maxv Exp $ */
 
 /*-
  * Copyright (c) 2013-2017 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: sun4i_emac.c,v 1.2 2017/11/30 18:29:25 jmcneill Exp $");
+__KERNEL_RCSID(1, "$NetBSD: sun4i_emac.c,v 1.3 2018/02/12 17:04:58 maxv Exp $");
 
 #include 
 #include 
@@ -509,6 +509,9 @@ sun4i_emac_mgethdr(struct sun4i_emac_sof
 {
 	struct mbuf *m = m_gethdr(M_DONTWAIT, MT_DATA);
 
+	if (m == NULL) {
+		return NULL;
+	}
 	if (rxlen + 2 > MHLEN) {
 		MCLGET(m, M_DONTWAIT);
 		if ((m->m_flags & M_EXT) == 0) {



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

2018-02-12 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Mon Feb 12 17:04:58 UTC 2018

Modified Files:
src/sys/arch/arm/sunxi: sun4i_emac.c

Log Message:
Another missing NULL-check.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/sunxi/sun4i_emac.c

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



CVS commit: src/sys/arch/x86/pci

2018-02-12 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Mon Feb 12 17:01:22 UTC 2018

Modified Files:
src/sys/arch/x86/pci: if_vmx.c

Log Message:
m_free -> m_freem, otherwise leak


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/x86/pci/if_vmx.c

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



CVS commit: src/sys/arch/x86/pci

2018-02-12 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Mon Feb 12 17:01:22 UTC 2018

Modified Files:
src/sys/arch/x86/pci: if_vmx.c

Log Message:
m_free -> m_freem, otherwise leak


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/x86/pci/if_vmx.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/x86/pci/if_vmx.c
diff -u src/sys/arch/x86/pci/if_vmx.c:1.20 src/sys/arch/x86/pci/if_vmx.c:1.21
--- src/sys/arch/x86/pci/if_vmx.c:1.20	Tue Sep 26 07:42:05 2017
+++ src/sys/arch/x86/pci/if_vmx.c	Mon Feb 12 17:01:22 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_vmx.c,v 1.20 2017/09/26 07:42:05 knakahara Exp $	*/
+/*	$NetBSD: if_vmx.c,v 1.21 2018/02/12 17:01:22 maxv Exp $	*/
 /*	$OpenBSD: if_vmx.c,v 1.16 2014/01/22 06:04:17 brad Exp $	*/
 
 /*
@@ -19,7 +19,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_vmx.c,v 1.20 2017/09/26 07:42:05 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_vmx.c,v 1.21 2018/02/12 17:01:22 maxv Exp $");
 
 #include 
 #include 
@@ -2527,7 +2527,7 @@ vmxnet3_txq_offload_ctx(struct vmxnet3_t
 		offset = ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN;
 		break;
 	default:
-		m_free(m);
+		m_freem(m);
 		return (EINVAL);
 	}
 



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

2018-02-12 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Mon Feb 12 16:58:01 UTC 2018

Modified Files:
src/sys/arch/arm/allwinner: awin_eth.c

Log Message:
NULL-check after M_DONTWAIT.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/arm/allwinner/awin_eth.c

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



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

2018-02-12 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Mon Feb 12 16:58:01 UTC 2018

Modified Files:
src/sys/arch/arm/allwinner: awin_eth.c

Log Message:
NULL-check after M_DONTWAIT.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/arm/allwinner/awin_eth.c

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

Modified files:

Index: src/sys/arch/arm/allwinner/awin_eth.c
diff -u src/sys/arch/arm/allwinner/awin_eth.c:1.11 src/sys/arch/arm/allwinner/awin_eth.c:1.12
--- src/sys/arch/arm/allwinner/awin_eth.c:1.11	Fri Jun 10 13:27:10 2016
+++ src/sys/arch/arm/allwinner/awin_eth.c	Mon Feb 12 16:58:01 2018
@@ -31,7 +31,7 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: awin_eth.c,v 1.11 2016/06/10 13:27:10 ozaki-r Exp $");
+__KERNEL_RCSID(1, "$NetBSD: awin_eth.c,v 1.12 2018/02/12 16:58:01 maxv Exp $");
 
 #include 
 #include 
@@ -401,6 +401,9 @@ awin_eth_mgethdr(struct awin_eth_softc *
 {
 	struct mbuf *m = m_gethdr(M_DONTWAIT, MT_DATA);
 
+	if (m == NULL) {
+		return NULL;
+	}
 	if (rxlen + 2 > MHLEN) {
 		MCLGET(m, M_DONTWAIT);
 		if ((m->m_flags & M_EXT) == 0) {



CVS commit: src/sys/kern

2018-02-12 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Mon Feb 12 16:01:35 UTC 2018

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

Log Message:
Add a KASSERT; we expect *from to be a single mbuf (not chained).


To generate a diff of this commit:
cvs rdiff -u -r1.190 -r1.191 src/sys/kern/uipc_syscalls.c

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



CVS commit: src/sys/kern

2018-02-12 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Mon Feb 12 16:01:35 UTC 2018

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

Log Message:
Add a KASSERT; we expect *from to be a single mbuf (not chained).


To generate a diff of this commit:
cvs rdiff -u -r1.190 -r1.191 src/sys/kern/uipc_syscalls.c

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

Modified files:

Index: src/sys/kern/uipc_syscalls.c
diff -u src/sys/kern/uipc_syscalls.c:1.190 src/sys/kern/uipc_syscalls.c:1.191
--- src/sys/kern/uipc_syscalls.c:1.190	Thu Jan  4 01:42:25 2018
+++ src/sys/kern/uipc_syscalls.c	Mon Feb 12 16:01:35 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: uipc_syscalls.c,v 1.190 2018/01/04 01:42:25 christos Exp $	*/
+/*	$NetBSD: uipc_syscalls.c,v 1.191 2018/02/12 16:01:35 maxv Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uipc_syscalls.c,v 1.190 2018/01/04 01:42:25 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_syscalls.c,v 1.191 2018/02/12 16:01:35 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_pipe.h"
@@ -989,6 +989,7 @@ do_sys_recvmsg_so(struct lwp *l, int s, 
 	mp->msg_flags &= MSG_USERFLAGS;
 	error = (*so->so_receive)(so, from, , NULL, control,
 	>msg_flags);
+	KASSERT(*from == NULL || (*from)->m_next == NULL);
 	len -= auio.uio_resid;
 	*retsize = len;
 	if (error != 0 && len != 0



CVS commit: src/sys/net

2018-02-12 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Mon Feb 12 15:38:14 UTC 2018

Modified Files:
src/sys/net: if_gif.c if_pppoe.c

Log Message:
Use m_freem instead of m_free. Otherwise we're leaking the next mbufs in
the chain.


To generate a diff of this commit:
cvs rdiff -u -r1.138 -r1.139 src/sys/net/if_gif.c
cvs rdiff -u -r1.133 -r1.134 src/sys/net/if_pppoe.c

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



CVS commit: src/sys/net

2018-02-12 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Mon Feb 12 15:38:14 UTC 2018

Modified Files:
src/sys/net: if_gif.c if_pppoe.c

Log Message:
Use m_freem instead of m_free. Otherwise we're leaking the next mbufs in
the chain.


To generate a diff of this commit:
cvs rdiff -u -r1.138 -r1.139 src/sys/net/if_gif.c
cvs rdiff -u -r1.133 -r1.134 src/sys/net/if_pppoe.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_gif.c
diff -u src/sys/net/if_gif.c:1.138 src/sys/net/if_gif.c:1.139
--- src/sys/net/if_gif.c:1.138	Mon Jan 15 09:26:21 2018
+++ src/sys/net/if_gif.c	Mon Feb 12 15:38:14 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_gif.c,v 1.138 2018/01/15 09:26:21 maxv Exp $	*/
+/*	$NetBSD: if_gif.c,v 1.139 2018/02/12 15:38:14 maxv Exp $	*/
 /*	$KAME: if_gif.c,v 1.76 2001/08/20 02:01:02 kjc Exp $	*/
 
 /*
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_gif.c,v 1.138 2018/01/15 09:26:21 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_gif.c,v 1.139 2018/02/12 15:38:14 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -458,7 +458,7 @@ gif_output(struct ifnet *ifp, struct mbu
 	IFQ_CLASSIFY(>if_snd, m, dst->sa_family);
 
 	if ((error = gif_check_nesting(ifp, m)) != 0) {
-		m_free(m);
+		m_freem(m);
 		goto end;
 	}
 

Index: src/sys/net/if_pppoe.c
diff -u src/sys/net/if_pppoe.c:1.133 src/sys/net/if_pppoe.c:1.134
--- src/sys/net/if_pppoe.c:1.133	Thu Dec  7 10:22:04 2017
+++ src/sys/net/if_pppoe.c	Mon Feb 12 15:38:14 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: if_pppoe.c,v 1.133 2017/12/07 10:22:04 ozaki-r Exp $ */
+/* $NetBSD: if_pppoe.c,v 1.134 2018/02/12 15:38:14 maxv Exp $ */
 
 /*-
  * Copyright (c) 2002, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_pppoe.c,v 1.133 2017/12/07 10:22:04 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_pppoe.c,v 1.134 2018/02/12 15:38:14 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "pppoe.h"
@@ -1795,7 +1795,7 @@ pppoe_transmit(struct ifnet *ifp, struct
 	PPPOE_LOCK(sc, RW_READER);
 	if (sc->sc_state < PPPOE_STATE_SESSION) {
 		PPPOE_UNLOCK(sc);
-		m_free(m);
+		m_freem(m);
 		return ENOBUFS;
 	}
 
@@ -1887,13 +1887,13 @@ static void
 pppoe_enqueue(struct ifqueue *inq, struct mbuf *m)
 {
 	if (m->m_flags & M_PROMISC) {
-		m_free(m);
+		m_freem(m);
 		return;
 	}
 
 #ifndef PPPOE_SERVER
 	if (m->m_flags & (M_MCAST | M_BCAST)) {
-		m_free(m);
+		m_freem(m);
 		return;
 	}
 #endif



CVS commit: src/sys/netinet6

2018-02-12 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Mon Feb 12 12:52:13 UTC 2018

Modified Files:
src/sys/netinet6: icmp6.c ip6_input.c ip6_output.c

Log Message:
Replace bcopy -> memcpy when it is obvious that the areas don't overlap.
Rearrange ip6_splithdr() for clarity.


To generate a diff of this commit:
cvs rdiff -u -r1.219 -r1.220 src/sys/netinet6/icmp6.c
cvs rdiff -u -r1.190 -r1.191 src/sys/netinet6/ip6_input.c
cvs rdiff -u -r1.200 -r1.201 src/sys/netinet6/ip6_output.c

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

Modified files:

Index: src/sys/netinet6/icmp6.c
diff -u src/sys/netinet6/icmp6.c:1.219 src/sys/netinet6/icmp6.c:1.220
--- src/sys/netinet6/icmp6.c:1.219	Tue Jan 23 10:55:38 2018
+++ src/sys/netinet6/icmp6.c	Mon Feb 12 12:52:12 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: icmp6.c,v 1.219 2018/01/23 10:55:38 maxv Exp $	*/
+/*	$NetBSD: icmp6.c,v 1.220 2018/02/12 12:52:12 maxv Exp $	*/
 /*	$KAME: icmp6.c,v 1.217 2001/06/20 15:03:29 jinmei Exp $	*/
 
 /*
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: icmp6.c,v 1.219 2018/01/23 10:55:38 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: icmp6.c,v 1.220 2018/02/12 12:52:12 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1486,7 +1486,7 @@ ni6_input(struct mbuf *m, int off)
 		nni6->ni_flags = htons(0x);	/* raw bitmap */
 		/* supports NOOP, SUPTYPES, FQDN, and NODEADDR */
 		v = (u_int32_t)htonl(0x000f);
-		bcopy(, nni6 + 1, sizeof(u_int32_t));
+		memcpy(nni6 + 1, , sizeof(u_int32_t));
 		break;
 	}
 	case NI_QTYPE_FQDN:
@@ -1580,7 +1580,7 @@ ni6_nametodns(const char *name, int name
 	if (old) {
 		m->m_len = len;
 		*mtod(m, char *) = namelen;
-		bcopy(name, mtod(m, char *) + 1, namelen);
+		memcpy(mtod(m, char *) + 1, name, namelen);
 		return m;
 	} else {
 		m->m_len = 0;
@@ -1927,7 +1927,7 @@ again:
 ltime = 0x7fff;
 			ltime = htonl(ltime);
 
-			bcopy(, cp, sizeof(u_int32_t));
+			memcpy(cp, , sizeof(u_int32_t));
 			cp += sizeof(u_int32_t);
 
 			/* copy the address itself */
@@ -2109,7 +2109,7 @@ icmp6_reflect(struct mbuf *m, size_t off
 			if ((m = m_pullup(m, l)) == NULL)
 return;
 		}
-		bcopy((void *), mtod(m, void *), sizeof(nip6));
+		memcpy(mtod(m, void *), (void *), sizeof(nip6));
 	} else {
 		size_t l = sizeof(struct ip6_hdr) + sizeof(struct icmp6_hdr);
 		if (m->m_len < l) {

Index: src/sys/netinet6/ip6_input.c
diff -u src/sys/netinet6/ip6_input.c:1.190 src/sys/netinet6/ip6_input.c:1.191
--- src/sys/netinet6/ip6_input.c:1.190	Fri Feb  9 18:31:52 2018
+++ src/sys/netinet6/ip6_input.c	Mon Feb 12 12:52:12 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip6_input.c,v 1.190 2018/02/09 18:31:52 maxv Exp $	*/
+/*	$NetBSD: ip6_input.c,v 1.191 2018/02/12 12:52:12 maxv Exp $	*/
 /*	$KAME: ip6_input.c,v 1.188 2001/03/29 05:34:31 itojun Exp $	*/
 
 /*
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ip6_input.c,v 1.190 2018/02/09 18:31:52 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip6_input.c,v 1.191 2018/02/12 12:52:12 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_gateway.h"
@@ -960,7 +960,7 @@ ip6_process_hopopts(struct mbuf *m, u_in
 
 			/*
 			 * We may see jumbolen in unaligned location, so
-			 * we'd need to perform bcopy().
+			 * we'd need to perform memcpy().
 			 */
 			memcpy(, opt + 2, sizeof(jumboplen));
 			jumboplen = (u_int32_t)htonl(jumboplen);

Index: src/sys/netinet6/ip6_output.c
diff -u src/sys/netinet6/ip6_output.c:1.200 src/sys/netinet6/ip6_output.c:1.201
--- src/sys/netinet6/ip6_output.c:1.200	Wed Jan 31 15:23:08 2018
+++ src/sys/netinet6/ip6_output.c	Mon Feb 12 12:52:12 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip6_output.c,v 1.200 2018/01/31 15:23:08 maxv Exp $	*/
+/*	$NetBSD: ip6_output.c,v 1.201 2018/02/12 12:52:12 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.200 2018/01/31 15:23:08 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip6_output.c,v 1.201 2018/02/12 12:52:12 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1115,7 +1115,7 @@ ip6_copyexthdr(struct mbuf **mp, void *h
 	}
 	m->m_len = hlen;
 	if (hdr)
-		bcopy(hdr, mtod(m, void *), hlen);
+		memcpy(mtod(m, void *), hdr, hlen);
 
 	*mp = m;
 	return 0;
@@ -1236,7 +1236,7 @@ ip6_insert_jumboopt(struct ip6_exthdrs *
 	optbuf[2] = IP6OPT_JUMBO;
 	optbuf[3] = 4;
 	v = (u_int32_t)htonl(plen + JUMBOOPTLEN);
-	bcopy(, [4], sizeof(u_int32_t));
+	memcpy([4], , sizeof(u_int32_t));
 
 	/* finally, adjust the packet header length */
 	exthdrs->ip6e_ip6->m_pkthdr.len += JUMBOOPTLEN;
@@ -3328,7 +3328,7 @@ ip6_mloopback(struct ifnet *ifp, struct 
  * Chop IPv6 header off from the payload.
  */
 static int
-ip6_splithdr(struct mbuf *m,  struct ip6_exthdrs *exthdrs)
+ip6_splithdr(struct mbuf *m, struct ip6_exthdrs *exthdrs)
 {
 	struct mbuf *mh;
 	struct ip6_hdr *ip6;
@@ -3336,7 +3336,7 @@ ip6_splithdr(struct mbuf *m,  struct 

CVS commit: src/sys/netinet6

2018-02-12 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Mon Feb 12 12:52:13 UTC 2018

Modified Files:
src/sys/netinet6: icmp6.c ip6_input.c ip6_output.c

Log Message:
Replace bcopy -> memcpy when it is obvious that the areas don't overlap.
Rearrange ip6_splithdr() for clarity.


To generate a diff of this commit:
cvs rdiff -u -r1.219 -r1.220 src/sys/netinet6/icmp6.c
cvs rdiff -u -r1.190 -r1.191 src/sys/netinet6/ip6_input.c
cvs rdiff -u -r1.200 -r1.201 src/sys/netinet6/ip6_output.c

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



CVS commit: src/sys/net

2018-02-12 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Mon Feb 12 12:17:38 UTC 2018

Modified Files:
src/sys/net: if_ethersubr.c

Log Message:
Fix typo, and add a comment about MPLS.


To generate a diff of this commit:
cvs rdiff -u -r1.257 -r1.258 src/sys/net/if_ethersubr.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_ethersubr.c
diff -u src/sys/net/if_ethersubr.c:1.257 src/sys/net/if_ethersubr.c:1.258
--- src/sys/net/if_ethersubr.c:1.257	Fri Jan 19 12:31:27 2018
+++ src/sys/net/if_ethersubr.c	Mon Feb 12 12:17:38 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ethersubr.c,v 1.257 2018/01/19 12:31:27 nakayama Exp $	*/
+/*	$NetBSD: if_ethersubr.c,v 1.258 2018/02/12 12:17:38 maxv Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_ethersubr.c,v 1.257 2018/01/19 12:31:27 nakayama Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ethersubr.c,v 1.258 2018/02/12 12:17:38 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -260,7 +260,7 @@ ether_output(struct ifnet * const ifp0, 
 			void *tha = ar_tha(ah);
 
 			if (tha == NULL) {
-/* fake with ARPHDR_IEEE1394 */
+/* fake with ARPHRD_IEEE1394 */
 m_freem(m);
 return 0;
 			}
@@ -606,7 +606,8 @@ ether_input(struct ifnet *ifp, struct mb
 	}
 
 	/*
-	 * Determine if the packet is within its size limits.
+	 * Determine if the packet is within its size limits. For MPLS the
+	 * header length is variable, so we skip the check.
 	 */
 	if (etype != ETHERTYPE_MPLS && m->m_pkthdr.len >
 	ETHER_MAX_FRAME(ifp, etype, m->m_flags & M_HASFCS)) {



CVS commit: src/sys/net

2018-02-12 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Mon Feb 12 12:17:38 UTC 2018

Modified Files:
src/sys/net: if_ethersubr.c

Log Message:
Fix typo, and add a comment about MPLS.


To generate a diff of this commit:
cvs rdiff -u -r1.257 -r1.258 src/sys/net/if_ethersubr.c

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



CVS commit: src/common/lib/libc/string

2018-02-12 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Feb 12 11:14:15 UTC 2018

Modified Files:
src/common/lib/libc/string: bcopy.c

Log Message:
Complete previous by complteley removing the _DIAGASSERT from memmove -
the accidental left over from previous fired on all legitimate calls
and caused PR bin/52986 and PR lib/52987.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/common/lib/libc/string/bcopy.c

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

Modified files:

Index: src/common/lib/libc/string/bcopy.c
diff -u src/common/lib/libc/string/bcopy.c:1.12 src/common/lib/libc/string/bcopy.c:1.13
--- src/common/lib/libc/string/bcopy.c:1.12	Sun Feb  4 20:22:17 2018
+++ src/common/lib/libc/string/bcopy.c	Mon Feb 12 11:14:15 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: bcopy.c,v 1.12 2018/02/04 20:22:17 mrg Exp $	*/
+/*	$NetBSD: bcopy.c,v 1.13 2018/02/12 11:14:15 martin Exp $	*/
 
 /*-
  * Copyright (c) 1990, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)bcopy.c	8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: bcopy.c,v 1.12 2018/02/04 20:22:17 mrg Exp $");
+__RCSID("$NetBSD: bcopy.c,v 1.13 2018/02/12 11:14:15 martin Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -88,10 +88,6 @@ bcopy(const void *src0, void *dst0, size
 	size_t t;
 	unsigned long u;
 
-#if !defined(_KERNEL)
-	_DIAGASSERT(length == 0);
-#endif
-
 	if (length == 0 || dst == src)		/* nothing to do */
 		goto done;
 



CVS commit: src/common/lib/libc/string

2018-02-12 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Feb 12 11:14:15 UTC 2018

Modified Files:
src/common/lib/libc/string: bcopy.c

Log Message:
Complete previous by complteley removing the _DIAGASSERT from memmove -
the accidental left over from previous fired on all legitimate calls
and caused PR bin/52986 and PR lib/52987.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/common/lib/libc/string/bcopy.c

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



CVS commit: src/doc

2018-02-12 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Mon Feb 12 10:37:51 UTC 2018

Modified Files:
src/doc: CHANGES

Log Message:
note GCC 6.4 import.


To generate a diff of this commit:
cvs rdiff -u -r1.2356 -r1.2357 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.2356 src/doc/CHANGES:1.2357
--- src/doc/CHANGES:1.2356	Fri Feb  9 17:14:26 2018
+++ src/doc/CHANGES	Mon Feb 12 10:37:50 2018
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2356 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2357 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -107,6 +107,7 @@ Changes from NetBSD 8.0 to NetBSD 9.0:
 	libc: Update to tzcode2018c. [christos 20180125]
 	i386: Add support for SMAP. [maxv 20180128]
 	dhcpcd(8): Import dhcpcd-7.0.1 [roy 20180129]
+	gcc: Import GCC 6.4.  [mrg 20180201]
 	openldap: Import 2.4.45. [christos 20180205]
 	unbound: Import 1.6.8. [christos 20180205]
 	nsd: import 4.1.19 [christos 20180209]



CVS commit: src/doc

2018-02-12 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Mon Feb 12 10:37:51 UTC 2018

Modified Files:
src/doc: CHANGES

Log Message:
note GCC 6.4 import.


To generate a diff of this commit:
cvs rdiff -u -r1.2356 -r1.2357 src/doc/CHANGES

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



CVS commit: src/sys/netinet

2018-02-12 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Mon Feb 12 09:31:06 UTC 2018

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

Log Message:
Don't rebase the pointers. 'm' is only allowed to become NULL (which
means 'processed').


To generate a diff of this commit:
cvs rdiff -u -r1.240 -r1.241 src/sys/netinet/udp_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/udp_usrreq.c
diff -u src/sys/netinet/udp_usrreq.c:1.240 src/sys/netinet/udp_usrreq.c:1.241
--- src/sys/netinet/udp_usrreq.c:1.240	Sat Feb 10 08:17:00 2018
+++ src/sys/netinet/udp_usrreq.c	Mon Feb 12 09:31:06 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: udp_usrreq.c,v 1.240 2018/02/10 08:17:00 maxv Exp $	*/
+/*	$NetBSD: udp_usrreq.c,v 1.241 2018/02/12 09:31:06 maxv Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -66,7 +66,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: udp_usrreq.c,v 1.240 2018/02/10 08:17:00 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: udp_usrreq.c,v 1.241 2018/02/12 09:31:06 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -405,14 +405,6 @@ udp_input(struct mbuf *m, ...)
 		return;
 	}
 
-	ip = mtod(m, struct ip *);
-	IP6_EXTHDR_GET(uh, struct udphdr *, m, iphlen, sizeof(struct udphdr));
-	if (uh == NULL) {
-		UDP_STATINC(UDP_STAT_HDROPS);
-		return;
-	}
-	/* XXX Re-enforce alignment? */
-
 #ifdef INET6
 	if (IN_MULTICAST(ip->ip_dst.s_addr) || n == 0) {
 		struct sockaddr_in6 src6, dst6;



CVS commit: src/sys/netinet

2018-02-12 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Mon Feb 12 09:31:06 UTC 2018

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

Log Message:
Don't rebase the pointers. 'm' is only allowed to become NULL (which
means 'processed').


To generate a diff of this commit:
cvs rdiff -u -r1.240 -r1.241 src/sys/netinet/udp_usrreq.c

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



CVS commit: src/sys/netinet

2018-02-12 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Mon Feb 12 08:22:27 UTC 2018

Modified Files:
src/sys/netinet: tcp_input.c tcp_output.c tcp_var.h

Log Message:
Remove unused argument from tcp_signature_getsav.


To generate a diff of this commit:
cvs rdiff -u -r1.378 -r1.379 src/sys/netinet/tcp_input.c
cvs rdiff -u -r1.197 -r1.198 src/sys/netinet/tcp_output.c
cvs rdiff -u -r1.183 -r1.184 src/sys/netinet/tcp_var.h

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



CVS commit: src/sys/netinet

2018-02-12 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Mon Feb 12 08:22:27 UTC 2018

Modified Files:
src/sys/netinet: tcp_input.c tcp_output.c tcp_var.h

Log Message:
Remove unused argument from tcp_signature_getsav.


To generate a diff of this commit:
cvs rdiff -u -r1.378 -r1.379 src/sys/netinet/tcp_input.c
cvs rdiff -u -r1.197 -r1.198 src/sys/netinet/tcp_output.c
cvs rdiff -u -r1.183 -r1.184 src/sys/netinet/tcp_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/netinet/tcp_input.c
diff -u src/sys/netinet/tcp_input.c:1.378 src/sys/netinet/tcp_input.c:1.379
--- src/sys/netinet/tcp_input.c:1.378	Mon Feb 12 08:13:08 2018
+++ src/sys/netinet/tcp_input.c	Mon Feb 12 08:22:26 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: tcp_input.c,v 1.378 2018/02/12 08:13:08 maxv Exp $	*/
+/*	$NetBSD: tcp_input.c,v 1.379 2018/02/12 08:22:26 maxv Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -148,7 +148,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tcp_input.c,v 1.378 2018/02/12 08:13:08 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tcp_input.c,v 1.379 2018/02/12 08:22:26 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -3092,7 +3092,7 @@ tcp_signature_apply(void *fstate, void *
 }
 
 struct secasvar *
-tcp_signature_getsav(struct mbuf *m, struct tcphdr *th)
+tcp_signature_getsav(struct mbuf *m)
 {
 	struct ip *ip;
 	struct ip6_hdr *ip6;
@@ -3341,9 +3341,7 @@ tcp_dooptions(struct tcpcb *tp, const u_
 	return 0;
 #else
 	if (tp->t_flags & TF_SIGNATURE) {
-
-		sav = tcp_signature_getsav(m, th);
-
+		sav = tcp_signature_getsav(m);
 		if (sav == NULL && tp->t_state == TCPS_LISTEN)
 			return (-1);
 	}
@@ -4584,9 +4582,7 @@ syn_cache_respond(struct syn_cache *sc)
 
 #ifdef TCP_SIGNATURE
 	if (sc->sc_flags & SCF_SIGNATURE) {
-
-		sav = tcp_signature_getsav(m, th);
-
+		sav = tcp_signature_getsav(m);
 		if (sav == NULL) {
 			if (m)
 m_freem(m);

Index: src/sys/netinet/tcp_output.c
diff -u src/sys/netinet/tcp_output.c:1.197 src/sys/netinet/tcp_output.c:1.198
--- src/sys/netinet/tcp_output.c:1.197	Thu Aug  3 06:32:51 2017
+++ src/sys/netinet/tcp_output.c	Mon Feb 12 08:22:26 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: tcp_output.c,v 1.197 2017/08/03 06:32:51 ozaki-r Exp $	*/
+/*	$NetBSD: tcp_output.c,v 1.198 2018/02/12 08:22:26 maxv Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -135,7 +135,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tcp_output.c,v 1.197 2017/08/03 06:32:51 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tcp_output.c,v 1.198 2018/02/12 08:22:26 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1492,8 +1492,7 @@ reset:			TCP_REASS_UNLOCK(tp);
 		struct secasvar *sav;
 		u_int8_t *sigp;
 
-		sav = tcp_signature_getsav(m, th);
-
+		sav = tcp_signature_getsav(m);
 		if (sav == NULL) {
 			if (m)
 m_freem(m);

Index: src/sys/netinet/tcp_var.h
diff -u src/sys/netinet/tcp_var.h:1.183 src/sys/netinet/tcp_var.h:1.184
--- src/sys/netinet/tcp_var.h:1.183	Mon Feb 12 08:08:28 2018
+++ src/sys/netinet/tcp_var.h	Mon Feb 12 08:22:26 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: tcp_var.h,v 1.183 2018/02/12 08:08:28 maxv Exp $	*/
+/*	$NetBSD: tcp_var.h,v 1.184 2018/02/12 08:22:26 maxv Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -880,7 +880,7 @@ struct tcpcb *
 	 tcp_drop(struct tcpcb *, int);
 #ifdef TCP_SIGNATURE
 int	 tcp_signature_apply(void *, void *, u_int);
-struct secasvar *tcp_signature_getsav(struct mbuf *, struct tcphdr *);
+struct secasvar *tcp_signature_getsav(struct mbuf *);
 int	 tcp_signature(struct mbuf *, struct tcphdr *, int, struct secasvar *,
 	char *);
 #endif



CVS commit: src/sys/netinet

2018-02-12 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Mon Feb 12 08:13:08 UTC 2018

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

Log Message:
Add a KASSERT.


To generate a diff of this commit:
cvs rdiff -u -r1.377 -r1.378 src/sys/netinet/tcp_input.c

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



CVS commit: src/sys/netinet

2018-02-12 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Mon Feb 12 08:13:08 UTC 2018

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

Log Message:
Add a KASSERT.


To generate a diff of this commit:
cvs rdiff -u -r1.377 -r1.378 src/sys/netinet/tcp_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/netinet/tcp_input.c
diff -u src/sys/netinet/tcp_input.c:1.377 src/sys/netinet/tcp_input.c:1.378
--- src/sys/netinet/tcp_input.c:1.377	Mon Feb 12 08:08:28 2018
+++ src/sys/netinet/tcp_input.c	Mon Feb 12 08:13:08 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: tcp_input.c,v 1.377 2018/02/12 08:08:28 maxv Exp $	*/
+/*	$NetBSD: tcp_input.c,v 1.378 2018/02/12 08:13:08 maxv Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -148,7 +148,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tcp_input.c,v 1.377 2018/02/12 08:08:28 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tcp_input.c,v 1.378 2018/02/12 08:13:08 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1616,6 +1616,8 @@ nosave:;
 		union syn_cache_sa src;
 		union syn_cache_sa dst;
 
+		KASSERT(tp->t_state == TCPS_LISTEN);
+
 		memset(, 0, sizeof(src));
 		memset(, 0, sizeof(dst));
 		switch (af) {



CVS commit: src/sys/netinet

2018-02-12 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Mon Feb 12 08:08:28 UTC 2018

Modified Files:
src/sys/netinet: tcp_input.c tcp_var.h

Log Message:
Remove the 'm' argument from syn_cache_respond(); all it does with it is
freeing it, so free in the caller instead.


To generate a diff of this commit:
cvs rdiff -u -r1.376 -r1.377 src/sys/netinet/tcp_input.c
cvs rdiff -u -r1.182 -r1.183 src/sys/netinet/tcp_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/netinet/tcp_input.c
diff -u src/sys/netinet/tcp_input.c:1.376 src/sys/netinet/tcp_input.c:1.377
--- src/sys/netinet/tcp_input.c:1.376	Mon Feb 12 08:03:42 2018
+++ src/sys/netinet/tcp_input.c	Mon Feb 12 08:08:28 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: tcp_input.c,v 1.376 2018/02/12 08:03:42 maxv Exp $	*/
+/*	$NetBSD: tcp_input.c,v 1.377 2018/02/12 08:08:28 maxv Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -148,7 +148,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tcp_input.c,v 1.376 2018/02/12 08:03:42 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tcp_input.c,v 1.377 2018/02/12 08:08:28 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -3749,7 +3749,7 @@ syn_cache_timer(void *arg)
 		goto dropit;
 
 	TCP_STATINC(TCP_STAT_SC_RETRANSMITTED);
-	(void) syn_cache_respond(sc, NULL);
+	(void)syn_cache_respond(sc);
 
 	/* Advance the timer back-off. */
 	sc->sc_rxtshift++;
@@ -3884,7 +3884,8 @@ syn_cache_get(struct sockaddr *src, stru
 	if ((th->th_ack != sc->sc_iss + 1) ||
 	SEQ_LEQ(th->th_seq, sc->sc_irs) ||
 	SEQ_GT(th->th_seq, sc->sc_irs + 1 + sc->sc_win)) {
-		(void) syn_cache_respond(sc, m);
+		m_freem(m);
+		(void)syn_cache_respond(sc);
 		splx(s);
 		return ((struct socket *)(-1));
 	}
@@ -4302,7 +4303,8 @@ syn_cache_add(struct sockaddr *src, stru
 			sc->sc_ipopts = ipopts;
 		}
 		sc->sc_timestamp = tb.ts_recent;
-		if (syn_cache_respond(sc, m) == 0) {
+		m_freem(m);
+		if (syn_cache_respond(sc) == 0) {
 			uint64_t *tcps = TCP_STAT_GETREF();
 			tcps[TCP_STAT_SNDACKS]++;
 			tcps[TCP_STAT_SNDTOTAL]++;
@@ -4411,7 +4413,8 @@ syn_cache_add(struct sockaddr *src, stru
 		sc->sc_flags |= SCF_SIGNATURE;
 #endif
 	sc->sc_tp = tp;
-	if (syn_cache_respond(sc, m) == 0) {
+	m_freem(m);
+	if (syn_cache_respond(sc) == 0) {
 		uint64_t *tcps = TCP_STAT_GETREF();
 		tcps[TCP_STAT_SNDACKS]++;
 		tcps[TCP_STAT_SNDTOTAL]++;
@@ -4438,7 +4441,7 @@ syn_cache_add(struct sockaddr *src, stru
  */
 
 int
-syn_cache_respond(struct syn_cache *sc, struct mbuf *m)
+syn_cache_respond(struct syn_cache *sc)
 {
 #ifdef INET6
 	struct rtentry *rt = NULL;
@@ -4453,6 +4456,7 @@ syn_cache_respond(struct syn_cache *sc, 
 #endif
 	struct tcpcb *tp = NULL;
 	struct tcphdr *th;
+	struct mbuf *m;
 	u_int hlen;
 #ifdef TCP_SIGNATURE
 	struct secasvar *sav = NULL;
@@ -4470,8 +4474,6 @@ syn_cache_respond(struct syn_cache *sc, 
 		break;
 #endif
 	default:
-		if (m)
-			m_freem(m);
 		return (EAFNOSUPPORT);
 	}
 
@@ -4481,8 +4483,6 @@ syn_cache_respond(struct syn_cache *sc, 
 	/*
 	 * Create the IP+TCP header from scratch.
 	 */
-	if (m)
-		m_freem(m);
 #ifdef DIAGNOSTIC
 	if (max_linkhdr + tlen > MCLBYTES)
 		return ENOBUFS;

Index: src/sys/netinet/tcp_var.h
diff -u src/sys/netinet/tcp_var.h:1.182 src/sys/netinet/tcp_var.h:1.183
--- src/sys/netinet/tcp_var.h:1.182	Fri Jan 19 07:53:01 2018
+++ src/sys/netinet/tcp_var.h	Mon Feb 12 08:08:28 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: tcp_var.h,v 1.182 2018/01/19 07:53:01 ozaki-r Exp $	*/
+/*	$NetBSD: tcp_var.h,v 1.183 2018/02/12 08:08:28 maxv Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -968,7 +968,7 @@ struct syn_cache *syn_cache_lookup(const
 		struct syn_cache_head **);
 void	 syn_cache_reset(struct sockaddr *, struct sockaddr *,
 		struct tcphdr *);
-int	 syn_cache_respond(struct syn_cache *, struct mbuf *);
+int	 syn_cache_respond(struct syn_cache *);
 void	 syn_cache_cleanup(struct tcpcb *);
 
 int	 tcp_input_checksum(int, struct mbuf *, const struct tcphdr *, int, int,



CVS commit: src/sys/netinet

2018-02-12 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Mon Feb 12 08:08:28 UTC 2018

Modified Files:
src/sys/netinet: tcp_input.c tcp_var.h

Log Message:
Remove the 'm' argument from syn_cache_respond(); all it does with it is
freeing it, so free in the caller instead.


To generate a diff of this commit:
cvs rdiff -u -r1.376 -r1.377 src/sys/netinet/tcp_input.c
cvs rdiff -u -r1.182 -r1.183 src/sys/netinet/tcp_var.h

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



CVS commit: src/sys/netinet

2018-02-12 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Mon Feb 12 08:03:42 UTC 2018

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

Log Message:
Remove this multicast check. Multicast packets are already dropped at
the beginning of the function.


To generate a diff of this commit:
cvs rdiff -u -r1.375 -r1.376 src/sys/netinet/tcp_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/netinet/tcp_input.c
diff -u src/sys/netinet/tcp_input.c:1.375 src/sys/netinet/tcp_input.c:1.376
--- src/sys/netinet/tcp_input.c:1.375	Fri Feb  9 14:06:17 2018
+++ src/sys/netinet/tcp_input.c	Mon Feb 12 08:03:42 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: tcp_input.c,v 1.375 2018/02/09 14:06:17 maxv Exp $	*/
+/*	$NetBSD: tcp_input.c,v 1.376 2018/02/12 08:03:42 maxv Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -148,7 +148,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tcp_input.c,v 1.375 2018/02/09 14:06:17 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tcp_input.c,v 1.376 2018/02/12 08:03:42 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -3043,24 +3043,9 @@ dropwithreset:
 	 */
 	if (tiflags & TH_RST)
 		goto drop;
-
-	switch (af) {
-#ifdef INET6
-	case AF_INET6:
-		/* For following calls to tcp_respond */
-		if (IN6_IS_ADDR_MULTICAST(>ip6_dst))
-			goto drop;
-		break;
-#endif /* INET6 */
-	case AF_INET:
-		if (IN_MULTICAST(ip->ip_dst.s_addr) ||
-		in_broadcast(ip->ip_dst, m_get_rcvif_NOMPSAFE(m)))
-			goto drop;
-	}
-
-	if (tiflags & TH_ACK)
+	if (tiflags & TH_ACK) {
 		(void)tcp_respond(tp, m, m, th, (tcp_seq)0, th->th_ack, TH_RST);
-	else {
+	} else {
 		if (tiflags & TH_SYN)
 			tlen++;
 		(void)tcp_respond(tp, m, m, th, th->th_seq + tlen, (tcp_seq)0,



CVS commit: src/sys/netinet

2018-02-12 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Mon Feb 12 08:03:42 UTC 2018

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

Log Message:
Remove this multicast check. Multicast packets are already dropped at
the beginning of the function.


To generate a diff of this commit:
cvs rdiff -u -r1.375 -r1.376 src/sys/netinet/tcp_input.c

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