From 232f2bf62812d84b0765ad5f23c8080d6a2f8284 Mon Sep 17 00:00:00 2001 From: deraadt Date: Fri, 7 Jan 2022 16:39:18 +0000 Subject: [PATCH] SIOCSIFXFLAGS drops into the SIOCSIFFLAGS to perform auto-up of the interface. If this operation fails (probably due to missing firmware), we must undo changes to the SIOCSIFXFLAGS xflags. ok stsp. --- sys/net/if.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sys/net/if.c b/sys/net/if.c index 3131fd00662..0bda92609c6 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if.c,v 1.646 2022/01/02 22:36:03 jsg Exp $ */ +/* $OpenBSD: if.c,v 1.647 2022/01/07 16:39:18 deraadt Exp $ */ /* $NetBSD: if.c,v 1.35 1996/05/07 05:26:04 thorpej Exp $ */ /* @@ -2030,7 +2030,6 @@ ifioctl(struct socket *so, u_long cmd, caddr_t data, struct proc *p) (!ISSET(oif_xflags, IFXF_AUTOCONF6TEMP) && ISSET(ifp->if_xflags, IFXF_AUTOCONF6TEMP)))) { ifr->ifr_flags = ifp->if_flags | IFF_UP; - cmd = SIOCSIFFLAGS; goto forceup; } @@ -2045,9 +2044,11 @@ ifioctl(struct socket *so, u_long cmd, caddr_t data, struct proc *p) forceup: ifp->if_flags = (ifp->if_flags & IFF_CANTCHANGE) | (ifr->ifr_flags & ~IFF_CANTCHANGE); - error = (*ifp->if_ioctl)(ifp, cmd, data); + error = (*ifp->if_ioctl)(ifp, SIOCSIFFLAGS, data); if (error != 0) { ifp->if_flags = oif_flags; + if (cmd == SIOCSIFXFLAGS) + ifp->if_xflags = oif_xflags; } else if (ISSET(oif_flags ^ ifp->if_flags, IFF_UP)) { s = splnet(); if (ISSET(ifp->if_flags, IFF_UP)) -- 2.20.1