Module Name:    src
Committed By:   martin
Date:           Mon Mar 11 19:34:00 UTC 2024

Modified Files:
        src/sys/net [netbsd-10]: if_wg.c

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #628):

        sys/net/if_wg.c: revision 1.78

wg(4): Bind to CPU in wg_handle_packet.

Required by use of psref there.
Assert we're bound up front so we catch mistakes early, rather than
later on if we get unlucky in preemption and scheduling.

PR bin/58021


To generate a diff of this commit:
cvs rdiff -u -r1.71.2.2 -r1.71.2.3 src/sys/net/if_wg.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_wg.c
diff -u src/sys/net/if_wg.c:1.71.2.2 src/sys/net/if_wg.c:1.71.2.3
--- src/sys/net/if_wg.c:1.71.2.2	Fri Jul  7 19:02:22 2023
+++ src/sys/net/if_wg.c	Mon Mar 11 19:34:00 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wg.c,v 1.71.2.2 2023/07/07 19:02:22 martin Exp $	*/
+/*	$NetBSD: if_wg.c,v 1.71.2.3 2024/03/11 19:34:00 martin Exp $	*/
 
 /*
  * Copyright (C) Ryota Ozaki <ozaki.ry...@gmail.com>
@@ -41,7 +41,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_wg.c,v 1.71.2.2 2023/07/07 19:02:22 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wg.c,v 1.71.2.3 2024/03/11 19:34:00 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_altq_enabled.h"
@@ -2870,6 +2870,8 @@ wg_handle_packet(struct wg_softc *wg, st
 {
 	struct wg_msg *wgm;
 
+	KASSERT(curlwp->l_pflag & LP_BOUND);
+
 	m = wg_validate_msg_header(wg, m);
 	if (__predict_false(m == NULL))
 		return;
@@ -5039,6 +5041,7 @@ rumpkern_wg_recv_peer(struct wg_softc *w
 {
 	struct mbuf *m;
 	const struct sockaddr *src;
+	int bound;
 
 	WG_TRACE("");
 
@@ -5053,7 +5056,9 @@ rumpkern_wg_recv_peer(struct wg_softc *w
 	WG_DLOG("iov_len=%lu\n", iov[1].iov_len);
 	WG_DUMP_BUF(iov[1].iov_base, iov[1].iov_len);
 
+	bound = curlwp_bind();
 	wg_handle_packet(wg, m, src);
+	curlwp_bindx(bound);
 }
 #endif /* WG_RUMPKERNEL */
 

Reply via email to