A leak may happens when wgpeer is deleted. ok?
The state queue should be freeed when wg_peer is destroyed. diff from IIJ. Index: sys/net/if_wg.c =================================================================== RCS file: /disk/cvs/openbsd/src/sys/net/if_wg.c,v retrieving revision 1.29 diff -u -p -r1.29 if_wg.c --- sys/net/if_wg.c 3 Aug 2023 09:49:08 -0000 1.29 +++ sys/net/if_wg.c 22 Sep 2023 03:11:47 -0000 @@ -518,6 +518,9 @@ wg_peer_destroy(struct wg_peer *peer) taskq_barrier(wg_crypt_taskq); taskq_barrier(net_tq(sc->sc_if.if_index)); + if (!mq_empty(&peer->p_stage_queue)) + mq_purge(&peer->p_stage_queue); + DPRINTF(sc, "Peer %llu destroyed\n", peer->p_id); explicit_bzero(peer, sizeof(*peer)); pool_put(&wg_peer_pool, peer);