CVS commit: src/sys/dev/usb

2022-11-04 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Fri Nov  4 19:46:55 UTC 2022

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

Log Message:
Back out r1.82 ("Do not explicitly set the HID Report Protocol upon attach")
due to the regression reported in PR# 57031


To generate a diff of this commit:
cvs rdiff -u -r1.93 -r1.94 src/sys/dev/usb/uhidev.c

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



CVS commit: src/sys/dev/usb

2022-11-04 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Fri Nov  4 19:46:55 UTC 2022

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

Log Message:
Back out r1.82 ("Do not explicitly set the HID Report Protocol upon attach")
due to the regression reported in PR# 57031


To generate a diff of this commit:
cvs rdiff -u -r1.93 -r1.94 src/sys/dev/usb/uhidev.c

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

Modified files:

Index: src/sys/dev/usb/uhidev.c
diff -u src/sys/dev/usb/uhidev.c:1.93 src/sys/dev/usb/uhidev.c:1.94
--- src/sys/dev/usb/uhidev.c:1.93	Mon Mar 28 12:44:45 2022
+++ src/sys/dev/usb/uhidev.c	Fri Nov  4 19:46:55 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: uhidev.c,v 1.93 2022/03/28 12:44:45 riastradh Exp $	*/
+/*	$NetBSD: uhidev.c,v 1.94 2022/11/04 19:46:55 jmcneill Exp $	*/
 
 /*
  * Copyright (c) 2001, 2012 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uhidev.c,v 1.93 2022/03/28 12:44:45 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uhidev.c,v 1.94 2022/11/04 19:46:55 jmcneill Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -223,16 +223,8 @@ uhidev_attach(device_t parent, device_t 
 	}
 	(void)usbd_set_idle(iface, 0, 0);
 
-#if 0
-	/*
-	 * HID 1.11 says we should do this, but the device firmware is
-	 * supposed to come up in Report Protocol after reset anyway, and
-	 * apparently explicitly requesting it confuses some devices.
-	 */
-	if ((usbd_get_quirks(sc->sc_udev)->uq_flags & UQ_NO_SET_PROTO) == 0 &&
-	id->bInterfaceSubClass == UISUBCLASS_BOOT)
+	if ((usbd_get_quirks(sc->sc_udev)->uq_flags & UQ_NO_SET_PROTO) == 0)
 		(void)usbd_set_protocol(iface, 1);
-#endif
 
 	maxinpktsize = 0;
 	sc->sc_iep_addr = sc->sc_oep_addr = -1;



CVS commit: src

2022-11-04 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Fri Nov  4 11:20:40 UTC 2022

Modified Files:
src/external/cddl/osnet/dist/uts/common/fs/zfs: zfs_ctldir.c
src/sys/fs/union: union_vfsops.c
src/sys/kern: vfs_mount.c vfs_trans.c
src/sys/miscfs/nullfs: null_vfsops.c
src/sys/miscfs/overlay: overlay_vfsops.c
src/sys/miscfs/umapfs: umap_vfsops.c
src/sys/sys: mount.h

Log Message:
Add a helper to set or clear lower mount and use it.
Always add a reference to the lower mount.

Ride 9.99.105


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 \
src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_ctldir.c
cvs rdiff -u -r1.83 -r1.84 src/sys/fs/union/union_vfsops.c
cvs rdiff -u -r1.98 -r1.99 src/sys/kern/vfs_mount.c
cvs rdiff -u -r1.69 -r1.70 src/sys/kern/vfs_trans.c
cvs rdiff -u -r1.99 -r1.100 src/sys/miscfs/nullfs/null_vfsops.c
cvs rdiff -u -r1.72 -r1.73 src/sys/miscfs/overlay/overlay_vfsops.c
cvs rdiff -u -r1.103 -r1.104 src/sys/miscfs/umapfs/umap_vfsops.c
cvs rdiff -u -r1.239 -r1.240 src/sys/sys/mount.h

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



CVS commit: src

2022-11-04 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Fri Nov  4 11:20:40 UTC 2022

Modified Files:
src/external/cddl/osnet/dist/uts/common/fs/zfs: zfs_ctldir.c
src/sys/fs/union: union_vfsops.c
src/sys/kern: vfs_mount.c vfs_trans.c
src/sys/miscfs/nullfs: null_vfsops.c
src/sys/miscfs/overlay: overlay_vfsops.c
src/sys/miscfs/umapfs: umap_vfsops.c
src/sys/sys: mount.h

Log Message:
Add a helper to set or clear lower mount and use it.
Always add a reference to the lower mount.

Ride 9.99.105


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 \
src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_ctldir.c
cvs rdiff -u -r1.83 -r1.84 src/sys/fs/union/union_vfsops.c
cvs rdiff -u -r1.98 -r1.99 src/sys/kern/vfs_mount.c
cvs rdiff -u -r1.69 -r1.70 src/sys/kern/vfs_trans.c
cvs rdiff -u -r1.99 -r1.100 src/sys/miscfs/nullfs/null_vfsops.c
cvs rdiff -u -r1.72 -r1.73 src/sys/miscfs/overlay/overlay_vfsops.c
cvs rdiff -u -r1.103 -r1.104 src/sys/miscfs/umapfs/umap_vfsops.c
cvs rdiff -u -r1.239 -r1.240 src/sys/sys/mount.h

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

Modified files:

