diff options
author | Tobias Brunner <tobias@strongswan.org> | 2016-04-01 16:41:05 +0200 |
---|---|---|
committer | Andreas Steffen <andreas.steffen@strongswan.org> | 2016-04-09 16:51:00 +0200 |
commit | 9c12635252080af3fad7d4d8e02813d479b6ffdf (patch) | |
tree | 17fa63341f6c7a55ada10cd5f2ae59669ccdb0b4 /src | |
parent | c4387e991ac1efb7cd0293ebc57b8372046cf944 (diff) | |
download | strongswan-9c12635252080af3fad7d4d8e02813d479b6ffdf.tar.bz2 strongswan-9c12635252080af3fad7d4d8e02813d479b6ffdf.tar.xz |
child-sa: Install "outbound" FWD policy
If there is a DROP shunt that matches outbound forwarded traffic it
would get dropped as the FWD policy we install only matches decrypted
inbound traffic. That's because the Linux kernel first checks the FWD
policies before looking up the OUT policy and SA to encrypt the packets.
Diffstat (limited to 'src')
-rw-r--r-- | src/libcharon/sa/child_sa.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/libcharon/sa/child_sa.c b/src/libcharon/sa/child_sa.c index 9c1808b95..05d42ba1d 100644 --- a/src/libcharon/sa/child_sa.c +++ b/src/libcharon/sa/child_sa.c @@ -915,6 +915,17 @@ static status_t install_policies_internal(private_child_sa_t *this, { in_id.dir = POLICY_FWD; status |= charon->kernel->add_policy(charon->kernel, &in_id, &in_policy); + + /* install an "outbound" FWD policy in case there is a drop policy + * matching outbound forwarded traffic, to allow another tunnel to use + * the reversed subnets and do the same we don't set a reqid (this also + * allows the kernel backend to distinguish between the two types of + * FWD policies) */ + out_id.dir = POLICY_FWD; + other_sa->reqid = 0; + status |= charon->kernel->add_policy(charon->kernel, &out_id, &out_policy); + /* reset the reqid for any other further policies */ + other_sa->reqid = this->reqid; } return status; } @@ -958,6 +969,11 @@ static void del_policies_internal(private_child_sa_t *this, { in_id.dir = POLICY_FWD; charon->kernel->del_policy(charon->kernel, &in_id, &in_policy); + + out_id.dir = POLICY_FWD; + other_sa->reqid = 0; + charon->kernel->del_policy(charon->kernel, &out_id, &out_policy); + other_sa->reqid = this->reqid; } } |