API refactoring : ipsec-gre
[vpp.git] / vnet / vnet / ipsec-gre / ipsec_gre.c
index 24ec6f4..a0b065a 100644 (file)
@@ -13,7 +13,7 @@
  * limitations under the License.
  */
 /**
- * @file ipsec_gre.c
+ * @file
  * @brief L2-GRE over IPSec packet processing.
  *
  * Add GRE header to thr packet and send it to the esp-encrypt node.
 
 ipsec_gre_main_t ipsec_gre_main;
 
-/**
- * @brief IPv4 and GRE header.
- *
-*/
-/* *INDENT-OFF* */
-typedef CLIB_PACKED (struct
-{
-  ip4_header_t ip4;
-  gre_header_t gre;
-}) ip4_and_gre_header_t;
-/* *INDENT-OFF* */
-
 /**
  * @brief IPv4 and GRE header union.
  *
@@ -218,8 +206,13 @@ ipsec_gre_interface_tx (vlib_main_t * vm,
          ip0->checksum = ip4_header_checksum (ip0);
          ip1->checksum = ip4_header_checksum (ip1);
 
-         vnet_buffer (b0)->output_features.ipsec_sad_index = t->local_sa;
-         vnet_buffer (b1)->output_features.ipsec_sad_index = t->local_sa;
+         vnet_buffer (b0)->sw_if_index[VLIB_RX] =
+           vnet_buffer (b0)->sw_if_index[VLIB_TX];
+         vnet_buffer (b1)->sw_if_index[VLIB_RX] =
+           vnet_buffer (b1)->sw_if_index[VLIB_TX];
+
+         vnet_buffer (b0)->ipsec.sad_index = t->local_sa;
+         vnet_buffer (b1)->ipsec.sad_index = t->local_sa;
 
          vnet_buffer (b0)->sw_if_index[VLIB_TX] = (u32) ~ 0;
          vnet_buffer (b1)->sw_if_index[VLIB_TX] = (u32) ~ 0;
@@ -293,7 +286,9 @@ ipsec_gre_interface_tx (vlib_main_t * vm,
          ip0->dst_address.as_u32 = t->tunnel_dst.as_u32;
          ip0->checksum = ip4_header_checksum (ip0);
 
-         vnet_buffer (b0)->output_features.ipsec_sad_index = t->local_sa;
+         vnet_buffer (b0)->sw_if_index[VLIB_RX] =
+           vnet_buffer (b0)->sw_if_index[VLIB_TX];
+         vnet_buffer (b0)->ipsec.sad_index = t->local_sa;
          vnet_buffer (b0)->sw_if_index[VLIB_TX] = (u32) ~ 0;
 
          next0 = IPSEC_GRE_OUTPUT_NEXT_ESP_ENCRYPT;