From 739b83a4002b8ed737c0d6f25c6cfac4c094b312 Mon Sep 17 00:00:00 2001 From: Klemens Nanni Date: Tue, 27 Jun 2023 17:36:57 +0000 Subject: Use shared net lock for DIOCGETIFACES snmpd(8) and 'pfctl -s Interfaces' dump pf's internal list of interfaces. pf's internal interface list is completely protected by the pf lock, pf lock assertions since pf_if.c r1.110 from over a week ago support this. pfi_*() iterate over net lock protected if_groups lists, but only to read, so downgrade from exclusive write net lock to a shared read-only one. Feedback mvs OK sashan --- sys/net/pf_ioctl.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'sys') diff --git a/sys/net/pf_ioctl.c b/sys/net/pf_ioctl.c index 499330b84b0..26e1fa07faf 100644 --- a/sys/net/pf_ioctl.c +++ b/sys/net/pf_ioctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pf_ioctl.c,v 1.407 2023/06/27 17:29:38 kn Exp $ */ +/* $OpenBSD: pf_ioctl.c,v 1.408 2023/06/27 17:36:56 kn Exp $ */ /* * Copyright (c) 2001 Daniel Hartmeier @@ -2944,11 +2944,11 @@ pfioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct proc *p) goto fail; } - NET_LOCK(); + NET_LOCK_SHARED(); PF_LOCK(); pfi_get_ifaces(io->pfiio_name, kif_buf, &io->pfiio_size); PF_UNLOCK(); - NET_UNLOCK(); + NET_UNLOCK_SHARED(); if (copyout(kif_buf, io->pfiio_buffer, sizeof(*kif_buf) * io->pfiio_size)) error = EFAULT; -- cgit v1.2.3