summaryrefslogtreecommitdiffstats
path: root/sys/net/if_loop.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/net/if_loop.c')
-rw-r--r--sys/net/if_loop.c15
1 files changed, 14 insertions, 1 deletions
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);