summaryrefslogtreecommitdiffstats
path: root/sys/net/if_loop.c
diff options
context:
space:
mode:
authorclaudio <claudio@openbsd.org>2018-02-10 05:32:21 +0000
committerclaudio <claudio@openbsd.org>2018-02-10 05:32:21 +0000
commitd62081b6dd05a67ee176092f85ee96e83eb74a19 (patch)
treebd440ed013a8669b781bbb2ec79eba37b019fb08 /sys/net/if_loop.c
parentSyncronize filesystems to disk when suspending. Each mountpoint's vnodes (diff)
downloadwireguard-openbsd-d62081b6dd05a67ee176092f85ee96e83eb74a19.tar.xz
wireguard-openbsd-d62081b6dd05a67ee176092f85ee96e83eb74a19.zip
Similar to the IPv6 case create 127.0.0.1/8 on lo(4) interfaces which act
as loopback interfaces for each rdomain (including lo0). This is done when the interface is brought up. This is now also done by default (either on attach of lo0 or when creating the rdomain). OK mpi@
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);