aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/ipsec/ipsec_sa.c
diff options
context:
space:
mode:
authorNeale Ranns <nranns@cisco.com>2019-06-17 15:43:38 +0000
committerDamjan Marion <dmarion@me.com>2019-06-17 20:24:52 +0000
commit72f2a3acb797797416a96dc10312ccd431126de7 (patch)
treee712168ebaea12b09299ac74e53842663dfef5a2 /src/vnet/ipsec/ipsec_sa.c
parent2f0522008ca168e5fff5d754e2ca280ef9366d58 (diff)
ipsec: One DPO per SA
An SA can be used only for ESP or AH nver both, so it needs only one coresponding DPO. Type: refactor Change-Id: I689060f795ee352245a0eaed0890a6b234c63d71 Signed-off-by: Neale Ranns <nranns@cisco.com>
Diffstat (limited to 'src/vnet/ipsec/ipsec_sa.c')
-rw-r--r--src/vnet/ipsec/ipsec_sa.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/src/vnet/ipsec/ipsec_sa.c b/src/vnet/ipsec/ipsec_sa.c
index 633f640ced2..e8a015957ce 100644
--- a/src/vnet/ipsec/ipsec_sa.c
+++ b/src/vnet/ipsec/ipsec_sa.c
@@ -80,14 +80,14 @@ ipsec_sa_stack (ipsec_sa_t * sa)
fib_entry_contribute_forwarding (sa->fib_entry_index, fct, &tmp);
- dpo_stack_from_node ((ipsec_sa_is_set_IS_TUNNEL_V6 (sa) ?
- im->ah6_encrypt_node_index :
- im->ah4_encrypt_node_index),
- &sa->dpo[IPSEC_PROTOCOL_AH], &tmp);
- dpo_stack_from_node ((ipsec_sa_is_set_IS_TUNNEL_V6 (sa) ?
- im->esp6_encrypt_node_index :
- im->esp4_encrypt_node_index),
- &sa->dpo[IPSEC_PROTOCOL_ESP], &tmp);
+ if (IPSEC_PROTOCOL_AH == sa->protocol)
+ dpo_stack_from_node ((ipsec_sa_is_set_IS_TUNNEL_V6 (sa) ?
+ im->ah6_encrypt_node_index :
+ im->ah4_encrypt_node_index), &sa->dpo, &tmp);
+ else
+ dpo_stack_from_node ((ipsec_sa_is_set_IS_TUNNEL_V6 (sa) ?
+ im->esp6_encrypt_node_index :
+ im->esp4_encrypt_node_index), &sa->dpo, &tmp);
dpo_reset (&tmp);
}
@@ -305,8 +305,7 @@ ipsec_sa_del (u32 id)
fib_table_entry_special_remove
(sa->tx_fib_index,
fib_entry_get_prefix (sa->fib_entry_index), FIB_SOURCE_RR);
- dpo_reset (&sa->dpo[IPSEC_PROTOCOL_AH]);
- dpo_reset (&sa->dpo[IPSEC_PROTOCOL_ESP]);
+ dpo_reset (&sa->dpo);
}
vnet_crypto_key_del (vm, sa->crypto_key_index);
vnet_crypto_key_del (vm, sa->integ_key_index);