From 4e88faf97e1f6bfd45003c5ccd81179b23c6a96b Mon Sep 17 00:00:00 2001 From: kn Date: Fri, 2 Dec 2022 12:56:51 +0000 Subject: [PATCH] Unlock in6_ioctl_get() aka. SIOCGIF{DSTADDR,NETMASK,AFLAG,ALIFETIME}_IN6 First the right address is picked from the net lock protected if_addrlist. Then all ioctls just copy out the address, nothing requires the kernel lock. SIOCGIFDSTADDR_IN6 checks the net lock protected if_flags, SIOCGIFALIFETIME_IN6 computes lifetimes which only need the address. This removes the last kernel lock from IPv6 read ioctls (multicast being the untouched exception here). Users of these ioctl(2)s are route6d(8), rad(8), slaacd(8), isakmpd(8) and of course ifconfig(8). OK mvs --- sys/netinet6/in6.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/sys/netinet6/in6.c b/sys/netinet6/in6.c index 0f36b5ab332..10f76106a75 100644 --- a/sys/netinet6/in6.c +++ b/sys/netinet6/in6.c @@ -1,4 +1,4 @@ -/* $OpenBSD: in6.c,v 1.257 2022/11/30 14:01:02 kn Exp $ */ +/* $OpenBSD: in6.c,v 1.258 2022/12/02 12:56:51 kn Exp $ */ /* $KAME: in6.c,v 1.372 2004/06/14 08:14:21 itojun Exp $ */ /* @@ -422,7 +422,6 @@ in6_ioctl_get(u_long cmd, caddr_t data, struct ifnet *ifp) return (error); } - KERNEL_LOCK(); NET_LOCK_SHARED(); if (sa6 != NULL) { @@ -518,7 +517,6 @@ in6_ioctl_get(u_long cmd, caddr_t data, struct ifnet *ifp) err: NET_UNLOCK_SHARED(); - KERNEL_UNLOCK(); return (error); } -- 2.20.1