summaryrefslogtreecommitdiffstats
path: root/src/vnet/ip/ip_api.c
diff options
context:
space:
mode:
authorKlement Sekera <ksekera@cisco.com>2019-06-25 11:19:22 +0000
committerOle Trøan <otroan@employees.org>2019-09-26 14:12:07 +0000
commitde34c35fc73226943538149fae9dbc5cfbdc6e75 (patch)
treeab354210305403bc29a3effc7c002f947422cb9f /src/vnet/ip/ip_api.c
parent33538a15087eea7c994b6f3d8a952c4b6ea98ee4 (diff)
ip: add shallow virtual reassembly functionality
Type: feature Change-Id: Ibc8334e26c7e6f6120696c3e313b6e11d73dab99 Signed-off-by: Klement Sekera <ksekera@cisco.com>
Diffstat (limited to 'src/vnet/ip/ip_api.c')
-rw-r--r--src/vnet/ip/ip_api.c134
1 files changed, 101 insertions, 33 deletions
diff --git a/src/vnet/ip/ip_api.c b/src/vnet/ip/ip_api.c
index 3e04b9f740c..dd1d1dcaf6c 100644
--- a/src/vnet/ip/ip_api.c
+++ b/src/vnet/ip/ip_api.c
@@ -43,7 +43,9 @@
#include <vnet/fib/ip6_fib.h>
#include <vnet/fib/fib_path_list.h>
#include <vnet/ip/ip6_hop_by_hop.h>
+#include <vnet/ip/reass/ip4_sv_reass.h>
#include <vnet/ip/reass/ip4_full_reass.h>
+#include <vnet/ip/reass/ip6_sv_reass.h>
#include <vnet/ip/reass/ip6_full_reass.h>
#include <vnet/ethernet/arp.h>
#include <vnet/ip/ip_types_api.h>
@@ -2736,23 +2738,51 @@ vl_api_ip_reassembly_set_t_handler (vl_api_ip_reassembly_set_t * mp)
{
vl_api_ip_reassembly_set_reply_t *rmp;
int rv = 0;
- if (mp->is_ip6)
- {
- rv = ip6_full_reass_set (clib_net_to_host_u32 (mp->timeout_ms),
- clib_net_to_host_u32 (mp->max_reassemblies),
- clib_net_to_host_u32
- (mp->max_reassembly_length),
- clib_net_to_host_u32
- (mp->expire_walk_interval_ms));
- }
- else
+ switch ((vl_api_ip_reass_type_t) clib_net_to_host_u32 (mp->type))
{
- rv = ip4_full_reass_set (clib_net_to_host_u32 (mp->timeout_ms),
- clib_net_to_host_u32 (mp->max_reassemblies),
- clib_net_to_host_u32
- (mp->max_reassembly_length),
- clib_net_to_host_u32
- (mp->expire_walk_interval_ms));
+ case IP_REASS_TYPE_FULL:
+ if (mp->is_ip6)
+ {
+ rv = ip6_full_reass_set (clib_net_to_host_u32 (mp->timeout_ms),
+ clib_net_to_host_u32
+ (mp->max_reassemblies),
+ clib_net_to_host_u32
+ (mp->max_reassembly_length),
+ clib_net_to_host_u32
+ (mp->expire_walk_interval_ms));
+ }
+ else
+ {
+ rv = ip4_full_reass_set (clib_net_to_host_u32 (mp->timeout_ms),
+ clib_net_to_host_u32
+ (mp->max_reassemblies),
+ clib_net_to_host_u32
+ (mp->max_reassembly_length),
+ clib_net_to_host_u32
+ (mp->expire_walk_interval_ms));
+ }
+ break;
+ case IP_REASS_TYPE_SHALLOW_VIRTUAL:
+ if (mp->is_ip6)
+ {
+ rv =
+ ip6_sv_reass_set (clib_net_to_host_u32 (mp->timeout_ms),
+ clib_net_to_host_u32 (mp->max_reassemblies),
+ clib_net_to_host_u32
+ (mp->max_reassembly_length),
+ clib_net_to_host_u32
+ (mp->expire_walk_interval_ms));
+ }
+ else
+ {
+ rv = ip4_sv_reass_set (clib_net_to_host_u32 (mp->timeout_ms),
+ clib_net_to_host_u32 (mp->max_reassemblies),
+ clib_net_to_host_u32
+ (mp->max_reassembly_length),
+ clib_net_to_host_u32
+ (mp->expire_walk_interval_ms));
+ }
+ break;
}
REPLY_MACRO (VL_API_IP_REASSEMBLY_SET_REPLY);
@@ -2772,19 +2802,42 @@ vl_api_ip_reassembly_get_t_handler (vl_api_ip_reassembly_get_t * mp)
rmp->_vl_msg_id = ntohs (VL_API_IP_REASSEMBLY_GET_REPLY);
rmp->context = mp->context;
rmp->retval = 0;
- if (mp->is_ip6)
+ u32 timeout_ms;
+ u32 max_reassemblies;
+ u32 max_reassembly_length;
+ u32 expire_walk_interval_ms;
+ switch ((vl_api_ip_reass_type_t) clib_net_to_host_u32 (mp->type))
{
- rmp->is_ip6 = 1;
- ip6_full_reass_get (&rmp->timeout_ms, &rmp->max_reassemblies,
- &rmp->max_reassembly_length,
- &rmp->expire_walk_interval_ms);
- }
- else
- {
- rmp->is_ip6 = 0;
- ip4_full_reass_get (&rmp->timeout_ms, &rmp->max_reassemblies,
- &rmp->max_reassembly_length,
- &rmp->expire_walk_interval_ms);
+ case IP_REASS_TYPE_FULL:
+ if (mp->is_ip6)
+ {
+ rmp->is_ip6 = 1;
+ ip6_full_reass_get (&timeout_ms, &max_reassemblies,
+ &max_reassembly_length,
+ &expire_walk_interval_ms);
+ }
+ else
+ {
+ rmp->is_ip6 = 0;
+ ip4_full_reass_get (&timeout_ms, &max_reassemblies,
+ &max_reassembly_length,
+ &expire_walk_interval_ms);
+ }
+ break;
+ case IP_REASS_TYPE_SHALLOW_VIRTUAL:
+ if (mp->is_ip6)
+ {
+ rmp->is_ip6 = 1;
+ ip6_sv_reass_get (&timeout_ms, &max_reassemblies,
+ &max_reassembly_length, &expire_walk_interval_ms);
+ }
+ else
+ {
+ rmp->is_ip6 = 0;
+ ip4_sv_reass_get (&timeout_ms, &max_reassemblies,
+ &max_reassembly_length, &expire_walk_interval_ms);
+ }
+ break;
}
rmp->timeout_ms = clib_host_to_net_u32 (rmp->timeout_ms);
rmp->max_reassemblies = clib_host_to_net_u32 (rmp->max_reassemblies);
@@ -2799,13 +2852,28 @@ void
{
vl_api_ip_reassembly_enable_disable_reply_t *rmp;
int rv = 0;
- rv = ip4_full_reass_enable_disable (clib_net_to_host_u32 (mp->sw_if_index),
- mp->enable_ip4);
- if (0 == rv)
+ switch ((vl_api_ip_reass_type_t) clib_net_to_host_u32 (mp->type))
{
+ case IP_REASS_TYPE_FULL:
rv =
- ip6_full_reass_enable_disable (clib_net_to_host_u32 (mp->sw_if_index),
- mp->enable_ip6);
+ ip4_full_reass_enable_disable (clib_net_to_host_u32 (mp->sw_if_index),
+ mp->enable_ip4);
+ if (0 == rv)
+ rv =
+ ip6_full_reass_enable_disable (clib_net_to_host_u32
+ (mp->sw_if_index), mp->enable_ip6);
+ break;
+ case IP_REASS_TYPE_SHALLOW_VIRTUAL:
+ rv =
+ ip4_sv_reass_enable_disable (clib_net_to_host_u32 (mp->sw_if_index),
+ mp->enable_ip4);
+ if (0 == rv)
+ {
+ rv =
+ ip6_sv_reass_enable_disable (clib_net_to_host_u32
+ (mp->sw_if_index), mp->enable_ip6);
+ }
+ break;
}
REPLY_MACRO (VL_API_IP_REASSEMBLY_ENABLE_DISABLE_REPLY);