diff options
Diffstat (limited to 'sys/net')
-rw-r--r-- | sys/net/if.c | 7 | ||||
-rw-r--r-- | sys/net/if_loop.c | 15 |
2 files changed, 19 insertions, 3 deletions
diff --git a/sys/net/if.c b/sys/net/if.c index 1557cae6cca..e450decf5ed 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if.c,v 1.541 2018/02/09 09:35:03 dlg Exp $ */ +/* $OpenBSD: if.c,v 1.542 2018/02/10 05:32:21 claudio Exp $ */ /* $NetBSD: if.c,v 1.35 1996/05/07 05:26:04 thorpej Exp $ */ /* @@ -1550,8 +1550,10 @@ if_up(struct ifnet *ifp) #ifdef INET6 /* Userland expects the kernel to set ::1 on default lo(4). */ - if (ifp->if_index == rtable_loindex(ifp->if_rdomain)) + if (ifp->if_index == rtable_loindex(ifp->if_rdomain)) { in6_ifattach(ifp); + in_up_loopback(ifp); + } #endif if_linkstate(ifp); @@ -1744,6 +1746,7 @@ if_setrdomain(struct ifnet *ifp, int rdomain) } loifp->if_rdomain = rdomain; + if_up(loifp); } /* make sure that the routing table is a real rdomain */ diff --git a/sys/net/if_loop.c b/sys/net/if_loop.c index 5ff594ef091..9cc46c6b700 100644 --- a/sys/net/if_loop.c +++ b/sys/net/if_loop.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_loop.c,v 1.85 2018/01/09 15:24:24 bluhm Exp $ */ +/* $OpenBSD: if_loop.c,v 1.86 2018/02/10 05:32:21 claudio Exp $ */ /* $NetBSD: if_loop.c,v 1.15 1996/05/07 02:40:33 thorpej Exp $ */ /* @@ -142,6 +142,7 @@ int loioctl(struct ifnet *, u_long, caddr_t); void loopattach(int); +void loop_delayed_create(void *); void lortrequest(struct ifnet *, int, struct rtentry *); int loinput(struct ifnet *, struct mbuf *, void *); int looutput(struct ifnet *, @@ -162,9 +163,19 @@ loopattach(int n) if_clone_attach(&loop_cloner); } +void +loop_delayed_create(void *arg) +{ + struct ifnet *ifp = arg; + NET_LOCK(); + if_up(ifp); + NET_UNLOCK(); +} + int loop_clone_create(struct if_clone *ifc, int unit) { + static struct task lot; struct ifnet *ifp; ifp = malloc(sizeof(*ifp), M_DEVBUF, M_WAITOK|M_ZERO); @@ -182,6 +193,8 @@ loop_clone_create(struct if_clone *ifc, int unit) if_attachhead(ifp); if_addgroup(ifp, ifc->ifc_name); rtable_l2set(0, 0, ifp->if_index); + task_set(&lot, loop_delayed_create, ifp); + task_add(systq, &lot); } else if_attach(ifp); if_alloc_sadl(ifp); |