Index: src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_ctldir.c
diff -u src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_ctldir.c:1.13 src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_ctldir.c:1.14
--- src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_ctldir.c:1.13	Sun Jul  4 11:25:07 2021
+++ src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_ctldir.c	Fri Nov  4 11:20:39 2022
@@ -1343,7 +1343,9 @@ sfs_snapshot_mount(vnode_t *vp, const ch
 	set_statvfs_info(path, UIO_SYSSPACE, vfsp->mnt_stat.f_mntfromname,
 	UIO_SYSSPACE, vfsp->mnt_op->vfs_name, vfsp, curlwp);
 
-	vfsp->mnt_lower = vp->v_vfsp;
+	error = vfs_set_lowermount(vfsp, vp->v_vfsp);
+	if (error)
+		goto out;
 
 	mountlist_append(vfsp);
 	vref(vp);

Index: src/sys/fs/union/union_vfsops.c
diff -u src/sys/fs/union/union_vfsops.c:1.83 src/sys/fs/union/union_vfsops.c:1.84
--- src/sys/fs/union/union_vfsops.c:1.83	Mon Sep 12 13:11:41 2022
+++ src/sys/fs/union/union_vfsops.c	Fri Nov  4 11:20:39 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: union_vfsops.c,v 1.83 2022/09/12 13:11:41 christos Exp $	*/
+/*	$NetBSD: union_vfsops.c,v 1.84 2022/11/04 11:20:39 hannken Exp $	*/
 
 /*
  * Copyright (c) 1994 The Regents of the University of California.
@@ -77,7 +77,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: union_vfsops.c,v 1.83 2022/09/12 13:11:41 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: union_vfsops.c,v 1.84 2022/11/04 11:20:39 hannken Exp $");
 
 #include 
 #include 
@@ -244,7 +244,9 @@ union_mount(struct mount *mp, const char
 
 	mp->mnt_data = um;
 	vfs_getnewfsid(mp);
-	mp->mnt_lower = um->um_uppervp->v_mount;
+	error = vfs_set_lowermount(mp, um->um_uppervp->v_mount);
+	if (error)
+		goto bad;
 
 	error = set_statvfs_info(path, UIO_USERSPACE, NULL, UIO_USERSPACE,
 	mp->mnt_op->vfs_name, mp, l);

Index: src/sys/kern/vfs_mount.c
diff -u src/sys/kern/vfs_mount.c:1.98 src/sys/kern/vfs_mount.c:1.99
--- src/sys/kern/vfs_mount.c:1.98	Wed Oct 26 23:39:10 2022
+++ src/sys/kern/vfs_mount.c	Fri Nov  4 11:20:39 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_mount.c,v 1.98 2022/10/26 23:39:10 riastradh Exp $	*/
+/*	$NetBSD: vfs_mount.c,v 1.99 2022/11/04 11:20:39 hannken Exp $	*/
 
 /*-
  * Copyright (c) 1997-2020 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_mount.c,v 1.98 2022/10/26 23:39:10 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_mount.c,v 1.99 2022/11/04 11:20:39 hannken Exp $");
 
 #include 
 #include 
@@ -391,6 +391,37 @@ vfs_unbusy(struct mount *mp)
 	vfs_rele(mp);
 }
 
+/*
+ * Change a file systems lower mount.
+ * Both the current and the new lower mount may be NULL.  The caller
+ * guarantees exclusive access to the mount and holds a pre-existing
+ * reference to the new lower mount.
+ */
+int
+vfs_set_lowermount(struct mount *mp, struct mount *lowermp)
+{
+	struct mount *oldlowermp;
+	int error;
+
+	if (lowermp) {
+		error = vfs_busy(lowermp);
+		if (error)
+			return error;
+		vfs_ref(lowermp);
+	}
+
+	oldlowermp = mp->mnt_lower;
+	mp->mnt_lower = lowermp;
+
+	if (lowermp)
+		vfs_unbusy(lowermp);
+
+	if (oldlowermp)
+		vfs_rele(oldlowermp);
+
+	return 0;
+}
+
 struct vnode_iterator {
 	vnode_impl_t vi_vnode;
 };
@@ -874,6 +905,7 @@ err_mounted:
 	mutex_exit(mp->mnt_updating);
 	if (error2 == 0)
 		vfs_resume(mp);
+	vfs_set_lowermount(mp, NULL);
 	vfs_rele(mp);
 
 	return error;
@@ -959,6 +991,7 @@ dounmount(struct mount *mp, int flags, s
 		panic("unmount: dangling vnode");
 	vfs_hooks_unmount(mp);
 
+	vfs_set_lowermount(mp, NULL);
 	vfs_rele(mp);	/* reference from mount() */
 	if (coveredvp != NULLVP) {
 		vrele(coveredvp);

Index: src/sys/kern/vfs_trans.c
diff -u src/sys/kern/vfs_trans.c:1.69 src/sys/kern/vfs_trans.c:1.70
--- src/sys/kern/vfs_trans.c:1.69	Wed Oct 26 23:39:43 2022
+++ 

CVS commit: src/sys

2022-11-04 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Fri Nov  4 10:51:17 UTC 2022

Modified Files:
src/sys/arch/evbarm/fdt: fdt_machdep.c
src/sys/dev/fdt: fdt_memory.c fdt_memory.h

Log Message:
Size boot_physmem with FDT_MEMORY_RANGES.

This effectively increases the size from 64 to 256 entries for Arm kernels.
It turns out on large systems that memory can be quite fragmented by UEFI.
Increasing the size of this just kicks the can down the road, we need a
better solution to deal with boot_physmem/fdt_memory/bootparams.dram
sizing.


To generate a diff of this commit:
cvs rdiff -u -r1.98 -r1.99 src/sys/arch/evbarm/fdt/fdt_machdep.c
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/fdt/fdt_memory.c
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/fdt/fdt_memory.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/evbarm/fdt/fdt_machdep.c
diff -u src/sys/arch/evbarm/fdt/fdt_machdep.c:1.98 src/sys/arch/evbarm/fdt/fdt_machdep.c:1.99
--- src/sys/arch/evbarm/fdt/fdt_machdep.c:1.98	Fri Oct 21 05:51:08 2022
+++ src/sys/arch/evbarm/fdt/fdt_machdep.c	Fri Nov  4 10:51:17 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: fdt_machdep.c,v 1.98 2022/10/21 05:51:08 skrll Exp $ */
+/* $NetBSD: fdt_machdep.c,v 1.99 2022/11/04 10:51:17 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2015-2017 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fdt_machdep.c,v 1.98 2022/10/21 05:51:08 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fdt_machdep.c,v 1.99 2022/11/04 10:51:17 jmcneill Exp $");
 
 #include "opt_arm_debug.h"
 #include "opt_bootconfig.h"
@@ -185,9 +185,8 @@ fdt_add_dram_blocks(const struct fdt_mem
 	bc->dramblocks++;
 }
 
-#define MAX_PHYSMEM 64
 static int nfdt_physmem = 0;
-static struct boot_physmem fdt_physmem[MAX_PHYSMEM];
+static struct boot_physmem fdt_physmem[FDT_MEMORY_RANGES];
 
 static void
 fdt_add_boot_physmem(const struct fdt_memory *m, void *arg)
@@ -204,7 +203,7 @@ fdt_add_boot_physmem(const struct fdt_me
 
 	struct boot_physmem *bp = _physmem[nfdt_physmem++];
 
-	KASSERT(nfdt_physmem <= MAX_PHYSMEM);
+	KASSERT(nfdt_physmem <= FDT_MEMORY_RANGES);
 
 	bp->bp_start = atop(saddr);
 	bp->bp_pages = atop(eaddr) - bp->bp_start;

Index: src/sys/dev/fdt/fdt_memory.c
diff -u src/sys/dev/fdt/fdt_memory.c:1.7 src/sys/dev/fdt/fdt_memory.c:1.8
--- src/sys/dev/fdt/fdt_memory.c:1.7	Thu Oct 20 11:38:21 2022
+++ src/sys/dev/fdt/fdt_memory.c	Fri Nov  4 10:51:16 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: fdt_memory.c,v 1.7 2022/10/20 11:38:21 skrll Exp $ */
+/* $NetBSD: fdt_memory.c,v 1.8 2022/11/04 10:51:16 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
 #include "opt_fdt.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fdt_memory.c,v 1.7 2022/10/20 11:38:21 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fdt_memory.c,v 1.8 2022/11/04 10:51:16 jmcneill Exp $");
 
 #include 
 #include 
@@ -41,10 +41,6 @@ __KERNEL_RCSID(0, "$NetBSD: fdt_memory.c
 #include 
 #include 
 
-#ifndef FDT_MEMORY_RANGES
-#define FDT_MEMORY_RANGES	256
-#endif
-
 struct fdt_memory_range {
 	struct fdt_memory   mr_mem;
 	boolmr_used;

Index: src/sys/dev/fdt/fdt_memory.h
diff -u src/sys/dev/fdt/fdt_memory.h:1.1 src/sys/dev/fdt/fdt_memory.h:1.2
--- src/sys/dev/fdt/fdt_memory.h:1.1	Sat Dec 12 09:27:31 2020
+++ src/sys/dev/fdt/fdt_memory.h	Fri Nov  4 10:51:16 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: fdt_memory.h,v 1.1 2020/12/12 09:27:31 skrll Exp $ */
+/* $NetBSD: fdt_memory.h,v 1.2 2022/11/04 10:51:16 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -32,6 +32,12 @@
 #ifndef _DEV_FDT_FDT_MEMORY_H_
 #define _DEV_FDT_FDT_MEMORY_H_
 
+#include "opt_fdt.h"
+
+#ifndef FDT_MEMORY_RANGES
+#define FDT_MEMORY_RANGES 256
+#endif
+
 struct fdt_memory {
 	uint64_t	start;
 	uint64_t	end;



CVS commit: src/sys

2022-11-04 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Fri Nov  4 10:51:17 UTC 2022

Modified Files:
src/sys/arch/evbarm/fdt: fdt_machdep.c
src/sys/dev/fdt: fdt_memory.c fdt_memory.h

Log Message:
Size boot_physmem with FDT_MEMORY_RANGES.

This effectively increases the size from 64 to 256 entries for Arm kernels.
It turns out on large systems that memory can be quite fragmented by UEFI.
Increasing the size of this just kicks the can down the road, we need a
better solution to deal with boot_physmem/fdt_memory/bootparams.dram
sizing.


To generate a diff of this commit:
cvs rdiff -u -r1.98 -r1.99 src/sys/arch/evbarm/fdt/fdt_machdep.c
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/fdt/fdt_memory.c
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/fdt/fdt_memory.h

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



CVS commit: src/sys/sys

2022-11-04 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Fri Nov  4 09:06:25 UTC 2022

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

Log Message:
Bump the version for function renames of inpcb

Welcome to 9.99.105


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

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

Modified files:

Index: src/sys/sys/param.h
diff -u src/sys/sys/param.h:1.717 src/sys/sys/param.h:1.718
--- src/sys/sys/param.h:1.717	Fri Oct 28 08:16:57 2022
+++ src/sys/sys/param.h	Fri Nov  4 09:06:25 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: param.h,v 1.717 2022/10/28 08:16:57 ozaki-r Exp $	*/
+/*	$NetBSD: param.h,v 1.718 2022/11/04 09:06:25 ozaki-r Exp $	*/
 
 /*-
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -67,7 +67,7 @@
  *	2.99.9		(299000900)
  */
 
-#define	__NetBSD_Version__	999010400	/* NetBSD 9.99.104 */
+#define	__NetBSD_Version__	999010500	/* NetBSD 9.99.105 */
 
 #define __NetBSD_Prereq__(M,m,p) (M) * 1) + \
 (m) * 100) + (p) * 100) <= __NetBSD_Version__)



CVS commit: src/sys/sys

2022-11-04 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Fri Nov  4 09:06:25 UTC 2022

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

Log Message:
Bump the version for function renames of inpcb

Welcome to 9.99.105


To generate a diff of this commit:
cvs rdiff -u -r1.717 -r1.718 src/sys/sys/param.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

2022-11-04 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Fri Nov  4 09:05:41 UTC 2022

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

Log Message:
ipcb: add/update the description of functions

>From rmind-smpnet patches


To generate a diff of this commit:
cvs rdiff -u -r1.201 -r1.202 src/sys/netinet/in_pcb.c

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

Modified files:

