tunnel: Common types for IP tunnels
[vpp.git] / src / vnet / ipip / ipip.c
index d68e815..05460fb 100644 (file)
@@ -75,9 +75,9 @@ ipip_build_rewrite (vnet_main_t * vnm, u32 sw_if_index,
       ip4->src_address.as_u32 = t->tunnel_src.ip4.as_u32;
       ip4->dst_address.as_u32 = t->tunnel_dst.ip4.as_u32;
       ip4->checksum = ip4_header_checksum (ip4);
-      if (!(t->flags & IPIP_TUNNEL_FLAG_ENCAP_COPY_DSCP))
+      if (!(t->flags & TUNNEL_ENCAP_DECAP_FLAG_ENCAP_COPY_DSCP))
        ip4_header_set_dscp (ip4, t->dscp);
-      if (t->flags & IPIP_TUNNEL_FLAG_ENCAP_SET_DF)
+      if (t->flags & TUNNEL_ENCAP_DECAP_FLAG_ENCAP_SET_DF)
        ip4_header_set_df (ip4);
       break;
 
@@ -92,7 +92,7 @@ ipip_build_rewrite (vnet_main_t * vnm, u32 sw_if_index,
       ip6->src_address.as_u64[1] = t->tunnel_src.ip6.as_u64[1];
       ip6->dst_address.as_u64[0] = t->tunnel_dst.ip6.as_u64[0];
       ip6->dst_address.as_u64[1] = t->tunnel_dst.ip6.as_u64[1];
-      if (!(t->flags & IPIP_TUNNEL_FLAG_ENCAP_COPY_DSCP))
+      if (!(t->flags & TUNNEL_ENCAP_DECAP_FLAG_ENCAP_COPY_DSCP))
        ip6_set_dscp_network_order (ip6, t->dscp);
       break;
 
@@ -116,11 +116,11 @@ ipip4_fixup (vlib_main_t * vm, const ip_adjacency_t * adj, vlib_buffer_t * b,
     {
     case VNET_LINK_IP6:
       ip4->protocol = IP_PROTOCOL_IPV6;
-      if (t->flags & IPIP_TUNNEL_FLAG_ENCAP_COPY_DSCP)
+      if (t->flags & TUNNEL_ENCAP_DECAP_FLAG_ENCAP_COPY_DSCP)
        ip4_header_set_dscp (ip4,
                             ip6_dscp_network_order ((ip6_header_t *) (ip4 +
                                                                       1)));
-      if (t->flags & IPIP_TUNNEL_FLAG_ENCAP_COPY_ECN)
+      if (t->flags & TUNNEL_ENCAP_DECAP_FLAG_ENCAP_COPY_ECN)
        ip4_header_set_ecn (ip4,
                            ip6_ecn_network_order ((ip6_header_t *) (ip4 +
                                                                     1)));
@@ -128,11 +128,11 @@ ipip4_fixup (vlib_main_t * vm, const ip_adjacency_t * adj, vlib_buffer_t * b,
 
     case VNET_LINK_IP4:
       ip4->protocol = IP_PROTOCOL_IP_IN_IP;
-      if (t->flags & IPIP_TUNNEL_FLAG_ENCAP_COPY_DSCP)
+      if (t->flags & TUNNEL_ENCAP_DECAP_FLAG_ENCAP_COPY_DSCP)
        ip4_header_set_dscp (ip4, ip4_header_get_dscp (ip4 + 1));
-      if (t->flags & IPIP_TUNNEL_FLAG_ENCAP_COPY_ECN)
+      if (t->flags & TUNNEL_ENCAP_DECAP_FLAG_ENCAP_COPY_ECN)
        ip4_header_set_ecn (ip4, ip4_header_get_ecn (ip4 + 1));
-      if ((t->flags & IPIP_TUNNEL_FLAG_ENCAP_COPY_DF) &&
+      if ((t->flags & TUNNEL_ENCAP_DECAP_FLAG_ENCAP_COPY_DF) &&
          ip4_header_get_df (ip4 + 1))
        ip4_header_set_df (ip4);
       break;
@@ -163,18 +163,18 @@ ipip6_fixup (vlib_main_t * vm, const ip_adjacency_t * adj, vlib_buffer_t * b,
     {
     case VNET_LINK_IP6:
       ip6->protocol = IP_PROTOCOL_IPV6;
-      if (t->flags & IPIP_TUNNEL_FLAG_ENCAP_COPY_DSCP)
+      if (t->flags & TUNNEL_ENCAP_DECAP_FLAG_ENCAP_COPY_DSCP)
        ip6_set_dscp_network_order (ip6, ip6_dscp_network_order (ip6 + 1));
-      if (t->flags & IPIP_TUNNEL_FLAG_ENCAP_COPY_ECN)
+      if (t->flags & TUNNEL_ENCAP_DECAP_FLAG_ENCAP_COPY_ECN)
        ip6_set_ecn_network_order (ip6, ip6_ecn_network_order (ip6 + 1));
       break;
 
     case VNET_LINK_IP4:
       ip6->protocol = IP_PROTOCOL_IP_IN_IP;
-      if (t->flags & IPIP_TUNNEL_FLAG_ENCAP_COPY_DSCP)
+      if (t->flags & TUNNEL_ENCAP_DECAP_FLAG_ENCAP_COPY_DSCP)
        ip6_set_dscp_network_order
          (ip6, ip4_header_get_dscp ((ip4_header_t *) (ip6 + 1)));
-      if (t->flags & IPIP_TUNNEL_FLAG_ENCAP_COPY_ECN)
+      if (t->flags & TUNNEL_ENCAP_DECAP_FLAG_ENCAP_COPY_ECN)
        ip6_set_ecn_network_order
          (ip6, ip4_header_get_ecn ((ip4_header_t *) (ip6 + 1)));
       break;
@@ -265,20 +265,6 @@ ipip_update_adj (vnet_main_t * vnm, u32 sw_if_index, adj_index_t ai)
   ipip_tunnel_stack (ai);
 }
 
-u8 *
-format_ipip_tunnel_flags (u8 * s, va_list * args)
-{
-  ipip_tunnel_flags_t f = va_arg (*args, int);
-
-  if (f == IPIP_TUNNEL_FLAG_NONE)
-    return (format (s, "none"));
-
-#define _(a,b,c) if (f & IPIP_TUNNEL_FLAG_##a) s = format(s, "%s ", b);
-  forech_ipip_tunnel_flag
-#undef _
-    return (s);
-}
-
 static u8 *
 format_ipip_tunnel_name (u8 * s, va_list * args)
 {
@@ -413,7 +399,7 @@ ipip_tunnel_db_remove (ipip_tunnel_t * t)
 int
 ipip_add_tunnel (ipip_transport_t transport,
                 u32 instance, ip46_address_t * src, ip46_address_t * dst,
-                u32 fib_index, ipip_tunnel_flags_t flags,
+                u32 fib_index, tunnel_encap_decap_flags_t flags,
                 ip_dscp_t dscp, u32 * sw_if_indexp)
 {
   ipip_main_t *gm = &ipip_main;