Rather than having the if_vmove() code intermixed in the vnet_destroy()
function in vnet.c move it to if.c where it logically belongs and put it under a VNET_SYSUNINIT() call. To not change the current behaviour make sure it runs first thing during teardown. In the future this will allow us more flexibility on changing the order on when we want to get rid of interfaces. Stop exporting if_vmove() and make it file static. Reviewed by: gnn Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D6438
This commit is contained in:
parent
15edb840eb
commit
47d341d05f
17
sys/net/if.c
17
sys/net/if.c
@ -182,6 +182,9 @@ static int if_getgroupmembers(struct ifgroupreq *);
|
||||
static void if_delgroups(struct ifnet *);
|
||||
static void if_attach_internal(struct ifnet *, int, struct if_clone *);
|
||||
static int if_detach_internal(struct ifnet *, int, struct if_clone **);
|
||||
#ifdef VIMAGE
|
||||
static void if_vmove(struct ifnet *, struct vnet *);
|
||||
#endif
|
||||
|
||||
#ifdef INET6
|
||||
/*
|
||||
@ -392,6 +395,20 @@ vnet_if_uninit(const void *unused __unused)
|
||||
}
|
||||
VNET_SYSUNINIT(vnet_if_uninit, SI_SUB_INIT_IF, SI_ORDER_FIRST,
|
||||
vnet_if_uninit, NULL);
|
||||
|
||||
static void
|
||||
vnet_if_return(const void *unused __unused)
|
||||
{
|
||||
struct ifnet *ifp, *nifp;
|
||||
|
||||
/* Return all inherited interfaces to their parent vnets. */
|
||||
TAILQ_FOREACH_SAFE(ifp, &V_ifnet, if_link, nifp) {
|
||||
if (ifp->if_home_vnet != ifp->if_vnet)
|
||||
if_vmove(ifp, ifp->if_home_vnet);
|
||||
}
|
||||
}
|
||||
VNET_SYSUNINIT(vnet_if_return, SI_SUB_VNET_DONE, SI_ORDER_ANY,
|
||||
vnet_if_return, NULL);
|
||||
#endif
|
||||
|
||||
static void
|
||||
|
@ -535,7 +535,6 @@ void if_dead(struct ifnet *);
|
||||
int if_delmulti(struct ifnet *, struct sockaddr *);
|
||||
void if_delmulti_ifma(struct ifmultiaddr *);
|
||||
void if_detach(struct ifnet *);
|
||||
void if_vmove(struct ifnet *, struct vnet *);
|
||||
void if_purgeaddrs(struct ifnet *);
|
||||
void if_delallmulti(struct ifnet *);
|
||||
void if_down(struct ifnet *);
|
||||
|
@ -269,7 +269,6 @@ vnet_alloc(void)
|
||||
void
|
||||
vnet_destroy(struct vnet *vnet)
|
||||
{
|
||||
struct ifnet *ifp, *nifp;
|
||||
|
||||
SDT_PROBE2(vnet, functions, vnet_destroy, entry, __LINE__, vnet);
|
||||
KASSERT(vnet->vnet_sockcnt == 0,
|
||||
@ -280,13 +279,6 @@ vnet_destroy(struct vnet *vnet)
|
||||
VNET_LIST_WUNLOCK();
|
||||
|
||||
CURVNET_SET_QUIET(vnet);
|
||||
|
||||
/* Return all inherited interfaces to their parent vnets. */
|
||||
TAILQ_FOREACH_SAFE(ifp, &V_ifnet, if_link, nifp) {
|
||||
if (ifp->if_home_vnet != ifp->if_vnet)
|
||||
if_vmove(ifp, ifp->if_home_vnet);
|
||||
}
|
||||
|
||||
vnet_sysuninit();
|
||||
CURVNET_RESTORE();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user