diff options
author | 2010-07-09 16:58:06 +0000 | |
---|---|---|
committer | 2010-07-09 16:58:06 +0000 | |
commit | 05d65ec4bc6b2a183ce998415c6c4d3200280c4d (patch) | |
tree | cd947dd68c165f3a4182b79e1670a2b74a482bfb /sys/netinet/ip_output.c | |
parent | Add the rtableid to struct rttimer and therefor make it available to (diff) | |
download | wireguard-openbsd-05d65ec4bc6b2a183ce998415c6c4d3200280c4d.tar.xz wireguard-openbsd-05d65ec4bc6b2a183ce998415c6c4d3200280c4d.zip |
Add support for using IPsec in multiple rdomains.
This allows to run isakmpd/iked/ipsecctl in multiple rdomains
independently (with "route exec"); the kernel will pickup the rdomain
from the process context of the pfkey socket and load the flows and
SAs into the matching rdomain encap routing table. The network stack
also needs to pass the rdomain to the ipsec stack to lookup the
correct rdomain that belongs to an interface/mbuf/... You can now run
individual IPsec configs per rdomain or create IPsec VPNs between
multiple rdomains on the same machine ;). Note that a primary enc(4)
in addition to enc0 interface is required per rdomain, eg. enc1 rdomain 1.
Test by some people, mostly on existing "rdomain 0" setups. Was in
snaps for some days and people didn't complain.
ok claudio@ naddy@
Diffstat (limited to 'sys/netinet/ip_output.c')
-rw-r--r-- | sys/netinet/ip_output.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/sys/netinet/ip_output.c b/sys/netinet/ip_output.c index 8dca59f9b4d..63a1cb2a020 100644 --- a/sys/netinet/ip_output.c +++ b/sys/netinet/ip_output.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_output.c,v 1.209 2010/07/03 04:44:51 guenther Exp $ */ +/* $OpenBSD: ip_output.c,v 1.210 2010/07/09 16:58:06 reyk Exp $ */ /* $NetBSD: ip_output.c,v 1.28 1996/02/13 23:43:07 christos Exp $ */ /* @@ -272,7 +272,8 @@ reroute: mtag->m_tag_len, sizeof (struct tdb_ident)); #endif tdbi = (struct tdb_ident *)(mtag + 1); - tdb = gettdb(tdbi->spi, &tdbi->dst, tdbi->proto); + tdb = gettdb(tdbi->rdomain, + tdbi->spi, &tdbi->dst, tdbi->proto); if (tdb == NULL) error = -EINVAL; m_tag_delete(m, mtag); @@ -315,6 +316,7 @@ reroute: tdbi = (struct tdb_ident *)(mtag + 1); if (tdbi->spi == tdb->tdb_spi && tdbi->proto == tdb->tdb_sproto && + tdbi->rdomain == tdb->tdb_rdomain && !bcmp(&tdbi->dst, &tdb->tdb_dst, sizeof(union sockaddr_union))) { splx(s); @@ -586,7 +588,8 @@ sendit: if (sproto != 0) { s = splnet(); - tdb = gettdb(sspi, &sdst, sproto); + tdb = gettdb(rtable_l2(m->m_pkthdr.rdomain), + sspi, &sdst, sproto); if (tdb == NULL) { DPRINTF(("ip_output: unknown TDB")); error = EHOSTUNREACH; @@ -599,7 +602,8 @@ sendit: * Packet filter */ #if NPF > 0 - if ((encif = enc_getif(0, tdb->tdb_tap)) == NULL || + if ((encif = enc_getif(tdb->tdb_rdomain, + tdb->tdb_tap)) == NULL || pf_test(PF_OUT, encif, &m, NULL) != PF_PASS) { error = EHOSTUNREACH; splx(s); |