diff options
author | Reyk Floeter <reyk@cvs.openbsd.org> | 2010-07-09 16:58:07 +0000 |
---|---|---|
committer | Reyk Floeter <reyk@cvs.openbsd.org> | 2010-07-09 16:58:07 +0000 |
commit | 9b4939a135e7439d02025abc3fae443f6b34a436 (patch) | |
tree | 4d6d474863598a533548ed438df229f82ffd9a59 /sys/net/route.c | |
parent | 74c8e65b12d50b84bca2cad414861a6a3de2ec89 (diff) |
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/net/route.c')
-rw-r--r-- | sys/net/route.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/sys/net/route.c b/sys/net/route.c index 07ae9d72d30..6f5541bcd55 100644 --- a/sys/net/route.c +++ b/sys/net/route.c @@ -1,4 +1,4 @@ -/* $OpenBSD: route.c,v 1.124 2010/07/09 15:44:20 claudio Exp $ */ +/* $OpenBSD: route.c,v 1.125 2010/07/09 16:58:06 reyk Exp $ */ /* $NetBSD: route.c,v 1.14 1996/02/13 22:00:46 christos Exp $ */ /* @@ -129,7 +129,7 @@ #include <netinet/ip_ipsp.h> #include <net/if_enc.h> -struct ifaddr *encap_findgwifa(struct sockaddr *); +struct ifaddr *encap_findgwifa(struct sockaddr *, u_int); #endif #define SA(p) ((struct sockaddr *)(p)) @@ -165,11 +165,11 @@ TAILQ_HEAD(rt_labels, rt_label) rt_labels = TAILQ_HEAD_INITIALIZER(rt_labels); #ifdef IPSEC struct ifaddr * -encap_findgwifa(struct sockaddr *gw) +encap_findgwifa(struct sockaddr *gw, u_int rdomain) { struct ifnet *encif; - if ((encif = enc_getif(0, 0)) == NULL) + if ((encif = enc_getif(rdomain, 0)) == NULL) return (NULL); return (TAILQ_FIRST(&encif->if_addrlist)); @@ -624,7 +624,7 @@ ifa_ifwithroute(int flags, struct sockaddr *dst, struct sockaddr *gateway, * enc0. */ if (dst && (dst->sa_family == PF_KEY)) - return (encap_findgwifa(gateway)); + return (encap_findgwifa(gateway, rtableid)); #endif if ((flags & RTF_GATEWAY) == 0) { |