diff options
author | sephe <sephe@FreeBSD.org> | 2017-02-21 03:00:33 +0000 |
---|---|---|
committer | sephe <sephe@FreeBSD.org> | 2017-02-21 03:00:33 +0000 |
commit | acfbfe5d08cd0049c7056edd0f606472e4bd9ea2 (patch) | |
tree | 3e3999954be320bdc76a1a4aefc6c0224acd97d8 | |
parent | 27565b0dff704c7701306aed25cc01aff9fcdcbc (diff) | |
download | FreeBSD-src-acfbfe5d08cd0049c7056edd0f606472e4bd9ea2.zip FreeBSD-src-acfbfe5d08cd0049c7056edd0f606472e4bd9ea2.tar.gz |
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
-rw-r--r-- | sys/net/if.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/sys/net/if.c b/sys/net/if.c index 881cd60..67f086b 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -2266,7 +2266,7 @@ ifhwioctl(u_long cmd, struct ifnet *ifp, caddr_t data, struct thread *td) { 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, caddr_t data, struct thread *td) 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, caddr_t data, struct thread *td) if (ifp->if_ioctl) { (void) (*ifp->if_ioctl)(ifp, cmd, data); } + if (do_ifup) + if_up(ifp); getmicrotime(&ifp->if_lastchange); break; |