Index: src/sys/netinet/in_pcb.c
diff -u src/sys/netinet/in_pcb.c:1.201 src/sys/netinet/in_pcb.c:1.202
--- src/sys/netinet/in_pcb.c:1.201	Fri Nov  4 09:05:04 2022
+++ src/sys/netinet/in_pcb.c	Fri Nov  4 09:05:41 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: in_pcb.c,v 1.201 2022/11/04 09:05:04 ozaki-r Exp $	*/
+/*	$NetBSD: in_pcb.c,v 1.202 2022/11/04 09:05:41 ozaki-r Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -93,7 +93,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: in_pcb.c,v 1.201 2022/11/04 09:05:04 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in_pcb.c,v 1.202 2022/11/04 09:05:41 ozaki-r Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -192,6 +192,10 @@ inpcb_init(struct inpcbtable *table, int
 	RUN_ONCE(, inpcb_poolinit);
 }
 
+/*
+ * inpcb_create: construct a new PCB and associated with a given socket.
+ * Sets the PCB state to INP_ATTACHED and makes PCB globally visible.
+ */
 int
 inpcb_create(struct socket *so, void *v)
 {
@@ -462,6 +466,14 @@ inpcb_bind_port(struct inpcb *inp, struc
 	return 0;
 }
 
+/*
+ * inpcb_bind: assign a local IP address and port number to the PCB.
+ *
+ * If the address is not a wildcard, verify that it corresponds to a
+ * local interface.  If a port is specified and it is privileged, then
+ * check the permission.  Check whether the address or port is in use,
+ * and if so, whether we can re-use them.
+ */
 int
 inpcb_bind(void *v, struct sockaddr_in *sin, struct lwp *l)
 {
@@ -501,10 +513,11 @@ inpcb_bind(void *v, struct sockaddr_in *
 }
 
 /*
- * Connect from a socket to a specified address.
- * Both address and port must be specified in argument sin.
- * If don't have a local address for this socket yet,
- * then pick one.
+ * inpcb_connect: connect from a socket to a specified address, i.e.,
+ * assign a foreign IP address and port number to the PCB.
+ *
+ * Both address and port must be specified in the name argument.
+ * If there is no local address for this socket yet, then pick one.
  */
 int
 inpcb_connect(void *v, struct sockaddr_in *sin, struct lwp *l)
@@ -638,6 +651,11 @@ inpcb_connect(void *v, struct sockaddr_i
 	return 0;
 }
 
+/*
+ * inpcb_disconnect: remove any foreign IP/port association.
+ *
+ * Note: destroys the PCB if socket was closed.
+ */
 void
 inpcb_disconnect(void *v)
 {
@@ -657,6 +675,9 @@ inpcb_disconnect(void *v)
 		inpcb_destroy(inp);
 }
 
+/*
+ * inpcb_destroy: destroy PCB as well as the associated socket.
+ */
 void
 inpcb_destroy(void *v)
 {
@@ -706,6 +727,9 @@ inpcb_destroy(void *v)
 	mutex_enter(softnet_lock);	/* reacquire the softnet_lock */
 }
 
+/*
+ * inpcb_fetch_sockaddr: fetch the local IP address and port number.
+ */
 void
 inpcb_fetch_sockaddr(struct inpcb *inp, struct sockaddr_in *sin)
 {
@@ -716,6 +740,9 @@ inpcb_fetch_sockaddr(struct inpcb *inp, 
 	sockaddr_in_init(sin, _laddr(inp), inp->inp_lport);
 }
 
+/*
+ * inpcb_fetch_peeraddr: fetch the foreign IP address and port number.
+ */
 void
 inpcb_fetch_peeraddr(struct inpcb *inp, struct sockaddr_in *sin)
 {
@@ -727,13 +754,14 @@ inpcb_fetch_peeraddr(struct inpcb *inp, 
 }
 
 /*
- * Pass some notification to all connections of a protocol
- * associated with address dst.  The local address and/or port numbers
- * may be specified to limit the search.  The "usual action" will be
- * taken, depending on the ctlinput cmd.  The caller must filter any
- * cmds that are uninteresting (e.g., no error in the map).
- * Call the protocol specific routine (if any) to report
- * any errors for each matching socket.
+ * inpcb_notify: pass some notification to all connections of a protocol
+ * associated with destination address.  The local address and/or port
+ * numbers may be specified to limit the search.  The "usual action" will
+ * be taken, depending on the command.
+ *
+ * The caller must filter any commands that are not interesting (e.g.,
+ * no error in the map).  Call the protocol specific routine (if any) to
+ * report any errors for each matching socket.
  *
  * Must be called at splsoftnet.
  */
@@ -859,10 +887,10 @@ inpcb_purgeif(struct inpcbtable *table, 
 }
 
 /*
- * Check for alternatives when higher level complains
- * about service problems.  For now, invalidate cached
- * routing information.  If the route was created dynamically
- * (by a redirect), time to try a default gateway again.
+ * inpcb_losing: check for alternatives when higher level complains about
+ * service problems.  For now, invalidate cached routing information.
+ * If the route was created dynamically (by a redirect), time to 

CVS commit: src/sys/netinet

2022-11-04 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Fri Nov  4 09:05:41 UTC 2022

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

Log Message:
ipcb: add/update the description of functions

>From rmind-smpnet patches


To generate a diff of this commit:
cvs rdiff -u -r1.201 -r1.202 src/sys/netinet/in_pcb.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

2022-11-04 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Fri Nov  4 09:05:04 UTC 2022

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

Log Message:
inpcb: replace leading white spaces with tabs


To generate a diff of this commit:
cvs rdiff -u -r1.200 -r1.201 src/sys/netinet/in_pcb.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

2022-11-04 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Fri Nov  4 09:05:04 UTC 2022

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

Log Message:
inpcb: replace leading white spaces with tabs


To generate a diff of this commit:
cvs rdiff -u -r1.200 -r1.201 src/sys/netinet/in_pcb.c

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

Modified files:

Index: src/sys/netinet/in_pcb.c
diff -u src/sys/netinet/in_pcb.c:1.200 src/sys/netinet/in_pcb.c:1.201
--- src/sys/netinet/in_pcb.c:1.200	Fri Nov  4 09:04:27 2022
+++ src/sys/netinet/in_pcb.c	Fri Nov  4 09:05:04 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: in_pcb.c,v 1.200 2022/11/04 09:04:27 ozaki-r Exp $	*/
+/*	$NetBSD: in_pcb.c,v 1.201 2022/11/04 09:05:04 ozaki-r Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -93,7 +93,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: in_pcb.c,v 1.200 2022/11/04 09:04:27 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in_pcb.c,v 1.201 2022/11/04 09:05:04 ozaki-r Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -619,15 +619,15 @@ inpcb_connect(void *v, struct sockaddr_i
 	in4p_faddr(inp) = sin->sin_addr;
 	inp->inp_fport = sin->sin_port;
 
-/* Late bind, if needed */
+	/* Late bind, if needed */
 	if (inp->inp_bindportonsend) {
-   struct sockaddr_in lsin = *((const struct sockaddr_in *)
+		struct sockaddr_in lsin = *((const struct sockaddr_in *)
 		inp->inp_socket->so_proto->pr_domain->dom_sa_any);
 		lsin.sin_addr = in4p_laddr(inp);
 		lsin.sin_port = 0;
 
 		if ((error = inpcb_bind_port(inp, , l->l_cred)) != 0)
-   return error;
+			return error;
 	}
 
 	inpcb_set_state(inp, INP_CONNECTED);



CVS commit: src/sys

2022-11-04 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Fri Nov  4 09:04:27 UTC 2022

Modified Files:
src/sys/netinet: in_pcb.c
src/sys/netinet6: in6_pcb.c

Log Message:
inpcb: get rid of parentheses for return value


To generate a diff of this commit:
cvs rdiff -u -r1.199 -r1.200 src/sys/netinet/in_pcb.c
cvs rdiff -u -r1.176 -r1.177 src/sys/netinet6/in6_pcb.c

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

Modified files:

Index: src/sys/netinet/in_pcb.c
diff -u src/sys/netinet/in_pcb.c:1.199 src/sys/netinet/in_pcb.c:1.200
--- src/sys/netinet/in_pcb.c:1.199	Fri Nov  4 09:03:56 2022
+++ src/sys/netinet/in_pcb.c	Fri Nov  4 09:04:27 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: in_pcb.c,v 1.199 2022/11/04 09:03:56 ozaki-r Exp $	*/
+/*	$NetBSD: in_pcb.c,v 1.200 2022/11/04 09:04:27 ozaki-r Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -93,7 +93,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: in_pcb.c,v 1.199 2022/11/04 09:03:56 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in_pcb.c,v 1.200 2022/11/04 09:04:27 ozaki-r Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -211,7 +211,7 @@ inpcb_create(struct socket *so, void *v)
 	inp = pool_cache_get(in4pcb_pool_cache, PR_NOWAIT);
 #endif
 	if (inp == NULL)
-		return (ENOBUFS);
+		return ENOBUFS;
 	if (soaf(so) == AF_INET)
 		memset(inp, 0, sizeof(struct in4pcb));
 #ifdef INET6
@@ -260,7 +260,7 @@ inpcb_create(struct socket *so, void *v)
 	inp_lhash);
 	inpcb_set_state(inp, INP_ATTACHED);
 	splx(s);
-	return (0);
+	return 0;
 }
 
 static int
@@ -291,7 +291,7 @@ inpcb_set_port(struct sockaddr_in *sin, 
 	error = kauth_authorize_network(cred, KAUTH_NETWORK_BIND, req, so, sin,
 	NULL);
 	if (error)
-		return (EACCES);
+		return EACCES;
 
/*
 * Use RFC6056 randomized port selection
@@ -306,7 +306,7 @@ inpcb_set_port(struct sockaddr_in *sin, 
 	inp->inp_lport = lport;
 	inpcb_set_state(inp, INP_BOUND);
 
-	return (0);
+	return 0;
 }
 
 int
@@ -318,7 +318,7 @@ inpcb_bindableaddr(const struct inpcb *i
 	int s;
 
 	if (sin->sin_family != AF_INET)
-		return (EAFNOSUPPORT);
+		return EAFNOSUPPORT;
 
 	s = pserialize_read_enter();
 	if (IN_MULTICAST(sin->sin_addr.s_addr)) {
@@ -382,7 +382,7 @@ inpcb_bind_port(struct inpcb *inp, struc
 	if (sin->sin_port == 0) {
 		error = inpcb_set_port(sin, inp, cred);
 		if (error)
-			return (error);
+			return error;
 	} else {
 		struct inpcb *t;
 		vestigial_inpcb_t vestige;
@@ -405,13 +405,13 @@ inpcb_bind_port(struct inpcb *inp, struc
 		error = kauth_authorize_network(cred, KAUTH_NETWORK_BIND, req,
 		so, sin, NULL);
 		if (error)
-			return (EACCES);
+			return EACCES;
 
 #ifdef INET6
 		in6_in_2_v4mapin6(>sin_addr, );
 		t6 = in6pcb_lookup_local(table, , sin->sin_port, wild, );
 		if (t6 && (reuseport & t6->inp_socket->so_options) == 0)
-			return (EADDRINUSE);
+			return EADDRINUSE;
 		if (!t6 && vestige.valid) {
 		if (!!reuseport != !!vestige.reuse_port) {
 			return EADDRINUSE;
@@ -432,7 +432,7 @@ inpcb_bind_port(struct inpcb *inp, struc
 			 !in_nullhost(in4p_laddr(t)) ||
 			 (t->inp_socket->so_options & SO_REUSEPORT) == 0)
 			&& (so->so_uidinfo->ui_uid != t->inp_socket->so_uidinfo->ui_uid)) {
-return (EADDRINUSE);
+return EADDRINUSE;
 			}
 			if (!t && vestige.valid) {
 if ((!in_nullhost(sin->sin_addr)
@@ -445,7 +445,7 @@ inpcb_bind_port(struct inpcb *inp, struc
 		}
 		t = inpcb_lookup_local(table, sin->sin_addr, sin->sin_port, wild, );
 		if (t && (reuseport & t->inp_socket->so_options) == 0)
-			return (EADDRINUSE);
+			return EADDRINUSE;
 		if (!t
 		&& vestige.valid
 		&& !(reuseport && vestige.reuse_port))
@@ -459,7 +459,7 @@ inpcb_bind_port(struct inpcb *inp, struc
 	LIST_INSERT_HEAD(INPCBHASH_PORT(table, inp->inp_lport), inp,
 	inp_lhash);
 
-	return (0);
+	return 0;
 }
 
 int
@@ -470,14 +470,14 @@ inpcb_bind(void *v, struct sockaddr_in *
 	int error;
 
 	if (inp->inp_af != AF_INET)
-		return (EINVAL);
+		return EINVAL;
 
 	if (inp->inp_lport || !in_nullhost(in4p_laddr(inp)))
-		return (EINVAL);
+		return EINVAL;
 
 	if (NULL != sin) {
 		if (sin->sin_len != sizeof(*sin))
-			return (EINVAL);
+			return EINVAL;
 	} else {
 		lsin = *((const struct sockaddr_in *)
 		inp->inp_socket->so_proto->pr_domain->dom_sa_any);
@@ -487,17 +487,17 @@ inpcb_bind(void *v, struct sockaddr_in *
 	/* Bind address. */
 	error = inpcb_bind_addr(inp, sin, l->l_cred);
 	if (error)
-		return (error);
+		return error;
 
 	/* Bind port. */
 	error = inpcb_bind_port(inp, sin, l->l_cred);
 	if (error) {
 		in4p_laddr(inp).s_addr = INADDR_ANY;
 
-		return (error);
+		return error;
 	}
 
-	return (0);
+	return 0;
 }
 
 /*
@@ -515,14 +515,14 @@ inpcb_connect(void *v, struct sockaddr_i
 	struct in_addr laddr;
 
 	if (inp->inp_af != AF_INET)
-		return (EINVAL);
+		return EINVAL;
 
 	if (sin->sin_len != sizeof (*sin))
-		return (EINVAL);
+		return EINVAL;
 	if 

CVS commit: src/sys

2022-11-04 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Fri Nov  4 09:04:27 UTC 2022

Modified Files:
src/sys/netinet: in_pcb.c
src/sys/netinet6: in6_pcb.c

Log Message:
inpcb: get rid of parentheses for return value


To generate a diff of this commit:
cvs rdiff -u -r1.199 -r1.200 src/sys/netinet/in_pcb.c
cvs rdiff -u -r1.176 -r1.177 src/sys/netinet6/in6_pcb.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

2022-11-04 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Fri Nov  4 09:03:56 UTC 2022

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

Log Message:
inpcb: use NULL


To generate a diff of this commit:
cvs rdiff -u -r1.198 -r1.199 src/sys/netinet/in_pcb.c

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

Modified files:

Index: src/sys/netinet/in_pcb.c
diff -u src/sys/netinet/in_pcb.c:1.198 src/sys/netinet/in_pcb.c:1.199
--- src/sys/netinet/in_pcb.c:1.198	Fri Nov  4 09:03:20 2022
+++ src/sys/netinet/in_pcb.c	Fri Nov  4 09:03:56 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: in_pcb.c,v 1.198 2022/11/04 09:03:20 ozaki-r Exp $	*/
+/*	$NetBSD: in_pcb.c,v 1.199 2022/11/04 09:03:56 ozaki-r Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -93,7 +93,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: in_pcb.c,v 1.198 2022/11/04 09:03:20 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in_pcb.c,v 1.199 2022/11/04 09:03:56 ozaki-r Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -747,7 +747,7 @@ inpcb_notify(struct inpcbtable *table, s
 	in_port_t fport = fport_arg, lport = lport_arg;
 	int nmatch;
 
-	if (in_nullhost(faddr) || notify == 0)
+	if (in_nullhost(faddr) || notify == NULL)
 		return (0);
 
 	nmatch = 0;
@@ -773,7 +773,7 @@ inpcb_notifyall(struct inpcbtable *table
 {
 	struct inpcb *inp;
 
-	if (in_nullhost(faddr) || notify == 0)
+	if (in_nullhost(faddr) || notify == NULL)
 		return;
 
 	TAILQ_FOREACH(inp, >inpt_queue, inp_queue) {



CVS commit: src/sys/netinet

2022-11-04 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Fri Nov  4 09:03:56 UTC 2022

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

Log Message:
inpcb: use NULL


To generate a diff of this commit:
cvs rdiff -u -r1.198 -r1.199 src/sys/netinet/in_pcb.c

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



CVS commit: src/sys

2022-11-04 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Fri Nov  4 09:03:20 UTC 2022

Modified Files:
src/sys/netinet: in.c in_pcb.c in_pcb.h
src/sys/netinet6: in6_pcb.c

Log Message:
inpcb: use in_port_t for port numbers


To generate a diff of this commit:
cvs rdiff -u -r1.243 -r1.244 src/sys/netinet/in.c
cvs rdiff -u -r1.197 -r1.198 src/sys/netinet/in_pcb.c
cvs rdiff -u -r1.75 -r1.76 src/sys/netinet/in_pcb.h
cvs rdiff -u -r1.175 -r1.176 src/sys/netinet6/in6_pcb.c

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



CVS commit: src/sys

2022-11-04 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Fri Nov  4 09:03:20 UTC 2022

Modified Files:
src/sys/netinet: in.c in_pcb.c in_pcb.h
src/sys/netinet6: in6_pcb.c

Log Message:
inpcb: use in_port_t for port numbers


To generate a diff of this commit:
cvs rdiff -u -r1.243 -r1.244 src/sys/netinet/in.c
cvs rdiff -u -r1.197 -r1.198 src/sys/netinet/in_pcb.c
cvs rdiff -u -r1.75 -r1.76 src/sys/netinet/in_pcb.h
cvs rdiff -u -r1.175 -r1.176 src/sys/netinet6/in6_pcb.c

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

Modified files:

Index: src/sys/netinet/in.c
diff -u src/sys/netinet/in.c:1.243 src/sys/netinet/in.c:1.244
--- src/sys/netinet/in.c:1.243	Tue Sep 20 02:23:37 2022
+++ src/sys/netinet/in.c	Fri Nov  4 09:03:20 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: in.c,v 1.243 2022/09/20 02:23:37 knakahara Exp $	*/
+/*	$NetBSD: in.c,v 1.244 2022/11/04 09:03:20 ozaki-r Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -91,7 +91,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: in.c,v 1.243 2022/09/20 02:23:37 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in.c,v 1.244 2022/11/04 09:03:20 ozaki-r Exp $");
 
 #include "arp.h"
 
@@ -1861,7 +1861,7 @@ in_selectsrc(struct sockaddr_in *sin, st
 		ia = ifatoia(ifa);
 	}
 	if (ia == NULL) {
-		u_int16_t fport = sin->sin_port;
+		in_port_t fport = sin->sin_port;
 		struct ifaddr *ifa;
 		int s;
 

Index: src/sys/netinet/in_pcb.c
diff -u src/sys/netinet/in_pcb.c:1.197 src/sys/netinet/in_pcb.c:1.198
--- src/sys/netinet/in_pcb.c:1.197	Fri Nov  4 09:02:38 2022
+++ src/sys/netinet/in_pcb.c	Fri Nov  4 09:03:20 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: in_pcb.c,v 1.197 2022/11/04 09:02:38 ozaki-r Exp $	*/
+/*	$NetBSD: in_pcb.c,v 1.198 2022/11/04 09:03:20 ozaki-r Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -93,7 +93,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: in_pcb.c,v 1.197 2022/11/04 09:02:38 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in_pcb.c,v 1.198 2022/11/04 09:03:20 ozaki-r Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -187,7 +187,7 @@ inpcb_init(struct inpcbtable *table, int
 	table->inpt_connecthashtbl = hashinit(connecthashsize, HASH_LIST, true,
 	>inpt_connecthash);
 	table->inpt_lastlow = IPPORT_RESERVEDMAX;
-	table->inpt_lastport = (u_int16_t)anonportmax;
+	table->inpt_lastport = (in_port_t)anonportmax;
 
 	RUN_ONCE(, inpcb_poolinit);
 }
@@ -268,8 +268,8 @@ inpcb_set_port(struct sockaddr_in *sin, 
 {
 	struct inpcbtable *table = inp->inp_table;
 	struct socket *so = inp->inp_socket;
-	u_int16_t *lastport;
-	u_int16_t lport = 0;
+	in_port_t *lastport;
+	in_port_t lport = 0;
 	enum kauth_network_req req;
 	int error;
 
@@ -744,7 +744,7 @@ inpcb_notify(struct inpcbtable *table, s
 {
 	struct inpcbhead *head;
 	struct inpcb *inp;
-	u_int16_t fport = fport_arg, lport = lport_arg;
+	in_port_t fport = fport_arg, lport = lport_arg;
 	int nmatch;
 
 	if (in_nullhost(faddr) || notify == 0)
@@ -926,7 +926,7 @@ inpcb_lookup_local(struct inpcbtable *ta
 	struct inpcb *match = NULL;
 	int matchwild = 3;
 	int wildcard;
-	u_int16_t lport = lport_arg;
+	in_port_t lport = lport_arg;
 
 	if (vp)
 		vp->valid = 0;
@@ -1034,7 +1034,7 @@ inpcb_lookup(struct inpcbtable *table,
 {
 	struct inpcbhead *head;
 	struct inpcb *inp;
-	u_int16_t fport = fport_arg, lport = lport_arg;
+	in_port_t fport = fport_arg, lport = lport_arg;
 
 	if (vp)
 		vp->valid = 0;
@@ -1080,7 +1080,7 @@ inpcb_lookup_bound(struct inpcbtable *ta
 {
 	struct inpcbhead *head;
 	struct inpcb *inp;
-	u_int16_t lport = lport_arg;
+	in_port_t lport = lport_arg;
 
 	head = INPCBHASH_BIND(table, laddr, lport);
 	LIST_FOREACH(inp, head, inp_hash) {

Index: src/sys/netinet/in_pcb.h
diff -u src/sys/netinet/in_pcb.h:1.75 src/sys/netinet/in_pcb.h:1.76
--- src/sys/netinet/in_pcb.h:1.75	Fri Nov  4 09:01:53 2022
+++ src/sys/netinet/in_pcb.h	Fri Nov  4 09:03:20 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: in_pcb.h,v 1.75 2022/11/04 09:01:53 ozaki-r Exp $	*/
+/*	$NetBSD: in_pcb.h,v 1.76 2022/11/04 09:03:20 ozaki-r Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -101,8 +101,8 @@ struct inpcb {
 	struct	  inpcbtable *inp_table;
 	struct	  inpcbpolicy *inp_sp;	/* security policy */
 	struct route	inp_route;	/* placeholder for routing entry */
-	u_int16_t	inp_fport;	/* foreign port */
-	u_int16_t	inp_lport;	/* local port */
+	in_port_t	inp_fport;	/* foreign port */
+	in_port_t	inp_lport;	/* local port */
 	int	 	inp_flags;	/* generic IP/datagram flags */
 	struct mbuf	*inp_options;	/* IP options */
 	bool		inp_bindportonsend;
@@ -232,8 +232,8 @@ struct inpcbtable {
 	u_long	  inpt_porthash;
 	u_long	  inpt_bindhash;
 	u_long	  inpt_connecthash;
-	u_int16_t inpt_lastport;
-	u_int16_t inpt_lastlow;
+	in_port_t inpt_lastport;
+	in_port_t inpt_lastlow;
 
 	struct vestigial_hooks *vestige;
 };

Index: src/sys/netinet6/in6_pcb.c
diff -u src/sys/netinet6/in6_pcb.c:1.175 

CVS commit: src/sys/netinet

2022-11-04 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Fri Nov  4 09:02:38 UTC 2022

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

Log Message:
inpcb: use pool_cache instead of pool


To generate a diff of this commit:
cvs rdiff -u -r1.196 -r1.197 src/sys/netinet/in_pcb.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

2022-11-04 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Fri Nov  4 09:02:38 UTC 2022

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

Log Message:
inpcb: use pool_cache instead of pool


To generate a diff of this commit:
cvs rdiff -u -r1.196 -r1.197 src/sys/netinet/in_pcb.c

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

Modified files:

Index: src/sys/netinet/in_pcb.c
diff -u src/sys/netinet/in_pcb.c:1.196 src/sys/netinet/in_pcb.c:1.197
--- src/sys/netinet/in_pcb.c:1.196	Fri Nov  4 09:01:53 2022
+++ src/sys/netinet/in_pcb.c	Fri Nov  4 09:02:38 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: in_pcb.c,v 1.196 2022/11/04 09:01:53 ozaki-r Exp $	*/
+/*	$NetBSD: in_pcb.c,v 1.197 2022/11/04 09:02:38 ozaki-r Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -93,7 +93,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: in_pcb.c,v 1.196 2022/11/04 09:01:53 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in_pcb.c,v 1.197 2022/11/04 09:02:38 ozaki-r Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -156,20 +156,20 @@ int	anonportmax = IPPORT_ANONMAX;
 int	lowportmin  = IPPORT_RESERVEDMIN;
 int	lowportmax  = IPPORT_RESERVEDMAX;
 
-static struct pool in4pcb_pool;
+static pool_cache_t	in4pcb_pool_cache;
 #ifdef INET6
-static struct pool in6pcb_pool;
+static pool_cache_t	in6pcb_pool_cache;
 #endif
 
 static int
 inpcb_poolinit(void)
 {
 
-	pool_init(_pool, sizeof(struct in4pcb), 0, 0, 0, "in4pcbpl", NULL,
-	IPL_NET);
+	in4pcb_pool_cache = pool_cache_init(sizeof(struct in4pcb), coherency_unit,
+	0, 0, "in4pcbpl", NULL, IPL_NET, NULL, NULL, NULL);
 #ifdef INET6
-	pool_init(_pool, sizeof(struct in6pcb), 0, 0, 0, "in6pcbpl", NULL,
-	IPL_NET);
+	in6pcb_pool_cache = pool_cache_init(sizeof(struct in6pcb), coherency_unit,
+	0, 0, "in6pcbpl", NULL, IPL_NET, NULL, NULL, NULL);
 #endif
 	return 0;
 }
@@ -203,22 +203,26 @@ inpcb_create(struct socket *so, void *v)
 	KASSERT(soaf(so) == AF_INET || soaf(so) == AF_INET6);
 
 	if (soaf(so) == AF_INET)
-		inp = pool_get(_pool, PR_NOWAIT|PR_ZERO);
+		inp = pool_cache_get(in4pcb_pool_cache, PR_NOWAIT);
 	else
-		inp = pool_get(_pool, PR_NOWAIT|PR_ZERO);
+		inp = pool_cache_get(in6pcb_pool_cache, PR_NOWAIT);
 #else
 	KASSERT(soaf(so) == AF_INET);
-	inp = pool_get(_pool, PR_NOWAIT|PR_ZERO);
+	inp = pool_cache_get(in4pcb_pool_cache, PR_NOWAIT);
 #endif
 	if (inp == NULL)
 		return (ENOBUFS);
+	if (soaf(so) == AF_INET)
+		memset(inp, 0, sizeof(struct in4pcb));
+#ifdef INET6
+	else
+		memset(inp, 0, sizeof(struct in6pcb));
+#endif
 	inp->inp_af = soaf(so);
 	inp->inp_table = table;
 	inp->inp_socket = so;
 	inp->inp_portalgo = PORTALGO_DEFAULT;
 	inp->inp_bindportonsend = false;
-	inp->inp_overudp_cb = NULL;
-	inp->inp_overudp_arg = NULL;
 
 	if (inp->inp_af == AF_INET) {
 		in4p_errormtu(inp) = -1;
@@ -237,12 +241,12 @@ inpcb_create(struct socket *so, void *v)
 		if (error != 0) {
 #ifdef INET6
 			if (inp->inp_af == AF_INET)
-pool_put(_pool, inp);
+pool_cache_put(in4pcb_pool_cache, inp);
 			else
-pool_put(_pool, inp);
+pool_cache_put(in6pcb_pool_cache, inp);
 #else
 			KASSERT(inp->inp_af == AF_INET);
-			pool_put(_pool, inp);
+			pool_cache_put(in4pcb_pool_cache, inp);
 #endif
 			return error;
 		}
@@ -692,12 +696,12 @@ inpcb_destroy(void *v)
 
 #ifdef INET6
 	if (inp->inp_af == AF_INET)
-		pool_put(_pool, inp);
+		pool_cache_put(in4pcb_pool_cache, inp);
 	else
-		pool_put(_pool, inp);
+		pool_cache_put(in6pcb_pool_cache, inp);
 #else
 	KASSERT(inp->inp_af == AF_INET);
-	pool_put(_pool, inp);
+	pool_cache_put(in4pcb_pool_cache, inp);
 #endif
 	mutex_enter(softnet_lock);	/* reacquire the softnet_lock */
 }



CVS commit: src/sys

2022-11-04 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Fri Nov  4 09:01:54 UTC 2022

Modified Files:
src/sys/dist/pf/net: pf.c
src/sys/netinet: dccp_usrreq.c in_pcb.c in_pcb.h portalgo.c
sctp_output.c tcp_input.c tcp_output.c tcp_subr.c tcp_syncache.c
tcp_usrreq.c
src/sys/netinet6: dccp6_usrreq.c in6_pcb.c in6_src.c raw_ip6.c
sctp6_usrreq.c udp6_usrreq.c

Log Message:
inpcb: rename functions to in6pcb_*


To generate a diff of this commit:
cvs rdiff -u -r1.86 -r1.87 src/sys/dist/pf/net/pf.c
cvs rdiff -u -r1.25 -r1.26 src/sys/netinet/dccp_usrreq.c
cvs rdiff -u -r1.195 -r1.196 src/sys/netinet/in_pcb.c
cvs rdiff -u -r1.74 -r1.75 src/sys/netinet/in_pcb.h
cvs rdiff -u -r1.14 -r1.15 src/sys/netinet/portalgo.c
cvs rdiff -u -r1.32 -r1.33 src/sys/netinet/sctp_output.c
cvs rdiff -u -r1.437 -r1.438 src/sys/netinet/tcp_input.c
cvs rdiff -u -r1.217 -r1.218 src/sys/netinet/tcp_output.c
cvs rdiff -u -r1.295 -r1.296 src/sys/netinet/tcp_subr.c
cvs rdiff -u -r1.5 -r1.6 src/sys/netinet/tcp_syncache.c
cvs rdiff -u -r1.237 -r1.238 src/sys/netinet/tcp_usrreq.c
cvs rdiff -u -r1.14 -r1.15 src/sys/netinet6/dccp6_usrreq.c
cvs rdiff -u -r1.174 -r1.175 src/sys/netinet6/in6_pcb.c
cvs rdiff -u -r1.90 -r1.91 src/sys/netinet6/in6_src.c
cvs rdiff -u -r1.181 -r1.182 src/sys/netinet6/raw_ip6.c
cvs rdiff -u -r1.23 -r1.24 src/sys/netinet6/sctp6_usrreq.c
cvs rdiff -u -r1.153 -r1.154 src/sys/netinet6/udp6_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/dist/pf/net/pf.c
diff -u src/sys/dist/pf/net/pf.c:1.86 src/sys/dist/pf/net/pf.c:1.87
--- src/sys/dist/pf/net/pf.c:1.86	Fri Nov  4 09:00:58 2022
+++ src/sys/dist/pf/net/pf.c	Fri Nov  4 09:01:53 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: pf.c,v 1.86 2022/11/04 09:00:58 ozaki-r Exp $	*/
+/*	$NetBSD: pf.c,v 1.87 2022/11/04 09:01:53 ozaki-r Exp $	*/
 /*	$OpenBSD: pf.c,v 1.552.2.1 2007/11/27 16:37:57 henning Exp $ */
 
 /*
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pf.c,v 1.86 2022/11/04 09:00:58 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pf.c,v 1.87 2022/11/04 09:01:53 ozaki-r Exp $");
 
 #include "pflog.h"
 
@@ -2802,11 +2802,11 @@ pf_socket_lookup(int direction, struct p
 #define in_pcbhashlookup(tbl, saddr, sport, daddr, dport) \
 inpcb_lookup(tbl, saddr, sport, daddr, dport, NULL)
 #define in6_pcbhashlookup(tbl, saddr, sport, daddr, dport) \
-in6_pcblookup_connect(tbl, saddr, sport, daddr, dport, 0, NULL)
+in6pcb_lookup(tbl, saddr, sport, daddr, dport, 0, NULL)
 #define in_pcblookup_listen(tbl, addr, port, zero) \
 inpcb_lookup_bound(tbl, addr, port)
 #define in6_pcblookup_listen(tbl, addr, port, zero) \
-in6_pcblookup_bind(tbl, addr, port, zero)
+in6pcb_lookup_bound(tbl, addr, port, zero)
 #endif
 	
 #ifdef INET

Index: src/sys/netinet/dccp_usrreq.c
diff -u src/sys/netinet/dccp_usrreq.c:1.25 src/sys/netinet/dccp_usrreq.c:1.26
--- src/sys/netinet/dccp_usrreq.c:1.25	Fri Nov  4 09:00:58 2022
+++ src/sys/netinet/dccp_usrreq.c	Fri Nov  4 09:01:53 2022
@@ -1,5 +1,5 @@
 /*	$KAME: dccp_usrreq.c,v 1.67 2005/11/03 16:05:04 nishida Exp $	*/
-/*	$NetBSD: dccp_usrreq.c,v 1.25 2022/11/04 09:00:58 ozaki-r Exp $ */
+/*	$NetBSD: dccp_usrreq.c,v 1.26 2022/11/04 09:01:53 ozaki-r Exp $ */
 
 /*
  * Copyright (c) 2003 Joacim Häggmark, Magnus Erixzon, Nils-Erik Mattsson 
@@ -67,7 +67,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dccp_usrreq.c,v 1.25 2022/11/04 09:00:58 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dccp_usrreq.c,v 1.26 2022/11/04 09:01:53 ozaki-r Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -337,11 +337,11 @@ dccp_input(struct mbuf *m, int off, int 
 	 */
 #ifdef INET6
 	if (isipv6) {
-		inp = in6_pcblookup_connect(, >ip6_src,
+		inp = in6pcb_lookup(, >ip6_src,
 		dh->dh_sport, >ip6_dst, dh->dh_dport, 0, 0);
 		if (inp == NULL) {
 			/* XXX stats increment? */
-			inp = in6_pcblookup_bind(, >ip6_dst,
+			inp = in6pcb_lookup_bound(, >ip6_dst,
 			dh->dh_dport, 0);
 		}
 	} else
@@ -1779,8 +1779,8 @@ dccp_doconnect(struct socket *so, struct
 	if (inp->inp_lport == 0) {
 #ifdef INET6
 		if (isipv6) {
-			DCCP_DEBUG((LOG_INFO, "Running in6_pcbbind!\n"));
-			error = in6_pcbbind(inp, NULL, l);
+			DCCP_DEBUG((LOG_INFO, "Running in6pcb_bind!\n"));
+			error = in6pcb_bind(inp, NULL, l);
 		} else
 #endif /* INET6 */
 		{
@@ -1794,8 +1794,8 @@ dccp_doconnect(struct socket *so, struct
 
 #ifdef INET6
 	if (isipv6) {
-		error = in6_pcbconnect(inp, (struct sockaddr_in6 *)nam, l);
-		DCCP_DEBUG((LOG_INFO, "in6_pcbconnect=%d\n",error));
+		error = in6pcb_connect(inp, (struct sockaddr_in6 *)nam, l);
+		DCCP_DEBUG((LOG_INFO, "in6pcb_connect=%d\n",error));
 	} else
 #endif
 		error = inpcb_connect(inp, (struct sockaddr_in *)nam, l);
@@ -2133,7 +2133,7 @@ dccp_newdccpcb(int family, void *aux)
 		in4p_ip(inp).ip_ttl = ip_defttl;
 		break;
 	case PF_INET6:
-		in6p_ip6(inp).ip6_hlim = 

CVS commit: src/sys

2022-11-04 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Fri Nov  4 09:01:54 UTC 2022

Modified Files:
src/sys/dist/pf/net: pf.c
src/sys/netinet: dccp_usrreq.c in_pcb.c in_pcb.h portalgo.c
sctp_output.c tcp_input.c tcp_output.c tcp_subr.c tcp_syncache.c
tcp_usrreq.c
src/sys/netinet6: dccp6_usrreq.c in6_pcb.c in6_src.c raw_ip6.c
sctp6_usrreq.c udp6_usrreq.c

Log Message:
inpcb: rename functions to in6pcb_*


To generate a diff of this commit:
cvs rdiff -u -r1.86 -r1.87 src/sys/dist/pf/net/pf.c
cvs rdiff -u -r1.25 -r1.26 src/sys/netinet/dccp_usrreq.c
cvs rdiff -u -r1.195 -r1.196 src/sys/netinet/in_pcb.c
cvs rdiff -u -r1.74 -r1.75 src/sys/netinet/in_pcb.h
cvs rdiff -u -r1.14 -r1.15 src/sys/netinet/portalgo.c
cvs rdiff -u -r1.32 -r1.33 src/sys/netinet/sctp_output.c
cvs rdiff -u -r1.437 -r1.438 src/sys/netinet/tcp_input.c
cvs rdiff -u -r1.217 -r1.218 src/sys/netinet/tcp_output.c
cvs rdiff -u -r1.295 -r1.296 src/sys/netinet/tcp_subr.c
cvs rdiff -u -r1.5 -r1.6 src/sys/netinet/tcp_syncache.c
cvs rdiff -u -r1.237 -r1.238 src/sys/netinet/tcp_usrreq.c
cvs rdiff -u -r1.14 -r1.15 src/sys/netinet6/dccp6_usrreq.c
cvs rdiff -u -r1.174 -r1.175 src/sys/netinet6/in6_pcb.c
cvs rdiff -u -r1.90 -r1.91 src/sys/netinet6/in6_src.c
cvs rdiff -u -r1.181 -r1.182 src/sys/netinet6/raw_ip6.c
cvs rdiff -u -r1.23 -r1.24 src/sys/netinet6/sctp6_usrreq.c
cvs rdiff -u -r1.153 -r1.154 src/sys/netinet6/udp6_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

2022-11-04 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Fri Nov  4 09:00:59 UTC 2022

Modified Files:
src/sys/dist/pf/net: pf.c
src/sys/net: if_wg.c
src/sys/netcan: can.c
src/sys/netinet: dccp_usrreq.c in_pcb.c in_pcb.h ip_output.c portalgo.c
raw_ip.c sctp_usrreq.c tcp_input.c tcp_output.c tcp_subr.c
tcp_syncache.c tcp_timer.c tcp_usrreq.c tcp_vtw.c udp_usrreq.c
src/sys/netinet6: in6_pcb.c raw_ip6.c udp6_usrreq.c
src/sys/netipsec: ipsec.c

Log Message:
inpcb: rename functions to inpcb_*

Inspired by rmind-smpnet patches.


To generate a diff of this commit:
cvs rdiff -u -r1.85 -r1.86 src/sys/dist/pf/net/pf.c
cvs rdiff -u -r1.70 -r1.71 src/sys/net/if_wg.c
cvs rdiff -u -r1.12 -r1.13 src/sys/netcan/can.c
cvs rdiff -u -r1.24 -r1.25 src/sys/netinet/dccp_usrreq.c
cvs rdiff -u -r1.194 -r1.195 src/sys/netinet/in_pcb.c
cvs rdiff -u -r1.73 -r1.74 src/sys/netinet/in_pcb.h
cvs rdiff -u -r1.322 -r1.323 src/sys/netinet/ip_output.c
cvs rdiff -u -r1.13 -r1.14 src/sys/netinet/portalgo.c
cvs rdiff -u -r1.183 -r1.184 src/sys/netinet/raw_ip.c
cvs rdiff -u -r1.22 -r1.23 src/sys/netinet/sctp_usrreq.c
cvs rdiff -u -r1.436 -r1.437 src/sys/netinet/tcp_input.c
cvs rdiff -u -r1.216 -r1.217 src/sys/netinet/tcp_output.c
cvs rdiff -u -r1.294 -r1.295 src/sys/netinet/tcp_subr.c
cvs rdiff -u -r1.4 -r1.5 src/sys/netinet/tcp_syncache.c
cvs rdiff -u -r1.98 -r1.99 src/sys/netinet/tcp_timer.c
cvs rdiff -u -r1.236 -r1.237 src/sys/netinet/tcp_usrreq.c
cvs rdiff -u -r1.23 -r1.24 src/sys/netinet/tcp_vtw.c
cvs rdiff -u -r1.263 -r1.264 src/sys/netinet/udp_usrreq.c
cvs rdiff -u -r1.173 -r1.174 src/sys/netinet6/in6_pcb.c
cvs rdiff -u -r1.180 -r1.181 src/sys/netinet6/raw_ip6.c
cvs rdiff -u -r1.152 -r1.153 src/sys/netinet6/udp6_usrreq.c
cvs rdiff -u -r1.174 -r1.175 src/sys/netipsec/ipsec.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/dist/pf/net/pf.c
diff -u src/sys/dist/pf/net/pf.c:1.85 src/sys/dist/pf/net/pf.c:1.86
--- src/sys/dist/pf/net/pf.c:1.85	Fri Oct 28 05:20:08 2022
+++ src/sys/dist/pf/net/pf.c	Fri Nov  4 09:00:58 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: pf.c,v 1.85 2022/10/28 05:20:08 ozaki-r Exp $	*/
+/*	$NetBSD: pf.c,v 1.86 2022/11/04 09:00:58 ozaki-r Exp $	*/
 /*	$OpenBSD: pf.c,v 1.552.2.1 2007/11/27 16:37:57 henning Exp $ */
 
 /*
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pf.c,v 1.85 2022/10/28 05:20:08 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pf.c,v 1.86 2022/11/04 09:00:58 ozaki-r Exp $");
 
 #include "pflog.h"
 
@@ -2455,7 +2455,7 @@ pf_get_sport(sa_family_t af, u_int8_t pr
 
 		/*
 		 * port search; start random, step;
-		 * similar 2 portloop in in_pcbbind
+		 * similar 2 portloop in inpcb_bind
 		 */
 		if (!(proto == IPPROTO_TCP || proto == IPPROTO_UDP ||
 		proto == IPPROTO_ICMP)) {
@@ -2800,11 +2800,11 @@ pf_socket_lookup(int direction, struct p
 
 #ifdef __NetBSD__
 #define in_pcbhashlookup(tbl, saddr, sport, daddr, dport) \
-in_pcblookup_connect(tbl, saddr, sport, daddr, dport, NULL)
+inpcb_lookup(tbl, saddr, sport, daddr, dport, NULL)
 #define in6_pcbhashlookup(tbl, saddr, sport, daddr, dport) \
 in6_pcblookup_connect(tbl, saddr, sport, daddr, dport, 0, NULL)
 #define in_pcblookup_listen(tbl, addr, port, zero) \
-in_pcblookup_bind(tbl, addr, port)
+inpcb_lookup_bound(tbl, addr, port)
 #define in6_pcblookup_listen(tbl, addr, port, zero) \
 in6_pcblookup_bind(tbl, addr, port, zero)
 #endif

Index: src/sys/net/if_wg.c
diff -u src/sys/net/if_wg.c:1.70 src/sys/net/if_wg.c:1.71
--- src/sys/net/if_wg.c:1.70	Fri Oct 28 05:20:08 2022
+++ src/sys/net/if_wg.c	Fri Nov  4 09:00:58 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wg.c,v 1.70 2022/10/28 05:20:08 ozaki-r Exp $	*/
+/*	$NetBSD: if_wg.c,v 1.71 2022/11/04 09:00:58 ozaki-r Exp $	*/
 
 /*
  * Copyright (C) Ryota Ozaki 
@@ -41,7 +41,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wg.c,v 1.70 2022/10/28 05:20:08 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wg.c,v 1.71 2022/11/04 09:00:58 ozaki-r Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_altq_enabled.h"
@@ -3266,7 +3266,7 @@ wg_socreate(struct wg_softc *wg, int af,
 	so->so_upcallarg = wg;
 	so->so_upcall = wg_so_upcall;
 	so->so_rcv.sb_flags |= SB_UPCALL;
-	in_pcb_register_overudp_cb(sotoinpcb(so), wg_overudp_cb, wg);
+	inpcb_register_overudp_cb(sotoinpcb(so), wg_overudp_cb, wg);
 	sounlock(so);
 
 	*sop = so;

Index: src/sys/netcan/can.c
diff -u src/sys/netcan/can.c:1.12 src/sys/netcan/can.c:1.13
--- src/sys/netcan/can.c:1.12	Sat Sep  3 02:07:32 2022
+++ src/sys/netcan/can.c	Fri Nov  4 09:00:58 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: can.c,v 1.12 2022/09/03 02:07:32 thorpej Exp $	*/
+/*	$NetBSD: can.c,v 1.13 2022/11/04 09:00:58 ozaki-r Exp $	*/
 
 /*-
  * Copyright (c) 2003, 2017 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: can.c,v 1.12 2022/09/03 02:07:32 thorpej Exp 

CVS commit: src/sys

2022-11-04 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Fri Nov  4 09:00:59 UTC 2022

Modified Files:
src/sys/dist/pf/net: pf.c
src/sys/net: if_wg.c
src/sys/netcan: can.c
src/sys/netinet: dccp_usrreq.c in_pcb.c in_pcb.h ip_output.c portalgo.c
raw_ip.c sctp_usrreq.c tcp_input.c tcp_output.c tcp_subr.c
tcp_syncache.c tcp_timer.c tcp_usrreq.c tcp_vtw.c udp_usrreq.c
src/sys/netinet6: in6_pcb.c raw_ip6.c udp6_usrreq.c
src/sys/netipsec: ipsec.c

Log Message:
inpcb: rename functions to inpcb_*

Inspired by rmind-smpnet patches.


To generate a diff of this commit:
cvs rdiff -u -r1.85 -r1.86 src/sys/dist/pf/net/pf.c
cvs rdiff -u -r1.70 -r1.71 src/sys/net/if_wg.c
cvs rdiff -u -r1.12 -r1.13 src/sys/netcan/can.c
cvs rdiff -u -r1.24 -r1.25 src/sys/netinet/dccp_usrreq.c
cvs rdiff -u -r1.194 -r1.195 src/sys/netinet/in_pcb.c
cvs rdiff -u -r1.73 -r1.74 src/sys/netinet/in_pcb.h
cvs rdiff -u -r1.322 -r1.323 src/sys/netinet/ip_output.c
cvs rdiff -u -r1.13 -r1.14 src/sys/netinet/portalgo.c
cvs rdiff -u -r1.183 -r1.184 src/sys/netinet/raw_ip.c
cvs rdiff -u -r1.22 -r1.23 src/sys/netinet/sctp_usrreq.c
cvs rdiff -u -r1.436 -r1.437 src/sys/netinet/tcp_input.c
cvs rdiff -u -r1.216 -r1.217 src/sys/netinet/tcp_output.c
cvs rdiff -u -r1.294 -r1.295 src/sys/netinet/tcp_subr.c
cvs rdiff -u -r1.4 -r1.5 src/sys/netinet/tcp_syncache.c
cvs rdiff -u -r1.98 -r1.99 src/sys/netinet/tcp_timer.c
cvs rdiff -u -r1.236 -r1.237 src/sys/netinet/tcp_usrreq.c
cvs rdiff -u -r1.23 -r1.24 src/sys/netinet/tcp_vtw.c
cvs rdiff -u -r1.263 -r1.264 src/sys/netinet/udp_usrreq.c
cvs rdiff -u -r1.173 -r1.174 src/sys/netinet6/in6_pcb.c
cvs rdiff -u -r1.180 -r1.181 src/sys/netinet6/raw_ip6.c
cvs rdiff -u -r1.152 -r1.153 src/sys/netinet6/udp6_usrreq.c
cvs rdiff -u -r1.174 -r1.175 src/sys/netipsec/ipsec.c

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



CVS commit: src

2022-11-04 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Fri Nov  4 08:01:42 UTC 2022

Modified Files:
src/distrib/sets/lists/debug: mi
src/distrib/sets/lists/tests: mi
src/etc/mtree: NetBSD.dist.tests
src/tests/net/tcp: Makefile
Added Files:
src/tests/net/tcp: t_tcp_shutdown.sh tcp_shutdown.c

Log Message:
tests: add tests for invalid extra operations on a shutdown socket

The tests cover some error paths that normally happen.


To generate a diff of this commit:
cvs rdiff -u -r1.389 -r1.390 src/distrib/sets/lists/debug/mi
cvs rdiff -u -r1.1226 -r1.1227 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.194 -r1.195 src/etc/mtree/NetBSD.dist.tests
cvs rdiff -u -r1.1 -r1.2 src/tests/net/tcp/Makefile
cvs rdiff -u -r0 -r1.1 src/tests/net/tcp/t_tcp_shutdown.sh \
src/tests/net/tcp/tcp_shutdown.c

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



CVS commit: src

2022-11-04 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Fri Nov  4 08:01:42 UTC 2022

Modified Files:
src/distrib/sets/lists/debug: mi
src/distrib/sets/lists/tests: mi
src/etc/mtree: NetBSD.dist.tests
src/tests/net/tcp: Makefile
Added Files:
src/tests/net/tcp: t_tcp_shutdown.sh tcp_shutdown.c

Log Message:
tests: add tests for invalid extra operations on a shutdown socket

The tests cover some error paths that normally happen.


To generate a diff of this commit:
cvs rdiff -u -r1.389 -r1.390 src/distrib/sets/lists/debug/mi
cvs rdiff -u -r1.1226 -r1.1227 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.194 -r1.195 src/etc/mtree/NetBSD.dist.tests
cvs rdiff -u -r1.1 -r1.2 src/tests/net/tcp/Makefile
cvs rdiff -u -r0 -r1.1 src/tests/net/tcp/t_tcp_shutdown.sh \
src/tests/net/tcp/tcp_shutdown.c

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

Modified files:

Index: src/distrib/sets/lists/debug/mi
diff -u src/distrib/sets/lists/debug/mi:1.389 src/distrib/sets/lists/debug/mi:1.390
--- src/distrib/sets/lists/debug/mi:1.389	Sun Aug 28 07:30:41 2022
+++ src/distrib/sets/lists/debug/mi	Fri Nov  4 08:01:42 2022
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.389 2022/08/28 07:30:41 christos Exp $
+# $NetBSD: mi,v 1.390 2022/11/04 08:01:42 ozaki-r Exp $
 ./etc/mtree/set.debug   comp-sys-root
 ./usr/lib	comp-sys-usr		compatdir
 ./usr/lib/i18n/libBIG5_g.a			comp-c-debuglib		debuglib,compatfile
@@ -2437,6 +2437,7 @@
 ./usr/libdata/debug/usr/tests/net/sys/t_listen.debug			tests-obsolete		obsolete,compattestfile
 ./usr/libdata/debug/usr/tests/net/sys/t_rfc6056.debug			tests-net-debug		debug,atf,compattestfile
 ./usr/libdata/debug/usr/tests/net/sys/t_socketpair.debug		tests-obsolete		obsolete,compattestfile
+./usr/libdata/debug/usr/tests/net/tcp/tcp_shutdown.debug		tests-net-debug		debug,atf,rump
 ./usr/libdata/debug/usr/tests/rump/modautoload/t_modautoload.debug	tests-syscall-debug	debug,atf,rump
 ./usr/libdata/debug/usr/tests/rump/rumpkern/h_client/h_forkcli.debug			tests-syscall-debug	debug,atf,rump
 ./usr/libdata/debug/usr/tests/rump/rumpkern/h_client/h_reboot.debug			tests-obsolete		obsolete

Index: src/distrib/sets/lists/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.1226 src/distrib/sets/lists/tests/mi:1.1227
--- src/distrib/sets/lists/tests/mi:1.1226	Fri Nov  4 07:54:27 2022
+++ src/distrib/sets/lists/tests/mi	Fri Nov  4 08:01:42 2022
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1226 2022/11/04 07:54:27 ozaki-r Exp $
+# $NetBSD: mi,v 1.1227 2022/11/04 08:01:42 ozaki-r Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -178,6 +178,7 @@
 ./usr/libdata/debug/usr/tests/net/mcast			tests-net-debug		compattestfile,atf
 ./usr/libdata/debug/usr/tests/net/net			tests-net-debug		compattestfile,atf
 ./usr/libdata/debug/usr/tests/net/sys			tests-net-debug		compattestfile,atf
+./usr/libdata/debug/usr/tests/net/tcp			tests-net-debug		compattestfile,atf
 ./usr/libdata/debug/usr/tests/rump			tests-syscall-debug	compattestfile,atf
 ./usr/libdata/debug/usr/tests/rump/modautoload		tests-syscall-debug	compattestfile,atf
 ./usr/libdata/debug/usr/tests/rump/rumpkern		tests-syscall-debug	compattestfile,atf
@@ -4286,7 +4287,9 @@
 ./usr/tests/net/tcp	tests-net-tests		compattestfile,atf
 ./usr/tests/net/tcp/Atffiletests-net-tests		atf,rump
 ./usr/tests/net/tcp/Kyuafiletests-net-tests		atf,rump,kyua
+./usr/tests/net/tcp/tcp_shutdown			tests-net-tests		atf,rump
 ./usr/tests/net/tcp/t_tcp_nctests-net-tests		atf,rump
+./usr/tests/net/tcp/t_tcp_shutdown			tests-net-tests		atf,rump
 ./usr/tests/net/wireguardtests-obsolete		obsolete
 ./usr/tests/net/wireguard/Atffile			tests-obsolete		obsolete
 ./usr/tests/net/wireguard/Kyuafile			tests-obsolete		obsolete

Index: src/etc/mtree/NetBSD.dist.tests
diff -u src/etc/mtree/NetBSD.dist.tests:1.194 src/etc/mtree/NetBSD.dist.tests:1.195
--- src/etc/mtree/NetBSD.dist.tests:1.194	Wed Nov  2 09:37:56 2022
+++ src/etc/mtree/NetBSD.dist.tests	Fri Nov  4 08:01:42 2022
@@ -1,4 +1,4 @@
-#	$NetBSD: NetBSD.dist.tests,v 1.194 2022/11/02 09:37:56 ozaki-r Exp $
+#	$NetBSD: NetBSD.dist.tests,v 1.195 2022/11/04 08:01:42 ozaki-r Exp $
 
 ./usr/libdata/debug/usr/tests
 ./usr/libdata/debug/usr/tests/atf
@@ -158,6 +158,7 @@
 ./usr/libdata/debug/usr/tests/net/mcast
 ./usr/libdata/debug/usr/tests/net/net
 ./usr/libdata/debug/usr/tests/net/sys
+./usr/libdata/debug/usr/tests/net/tcp
 ./usr/libdata/debug/usr/tests/rump
 ./usr/libdata/debug/usr/tests/rump/modautoload
 ./usr/libdata/debug/usr/tests/rump/rumpkern

Index: src/tests/net/tcp/Makefile
diff -u src/tests/net/tcp/Makefile:1.1 src/tests/net/tcp/Makefile:1.2
--- src/tests/net/tcp/Makefile:1.1	Wed Nov  2 09:37:56 2022
+++ src/tests/net/tcp/Makefile	Fri Nov  4 08:01:42 2022
@@ -1,13 +1,17 @@
-# $NetBSD: Makefile,v 1.1 2022/11/02 09:37:56 ozaki-r Exp $
+# $NetBSD: Makefile,v 1.2 2022/11/04 08:01:42 

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

2022-11-04 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Fri Nov  4 07:54:28 UTC 2022

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

Log Message:
sets: fix wrong keywords for tests/net/tcp


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

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

Modified files:

Index: src/distrib/sets/lists/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.1225 src/distrib/sets/lists/tests/mi:1.1226
--- src/distrib/sets/lists/tests/mi:1.1225	Wed Nov  2 09:37:56 2022
+++ src/distrib/sets/lists/tests/mi	Fri Nov  4 07:54:27 2022
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1225 2022/11/02 09:37:56 ozaki-r Exp $
+# $NetBSD: mi,v 1.1226 2022/11/04 07:54:27 ozaki-r Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -4284,9 +4284,9 @@
 ./usr/tests/net/sys/t_rfc6056tests-net-tests		compattestfile,atf
 ./usr/tests/net/sys/t_socketpair			tests-obsolete		obsolete
 ./usr/tests/net/tcp	tests-net-tests		compattestfile,atf
-./usr/tests/net/tcp/Atffiletests-net-tests		compattestfile,atf
-./usr/tests/net/tcp/Kyuafiletests-net-tests		compattestfile,atf,kyua
-./usr/tests/net/tcp/t_tcp_nctests-net-tests		compattestfile,atf
+./usr/tests/net/tcp/Atffiletests-net-tests		atf,rump
+./usr/tests/net/tcp/Kyuafiletests-net-tests		atf,rump,kyua
+./usr/tests/net/tcp/t_tcp_nctests-net-tests		atf,rump
 ./usr/tests/net/wireguardtests-obsolete		obsolete
 ./usr/tests/net/wireguard/Atffile			tests-obsolete		obsolete
 ./usr/tests/net/wireguard/Kyuafile			tests-obsolete		obsolete



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

2022-11-04 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Fri Nov  4 07:54:28 UTC 2022

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

Log Message:
sets: fix wrong keywords for tests/net/tcp


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

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



CVS commit: src/tests/lib/libcurses/check_files

2022-11-04 Thread Brett Lymn
Module Name:src
Committed By:   blymn
Date:   Fri Nov  4 06:17:59 UTC 2022

Modified Files:
src/tests/lib/libcurses/check_files: addstr3.chk copywin6.chk
copywin7.chk

Log Message:
Update check files to allow for changes due to fixes to libcurses.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/lib/libcurses/check_files/addstr3.chk
cvs rdiff -u -r1.4 -r1.5 src/tests/lib/libcurses/check_files/copywin6.chk \
src/tests/lib/libcurses/check_files/copywin7.chk

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

Modified files:

Index: src/tests/lib/libcurses/check_files/addstr3.chk
diff -u src/tests/lib/libcurses/check_files/addstr3.chk:1.3 src/tests/lib/libcurses/check_files/addstr3.chk:1.4
--- src/tests/lib/libcurses/check_files/addstr3.chk:1.3	Tue Apr 12 07:04:19 2022
+++ src/tests/lib/libcurses/check_files/addstr3.chk	Fri Nov  4 06:17:58 2022
@@ -1,5 +1,2 @@
-csr2;24Xhomehome
-rin1Xcsr1;24Xhomehomecup24;1Xhome
-()cup23;1X0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*cup2;3Xclearcsr2;23Xhome
-rin1Xcsr1;24Xhomehome
-hellocup23;76Xacup2;6X
\ No newline at end of file
+0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*cup24;1X()cup24;76Xel()clearcup23;76Xa
+hello
\ No newline at end of file

Index: src/tests/lib/libcurses/check_files/copywin6.chk
diff -u src/tests/lib/libcurses/check_files/copywin6.chk:1.4 src/tests/lib/libcurses/check_files/copywin6.chk:1.5
--- src/tests/lib/libcurses/check_files/copywin6.chk:1.4	Tue Jun 22 07:49:58 2021
+++ src/tests/lib/libcurses/check_files/copywin6.chk	Fri Nov  4 06:17:58 2022
@@ -1,4 +1,4 @@
 cup3;6Xstingt
  ingtes
  gtesti
- estingcup4;6X
\ No newline at end of file
+ estingcup8;6X
\ No newline at end of file
Index: src/tests/lib/libcurses/check_files/copywin7.chk
diff -u src/tests/lib/libcurses/check_files/copywin7.chk:1.4 src/tests/lib/libcurses/check_files/copywin7.chk:1.5
--- src/tests/lib/libcurses/check_files/copywin7.chk:1.4	Tue Jun 22 07:49:58 2021
+++ src/tests/lib/libcurses/check_files/copywin7.chk	Fri Nov  4 06:17:58 2022
@@ -1,4 +1,4 @@
-el
+el
  el
  el
  elcup11;15Xelcup12;15Xelcup13;15Xelcup14;15Xelcup15;15Xelcup17;15Xel
\ No newline at end of file



CVS commit: src/tests/lib/libcurses/check_files

2022-11-04 Thread Brett Lymn
Module Name:src
Committed By:   blymn
Date:   Fri Nov  4 06:17:59 UTC 2022

Modified Files:
src/tests/lib/libcurses/check_files: addstr3.chk copywin6.chk
copywin7.chk

Log Message:
Update check files to allow for changes due to fixes to libcurses.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/lib/libcurses/check_files/addstr3.chk
cvs rdiff -u -r1.4 -r1.5 src/tests/lib/libcurses/check_files/copywin6.chk \
src/tests/lib/libcurses/check_files/copywin7.chk

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



CVS commit: src/lib/libcurses

2022-11-04 Thread Brett Lymn
Module Name:src
Committed By:   blymn
Date:   Fri Nov  4 06:12:23 UTC 2022

Modified Files:
src/lib/libcurses: move.c

Log Message:
PR bin/57072

This fixes observed behviour in the PR.  Allow the cursor to be
moved one past the EOL, if postitioned here then set ISPASTEOL.
also protect out of range access if win->cury is past maxy.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/lib/libcurses/move.c

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

Modified files:

Index: src/lib/libcurses/move.c
diff -u src/lib/libcurses/move.c:1.24 src/lib/libcurses/move.c:1.25
--- src/lib/libcurses/move.c:1.24	Wed Apr 27 22:04:04 2022
+++ src/lib/libcurses/move.c	Fri Nov  4 06:12:22 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: move.c,v 1.24 2022/04/27 22:04:04 blymn Exp $	*/
+/*	$NetBSD: move.c,v 1.25 2022/11/04 06:12:22 blymn Exp $	*/
 
 /*
  * Copyright (c) 1981, 1993, 1994
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)move.c	8.2 (Berkeley) 5/4/94";
 #else
-__RCSID("$NetBSD: move.c,v 1.24 2022/04/27 22:04:04 blymn Exp $");
+__RCSID("$NetBSD: move.c,v 1.25 2022/11/04 06:12:22 blymn Exp $");
 #endif
 #endif/* not lint */
 
@@ -65,13 +65,17 @@ wmove(WINDOW *win, int y, int x)
 	__CTRACE(__CTRACE_MISC, "wmove: win %p, (%d, %d)\n", win, y, x);
 	if (x < 0 || y < 0)
 		return ERR;
-	if (x >= win->maxx || y >= win->maxy)
+	if (x > win->maxx || y >= win->maxy)
 		return ERR;
 
 	/* clear the EOL flags for both where we were and where we are going */
-	win->alines[win->cury]->flags &= ~ __ISPASTEOL;
+	if (win->cury < win->maxy)
+		win->alines[win->cury]->flags &= ~ __ISPASTEOL;
 	win->alines[y]->flags &= ~ __ISPASTEOL;
 
+	if (x == win->maxx)
+		win->alines[y]->flags |= __ISPASTEOL;
+
 	win->curx = x;
 	win->cury = y;
 



CVS commit: src/lib/libcurses

2022-11-04 Thread Brett Lymn
Module Name:src
Committed By:   blymn
Date:   Fri Nov  4 06:12:23 UTC 2022

Modified Files:
src/lib/libcurses: move.c

Log Message:
PR bin/57072

This fixes observed behviour in the PR.  Allow the cursor to be
moved one past the EOL, if postitioned here then set ISPASTEOL.
also protect out of range access if win->cury is past maxy.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/lib/libcurses/move.c

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