summaryrefslogtreecommitdiffstats
path: root/sys/kern/init_main.c
diff options
context:
space:
mode:
authormpi <mpi@openbsd.org>2016-11-14 10:32:46 +0000
committermpi <mpi@openbsd.org>2016-11-14 10:32:46 +0000
commit3a63dfc0a7570a1d3db367d368db7715b946fa77 (patch)
tree113a26f127ac2afe7bdff22e99b2a3e01b8b7259 /sys/kern/init_main.c
parentspecify ordering and precedence of location { } sections; (diff)
downloadwireguard-openbsd-3a63dfc0a7570a1d3db367d368db7715b946fa77.tar.xz
wireguard-openbsd-3a63dfc0a7570a1d3db367d368db7715b946fa77.zip
Automatically create a default lo(4) interface per rdomain.
In order to stop abusing lo0 for all rdomains, a new loopback interface will be created every time a rdomain is created. The unit number will be the same as the rdomain, i.e. lo1 will be attached to rdomain 1. If this loopback interface is already in use it wont be possible to create the corresponding rdomain. In order to know which lo(4) interface is attached to a rdomain, its index is stored in the rtable/rdomain map. This is a long overdue since the introduction of rtable/rdomain. It also fixes a recent regression due to resetting the rdomain of an incoming packet reported by semarie@, Andreas Bartelt and Nils Frohberg. ok claudio@
Diffstat (limited to 'sys/kern/init_main.c')
-rw-r--r--sys/kern/init_main.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/sys/kern/init_main.c b/sys/kern/init_main.c
index 47408b45081..f90fc05373c 100644
--- a/sys/kern/init_main.c
+++ b/sys/kern/init_main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: init_main.c,v 1.262 2016/11/07 00:26:32 guenther Exp $ */
+/* $OpenBSD: init_main.c,v 1.263 2016/11/14 10:32:46 mpi Exp $ */
/* $NetBSD: init_main.c,v 1.84.4.1 1996/06/02 09:08:06 mrg Exp $ */
/*
@@ -389,6 +389,9 @@ main(void *framep)
msginit();
#endif
+ /* Create default routing table before attaching lo0. */
+ rtable_init();
+
/* Attach pseudo-devices. */
for (pdev = pdevinit; pdev->pdev_attach != NULL; pdev++)
if (pdev->pdev_count > 0)
@@ -399,8 +402,6 @@ main(void *framep)
swcr_init();
#endif /* CRYPTO */
- rtable_init();
-
/*
* Initialize protocols. Block reception of incoming packets
* until everything is ready.