summaryrefslogtreecommitdiffstats
path: root/hicn-plugin/src
diff options
context:
space:
mode:
authorAlberto Compagno <acompagn+fdio@cisco.com>2020-05-05 18:26:18 +0200
committerAlberto Compagno <acompagn+fdio@cisco.com>2020-05-05 19:29:02 +0200
commit7415aeaa213e63caa0bc3e625219996d9c2dc93a (patch)
treec86eac2b6cbd039fda12e0f270728f55c6f7d80d /hicn-plugin/src
parent43d0ecbb1a1f7e1f72bf85441547b1678aed4350 (diff)
[HICN-608] Added configuratin option to manage hicn behaviour with interfaces
Signed-off-by: Alberto Compagno <acompagn+fdio@cisco.com> Change-Id: I8d48237b5dce737be443ec8949ac11721158d830
Diffstat (limited to 'hicn-plugin/src')
-rw-r--r--hicn-plugin/src/cli.c6
-rw-r--r--hicn-plugin/src/hicn.c13
-rw-r--r--hicn-plugin/src/hicn_api.c3
-rw-r--r--hicn-plugin/src/infra.h6
-rw-r--r--hicn-plugin/src/route.c7
5 files changed, 28 insertions, 7 deletions
diff --git a/hicn-plugin/src/cli.c b/hicn-plugin/src/cli.c
index 5d613c535..a555d7143 100644
--- a/hicn-plugin/src/cli.c
+++ b/hicn-plugin/src/cli.c
@@ -61,7 +61,8 @@ hicn_cli_node_ctl_start_set_command_fn (vlib_main_t * vm,
node_ctl_params.pit_max_size,
node_ctl_params.
pit_max_lifetime_sec,
- node_ctl_params.cs_max_size);
+ node_ctl_params.cs_max_size,
+ ~0);
vlib_cli_output (vm, "hicn: fwdr initialize => %s\n",
get_error_string (ret));
@@ -104,7 +105,8 @@ hicn_cli_node_ctl_stop_set_command_fn (vlib_main_t * vm,
node_ctl_params.pit_max_size,
node_ctl_params.
pit_max_lifetime_sec,
- node_ctl_params.cs_max_size);
+ node_ctl_params.cs_max_size,
+ ~0);
return (ret == HICN_ERROR_NONE) ? 0 : clib_error_return (0,
get_error_string
diff --git a/hicn-plugin/src/hicn.c b/hicn-plugin/src/hicn.c
index 7bcbf5094..43a717f80 100644
--- a/hicn-plugin/src/hicn.c
+++ b/hicn-plugin/src/hicn.c
@@ -16,6 +16,7 @@
#include <vnet/vnet.h>
#include <vnet/plugin/plugin.h>
#include <vlib/vlib.h>
+#include <vnet/interface.h>
#include "hicn.h"
#include "params.h"
@@ -80,7 +81,8 @@ int
hicn_infra_plugin_enable_disable (int enable_disable,
int pit_size_req,
f64 pit_max_lifetime_sec_req,
- int cs_size_req)
+ int cs_size_req,
+ vnet_link_t link)
{
int ret = 0;
@@ -171,7 +173,7 @@ hicn_infra_plugin_enable_disable (int enable_disable,
goto done;
}
sm->is_enabled = 1;
-
+ sm->link = link;
//hicn_face_udp_init_internal ();
done:
@@ -186,6 +188,9 @@ hicn_configure (vlib_main_t * vm, unformat_input_t * input)
u32 cs_size = HICN_PARAM_CS_ENTRIES_DFLT;
u64 pit_lifetime_max_sec = HICN_PARAM_PIT_LIFETIME_DFLT_MAX_MS / SEC_MS;
+ vnet_link_t link;
+
+
while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
{
if (unformat (input, "pit-size %u", &pit_size))
@@ -194,6 +199,8 @@ hicn_configure (vlib_main_t * vm, unformat_input_t * input)
;
else if (unformat (input, "pit-lifetime-max %u", &pit_lifetime_max_sec))
;
+ else if (unformat (input, "grab mpls-tunnels"))
+ link = VNET_LINK_MPLS;
else
break;
}
@@ -202,7 +209,7 @@ hicn_configure (vlib_main_t * vm, unformat_input_t * input)
hicn_infra_plugin_enable_disable (1, pit_size,
pit_lifetime_max_sec,
- cs_size);
+ cs_size, link);
return 0;
diff --git a/hicn-plugin/src/hicn_api.c b/hicn-plugin/src/hicn_api.c
index f5d2cee74..e6050f96c 100644
--- a/hicn-plugin/src/hicn_api.c
+++ b/hicn-plugin/src/hicn_api.c
@@ -91,7 +91,8 @@ vl_api_hicn_api_node_params_set_t_handler (vl_api_hicn_api_node_params_set_t *
rv = hicn_infra_plugin_enable_disable ((int) (mp->enable_disable),
pit_max_size,
pit_max_lifetime_sec,
- cs_max_size);
+ cs_max_size,
+ ~0);
REPLY_MACRO (VL_API_HICN_API_NODE_PARAMS_SET_REPLY /* , rmp, mp, rv */ );
}
diff --git a/hicn-plugin/src/infra.h b/hicn-plugin/src/infra.h
index 007cf266d..334b62ffe 100644
--- a/hicn-plugin/src/infra.h
+++ b/hicn-plugin/src/infra.h
@@ -18,6 +18,7 @@
#include <vlib/vlib.h>
#include <vnet/vnet.h>
+#include <vnet/interface.h>
#include "pcs.h"
@@ -43,6 +44,8 @@ typedef struct hicn_main_s
*/
u64 pit_lifetime_max_ms;
+ vnet_link_t link;
+
} hicn_main_t;
extern hicn_main_t hicn_main;
@@ -67,7 +70,8 @@ int
hicn_infra_plugin_enable_disable (int enable_disable,
int pit_max_size,
f64 pit_max_lifetime_sec_req,
- int cs_max_size);
+ int cs_max_size,
+ vnet_link_t link);
/* vlib nodes that compose the hICN forwarder */
diff --git a/hicn-plugin/src/route.c b/hicn-plugin/src/route.c
index b569d431e..3b774cd82 100644
--- a/hicn-plugin/src/route.c
+++ b/hicn-plugin/src/route.c
@@ -676,6 +676,13 @@ set_table_interface_add_del (vnet_main_t * vnm, u32 sw_if_index, u32 is_add)
if (!is_add)
return HICN_ERROR_NONE;
+ vnet_sw_interface_t * sw_int = vnet_get_sw_interface(vnm, sw_if_index);
+ vnet_hw_interface_t * hw_int = vnet_get_hw_interface(vnm, sw_int->hw_if_index);
+
+ char * mpls = "mpls";
+ if (strstr((char *)hw_int->name, mpls) == NULL)
+ return 0;
+
int rv = ip_table_bind (FIB_PROTOCOL_IP4, sw_if_index, HICN_FIB_TABLE, 1);
if (!rv)