On Wed, Nov 23, 2022 at 08:46:41AM +0000, Klemens Nanni wrote:
> Mechanical move that "unlocks" the errno(2) cases.
>
> This is another step towards more read-only interface ioctls running
> with the shared net lock alone.
>
> Feedback? OK?
>
Could this be merged with the following non "Mechanical move" diff?
> diff --git a/sys/netinet6/in6.c b/sys/netinet6/in6.c
> index 3fe9386f8af..47a381a1065 100644
> --- a/sys/netinet6/in6.c
> +++ b/sys/netinet6/in6.c
> @@ -213,9 +213,7 @@ in6_control(struct socket *so, u_long cmd, caddr_t data,
> struct ifnet *ifp)
> break;
> #endif /* MROUTING */
> default:
> - KERNEL_LOCK();
> error = in6_ioctl(cmd, data, ifp, privileged);
> - KERNEL_UNLOCK();
> break;
> }
>
> @@ -225,23 +223,34 @@ in6_control(struct socket *so, u_long cmd, caddr_t
> data, struct ifnet *ifp)
> int
> in6_ioctl(u_long cmd, caddr_t data, struct ifnet *ifp, int privileged)
> {
> + int error;
> +
> if (ifp == NULL)
> return (ENXIO);
>
> switch (cmd) {
> case SIOCGIFINFO_IN6:
> case SIOCGNBRINFO_IN6:
> - return (nd6_ioctl(cmd, data, ifp));
> + KERNEL_LOCK();
> + error = nd6_ioctl(cmd, data, ifp);
> + KERNEL_UNLOCK();
> + return (error);
> case SIOCGIFDSTADDR_IN6:
> case SIOCGIFNETMASK_IN6:
> case SIOCGIFAFLAG_IN6:
> case SIOCGIFALIFETIME_IN6:
> - return (in6_ioctl_get(cmd, data, ifp));
> + KERNEL_LOCK();
> + error = in6_ioctl_get(cmd, data, ifp);
> + KERNEL_UNLOCK();
> + return (error);
> case SIOCAIFADDR_IN6:
> case SIOCDIFADDR_IN6:
> if (!privileged)
> return (EPERM);
> - return (in6_ioctl_change_ifaddr(cmd, data, ifp));
> + KERNEL_LOCK();
> + error = in6_ioctl_change_ifaddr(cmd, data, ifp);
> + KERNEL_UNLOCK();
> + return (error);
> case SIOCSIFADDR:
> case SIOCSIFDSTADDR:
> case SIOCSIFBRDADDR:
>