From owner-svn-src-stable-11@freebsd.org Tue Feb 21 02:10:03 2017 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 88F3BCE766E; Tue, 21 Feb 2017 02:10:03 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 57F9017D6; Tue, 21 Feb 2017 02:10:03 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v1L2A2MY007589; Tue, 21 Feb 2017 02:10:02 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v1L2A2RI007588; Tue, 21 Feb 2017 02:10:02 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201702210210.v1L2A2RI007588@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Tue, 21 Feb 2017 02:10:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r314002 - stable/11/sys/net X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Feb 2017 02:10:03 -0000 Author: sephe Date: Tue Feb 21 02:10:02 2017 New Revision: 314002 URL: https://svnweb.freebsd.org/changeset/base/314002 Log: MFC 311475 if: Defer the if_up until the ifnet.if_ioctl is called. This ensures the interface is initialized by the interface driver before it can be used by the rest of the system. Reviewed by: jhb, karels, gnn Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8905 Modified: stable/11/sys/net/if.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/net/if.c ============================================================================== --- stable/11/sys/net/if.c Tue Feb 21 01:11:18 2017 (r314001) +++ stable/11/sys/net/if.c Tue Feb 21 02:10:02 2017 (r314002) @@ -2300,7 +2300,7 @@ static int ifhwioctl(u_long cmd, struct ifnet *ifp, caddr_t data, struct thread *td) { struct ifreq *ifr; - int error = 0; + int error = 0, do_ifup = 0; int new_flags, temp_flags; size_t namelen, onamelen; size_t descrlen; @@ -2427,7 +2427,7 @@ ifhwioctl(u_long cmd, struct ifnet *ifp, if_down(ifp); } else if (new_flags & IFF_UP && (ifp->if_flags & IFF_UP) == 0) { - if_up(ifp); + do_ifup = 1; } /* See if permanently promiscuous mode bit is about to flip */ if ((ifp->if_flags ^ new_flags) & IFF_PPROMISC) { @@ -2446,6 +2446,8 @@ ifhwioctl(u_long cmd, struct ifnet *ifp, if (ifp->if_ioctl) { (void) (*ifp->if_ioctl)(ifp, cmd, data); } + if (do_ifup) + if_up(ifp); getmicrotime(&ifp->if_lastchange); break;