Author: sephe
Date: Tue Feb 21 03:00:33 2017
New Revision: 314017
URL: https://svnweb.freebsd.org/changeset/base/314017

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/10/sys/net/if.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/net/if.c
==============================================================================
--- stable/10/sys/net/if.c      Tue Feb 21 02:38:14 2017        (r314016)
+++ stable/10/sys/net/if.c      Tue Feb 21 03:00:33 2017        (r314017)
@@ -2266,7 +2266,7 @@ ifhwioctl(u_long cmd, struct ifnet *ifp,
 {
        struct ifreq *ifr;
        struct ifstat *ifs;
-       int error = 0;
+       int error = 0, do_ifup = 0;
        int new_flags, temp_flags;
        size_t namelen, onamelen;
        size_t descrlen;
@@ -2394,7 +2394,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) {
@@ -2413,6 +2413,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;
 
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to