aboutsummaryrefslogtreecommitdiffstats
path: root/hicn-plugin/src/udp_tunnels
diff options
context:
space:
mode:
Diffstat (limited to 'hicn-plugin/src/udp_tunnels')
-rw-r--r--hicn-plugin/src/udp_tunnels/udp_decap_node.c40
-rw-r--r--hicn-plugin/src/udp_tunnels/udp_tunnel.c7
-rw-r--r--hicn-plugin/src/udp_tunnels/udp_tunnel.h34
3 files changed, 36 insertions, 45 deletions
diff --git a/hicn-plugin/src/udp_tunnels/udp_decap_node.c b/hicn-plugin/src/udp_tunnels/udp_decap_node.c
index 84e4e5234..06eb8da71 100644
--- a/hicn-plugin/src/udp_tunnels/udp_decap_node.c
+++ b/hicn-plugin/src/udp_tunnels/udp_decap_node.c
@@ -223,7 +223,7 @@ udp4_decap_node_fn (vlib_main_t *vm, vlib_node_runtime_t *node,
&((ip4_header_t *) outer_ptr0)->dst_address);
udp0 = (udp_header_t *) (outer_ptr0 + sizeof (ip4_header_t));
next0 = v0 == 0x40 ? UDP4_DECAP_NEXT_LOOKUP_IP4 :
- UDP4_DECAP_NEXT_LOOKUP_IP6;
+ UDP4_DECAP_NEXT_LOOKUP_IP6;
ip46_address_set_ip4 (&src1,
&((ip4_header_t *) outer_ptr1)->src_address);
@@ -231,7 +231,7 @@ udp4_decap_node_fn (vlib_main_t *vm, vlib_node_runtime_t *node,
&((ip4_header_t *) outer_ptr1)->dst_address);
udp1 = (udp_header_t *) (outer_ptr1 + sizeof (ip4_header_t));
next1 = v1 == 0x40 ? UDP4_DECAP_NEXT_LOOKUP_IP4 :
- UDP4_DECAP_NEXT_LOOKUP_IP6;
+ UDP4_DECAP_NEXT_LOOKUP_IP6;
ip46_address_set_ip4 (&src2,
&((ip4_header_t *) outer_ptr2)->src_address);
@@ -239,7 +239,7 @@ udp4_decap_node_fn (vlib_main_t *vm, vlib_node_runtime_t *node,
&((ip4_header_t *) outer_ptr2)->dst_address);
udp2 = (udp_header_t *) (outer_ptr2 + sizeof (ip4_header_t));
next2 = v2 == 0x40 ? UDP4_DECAP_NEXT_LOOKUP_IP4 :
- UDP4_DECAP_NEXT_LOOKUP_IP6;
+ UDP4_DECAP_NEXT_LOOKUP_IP6;
ip46_address_set_ip4 (&src3,
&((ip4_header_t *) outer_ptr3)->src_address);
@@ -247,7 +247,7 @@ udp4_decap_node_fn (vlib_main_t *vm, vlib_node_runtime_t *node,
&((ip4_header_t *) outer_ptr3)->dst_address);
udp3 = (udp_header_t *) (outer_ptr3 + sizeof (ip4_header_t));
next3 = v3 == 0x40 ? UDP4_DECAP_NEXT_LOOKUP_IP4 :
- UDP4_DECAP_NEXT_LOOKUP_IP6;
+ UDP4_DECAP_NEXT_LOOKUP_IP6;
hicn_buffer_t *hicnb0, *hicnb1, *hicnb2, *hicnb3;
hicnb0 = hicn_get_buffer (b0);
@@ -269,22 +269,22 @@ udp4_decap_node_fn (vlib_main_t *vm, vlib_node_runtime_t *node,
if (vnet_buffer (b0)->ip.adj_index[VLIB_RX] != UDP_TUNNEL_INVALID)
hicnb0->flags |=
(outer_v0 == 0x40 ? HICN_BUFFER_FLAGS_FROM_UDP4_TUNNEL :
- HICN_BUFFER_FLAGS_FROM_UDP6_TUNNEL);
+ HICN_BUFFER_FLAGS_FROM_UDP6_TUNNEL);
if (vnet_buffer (b1)->ip.adj_index[VLIB_RX] != UDP_TUNNEL_INVALID)
hicnb1->flags |=
(outer_v1 == 0x40 ? HICN_BUFFER_FLAGS_FROM_UDP4_TUNNEL :
- HICN_BUFFER_FLAGS_FROM_UDP6_TUNNEL);
+ HICN_BUFFER_FLAGS_FROM_UDP6_TUNNEL);
if (vnet_buffer (b2)->ip.adj_index[VLIB_RX] != UDP_TUNNEL_INVALID)
hicnb2->flags |=
(outer_v2 == 0x40 ? HICN_BUFFER_FLAGS_FROM_UDP4_TUNNEL :
- HICN_BUFFER_FLAGS_FROM_UDP6_TUNNEL);
+ HICN_BUFFER_FLAGS_FROM_UDP6_TUNNEL);
if (vnet_buffer (b3)->ip.adj_index[VLIB_RX] != UDP_TUNNEL_INVALID)
hicnb3->flags |=
(outer_v3 == 0x40 ? HICN_BUFFER_FLAGS_FROM_UDP4_TUNNEL :
- HICN_BUFFER_FLAGS_FROM_UDP6_TUNNEL);
+ HICN_BUFFER_FLAGS_FROM_UDP6_TUNNEL);
udp_decap_trace_buffer (vm, node, 1, b0);
udp_decap_trace_buffer (vm, node, 1, b1);
@@ -346,7 +346,7 @@ udp4_decap_node_fn (vlib_main_t *vm, vlib_node_runtime_t *node,
&((ip4_header_t *) outer_ptr0)->dst_address);
udp0 = (udp_header_t *) (outer_ptr0 + sizeof (ip4_header_t));
next0 = v0 == 0x40 ? UDP4_DECAP_NEXT_LOOKUP_IP4 :
- UDP4_DECAP_NEXT_LOOKUP_IP6;
+ UDP4_DECAP_NEXT_LOOKUP_IP6;
hicn_buffer_t *hicnb0 = hicn_get_buffer (b0);
@@ -356,7 +356,7 @@ udp4_decap_node_fn (vlib_main_t *vm, vlib_node_runtime_t *node,
if (vnet_buffer (b0)->ip.adj_index[VLIB_RX] != UDP_TUNNEL_INVALID)
hicnb0->flags |=
(outer_v0 == 0x40 ? HICN_BUFFER_FLAGS_FROM_UDP4_TUNNEL :
- HICN_BUFFER_FLAGS_FROM_UDP6_TUNNEL);
+ HICN_BUFFER_FLAGS_FROM_UDP6_TUNNEL);
udp_decap_trace_buffer (vm, node, 1, b0);
@@ -488,7 +488,7 @@ udp6_decap_node_fn (vlib_main_t *vm, vlib_node_runtime_t *node,
&((ip6_header_t *) outer_ptr0)->dst_address);
udp0 = (udp_header_t *) (outer_ptr0 + sizeof (ip6_header_t));
next0 = v0 == 0x40 ? UDP6_DECAP_NEXT_LOOKUP_IP4 :
- UDP6_DECAP_NEXT_LOOKUP_IP6;
+ UDP6_DECAP_NEXT_LOOKUP_IP6;
ip46_address_set_ip6 (&src1,
&((ip6_header_t *) outer_ptr1)->src_address);
@@ -496,7 +496,7 @@ udp6_decap_node_fn (vlib_main_t *vm, vlib_node_runtime_t *node,
&((ip6_header_t *) outer_ptr1)->dst_address);
udp1 = (udp_header_t *) (outer_ptr1 + sizeof (ip6_header_t));
next1 = v1 == 0x40 ? UDP6_DECAP_NEXT_LOOKUP_IP4 :
- UDP6_DECAP_NEXT_LOOKUP_IP6;
+ UDP6_DECAP_NEXT_LOOKUP_IP6;
ip46_address_set_ip6 (&src2,
&((ip6_header_t *) outer_ptr2)->src_address);
@@ -504,7 +504,7 @@ udp6_decap_node_fn (vlib_main_t *vm, vlib_node_runtime_t *node,
&((ip6_header_t *) outer_ptr2)->dst_address);
udp2 = (udp_header_t *) (outer_ptr2 + sizeof (ip6_header_t));
next2 = v2 == 0x40 ? UDP6_DECAP_NEXT_LOOKUP_IP4 :
- UDP6_DECAP_NEXT_LOOKUP_IP6;
+ UDP6_DECAP_NEXT_LOOKUP_IP6;
ip46_address_set_ip6 (&src3,
&((ip6_header_t *) outer_ptr3)->src_address);
@@ -512,7 +512,7 @@ udp6_decap_node_fn (vlib_main_t *vm, vlib_node_runtime_t *node,
&((ip6_header_t *) outer_ptr3)->dst_address);
udp3 = (udp_header_t *) (outer_ptr3 + sizeof (ip6_header_t));
next3 = v3 == 0x40 ? UDP6_DECAP_NEXT_LOOKUP_IP4 :
- UDP6_DECAP_NEXT_LOOKUP_IP6;
+ UDP6_DECAP_NEXT_LOOKUP_IP6;
hicn_buffer_t *hicnb0, *hicnb1, *hicnb2, *hicnb3;
hicnb0 = hicn_get_buffer (b0);
@@ -534,22 +534,22 @@ udp6_decap_node_fn (vlib_main_t *vm, vlib_node_runtime_t *node,
if (vnet_buffer (b0)->ip.adj_index[VLIB_RX] != UDP_TUNNEL_INVALID)
hicnb0->flags |=
(outer_v0 == 0x40 ? HICN_BUFFER_FLAGS_FROM_UDP4_TUNNEL :
- HICN_BUFFER_FLAGS_FROM_UDP6_TUNNEL);
+ HICN_BUFFER_FLAGS_FROM_UDP6_TUNNEL);
if (vnet_buffer (b1)->ip.adj_index[VLIB_RX] != UDP_TUNNEL_INVALID)
hicnb1->flags |=
(outer_v1 == 0x40 ? HICN_BUFFER_FLAGS_FROM_UDP4_TUNNEL :
- HICN_BUFFER_FLAGS_FROM_UDP6_TUNNEL);
+ HICN_BUFFER_FLAGS_FROM_UDP6_TUNNEL);
if (vnet_buffer (b2)->ip.adj_index[VLIB_RX] != UDP_TUNNEL_INVALID)
hicnb2->flags |=
(outer_v2 == 0x40 ? HICN_BUFFER_FLAGS_FROM_UDP4_TUNNEL :
- HICN_BUFFER_FLAGS_FROM_UDP6_TUNNEL);
+ HICN_BUFFER_FLAGS_FROM_UDP6_TUNNEL);
if (vnet_buffer (b3)->ip.adj_index[VLIB_RX] != UDP_TUNNEL_INVALID)
hicnb3->flags |=
(outer_v3 == 0x40 ? HICN_BUFFER_FLAGS_FROM_UDP4_TUNNEL :
- HICN_BUFFER_FLAGS_FROM_UDP6_TUNNEL);
+ HICN_BUFFER_FLAGS_FROM_UDP6_TUNNEL);
udp_decap_trace_buffer (vm, node, 0, b0);
udp_decap_trace_buffer (vm, node, 0, b1);
@@ -610,7 +610,7 @@ udp6_decap_node_fn (vlib_main_t *vm, vlib_node_runtime_t *node,
&((ip6_header_t *) outer_ptr0)->dst_address);
udp0 = (udp_header_t *) (outer_ptr0 + sizeof (ip6_header_t));
next0 = v0 == 0x40 ? UDP6_DECAP_NEXT_LOOKUP_IP4 :
- UDP6_DECAP_NEXT_LOOKUP_IP6;
+ UDP6_DECAP_NEXT_LOOKUP_IP6;
hicn_buffer_t *hicnb0 = hicn_get_buffer (b0);
@@ -620,7 +620,7 @@ udp6_decap_node_fn (vlib_main_t *vm, vlib_node_runtime_t *node,
if (vnet_buffer (b0)->ip.adj_index[VLIB_RX] != UDP_TUNNEL_INVALID)
hicnb0->flags |=
(outer_v0 == 0x40 ? HICN_BUFFER_FLAGS_FROM_UDP4_TUNNEL :
- HICN_BUFFER_FLAGS_FROM_UDP6_TUNNEL);
+ HICN_BUFFER_FLAGS_FROM_UDP6_TUNNEL);
udp_decap_trace_buffer (vm, node, 0, b0);
diff --git a/hicn-plugin/src/udp_tunnels/udp_tunnel.c b/hicn-plugin/src/udp_tunnels/udp_tunnel.c
index 58694d8e9..8ea2cb503 100644
--- a/hicn-plugin/src/udp_tunnels/udp_tunnel.c
+++ b/hicn-plugin/src/udp_tunnels/udp_tunnel.c
@@ -16,6 +16,7 @@
#include <vnet/vnet.h>
#include <vppinfra/bihash_40_8.h>
#include <vnet/fib/fib_table.h>
+#include <vnet/udp/udp_local.h>
#include "../error.h"
#include "../strategy_dpo_ctx.h"
@@ -254,8 +255,8 @@ udp_tunnel_command_fn (vlib_main_t *vm, unformat_input_t *main_input,
int ret = udp_tunnel_del (fproto, fib_index, &src_ip, &dst_ip, src_port,
dst_port, UDP_ENCAP_FIXUP_NONE);
error = (ret == HICN_ERROR_NONE) ?
- 0 :
- clib_error_return (0, "%s\n", get_error_string (ret));
+ 0 :
+ clib_error_return (0, "%s\n", get_error_string (ret));
}
else
{
@@ -271,7 +272,7 @@ VLIB_CLI_COMMAND (udp_tunnel_command, static) = {
.path = "udp tunnel",
.short_help =
"udp tunnel [add/del] src_address dst_address src_port dst_port",
- .function = udp_tunnel_command_fn,
+ .function = udp_tunnel_command_fn,
};
/*
diff --git a/hicn-plugin/src/udp_tunnels/udp_tunnel.h b/hicn-plugin/src/udp_tunnels/udp_tunnel.h
index 2ec92056c..2e57b7857 100644
--- a/hicn-plugin/src/udp_tunnels/udp_tunnel.h
+++ b/hicn-plugin/src/udp_tunnels/udp_tunnel.h
@@ -26,9 +26,9 @@
* This file implements bidirectional udp tunnels. Udp tunnels exploit
* the udp encap functionality in vpp. In particular, a udp tunnel creates
* an udp encap object with the information for encapsulating packets and it
- * implements the udp decap node. The udp decap node checks if a udp tunnel exists
- * before performing the decapsulation. If the tunnel does not exist the packet
- * is dropped.
+ * implements the udp decap node. The udp decap node checks if a udp tunnel
+ * exists before performing the decapsulation. If the tunnel does not exist the
+ * packet is dropped.
*/
#define UDP_TUNNEL_INVALID ~0
@@ -52,13 +52,9 @@ extern vlib_node_registration_t udp6_decap_node;
*
* @return return the id of the tunnel
*/
-u32 udp_tunnel_add (fib_protocol_t proto,
- index_t fib_index,
- const ip46_address_t * src_ip,
- const ip46_address_t * dst_ip,
- u16 src_port,
- u16 dst_port,
- udp_encap_fixup_flags_t flags);
+u32 udp_tunnel_add (fib_protocol_t proto, index_t fib_index,
+ const ip46_address_t *src_ip, const ip46_address_t *dst_ip,
+ u16 src_port, u16 dst_port, udp_encap_fixup_flags_t flags);
/**
* @brief Retrieve the index of a udp tunnel (same id of the udp encap)
@@ -70,10 +66,8 @@ u32 udp_tunnel_add (fib_protocol_t proto,
*
* @return id of the udp tunnel/encap
*/
-u32 udp_tunnel_get(const ip46_address_t * src_ip,
- const ip46_address_t * dst_ip,
- u16 src_port,
- u16 dst_port);
+u32 udp_tunnel_get (const ip46_address_t *src_ip, const ip46_address_t *dst_ip,
+ u16 src_port, u16 dst_port);
/**
* @brief Delete a udp tunnel
@@ -89,13 +83,9 @@ u32 udp_tunnel_get(const ip46_address_t * src_ip,
* @return HICN_ERROR_UDP_TUNNEL_NOT_FOUND if the tunnel was not found
* or HICN_ERROR_NONE if the tunnel has been deleted
*/
-int udp_tunnel_del (fib_protocol_t proto,
- index_t fib_index,
- const ip46_address_t * src_ip,
- const ip46_address_t * dst_ip,
- u16 src_port,
- u16 dst_port,
- udp_encap_fixup_flags_t flags);
+int udp_tunnel_del (fib_protocol_t proto, index_t fib_index,
+ const ip46_address_t *src_ip, const ip46_address_t *dst_ip,
+ u16 src_port, u16 dst_port, udp_encap_fixup_flags_t flags);
/**
* @brief Add a udp tunnel from an existing udp encap
@@ -109,6 +99,6 @@ void udp_tunnel_add_existing (index_t uei, dpo_proto_t proto);
* @brief Init the udp tunnel module
*
*/
-void udp_tunnel_init();
+void udp_tunnel_init ();
#endif