ipsec: Reference count the SAs
[vpp.git] / src / vnet / ipsec / ipsec_cli.c
index 60b9244..a5972bb 100644 (file)
@@ -144,12 +144,12 @@ ipsec_sa_add_del_command_fn (vlib_main_t * vm,
     }
 
   if (is_add)
-    rv = ipsec_sa_add (id, spi, proto, crypto_alg,
-                      &ck, integ_alg, &ik, flags,
-                      0, clib_host_to_net_u32 (salt),
-                      &tun_src, &tun_dst, NULL);
+    rv = ipsec_sa_add_and_lock (id, spi, proto, crypto_alg,
+                               &ck, integ_alg, &ik, flags,
+                               0, clib_host_to_net_u32 (salt),
+                               &tun_src, &tun_dst, NULL);
   else
-    rv = ipsec_sa_del (id);
+    rv = ipsec_sa_unlock_id (id);
 
   if (rv)
     error = clib_error_return (0, "failed");