diff options
author | Tobias Brunner <tobias@strongswan.org> | 2014-06-26 16:38:28 +0200 |
---|---|---|
committer | Tobias Brunner <tobias@strongswan.org> | 2014-06-26 18:13:17 +0200 |
commit | f22add05f6cccaae85eee4d99044d45f418b0989 (patch) | |
tree | 43468df86b4e1510eb5cf2dc9976fc0c6dd7a0a8 | |
parent | 60f5fb2318bde01128f190d2a5ce4ba787dba1ca (diff) | |
download | strongswan-f22add05f6cccaae85eee4d99044d45f418b0989.tar.bz2 strongswan-f22add05f6cccaae85eee4d99044d45f418b0989.tar.xz |
kernel-pfkey: Use address in TS to determine interface for shunt routes
-rw-r--r-- | src/libhydra/plugins/kernel_pfkey/kernel_pfkey_ipsec.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/libhydra/plugins/kernel_pfkey/kernel_pfkey_ipsec.c b/src/libhydra/plugins/kernel_pfkey/kernel_pfkey_ipsec.c index 5715476e1..e1a58aa94 100644 --- a/src/libhydra/plugins/kernel_pfkey/kernel_pfkey_ipsec.c +++ b/src/libhydra/plugins/kernel_pfkey/kernel_pfkey_ipsec.c @@ -2230,19 +2230,22 @@ static bool install_route(private_kernel_pfkey_ipsec_t *this, { route->gateway = hydra->kernel_interface->get_nexthop( hydra->kernel_interface, dst, -1, src); + + /* if the IP is virtual, we install the route over the interface it has + * been installed on. Otherwise we use the interface we use for IKE, as + * this is required for example on Linux. */ + if (is_virtual) + { + src = route->src_ip; + } } else { /* for shunt policies */ route->gateway = hydra->kernel_interface->get_nexthop( hydra->kernel_interface, policy->src.net, policy->src.mask, route->src_ip); - } - /* if the IP is virtual, we install the route over the interface it has - * been installed on. Otherwise we use the interface we use for IKE, as - * this is required for example on Linux. */ - if (is_virtual) - { + /* we don't have a source address, use the address we found */ src = route->src_ip; } |