summaryrefslogtreecommitdiffstats
path: root/src/vnet/ipip
diff options
context:
space:
mode:
Diffstat (limited to 'src/vnet/ipip')
-rw-r--r--src/vnet/ipip/ipip.api6
-rw-r--r--src/vnet/ipip/ipip.c40
-rw-r--r--src/vnet/ipip/ipip.h28
-rw-r--r--src/vnet/ipip/ipip_api.c8
-rw-r--r--src/vnet/ipip/ipip_cli.c4
-rw-r--r--src/vnet/ipip/ipip_types.api33
-rw-r--r--src/vnet/ipip/ipip_types_api.c53
-rw-r--r--src/vnet/ipip/ipip_types_api.h41
-rw-r--r--src/vnet/ipip/node.c4
9 files changed, 27 insertions, 190 deletions
diff --git a/src/vnet/ipip/ipip.api b/src/vnet/ipip/ipip.api
index baf0e508cf0..8ba31363b17 100644
--- a/src/vnet/ipip/ipip.api
+++ b/src/vnet/ipip/ipip.api
@@ -49,11 +49,11 @@
*
*/
-option version = "2.0.0";
+option version = "2.0.1";
import "vnet/interface_types.api";
import "vnet/ip/ip_types.api";
-import "vnet/ipip/ipip_types.api";
+import "vnet/tunnel/tunnel_types.api";
/**
* An IP{v4,v6} over IP{v4,v6} tunnel.
@@ -66,7 +66,7 @@ typedef ipip_tunnel
vl_api_interface_index_t sw_if_index; /* ignored on create, set in
details/dump */
u32 table_id;
- vl_api_ipip_tunnel_flags_t flags;
+ vl_api_tunnel_encap_decap_flags_t flags;
vl_api_ip_dscp_t dscp; /* DSCP value for the tunnel encap,
ignored if ECNAP_COPY_DSCP flag is set */
};
diff --git a/src/vnet/ipip/ipip.c b/src/vnet/ipip/ipip.c
index d68e8152972..05460fbbe34 100644
--- a/src/vnet/ipip/ipip.c
+++ b/src/vnet/ipip/ipip.c
@@ -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;
diff --git a/src/vnet/ipip/ipip.h b/src/vnet/ipip/ipip.h
index be944507b40..a3732f75128 100644
--- a/src/vnet/ipip/ipip.h
+++ b/src/vnet/ipip/ipip.h
@@ -22,7 +22,7 @@
#include <vnet/ip/ip6_packet.h>
#include <vnet/ip/format.h>
#include <vnet/ip/ip.h>
-#include <vnet/vnet.h>
+#include <vnet/tunnel/tunnel.h>
extern vnet_hw_interface_class_t ipip_hw_interface_class;
@@ -65,28 +65,6 @@ typedef enum
} ipip_mode_t;
/**
- * Keep these idenitical to those in ipip.api
- */
-#define forech_ipip_tunnel_flag \
- _(NONE, "none", 0x0) \
- _(ENCAP_COPY_DF, "encap-copy-df", 0x1) \
- _(ENCAP_SET_DF, "encap-set-df", 0x2) \
- _(ENCAP_COPY_DSCP, "encap-copy-dscp", 0x4) \
- _(ENCAP_COPY_ECN, "encap-copy-ecn", 0x8) \
- _(DECAP_COPY_ECN, "decap-copy-ecn", 0x10)
-
-typedef enum ipip_tunnel_flags_t_
-{
-#define _(a,b,c) IPIP_TUNNEL_FLAG_##a = c,
- forech_ipip_tunnel_flag
-#undef _
-} __clib_packed ipip_tunnel_flags_t;
-
-#define IPIP_TUNNEL_FLAG_MASK (0x1f)
-
-extern u8 *format_ipip_tunnel_flags (u8 * s, va_list * args);
-
-/**
* @brief A representation of a IPIP tunnel
*/
typedef struct
@@ -104,7 +82,7 @@ typedef struct
u32 sw_if_index;
u32 dev_instance; /* Real device instance in tunnel vector */
u32 user_instance; /* Instance name being shown to user */
- ipip_tunnel_flags_t flags;
+ tunnel_encap_decap_flags_t flags;
ip_dscp_t dscp;
struct
@@ -166,7 +144,7 @@ sixrd_get_addr_net (const ipip_tunnel_t * t, u64 dal)
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);
int ipip_del_tunnel (u32 sw_if_index);
int sixrd_add_tunnel (ip6_address_t * ip6_prefix, u8 ip6_prefix_len,
diff --git a/src/vnet/ipip/ipip_api.c b/src/vnet/ipip/ipip_api.c
index 47ff159b703..4f6aa7f3dbe 100644
--- a/src/vnet/ipip/ipip_api.c
+++ b/src/vnet/ipip/ipip_api.c
@@ -22,7 +22,7 @@
#include <vnet/ipip/ipip.h>
#include <vnet/vnet.h>
#include <vnet/ip/ip_types_api.h>
-#include <vnet/ipip/ipip_types_api.h>
+#include <vnet/tunnel/tunnel_types_api.h>
#include <vnet/ipip/ipip.api_enum.h>
#include <vnet/ipip/ipip.api_types.h>
@@ -37,7 +37,7 @@ vl_api_ipip_add_tunnel_t_handler (vl_api_ipip_add_tunnel_t * mp)
vl_api_ipip_add_tunnel_reply_t *rmp;
int rv = 0;
u32 fib_index, sw_if_index = ~0;
- ipip_tunnel_flags_t flags;
+ tunnel_encap_decap_flags_t flags;
ip46_address_t src, dst;
ip46_type_t itype[2];
@@ -56,7 +56,7 @@ vl_api_ipip_add_tunnel_t_handler (vl_api_ipip_add_tunnel_t * mp)
goto out;
}
- rv = ipip_tunnel_flags_decode (mp->tunnel.flags, &flags);
+ rv = tunnel_encap_decap_flags_decode (mp->tunnel.flags, &flags);
if (rv)
goto out;
@@ -119,7 +119,7 @@ send_ipip_tunnel_details (ipip_tunnel_t * t, vl_api_ipip_tunnel_dump_t * mp)
rmp->tunnel.instance = htonl (t->user_instance);
rmp->tunnel.sw_if_index = htonl (t->sw_if_index);
rmp->tunnel.dscp = ip_dscp_encode(t->dscp);
- rmp->tunnel.flags = ipip_tunnel_flags_encode(t->flags);
+ rmp->tunnel.flags = tunnel_encap_decap_flags_encode(t->flags);
}));
/* *INDENT-ON* */
}
diff --git a/src/vnet/ipip/ipip_cli.c b/src/vnet/ipip/ipip_cli.c
index e252f3a519e..09f2ebae228 100644
--- a/src/vnet/ipip/ipip_cli.c
+++ b/src/vnet/ipip/ipip_cli.c
@@ -82,7 +82,7 @@ static clib_error_t *create_ipip_tunnel_command_fn(vlib_main_t *vm,
&src,
&dst,
fib_index,
- IPIP_TUNNEL_FLAG_NONE,
+ TUNNEL_ENCAP_DECAP_FLAG_NONE,
IP_DSCP_CS0,
&sw_if_index);
}
@@ -192,7 +192,7 @@ static u8 *format_ipip_tunnel(u8 *s, va_list *args) {
s = format(s, "table-ID %d sw-if-idx %d flags [%U] dscp %U",
table_id, t->sw_if_index,
- format_ipip_tunnel_flags, t->flags,
+ format_tunnel_encap_decap_flags, t->flags,
format_ip_dscp, t->dscp);
return s;
diff --git a/src/vnet/ipip/ipip_types.api b/src/vnet/ipip/ipip_types.api
deleted file mode 100644
index 3e52fe74c1d..00000000000
--- a/src/vnet/ipip/ipip_types.api
+++ /dev/null
@@ -1,33 +0,0 @@
-/* Hey Emacs use -*- mode: C -*- */
-/*
- * Copyright (c) 2019 Cisco and/or its affiliates.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * Flags controlling tunnel behaviour
- */
-enum ipip_tunnel_flags : u8
-{
- IPIP_TUNNEL_API_FLAG_NONE = 0,
- /** at encap, copy the DF bit of the payload into the tunnel header */
- IPIP_TUNNEL_API_FLAG_ENCAP_COPY_DF = 0x1,
- /** at encap, set the DF bit in the tunnel header */
- IPIP_TUNNEL_API_FLAG_ENCAP_SET_DF = 0x2,
- /** at encap, copy the DSCP bits of the payload into the tunnel header */
- IPIP_TUNNEL_API_FLAG_ENCAP_COPY_DSCP = 0x4,
- /** at encap, copy the ECN bit of the payload into the tunnel header */
- IPIP_TUNNEL_API_FLAG_ENCAP_COPY_ECN = 0x8,
- /** at decap, copy the ECN bit of the tunnel header into the payload */
- IPIP_TUNNEL_API_FLAG_DECAP_COPY_ECN = 0x10,
-};
diff --git a/src/vnet/ipip/ipip_types_api.c b/src/vnet/ipip/ipip_types_api.c
deleted file mode 100644
index 5625b85af68..00000000000
--- a/src/vnet/ipip/ipip_types_api.c
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * ipip_api.c - ipip api
- *
- * Copyright (c) 2018 Cisco and/or its affiliates.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <vnet/api_errno.h>
-#include <vnet/ipip/ipip_types_api.h>
-
-#include <vnet/ipip/ipip_types.api_enum.h>
-#include <vnet/ipip/ipip_types.api_types.h>
-
-
-STATIC_ASSERT (sizeof (vl_api_ipip_tunnel_flags_t) ==
- sizeof (ipip_tunnel_flags_t),
- "IPIP tunnel API and internal flags enum size differ");
-
-int
-ipip_tunnel_flags_decode (vl_api_ipip_tunnel_flags_t f,
- ipip_tunnel_flags_t * o)
-{
- if (f & ~IPIP_TUNNEL_FLAG_MASK)
- /* unknown flags set */
- return (VNET_API_ERROR_INVALID_VALUE_2);
-
- *o = (ipip_tunnel_flags_t) f;
- return (0);
-}
-
-vl_api_ipip_tunnel_flags_t
-ipip_tunnel_flags_encode (ipip_tunnel_flags_t f)
-{
- return ((vl_api_ipip_tunnel_flags_t) f);
-}
-
-/*
- * fd.io coding-style-patch-verification: ON
- *
- * Local Variables:
- * eval: (c-set-style "gnu")
- * End:
- */
diff --git a/src/vnet/ipip/ipip_types_api.h b/src/vnet/ipip/ipip_types_api.h
deleted file mode 100644
index 17b1f1bb210..00000000000
--- a/src/vnet/ipip/ipip_types_api.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (c) 2018 Cisco and/or its affiliates.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __IPIP_TYPES_API_H__
-#define __IPIP_TYPES_API_H__
-
-/**
- * Conversion functions to/from (decode/encode) API types to VPP internal types
- */
-
-#include <vnet/ipip/ipip.h>
-#include <vnet/ipip/ipip.api_types.h>
-
-/**
- * These enum decode/encodes use 'int' as the type for the enum because
- * one cannot forward declare an enum
- */
-extern int ipip_tunnel_flags_decode (u8 _f, ipip_tunnel_flags_t * out);
-extern u8 ipip_tunnel_flags_encode (ipip_tunnel_flags_t f);
-
-#endif
-
-/*
- * fd.io coding-style-patch-verification: ON
- *
- * Local Variables:
- * eval: (c-set-style "gnu")
- * End:
- */
diff --git a/src/vnet/ipip/node.c b/src/vnet/ipip/node.c
index cd26b8a8b85..bc0250ad6ef 100644
--- a/src/vnet/ipip/node.c
+++ b/src/vnet/ipip/node.c
@@ -161,7 +161,7 @@ ipip_input (vlib_main_t * vm, vlib_node_runtime_t * node,
{
next0 = IPIP_INPUT_NEXT_IP6_INPUT;
- if (t0->flags & IPIP_TUNNEL_FLAG_DECAP_COPY_ECN)
+ if (t0->flags & TUNNEL_ENCAP_DECAP_FLAG_DECAP_COPY_ECN)
{
if (is_ipv6)
ip6_set_ecn_network_order ((ip60 + 1),
@@ -174,7 +174,7 @@ ipip_input (vlib_main_t * vm, vlib_node_runtime_t * node,
else if (inner_protocol0 == IP_PROTOCOL_IP_IN_IP)
{
next0 = IPIP_INPUT_NEXT_IP4_INPUT;
- if (t0->flags & IPIP_TUNNEL_FLAG_DECAP_COPY_ECN)
+ if (t0->flags & TUNNEL_ENCAP_DECAP_FLAG_DECAP_COPY_ECN)
{
if (is_ipv6)
ip4_header_set_ecn_w_chksum ((ip4_header_t *) (ip60 + 1),