dpdk: ipsec tunnel support for ip6-in-ip4
[vpp.git] / src / plugins / dpdk / ipsec / esp_decrypt.c
index 47aff17..afbab96 100644 (file)
@@ -168,6 +168,7 @@ dpdk_esp_decrypt_inline (vlib_main_t * vm,
          dpdk_op_priv_t *priv = crypto_op_get_priv (op);
          /* store bi in op private */
          priv->bi = bi0;
+         priv->encrypt = 0;
 
          u16 op_len =
            sizeof (op[0]) + sizeof (op[0].sym[0]) + sizeof (priv[0]);
@@ -234,7 +235,8 @@ dpdk_esp_decrypt_inline (vlib_main_t * vm,
            }
 
          /* anti-replay check */
-         if (ipsec_sa_anti_replay_check (sa0, &esp0->seq))
+         if (ipsec_sa_anti_replay_check
+             (sa0, clib_host_to_net_u32 (esp0->seq)))
            {
              clib_warning ("failed anti-replay check");
              if (is_ip6)
@@ -372,7 +374,7 @@ dpdk_esp_decrypt_inline (vlib_main_t * vm,
                                   from_frame->n_vectors);
 
       crypto_enqueue_ops (vm, cwm, dpdk_esp6_decrypt_node.index,
-                         ESP_DECRYPT_ERROR_ENQ_FAIL, numa);
+                         ESP_DECRYPT_ERROR_ENQ_FAIL, numa, 0 /* encrypt */ );
     }
   else
     {
@@ -381,7 +383,7 @@ dpdk_esp_decrypt_inline (vlib_main_t * vm,
                                   from_frame->n_vectors);
 
       crypto_enqueue_ops (vm, cwm, dpdk_esp4_decrypt_node.index,
-                         ESP_DECRYPT_ERROR_ENQ_FAIL, numa);
+                         ESP_DECRYPT_ERROR_ENQ_FAIL, numa, 0 /* encrypt */ );
     }
 
   crypto_free_ops (numa, ops, cwm->ops + from_frame->n_vectors - ops);
@@ -548,7 +550,8 @@ dpdk_esp_decrypt_post_inline (vlib_main_t * vm,
 
          iv_size = cipher_alg->iv_len;
 
-         ipsec_sa_anti_replay_advance (sa0, &esp0->seq);
+         ipsec_sa_anti_replay_advance (sa0,
+                                       clib_host_to_net_u32 (esp0->seq));
 
          /* if UDP encapsulation is used adjust the address of the IP header */
          if (ipsec_sa_is_set_UDP_ENCAP (sa0)
@@ -584,8 +587,7 @@ dpdk_esp_decrypt_post_inline (vlib_main_t * vm,
            {
              if (f0->next_header == IP_PROTOCOL_IP_IN_IP)
                next0 = ESP_DECRYPT_NEXT_IP4_INPUT;
-             else if (ipsec_sa_is_set_IS_TUNNEL_V6 (sa0)
-                      && f0->next_header == IP_PROTOCOL_IPV6)
+             else if (f0->next_header == IP_PROTOCOL_IPV6)
                next0 = ESP_DECRYPT_NEXT_IP6_INPUT;
              else
                {