aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ctrl/libhicnctrl/src/hicn_plugin_api.c4
-rw-r--r--ctrl/sysrepo-plugins/hicn-plugin/plugin/hicn_plugin.c2
-rw-r--r--ctrl/sysrepo-plugins/hicn-plugin/plugin/ietf/ietf_interface.c17
-rw-r--r--hicn-plugin/CMakeLists.txt2
-rw-r--r--hicn-plugin/src/CMakeLists.txt16
-rw-r--r--hicn-plugin/src/faces/app/address_mgr.c26
-rw-r--r--hicn-plugin/src/faces/app/face_prod_node.c19
-rw-r--r--hicn-plugin/src/faces/face.h1
-rw-r--r--hicn-plugin/src/faces/ip/face_ip.c4
-rw-r--r--hicn-plugin/src/faces/ip/face_ip_node.c2
-rw-r--r--hicn-plugin/src/faces/ip/iface_ip_node.c2
-rw-r--r--hicn-plugin/src/faces/udp/face_udp.c8
-rw-r--r--hicn-plugin/src/faces/udp/face_udp_node.c4
-rw-r--r--hicn-plugin/src/hicn.api14
-rw-r--r--hicn-plugin/src/hicn.c4
-rw-r--r--hicn-plugin/src/hicn.h12
-rw-r--r--hicn-plugin/src/hicn_api.c84
-rw-r--r--hicn-plugin/src/hicn_api_test.c182
-rw-r--r--hicn-plugin/src/mapme.h2
-rw-r--r--hicn-plugin/src/mapme_ack_node.c2
-rw-r--r--hicn-plugin/src/mapme_ctrl_node.c2
-rw-r--r--hicn-plugin/src/punt.c1
-rw-r--r--hicn-plugin/src/punt.h3
-rw-r--r--hicn-plugin/src/route.c33
-rw-r--r--hicn-plugin/src/route.h3
-rw-r--r--hicn-plugin/src/strategy_dpo_ctx.h1
-rw-r--r--lib/includes/hicn/common.h1
-rw-r--r--libtransport/src/hicn/transport/core/hicn_vapi.c14
-rw-r--r--scripts/build-extras.sh6
-rw-r--r--scripts/build-packages.sh26
30 files changed, 202 insertions, 295 deletions
diff --git a/ctrl/libhicnctrl/src/hicn_plugin_api.c b/ctrl/libhicnctrl/src/hicn_plugin_api.c
index fc8954b65..70e0556a9 100644
--- a/ctrl/libhicnctrl/src/hicn_plugin_api.c
+++ b/ctrl/libhicnctrl/src/hicn_plugin_api.c
@@ -39,7 +39,7 @@
#include <hicn/util/map.h>
#include <hicn/error.h>
#include <vnet/ip/ip6_packet.h>
-#include <vnet/ip/ip_types_api.h>
+#include <vnet/ip/ip46_address.h>
#define APP_NAME "hicn_plugin"
#define MAX_OUTSTANDING_REQUESTS 4
@@ -1320,4 +1320,4 @@ u8 *
format_vl_api_address_union (u8 * s, va_list * args)
{
return NULL;
-} \ No newline at end of file
+}
diff --git a/ctrl/sysrepo-plugins/hicn-plugin/plugin/hicn_plugin.c b/ctrl/sysrepo-plugins/hicn-plugin/plugin/hicn_plugin.c
index 5072c3d6c..dc3ac16d4 100644
--- a/ctrl/sysrepo-plugins/hicn-plugin/plugin/hicn_plugin.c
+++ b/ctrl/sysrepo-plugins/hicn-plugin/plugin/hicn_plugin.c
@@ -39,7 +39,7 @@ int sr_plugin_init_cb(sr_session_ctx_t *session, void **private_ctx) {
hicn_subscribe_events(session, &subscription);
// IETF subscribe
- // ietf_subscribe_events(session, &subscription);
+ ietf_subscribe_events(session, &subscription);
/* set subscription as our private context */
diff --git a/ctrl/sysrepo-plugins/hicn-plugin/plugin/ietf/ietf_interface.c b/ctrl/sysrepo-plugins/hicn-plugin/plugin/ietf/ietf_interface.c
index b3d31ff80..b46b38b89 100644
--- a/ctrl/sysrepo-plugins/hicn-plugin/plugin/ietf/ietf_interface.c
+++ b/ctrl/sysrepo-plugins/hicn-plugin/plugin/ietf/ietf_interface.c
@@ -30,7 +30,6 @@
#include "../hicn_vpp_comm.h"
-
DEFINE_VAPI_MSG_IDS_INTERFACE_API_JSON;
typedef struct hicn_interface_
@@ -38,8 +37,8 @@ typedef struct hicn_interface_
u32 sw_if_index;
char interface_name[VPP_INTFC_NAME_LEN];
u8 l2_address[VPP_MAC_ADDRESS_LEN];
- u32 l2_address_length;
u64 link_speed;
+ u32 flags;
u16 link_mtu;
u8 admin_up_down;
u8 link_up_down;
@@ -293,8 +292,7 @@ ietf_sw_interface_dump_cb (struct vapi_ctx_s *ctx, void *callback_ctx,
thisIntfc->sw_if_index = reply->sw_if_index;
memcpy(thisIntfc->interface_name, reply->interface_name, VPP_INTFC_NAME_LEN);
- thisIntfc->l2_address_length = reply->l2_address_length;
- memcpy(thisIntfc->l2_address, reply->l2_address, reply->l2_address_length );
+ memcpy(thisIntfc->l2_address, reply->l2_address, VPP_MAC_ADDRESS_LEN );
//thisIntfc->link_speed = reply->link_speed;
#define ONE_MEGABIT (uint64_t)1000000
switch (reply->link_speed << VNET_HW_INTERFACE_FLAG_SPEED_SHIFT)
@@ -305,8 +303,7 @@ ietf_sw_interface_dump_cb (struct vapi_ctx_s *ctx, void *callback_ctx,
}
thisIntfc->link_mtu = reply->link_mtu;
- thisIntfc->admin_up_down = reply->admin_up_down;
- thisIntfc->link_up_down = reply->link_up_down;
+ thisIntfc->flags = reply->flags;
dctx->num_ifs += 1;
}
@@ -352,10 +349,10 @@ i32 ietf_interface_add_del_addr( u32 sw_if_index, u8 is_add, u8 is_ipv6, u8 del_
vapi_msg_sw_interface_add_del_address *msg = vapi_alloc_sw_interface_add_del_address(g_vapi_ctx_instance);
msg->payload.sw_if_index = sw_if_index;
msg->payload.is_add = is_add;
- msg->payload.is_ipv6 = is_ipv6;
+ msg->payload.prefix.address.af = is_ipv6 ? ADDRESS_IP6 : ADDRESS_IP4;
msg->payload.del_all = del_all;
- msg->payload.address_length = address_length;
- memcpy(msg->payload.address, address, VPP_IP6_ADDRESS_LEN);
+ msg->payload.prefix.len = address_length;
+ memcpy(msg->payload.prefix.address.un.ip6, address, VPP_IP6_ADDRESS_LEN);
if(vapi_sw_interface_add_del_address(g_vapi_ctx_instance,msg,call_sw_interface_add_del_address,NULL)!=VAPI_OK){
SRP_LOG_DBGMSG("Operation failed");
@@ -370,7 +367,7 @@ i32 ietf_setInterfaceFlags(u32 sw_if_index, u8 admin_up_down)
i32 ret = -1;
vapi_msg_sw_interface_set_flags *msg = vapi_alloc_sw_interface_set_flags(g_vapi_ctx_instance);
msg->payload.sw_if_index = sw_if_index;
- msg->payload.admin_up_down = admin_up_down;
+ msg->payload.flags = admin_up_down? IF_STATUS_API_FLAG_ADMIN_UP : 0;
if(vapi_sw_interface_set_flags(g_vapi_ctx_instance,msg,call_sw_interface_set_flags,NULL)!=VAPI_OK){
SRP_LOG_DBGMSG("Operation failed");
diff --git a/hicn-plugin/CMakeLists.txt b/hicn-plugin/CMakeLists.txt
index 038426838..ea933d8a0 100644
--- a/hicn-plugin/CMakeLists.txt
+++ b/hicn-plugin/CMakeLists.txt
@@ -39,4 +39,4 @@ include (Packaging)
add_subdirectory(src)
-add_subdirectory(vapi) \ No newline at end of file
+add_subdirectory(vapi)
diff --git a/hicn-plugin/src/CMakeLists.txt b/hicn-plugin/src/CMakeLists.txt
index 3e9b8f6d1..68c583e0b 100644
--- a/hicn-plugin/src/CMakeLists.txt
+++ b/hicn-plugin/src/CMakeLists.txt
@@ -200,24 +200,27 @@ execute_process(
COMMAND
bash -c
"if [ ! -e ${CMAKE_CURRENT_BINARY_DIR}/vapi_json_parser.py ]; then
- curl https://raw.githubusercontent.com/FDio/vpp/stable/1908/src/vpp-api/vapi/vapi_json_parser.py -o ${CMAKE_CURRENT_BINARY_DIR}/vapi_json_parser.py;
+ curl https://raw.githubusercontent.com/FDio/vpp/stable/2001/src/vpp-api/vapi/vapi_json_parser.py -o ${CMAKE_CURRENT_BINARY_DIR}/vapi_json_parser.py;
fi;
if [ ! -e ${CMAKE_CURRENT_BINARY_DIR}/vapi_c_gen.py ]; then
- curl https://raw.githubusercontent.com/FDio/vpp/stable/1908/src/vpp-api/vapi/vapi_c_gen.py -o ${CMAKE_CURRENT_BINARY_DIR}/vapi_c_gen.py;
+ curl https://raw.githubusercontent.com/FDio/vpp/stable/2001/src/vpp-api/vapi/vapi_c_gen.py -o ${CMAKE_CURRENT_BINARY_DIR}/vapi_c_gen.py;
fi;
if [ ! -e ${CMAKE_CURRENT_BINARY_DIR}/vapi_cpp_gen.py ]; then
- curl https://raw.githubusercontent.com/FDio/vpp/stable/1908/src/vpp-api/vapi/vapi_cpp_gen.py -o ${CMAKE_CURRENT_BINARY_DIR}/vapi_cpp_gen.py;
+ curl https://raw.githubusercontent.com/FDio/vpp/stable/2001/src/vpp-api/vapi/vapi_cpp_gen.py -o ${CMAKE_CURRENT_BINARY_DIR}/vapi_cpp_gen.py;
fi;
if [ ! -e ${CMAKE_CURRENT_BINARY_DIR}/vnet/ip/ip_types.api ]; then
- curl https://raw.githubusercontent.com/FDio/vpp/stable/1908/src/vnet/ip/ip_types.api -o ${CMAKE_CURRENT_BINARY_DIR}/vnet/ip/ip_types.api;
+ curl https://raw.githubusercontent.com/FDio/vpp/stable/2001/src/vnet/ip/ip_types.api -o ${CMAKE_CURRENT_BINARY_DIR}/vnet/ip/ip_types.api;
+ fi;
+ if [ ! -e ${CMAKE_CURRENT_BINARY_DIR}/vnet/ip/ip_format_fns.h ]; then
+ curl https://raw.githubusercontent.com/FDio/vpp/master/src/vnet/ip/ip_format_fns.h -o ${CMAKE_CURRENT_BINARY_DIR}/vnet/ip/ip_format_fns.h;
fi;
chmod +x ${CMAKE_CURRENT_BINARY_DIR}/vapi_json_parser.py ${CMAKE_CURRENT_BINARY_DIR}/vapi_c_gen.py ${CMAKE_CURRENT_BINARY_DIR}/vapi_cpp_gen.py"
)
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/vpp_plugins/hicn/hicn.api.h ${CMAKE_CURRENT_BINARY_DIR}/vapi/hicn.api.json
- COMMAND ${VPP_HOME}/bin/vppapigen ARGS --includedir ${CMAKE_CURRENT_BINARY_DIR} --input ${CMAKE_CURRENT_SOURCE_DIR}/hicn.api --output ${CMAKE_CURRENT_BINARY_DIR}/vpp_plugins/hicn/hicn.api.h
- COMMAND ${VPP_HOME}/bin/vppapigen ARGS JSON --includedir ${CMAKE_CURRENT_BINARY_DIR} --input ${CMAKE_CURRENT_SOURCE_DIR}/hicn.api --output ${CMAKE_CURRENT_BINARY_DIR}/vapi/hicn.api.json
+ COMMAND ${VPP_HOME}/bin/vppapigen ARGS --includedir ${CMAKE_CURRENT_BINARY_DIR} --input ${CMAKE_CURRENT_SOURCE_DIR}/hicn.api --output ${CMAKE_CURRENT_BINARY_DIR}/vpp_plugins/hicn/hicn.api.h --outputdir ${CMAKE_CURRENT_BINARY_DIR}/vpp_plugins/hicn/
+ COMMAND ${VPP_HOME}/bin/vppapigen ARGS JSON --includedir ${CMAKE_CURRENT_BINARY_DIR} --input ${CMAKE_CURRENT_SOURCE_DIR}/hicn.api --output ${CMAKE_CURRENT_BINARY_DIR}/vapi/hicn.api.json --outputdir ${CMAKE_CURRENT_BINARY_DIR}/vapi/
)
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/vapi/hicn.api.vapi.h ${CMAKE_CURRENT_BINARY_DIR}/vapi/hicn.api.vapi.hpp
COMMAND ${CMAKE_CURRENT_BINARY_DIR}/vapi_c_gen.py ARGS ${CMAKE_CURRENT_BINARY_DIR}/vapi/hicn.api.json
@@ -293,5 +296,6 @@ install(FILES ${HICN_VAPI_GENERATED_FILES}
set(HICNPLUGIN_INCLUDE_DIRS
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_BINARY_DIR}/vpp_plugins
+ ${VPP_INCLUDE_DIRS}
CACHE INTERNAL "" FORCE)
set(HICNPLUGIN_LIBRARIES ${VPP_LIBRARIES} CACHE INTERNAL "" FORCE) \ No newline at end of file
diff --git a/hicn-plugin/src/faces/app/address_mgr.c b/hicn-plugin/src/faces/app/address_mgr.c
index 76a7e0f6d..1674379c4 100644
--- a/hicn-plugin/src/faces/app/address_mgr.c
+++ b/hicn-plugin/src/faces/app/address_mgr.c
@@ -25,7 +25,7 @@
#include <vnet/ip/ip4.h> //ip4_add_del_ip_address
#include <vnet/ip/ip6.h> //ip6_add_del_ip_address
#include <vnet/fib/fib_types.h> //FIB_PROTOCOL_IP4/6, FIB_NODE_INDEX_INVALID
-#include <vnet/fib/fib_entry.h> //FIB_SOURCE_PLUGIN_HI
+#include <vnet/fib/fib_entry.h> //FIB_SOURCE_PRIORITY_HI
#include <vnet/fib/fib_table.h>
#include <vppinfra/format.h>
#include <vnet/interface.h> //appif_flags
@@ -89,19 +89,19 @@ get_two_ip4_addresses (ip4_address_t * appif_addr, ip4_address_t * nh_addr)
fib_pfx.fp_addr = to_ip46 ( /* is_v6 */ 0, appif_addr->as_u8);
fib_index = fib_table_find_or_create_and_lock (fib_pfx.fp_proto,
HICN_FIB_TABLE,
- FIB_SOURCE_PLUGIN_HI);
+ FIB_SOURCE_PRIORITY_HI);
fib_entry_index = fib_table_lookup_exact_match (fib_index, &fib_pfx);
- fib_table_unlock (fib_index, fib_pfx.fp_proto, FIB_SOURCE_PLUGIN_HI);
+ fib_table_unlock (fib_index, fib_pfx.fp_proto, FIB_SOURCE_PRIORITY_HI);
if (fib_entry_index != FIB_NODE_INDEX_INVALID)
{
fib_pfx.fp_addr = to_ip46 ( /* is_v6 */ 0, nh_addr->as_u8);
fib_index = fib_table_find_or_create_and_lock (fib_pfx.fp_proto,
HICN_FIB_TABLE,
- FIB_SOURCE_PLUGIN_HI);
+ FIB_SOURCE_PRIORITY_HI);
fib_entry_index =
fib_table_lookup_exact_match (fib_index, &fib_pfx);
fib_table_unlock (fib_index, fib_pfx.fp_proto,
- FIB_SOURCE_PLUGIN_HI);
+ FIB_SOURCE_PRIORITY_HI);
}
if (fib_entry_index != FIB_NODE_INDEX_INVALID)
{
@@ -141,19 +141,19 @@ get_two_ip6_addresses (ip6_address_t * appif_addr, ip6_address_t * nh_addr)
fib_pfx.fp_addr = to_ip46 ( /* is_v6 */ 1, appif_addr->as_u8);
fib_index = fib_table_find_or_create_and_lock (fib_pfx.fp_proto,
HICN_FIB_TABLE,
- FIB_SOURCE_PLUGIN_HI);
+ FIB_SOURCE_PRIORITY_HI);
fib_entry_index = fib_table_lookup_exact_match (fib_index, &fib_pfx);
- fib_table_unlock (fib_index, fib_pfx.fp_proto, FIB_SOURCE_PLUGIN_HI);
+ fib_table_unlock (fib_index, fib_pfx.fp_proto, FIB_SOURCE_PRIORITY_HI);
if (fib_entry_index != FIB_NODE_INDEX_INVALID)
{
fib_pfx.fp_addr = to_ip46 ( /* is_v6 */ 0, nh_addr->as_u8);
fib_index = fib_table_find_or_create_and_lock (fib_pfx.fp_proto,
HICN_FIB_TABLE,
- FIB_SOURCE_PLUGIN_HI);
+ FIB_SOURCE_PRIORITY_HI);
fib_entry_index =
fib_table_lookup_exact_match (fib_index, &fib_pfx);
fib_table_unlock (fib_index, fib_pfx.fp_proto,
- FIB_SOURCE_PLUGIN_HI);
+ FIB_SOURCE_PRIORITY_HI);
}
if (fib_entry_index != FIB_NODE_INDEX_INVALID)
{
@@ -184,9 +184,9 @@ get_ip4_address ()
fib_pfx.fp_addr = to_ip46 ( /* is_v6 */ 0, prefix->as_u8);
fib_index = fib_table_find_or_create_and_lock (fib_pfx.fp_proto,
HICN_FIB_TABLE,
- FIB_SOURCE_PLUGIN_HI);
+ FIB_SOURCE_PRIORITY_HI);
fib_entry_index = fib_table_lookup_exact_match (fib_index, &fib_pfx);
- fib_table_unlock (fib_index, fib_pfx.fp_proto, FIB_SOURCE_PLUGIN_HI);
+ fib_table_unlock (fib_index, fib_pfx.fp_proto, FIB_SOURCE_PRIORITY_HI);
increment_v4_address (prefix, 1);
}
while (fib_entry_index != FIB_NODE_INDEX_INVALID);
@@ -211,9 +211,9 @@ get_ip6_address ()
fib_pfx.fp_addr = to_ip46 ( /* is_v6 */ 1, prefix->as_u8);
fib_index = fib_table_find_or_create_and_lock (fib_pfx.fp_proto,
HICN_FIB_TABLE,
- FIB_SOURCE_PLUGIN_HI);
+ FIB_SOURCE_PRIORITY_HI);
fib_entry_index = fib_table_lookup_exact_match (fib_index, &fib_pfx);
- fib_table_unlock (fib_index, fib_pfx.fp_proto, FIB_SOURCE_PLUGIN_HI);
+ fib_table_unlock (fib_index, fib_pfx.fp_proto, FIB_SOURCE_PRIORITY_HI);
increment_v6_address (prefix, 1);
}
while (fib_entry_index != FIB_NODE_INDEX_INVALID);
diff --git a/hicn-plugin/src/faces/app/face_prod_node.c b/hicn-plugin/src/faces/app/face_prod_node.c
index 48e7c4259..e2967bf39 100644
--- a/hicn-plugin/src/faces/app/face_prod_node.c
+++ b/hicn-plugin/src/faces/app/face_prod_node.c
@@ -80,7 +80,7 @@ match_ip4_name (u32 * name, fib_prefix_t * prefix)
}
static_always_inline int
-match_ip6_name (u32x4 * name, fib_prefix_t * prefix)
+match_ip6_name (u8 * name, fib_prefix_t * prefix)
{
union
{
@@ -90,18 +90,13 @@ match_ip6_name (u32x4 * name, fib_prefix_t * prefix)
} xor_sum __attribute__ ((aligned (sizeof (u32x4))));
#ifdef CLIB_HAVE_VEC128
- if (U32X4_ALIGNED (name))
- { //SSE can't handle unaligned data
- xor_sum.as_u32x4 = *((u32x4 *) name) &
- UNION_CAST (prefix->fp_addr.ip6.as_u64[0], u32x4);
- }
- else
-#endif /* CLIB_HAVE_VEC128 */
- {
+ u32x4u *data = (u32x4u *)name;
+ xor_sum.as_u32x4 = *(data) &
+ UNION_CAST (prefix->fp_addr.ip6.as_u64[0], u32x4);
+#else
xor_sum.as_u64[0] = ((u64 *) name)[0] & prefix->fp_addr.ip6.as_u64[0];
xor_sum.as_u64[1] = ((u64 *) name)[1] & prefix->fp_addr.ip6.as_u64[1];
- }
-
+#endif /* CLIB_HAVE_VEC128 */
return (xor_sum.as_u64[0] == prefix->fp_addr.ip6.as_u64[0]) &&
(xor_sum.as_u64[1] == prefix->fp_addr.ip6.as_u64[1]);
}
@@ -120,7 +115,7 @@ hicn_face_prod_next_from_data_hdr (vlib_node_runtime_t * node,
}
else if (PREDICT_TRUE (v == 0x60 && !ip46_address_is_ip4 (&prefix->fp_addr)))
{
- match_res = match_ip6_name ((u32x4 *) & (ptr[8]), prefix);
+ match_res = match_ip6_name (& (ptr[8]), prefix);
}
return match_res ? HICN_FACE_PROD_NEXT_DATA_IP4 + (v ==
diff --git a/hicn-plugin/src/faces/face.h b/hicn-plugin/src/faces/face.h
index d4f7f356a..b758ece06 100644
--- a/hicn-plugin/src/faces/face.h
+++ b/hicn-plugin/src/faces/face.h
@@ -20,7 +20,6 @@
#include <vlib/vlib.h>
#include <vnet/dpo/dpo.h>
#include <vnet/adj/adj_types.h>
-
#include "../hicn.h"
typedef u8 hicn_face_flags_t;
diff --git a/hicn-plugin/src/faces/ip/face_ip.c b/hicn-plugin/src/faces/ip/face_ip.c
index d4ba158de..f4ae5429d 100644
--- a/hicn-plugin/src/faces/ip/face_ip.c
+++ b/hicn-plugin/src/faces/ip/face_ip.c
@@ -172,7 +172,7 @@ hicn_face_ip_del (hicn_face_id_t face_id)
* @brief Helper for handling midchain adjacencies
*/
void face_midchain_fixup_t (vlib_main_t * vm,
- struct ip_adjacency_t_ * adj,
+ const struct ip_adjacency_t_ * adj,
vlib_buffer_t * b0,
const void *data) {
vnet_buffer (b0)->sw_if_index[VLIB_TX] = 0;
@@ -213,7 +213,7 @@ hicn_face_ip_find_adj (const ip46_address_t * remote_addr,
{
u32 fib_index = fib_table_find_or_create_and_lock (fib_pfx.fp_proto,
HICN_FIB_TABLE,
- FIB_SOURCE_PLUGIN_HI);
+ FIB_SOURCE_PRIORITY_HI);
fib_entry_index = fib_table_lookup (fib_index, &fib_pfx);
diff --git a/hicn-plugin/src/faces/ip/face_ip_node.c b/hicn-plugin/src/faces/ip/face_ip_node.c
index 1229b4eaa..0eeeab6fb 100644
--- a/hicn-plugin/src/faces/ip/face_ip_node.c
+++ b/hicn-plugin/src/faces/ip/face_ip_node.c
@@ -589,7 +589,7 @@ hicn_face_rewrite_interest (vlib_main_t * vm, vlib_buffer_t * b0,
u32 fib_index = fib_table_find_or_create_and_lock (fib_pfx.fp_proto,
HICN_FIB_TABLE,
- FIB_SOURCE_PLUGIN_HI);
+ FIB_SOURCE_PRIORITY_HI);
fib_entry_index = fib_table_lookup (fib_index, &fib_pfx);
diff --git a/hicn-plugin/src/faces/ip/iface_ip_node.c b/hicn-plugin/src/faces/ip/iface_ip_node.c
index 62ccc514d..8adef50d9 100644
--- a/hicn-plugin/src/faces/ip/iface_ip_node.c
+++ b/hicn-plugin/src/faces/ip/iface_ip_node.c
@@ -13,11 +13,11 @@
* limitations under the License.
*/
-#include <hicn/hicn.h>
#include "face_ip.h"
#include "dpo_ip.h"
#include "../../strategy_dpo_manager.h"
#include "../face.h"
+#include "../../hicn.h"
#include "../../infra.h"
#include "../../cache_policies/cs_lru.h"
diff --git a/hicn-plugin/src/faces/udp/face_udp.c b/hicn-plugin/src/faces/udp/face_udp.c
index 54d773358..e2fa3227b 100644
--- a/hicn-plugin/src/faces/udp/face_udp.c
+++ b/hicn-plugin/src/faces/udp/face_udp.c
@@ -147,7 +147,7 @@ hicn_face_udp_add (const ip46_address_t * local_addr,
u32 fib_index = fib_table_find_or_create_and_lock (fib_pfx.fp_proto,
HICN_FIB_TABLE,
- FIB_SOURCE_PLUGIN_HI);
+ FIB_SOURCE_PRIORITY_HI);
fib_entry_index = fib_table_lookup (fib_index, &fib_pfx);
ip_adj = fib_entry_get_adj (fib_entry_index);
@@ -199,7 +199,7 @@ hicn_face_udp_add (const ip46_address_t * local_addr,
*pfaceid = hicn_dpoi_get_index (face);
dpo_proto = DPO_PROTO_IP4;
- fib_table_unlock (fib_index, fib_pfx.fp_proto, FIB_SOURCE_PLUGIN_HI);
+ fib_table_unlock (fib_index, fib_pfx.fp_proto, FIB_SOURCE_PRIORITY_HI);
}
else if (!ip46_address_is_ip4 (local_addr)
&& !ip46_address_is_ip4 (remote_addr))
@@ -211,7 +211,7 @@ hicn_face_udp_add (const ip46_address_t * local_addr,
u32 fib_index = fib_table_find_or_create_and_lock (fib_pfx.fp_proto,
HICN_FIB_TABLE,
- FIB_SOURCE_PLUGIN_HI);
+ FIB_SOURCE_PRIORITY_HI);
fib_entry_index = fib_table_lookup (fib_index, &fib_pfx);
ip_adj = fib_entry_get_adj (fib_entry_index);
@@ -254,7 +254,7 @@ hicn_face_udp_add (const ip46_address_t * local_addr,
*pfaceid = hicn_dpoi_get_index (face);
dpo_proto = DPO_PROTO_IP6;
- fib_table_unlock (fib_index, fib_pfx.fp_proto, FIB_SOURCE_PLUGIN_HI);
+ fib_table_unlock (fib_index, fib_pfx.fp_proto, FIB_SOURCE_PRIORITY_HI);
}
else
{
diff --git a/hicn-plugin/src/faces/udp/face_udp_node.c b/hicn-plugin/src/faces/udp/face_udp_node.c
index 232b86d70..c82336659 100644
--- a/hicn-plugin/src/faces/udp/face_udp_node.c
+++ b/hicn-plugin/src/faces/udp/face_udp_node.c
@@ -557,7 +557,7 @@ hicn_face_udp4_encap (vlib_main_t * vm,
u32 fib_index = fib_table_find_or_create_and_lock (fib_pfx.fp_proto,
HICN_FIB_TABLE,
- FIB_SOURCE_PLUGIN_HI);
+ FIB_SOURCE_PRIORITY_HI);
fib_entry_index = fib_table_lookup (fib_index, &fib_pfx);
@@ -625,7 +625,7 @@ hicn_face_udp6_encap (vlib_main_t * vm,
u32 fib_index = fib_table_find_or_create_and_lock (fib_pfx.fp_proto,
HICN_FIB_TABLE,
- FIB_SOURCE_PLUGIN_HI);
+ FIB_SOURCE_PRIORITY_HI);
fib_entry_index = fib_table_lookup (fib_index, &fib_pfx);
diff --git a/hicn-plugin/src/hicn.api b/hicn-plugin/src/hicn.api
index 673f67c43..b226dfe4d 100644
--- a/hicn-plugin/src/hicn.api
+++ b/hicn-plugin/src/hicn.api
@@ -16,13 +16,13 @@
option version = "5.1.0";
import "vnet/ip/ip_types.api";
-enum face_type
+enum hicn_face_type
{
IP_FACE = 0,
UDP_FACE,
};
-enum punt_type
+enum hicn_punt_type
{
IP_PUNT = 0,
UDP_PUNT,
@@ -375,7 +375,7 @@ define hicn_api_face_add
u32 context;
/* Type of face to add */
- vl_api_face_type_t type;
+ vl_api_hicn_face_type_t type;
/* Face to add */
vl_api_hicn_face_union_t face;
@@ -426,7 +426,7 @@ define hicn_api_faces_details
u32 faceid;
/* Type of face to add */
- vl_api_face_type_t type;
+ vl_api_hicn_face_type_t type;
/* Face to add */
vl_api_hicn_face_union_t face;
@@ -465,7 +465,7 @@ define hicn_api_face_get_reply
u32 faceid;
/* Type of face to add */
- vl_api_face_type_t type;
+ vl_api_hicn_face_type_t type;
/* Face to add */
vl_api_hicn_face_union_t face;
@@ -672,7 +672,7 @@ define hicn_api_punting_add
u32 context;
/* Type of punting rule */
- vl_api_punt_type_t type;
+ vl_api_hicn_punt_type_t type;
/* Prefix to match */
vl_api_hicn_punting_union_t rule;
@@ -696,7 +696,7 @@ define hicn_api_punting_del
u32 context;
/* Type of punting rule */
- vl_api_punt_type_t type;
+ vl_api_hicn_punt_type_t type;
/* Prefix to match */
vl_api_hicn_punting_union_t rule;
diff --git a/hicn-plugin/src/hicn.c b/hicn-plugin/src/hicn.c
index a30eac4ff..b4a26ec8f 100644
--- a/hicn-plugin/src/hicn.c
+++ b/hicn-plugin/src/hicn.c
@@ -27,6 +27,7 @@
#include "faces/app/address_mgr.h"
#include "face_db.h"
#include "faces/udp/face_udp.h"
+#include "route.h"
hicn_main_t hicn_main;
/* Module vars */
@@ -258,6 +259,9 @@ hicn_init (vlib_main_t * vm)
hicn_face_module_init (vm);
+ /* Init the route module*/
+ hicn_route_init();
+
return error;
}
diff --git a/hicn-plugin/src/hicn.h b/hicn-plugin/src/hicn.h
index 1b57ce9e2..b469a7ed9 100644
--- a/hicn-plugin/src/hicn.h
+++ b/hicn-plugin/src/hicn.h
@@ -16,7 +16,19 @@
#ifndef __HICN_H__
#define __HICN_H__
+#define ip_address_t hicn_ip_address_t
+#define ip_address_cmp hicn_ip_address_cmp
+#define ip_prefix_t hicn_ip_prefix_t
+#define ip_prefix_cmp hicn_ip_prefix_cmp
+#undef ip_prefix_len
+#define ip_prefix_len hicn_ip_prefix_len
#include <hicn/hicn.h>
+#undef ip_address_t
+#undef ip_address_cmp
+#undef ip_prefix_t
+#undef ip_prefix_cmp
+#undef ip_prefix_len
+#define ip_prefix_len(_a) (_a)->len
#include <netinet/in.h>
#include <vnet/ip/ip.h>
diff --git a/hicn-plugin/src/hicn_api.c b/hicn-plugin/src/hicn_api.c
index 639840647..4601ae316 100644
--- a/hicn-plugin/src/hicn_api.c
+++ b/hicn-plugin/src/hicn_api.c
@@ -23,8 +23,8 @@
#include <vlibmemory/api.h>
#include <vnet/dpo/load_balance.h>
#include <vnet/ip/ip_types_api.h>
+#include <vnet/ip/ip_format_fns.h>
-#include "hicn.h"
#include "faces/ip/face_ip.h"
#include "faces/udp/face_udp.h"
#include "infra.h"
@@ -41,55 +41,17 @@
#include "route.h"
/* define message IDs */
-#include <hicn/hicn_msg_enum.h>
+#include <hicn/hicn.api_enum.h>
+#include <hicn/hicn.api_types.h>
/* define generated endian-swappers */
#define vl_endianfun
#include <hicn/hicn_all_api_h.h>
#undef vl_endianfun
-/* instantiate all the print functions we know about */
-#define vl_print(handle, ...) vlib_cli_output (handle, __VA_ARGS__)
-#define vl_printfun
-#include <hicn/hicn_all_api_h.h>
-#undef vl_printfun
-
-/* Get the API version number */
-#define vl_api_version(n, v) static u32 api_version=(v);
-#include <hicn/hicn_all_api_h.h>
-#undef vl_api_version
-
#define REPLY_MSG_ID_BASE sm->msg_id_base
#include <vlibapi/api_helper_macros.h>
-/****** List of message types that this plugin understands ******/
-
-#define foreach_hicn_plugin_api_msg \
- _(HICN_API_NODE_PARAMS_SET, hicn_api_node_params_set) \
- _(HICN_API_NODE_PARAMS_GET, hicn_api_node_params_get) \
- _(HICN_API_NODE_STATS_GET, hicn_api_node_stats_get) \
- _(HICN_API_FACE_IP_ADD, hicn_api_face_ip_add) \
- _(HICN_API_FACE_IP_DEL, hicn_api_face_ip_del) \
- _(HICN_API_FACE_IP_PARAMS_GET, hicn_api_face_ip_params_get) \
- _(HICN_API_FACE_ADD, hicn_api_face_add) \
- _(HICN_API_FACE_DEL, hicn_api_face_del) \
- _(HICN_API_FACES_DUMP, hicn_api_faces_dump) \
- _(HICN_API_FACE_GET, hicn_api_face_get) \
- _(HICN_API_FACE_STATS_DUMP, hicn_api_face_stats_dump) \
- _(HICN_API_ROUTE_GET, hicn_api_route_get) \
- _(HICN_API_ROUTES_DUMP, hicn_api_routes_dump) \
- _(HICN_API_ROUTE_NHOPS_ADD, hicn_api_route_nhops_add) \
- _(HICN_API_ROUTE_DEL, hicn_api_route_del) \
- _(HICN_API_ROUTE_NHOP_DEL, hicn_api_route_nhop_del) \
- _(HICN_API_STRATEGIES_GET, hicn_api_strategies_get) \
- _(HICN_API_STRATEGY_GET, hicn_api_strategy_get) \
- _(HICN_API_PUNTING_ADD, hicn_api_punting_add) \
- _(HICN_API_PUNTING_DEL, hicn_api_punting_del) \
- _(HICN_API_REGISTER_PROD_APP, hicn_api_register_prod_app) \
- _(HICN_API_FACE_PROD_DEL, hicn_api_face_prod_del) \
- _(HICN_API_REGISTER_CONS_APP, hicn_api_register_cons_app) \
- _(HICN_API_FACE_CONS_DEL, hicn_api_face_cons_del)
-
/****** SUPPORTING FUNCTION DECLARATIONS ******/
/*
@@ -352,7 +314,7 @@ vl_api_hicn_api_face_add_t_handler (vl_api_hicn_api_face_add_t * mp)
hicn_main_t *sm = &hicn_main;
hicn_face_id_t face_id;
- vl_api_face_type_t face_type = clib_net_to_host_u32(mp->type);
+ vl_api_hicn_face_type_t face_type = clib_net_to_host_u32(mp->type);
switch (face_type)
{
@@ -1044,49 +1006,15 @@ vl_api_hicn_api_face_cons_del_t_handler (vl_api_hicn_api_face_cons_del_t * mp)
/************************************************************************************/
-#define vl_msg_name_crc_list
-#include <hicn/hicn_all_api_h.h>
-#undef vl_msg_name_crc_list
-
-static void
-setup_message_id_table (hicn_main_t * hm, api_main_t * am)
-{
-#define _(id,n,crc) \
- vl_msg_api_add_msg_name_crc (am, #n "_" #crc, id + hm->msg_id_base);
- foreach_vl_msg_name_crc_hicn;
-#undef _
-}
-
+#include <hicn/hicn.api.c>
/* Set up the API message handling tables */
clib_error_t *
hicn_api_plugin_hookup (vlib_main_t * vm)
{
hicn_main_t *hm = &hicn_main;
- api_main_t *am = &api_main;
-
- /* Get a correctly-sized block of API message decode slots */
- u8 *name = format (0, "hicn_%08x%c", api_version, 0);
- hm->msg_id_base = vl_msg_api_get_msg_ids ((char *) name,
- VL_MSG_FIRST_AVAILABLE);
- vec_free (name);
-
-#define _(N, n) \
- vl_msg_api_set_handlers(hm->msg_id_base + VL_API_##N, \
- #n, \
- vl_api_##n##_t_handler, \
- vl_noop_handler, \
- vl_api_##n##_t_endian, \
- vl_api_##n##_t_print, \
- sizeof(vl_api_##n##_t), 1);
- foreach_hicn_plugin_api_msg;
-#undef _
-
- /*
- * Set up the (msg_name, crc, message-id) table
- */
- setup_message_id_table (hm, am);
+ hm->msg_id_base = setup_message_id_table ();
return 0;
}
diff --git a/hicn-plugin/src/hicn_api_test.c b/hicn-plugin/src/hicn_api_test.c
index 704e66352..3e93300d7 100644
--- a/hicn-plugin/src/hicn_api_test.c
+++ b/hicn-plugin/src/hicn_api_test.c
@@ -24,46 +24,20 @@
#include <vnet/ip/ip6_packet.h>
#include <vnet/ip/format.h>
#include <vnet/ip/ip_types_api.h>
+#include <vnet/ip/ip_format_fns.h>
#define __plugin_msg_base hicn_test_main.msg_id_base
#include <vlibapi/vat_helper_macros.h>
+#include <vpp/api/vpe.api_types.h>
+
#include <hicn/hicn_api.h>
#include "error.h"
-// uword unformat_sw_if_index(unformat_input_t * input, va_list * args);
/* Declare message IDs */
#include "hicn_msg_enum.h"
-/* define message structures */
-#define vl_typedefs
-#include <vpp/api/vpe_all_api_h.h>
-#include <hicn/hicn_all_api_h.h>
-#undef vl_typedefs
-
-/* Get CRC codes of the messages defined outside of this plugin */
-#define vl_msg_name_crc_list
-#include <vpp/api/vpe_all_api_h.h>
-#undef vl_msg_name_crc_list
-
-/* declare message handlers for each api */
-
-#define vl_endianfun /* define message structures */
-#include "hicn_all_api_h.h"
-#undef vl_endianfun
-
-/* instantiate all the print functions we know about */
-#define vl_print(handle, ...)
-#define vl_printfun
-#include "hicn_all_api_h.h"
-#undef vl_printfun
-
-/* Get the API version number. */
-#define vl_api_version(n, v) static u32 api_version=(v);
-#include "hicn_all_api_h.h"
-#undef vl_api_version
-
/* SUPPORTING FUNCTIONS NOT LOADED BY VPP_API_TEST */
uword
unformat_ip46_address (unformat_input_t * input, va_list * args)
@@ -253,9 +227,8 @@ _(hicn_api_face_del_reply) \
_(hicn_api_route_nhops_add_reply) \
_(hicn_api_route_del_reply) \
_(hicn_api_route_nhop_del_reply) \
-_(hicn_api_punting_add_reply) \
-_(hicn_api_face_cons_del_reply) \
-_(hicn_api_face_prod_del_reply)
+_(hicn_api_punting_add_reply) \
+_(hicn_api_punting_del_reply)
#define _(n) \
static void vl_api_##n##_t_handler \
@@ -608,6 +581,34 @@ api_hicn_api_face_udp_add (vat_main_t * vam)
return ret;
}
+static int
+api_hicn_api_face_add (vat_main_t * vam)
+{
+ unformat_input_t *input = vam->input;
+ int ret = HICN_ERROR_NONE;
+ u32 type = ~0;
+
+ /* Parse args required to build the message */
+ while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
+ {
+ if (unformat
+ (input, "type %d", &type));
+ else
+ {
+ break;
+ }
+ }
+
+ vam->input = input;
+
+ if (type == IP_FACE)
+ ret = api_hicn_api_face_ip_add(vam);
+ else if (type == UDP_FACE)
+ ret = api_hicn_api_face_udp_add(vam);
+
+ return ret;
+}
+
static void
vl_api_hicn_api_face_add_reply_t_handler
(vl_api_hicn_api_face_add_reply_t * rmp)
@@ -1553,6 +1554,38 @@ api_hicn_api_udp_punting_add (vat_main_t * vam)
return ret;
}
+static int
+api_hicn_api_punting_add (vat_main_t * vam)
+{
+ unformat_input_t *input = vam->input;
+ u32 type = ~0;
+ int ret = 0;
+
+ while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
+ {
+ if (unformat (input, "type %d", &type))
+ {;
+ }
+ else
+ {
+ break;
+ }
+ }
+
+ vam->input = input;
+ if (type == IP_PUNT)
+ ret = api_hicn_api_ip_punting_add (vam);
+ else if (type == UDP_PUNT)
+ ret = api_hicn_api_udp_punting_add (vam);
+
+ return ret;
+}
+
+static int
+api_hicn_api_punting_del (vat_main_t * vam)
+{
+ return 0;
+}
static int
api_hicn_api_register_prod_app (vat_main_t * vam)
@@ -1753,90 +1786,7 @@ static void
format_ip46_address, IP46_TYPE_ANY, &src_addr6);
}
-/*
- * List of messages that the api test plugin sends, and that the data plane
- * plugin processes
- */
-#define foreach_vpe_api_msg \
-_(hicn_api_node_params_set, "PIT size <sz> CS size <sz>" \
- "PIT minlimit <f> PIT maxlimit <f> [disable] ") \
-_(hicn_api_node_params_get, "") \
-_(hicn_api_node_stats_get, "") \
-_(hicn_api_face_ip_del, "face <faceID>") \
-_(hicn_api_face_ip_add, "local <address> remote <address> intfc <swif>")\
-_(hicn_api_face_udp_add, "local <address> port <port> remote <address> port <port> intfc <swif>") \
-_(hicn_api_face_del, "face <faceID>") \
-_(hicn_api_faces_dump, "") \
-_(hicn_api_face_get, "face <faceID>") \
-_(hicn_api_face_stats_dump, "") \
-_(hicn_api_route_nhops_add, "add prefix <IP4/IP6>/<subnet> face <faceID> weight <weight>") \
-_(hicn_api_face_ip_params_get, "face <faceID>") \
-_(hicn_api_route_get, "prefix <IP4/IP6>/<subnet>") \
-_(hicn_api_routes_dump, "") \
-_(hicn_api_route_del, "prefix <IP4/IP6>/<subnet>") \
-_(hicn_api_route_nhop_del, "del prefix <IP4/IP6>/<subnet> face <faceID>") \
-_(hicn_api_strategies_get, "") \
-_(hicn_api_strategy_get, "strategy <id>") \
-_(hicn_api_ip_punting_add, "prefix <IP4/IP6>/<subnet> intfc <swif>") \
-_(hicn_api_udp_punting_add, "prefix <IP4/IP6>/<subnet> intfc <swif> sport <port> dport <port> ip4/ip6") \
-_(hicn_api_register_prod_app, "prefix <IP4/IP6>/<subnet> id <appif_id>") \
-_(hicn_api_face_prod_del, "face <faceID>") \
-_(hicn_api_register_cons_app, "") \
-_(hicn_api_face_cons_del, "face <faceID>")
-
-void
-hicn_vat_api_hookup (vat_main_t * vam)
-{
- hicn_test_main_t *sm = &hicn_test_main;
- /* Hook up handlers for replies from the data plane plug-in */
-#define _(N, n) \
- vl_msg_api_set_handlers((VL_API_##N + sm->msg_id_base), \
- #n, \
- vl_api_##n##_t_handler, \
- vl_noop_handler, \
- vl_api_##n##_t_endian, \
- vl_api_##n##_t_print, \
- sizeof(vl_api_##n##_t), 1);
- foreach_vpe_api_reply_msg;
-#undef _
-
- /* API messages we can send */
-#define _(n, h) hash_set_mem (vam->function_by_name, #n, api_##n);
- foreach_vpe_api_msg;
-#undef _
-
- /* Help strings */
-#define _(n, h) hash_set_mem (vam->help_by_name, #n, h);
- foreach_vpe_api_msg;
-#undef _
-}
-
-clib_error_t *
-vat_plugin_register (vat_main_t * vam)
-{
- hicn_test_main_t *sm = &hicn_test_main;
- u8 *name;
-
- sm->vat_main = vam;
-
- /* Ask the vpp engine for the first assigned message-id */
- name = format (0, "hicn_%08x%c", api_version, 0);
- sm->msg_id_base = vl_client_get_first_plugin_msg_id ((char *) name);
-
- /* Get the control ping ID */
-#define _(id,n,crc) \
- const char *id ## _CRC __attribute__ ((unused)) = #n "_" #crc;
- foreach_vl_msg_name_crc_vpe;
-#undef _
- sm->ping_id = vl_msg_api_get_msg_index ((u8 *) (VL_API_CONTROL_PING_CRC));
-
- if (sm->msg_id_base != (u16) ~ 0)
- hicn_vat_api_hookup (vam);
-
- vec_free (name);
-
- return 0;
-}
+#include <hicn/hicn.api_test.c>
/*
* fd.io coding-style-patch-verification: ON
diff --git a/hicn-plugin/src/mapme.h b/hicn-plugin/src/mapme.h
index 5b89e5709..071590ede 100644
--- a/hicn-plugin/src/mapme.h
+++ b/hicn-plugin/src/mapme.h
@@ -18,7 +18,7 @@
#include <vnet/dpo/load_balance.h>
#include <vnet/buffer.h>
-#include <hicn/hicn.h>
+//#include <hicn/hicn.h>
#include <hicn/mapme.h>
#include "hicn.h"
diff --git a/hicn-plugin/src/mapme_ack_node.c b/hicn-plugin/src/mapme_ack_node.c
index 4f377447d..ebb12a124 100644
--- a/hicn-plugin/src/mapme_ack_node.c
+++ b/hicn-plugin/src/mapme_ack_node.c
@@ -14,8 +14,8 @@
*/
#include <vnet/ip/ip6_packet.h>
-#include <hicn/hicn.h>
+#include "hicn.h"
#include "mapme.h"
#include "mapme_ack.h"
#include "mapme_eventmgr.h"
diff --git a/hicn-plugin/src/mapme_ctrl_node.c b/hicn-plugin/src/mapme_ctrl_node.c
index 3985f3073..cef3d0944 100644
--- a/hicn-plugin/src/mapme_ctrl_node.c
+++ b/hicn-plugin/src/mapme_ctrl_node.c
@@ -18,8 +18,8 @@
*/
#include <vnet/ip/ip6_packet.h>
#include <vnet/dpo/load_balance.h>
-#include <hicn/hicn.h>
+#include "hicn.h"
#include "mapme.h"
#include "mapme_ctrl.h"
#include "mapme_eventmgr.h"
diff --git a/hicn-plugin/src/punt.c b/hicn-plugin/src/punt.c
index 74d4c1056..d62cf992d 100644
--- a/hicn-plugin/src/punt.c
+++ b/hicn-plugin/src/punt.c
@@ -27,7 +27,6 @@
#include <vnet/ethernet/packet.h>
#include <vnet/fib/fib_types.h>
#include <vlib/global_funcs.h>
-#include <hicn/hicn.h>
#include "hicn.h"
#include "infra.h"
diff --git a/hicn-plugin/src/punt.h b/hicn-plugin/src/punt.h
index 7ad96c791..0e821ccb7 100644
--- a/hicn-plugin/src/punt.h
+++ b/hicn-plugin/src/punt.h
@@ -18,7 +18,8 @@
#include <vppinfra/error.h>
#include <vnet/fib/fib_types.h>
-#include <hicn/hicn.h>
+#include "hicn.h"
+#include <vnet/classify/vnet_classify.h>
#define HICN_CLASSIFY_TABLE_MEMORY_SIZE (2*1024*1024) // 2MB allocated for the classification table
#define HICN_PUNTING_BUFFER_SIZE_32 (32)
diff --git a/hicn-plugin/src/route.c b/hicn-plugin/src/route.c
index 5ece5cfdb..85ad9f729 100644
--- a/hicn-plugin/src/route.c
+++ b/hicn-plugin/src/route.c
@@ -27,6 +27,10 @@
#include "error.h"
#include "strategies/dpo_mw.h"
+#define FIB_SOURCE_HICN 0x04 //Right after the FIB_SOURCE_INTERFACE priority
+
+fib_source_t hicn_fib_src;
+
int
hicn_route_get_dpo (const fib_prefix_t * prefix,
const dpo_id_t ** hicn_dpo, u32 * fib_index)
@@ -44,7 +48,7 @@ hicn_route_get_dpo (const fib_prefix_t * prefix,
*/
*fib_index = fib_table_find_or_create_and_lock (prefix->fp_proto,
HICN_FIB_TABLE,
- FIB_SOURCE_PLUGIN_HI);
+ hicn_fib_src);
fib_entry_index = fib_table_lookup_exact_match (*fib_index, prefix);
if (fib_entry_index != FIB_NODE_INDEX_INVALID)
@@ -81,7 +85,7 @@ hicn_route_get_dpo (const fib_prefix_t * prefix,
* Remove the lock from the table. We keep one lock per route, not
* per dpo
*/
- fib_table_unlock (*fib_index, prefix->fp_proto, FIB_SOURCE_PLUGIN_HI);
+ fib_table_unlock (*fib_index, prefix->fp_proto, hicn_fib_src);
return ret;
}
@@ -220,12 +224,12 @@ hicn_route_add (hicn_face_id_t * face_id, u32 len,
fib_node_index_t new_fib_node_index =
fib_table_entry_special_dpo_add (fib_index,
prefix,
- FIB_SOURCE_PLUGIN_HI,
+ hicn_fib_src,
FIB_ENTRY_FLAG_EXCLUSIVE,
&dpo);
/* We added a route, therefore add one lock to the table */
- fib_table_lock (fib_index, prefix->fp_proto, FIB_SOURCE_PLUGIN_HI);
+ fib_table_lock (fib_index, prefix->fp_proto, hicn_fib_src);
dpo_unlock (&dpo);
ret =
@@ -259,13 +263,12 @@ hicn_route_del (fib_prefix_t * prefix)
if (ret == HICN_ERROR_NONE)
{
- fib_table_entry_special_remove (HICN_FIB_TABLE, prefix,
- FIB_SOURCE_PLUGIN_HI);
+ fib_table_entry_special_remove (HICN_FIB_TABLE, prefix, hicn_fib_src);
/*
* Remove the lock from the table. We keep one lock per route
*/
- fib_table_unlock (fib_index, prefix->fp_proto, FIB_SOURCE_PLUGIN_HI);
+ fib_table_unlock (fib_index, prefix->fp_proto, hicn_fib_src);
}
//Remember to remove the lock from the table when removing the entry
return ret;
@@ -289,12 +292,13 @@ hicn_route_del_nhop (fib_prefix_t * prefix, hicn_face_id_t face_id)
vft_id = hicn_dpo_get_vft_id (hicn_dpo_id);
dpo_vft = hicn_dpo_get_vft (vft_id);
ret = dpo_vft->hicn_dpo_del_nh (face_id, hicn_dpo_id->dpoi_index,
- prefix);
+ prefix);
- hicn_dpo_ctx_t * dpo_ctx = dpo_vft->hicn_dpo_get_ctx(hicn_dpo_id->dpoi_index);
+ hicn_dpo_ctx_t *dpo_ctx =
+ dpo_vft->hicn_dpo_get_ctx (hicn_dpo_id->dpoi_index);
if (ret == HICN_ERROR_NONE && !dpo_ctx->entry_count)
- ret = hicn_route_del(prefix);
+ ret = hicn_route_del (prefix);
}
//Remember to remove the lock from the table when removing the entry
return ret;
@@ -349,7 +353,7 @@ hicn_route_set_strategy (fib_prefix_t * prefix, u8 strategy_id)
fib_node_index_t new_fib_node_index =
fib_table_entry_special_dpo_update (fib_index,
prefix,
- FIB_SOURCE_PLUGIN_HI,
+ hicn_fib_src,
FIB_ENTRY_FLAG_EXCLUSIVE,
&new_dpo_id);
@@ -364,6 +368,13 @@ hicn_route_set_strategy (fib_prefix_t * prefix, u8 strategy_id)
}
+void
+hicn_route_init ()
+{
+ hicn_fib_src = fib_source_allocate ("hicn",
+ FIB_SOURCE_HICN, FIB_SOURCE_BH_API);
+}
+
/*
* fd.io coding-style-patch-verification: ON
*
diff --git a/hicn-plugin/src/route.h b/hicn-plugin/src/route.h
index f6e32d8e0..5877f31a8 100644
--- a/hicn-plugin/src/route.h
+++ b/hicn-plugin/src/route.h
@@ -52,6 +52,9 @@ int hicn_route_del_nhop (fib_prefix_t * prefix, u32 face_id);
int
hicn_route_set_strategy (fib_prefix_t * prefix, u32 strategy_id);
+/* Init route internal strustures */
+void
+hicn_route_init();
#endif /* //__HICN_ROUTE__ */
/*
diff --git a/hicn-plugin/src/strategy_dpo_ctx.h b/hicn-plugin/src/strategy_dpo_ctx.h
index c6de6b78c..00b11412b 100644
--- a/hicn-plugin/src/strategy_dpo_ctx.h
+++ b/hicn-plugin/src/strategy_dpo_ctx.h
@@ -19,7 +19,6 @@
#include <vnet/dpo/dpo.h>
#include <vnet/fib/fib_table.h>
-#include "hicn.h"
#include "params.h"
#include "faces/face.h"
diff --git a/lib/includes/hicn/common.h b/lib/includes/hicn/common.h
index 33323da1b..30f370241 100644
--- a/lib/includes/hicn/common.h
+++ b/lib/includes/hicn/common.h
@@ -143,6 +143,7 @@ struct iovec
#include <vnet/ip/ip4_packet.h> // ip4_address_t
#include <vnet/ip/ip6_packet.h> // ip6_address_t
+#include <vnet/ip/ip46_address.h>
#else
diff --git a/libtransport/src/hicn/transport/core/hicn_vapi.c b/libtransport/src/hicn/transport/core/hicn_vapi.c
index 9cb96231a..af7fa5a03 100644
--- a/libtransport/src/hicn/transport/core/hicn_vapi.c
+++ b/libtransport/src/hicn/transport/core/hicn_vapi.c
@@ -33,12 +33,10 @@
#include <vnet/ip/format.h>
#include <vnet/ip/ip4_packet.h>
#include <vnet/ip/ip6_packet.h>
-#include <vnet/ip/ip_types_api.h>
#include <vnet/fib/fib_types.h>
#include <vpp_plugins/hicn/error.h>
#include <vapi/hicn.api.vapi.h>
-//#include <vpp_plugins/hicn/hicn_api.h>
/////////////////////////////////////////////////////
const char *HICN_ERROR_STRING[] = {
@@ -52,16 +50,6 @@ const char *HICN_ERROR_STRING[] = {
u8 *
format_vl_api_address_union (u8 * s, va_list * args)
{
- // const vl_api_address_union_t *addr =
- // va_arg (*args, vl_api_address_union_t *);
- // vl_api_address_family_t af = va_arg (*args, vl_api_address_family_t);
-
- // if (ADDRESS_IP6 == af)
- // s = format (s, "%U", format_ip6_address, addr->ip6);
- // else
- // s = format (s, "%U", format_ip4_address, addr->ip4);
-
- // return s;
return NULL;
}
@@ -98,7 +86,7 @@ int hicn_vapi_register_prod_app(
vapi_lock();
vapi_msg_hicn_api_register_prod_app * msg = vapi_alloc_hicn_api_register_prod_app(ctx);
- if(ip46_address_is_ip4(&input_params->prefix->address)) {
+ if(ip46_address_is_ip4((ip46_address_t *)&input_params->prefix->address)) {
memcpy(&msg->payload.prefix.address.un.ip4, &input_params->prefix->address, sizeof(ip4_address_t));
msg->payload.prefix.address.af = ADDRESS_IP4;
} else {
diff --git a/scripts/build-extras.sh b/scripts/build-extras.sh
index cbf2113ba..4112298a8 100644
--- a/scripts/build-extras.sh
+++ b/scripts/build-extras.sh
@@ -22,10 +22,10 @@ PACKAGECLOUD_RELEASE_REPO_DEB="https://packagecloud.io/install/repositories/fdio
PACKAGECLOUD_RELEASE_REPO_RPM="https://packagecloud.io/install/repositories/fdio/release/script.rpm.sh"
VPP_GIT_REPO="https://git.fd.io/vpp"
-VPP_BRANCH="stable/1908"
+VPP_BRANCH="stable/2001"
-VPP_VERSION_DEB="19.08.1-release"
-VPP_VERSION_RPM="19.08.1-release.x86_64"
+VPP_VERSION_DEB="20.01-release"
+VPP_VERSION_RPM="20.01-release.x86_64"
BUILD_TOOLS_UBUNTU="build-essential doxygen"
LIBSSL_LIBEVENT_UBUNTU="libevent-dev libssl-dev"
diff --git a/scripts/build-packages.sh b/scripts/build-packages.sh
index 3efd92cc4..6ec32c0a7 100644
--- a/scripts/build-packages.sh
+++ b/scripts/build-packages.sh
@@ -22,10 +22,10 @@ PACKAGECLOUD_RELEASE_REPO_DEB="https://packagecloud.io/install/repositories/fdio
PACKAGECLOUD_RELEASE_REPO_RPM="https://packagecloud.io/install/repositories/fdio/release/script.rpm.sh"
VPP_GIT_REPO="https://git.fd.io/vpp"
-VPP_BRANCH="stable/1908"
+VPP_BRANCH="stable/2001"
-VPP_VERSION_DEB="19.08.1-release"
-VPP_VERSION_RPM="19.08.1-release.x86_64"
+VPP_VERSION_DEB="20.01-release"
+VPP_VERSION_RPM="20.01-release.x86_64"
BUILD_TOOLS_UBUNTU="build-essential doxygen"
LIBSSL_LIBEVENT_UBUNTU="libevent-dev libssl-dev"
@@ -44,6 +44,22 @@ DEPS_UBUNTU="libparc-dev \
sysrepo \
python3-ply"
+
+DEPS_UBUNTU_NOVERSION="libparc-dev \
+ libmemif-dev \
+ libmemif \
+ libasio-dev \
+ libconfig-dev \
+ libcurl4-openssl-dev \
+ vpp \
+ vpp-dev \
+ libvppinfra \
+ libvppinfra-dev \
+ vpp-plugin-core \
+ libyang \
+ sysrepo \
+ python3-ply"
+
DEPS_CMAKE_UBUNTU="curl"
# BUILD_TOOLS_GROUP_CENTOS="'Development Tools'"
@@ -102,7 +118,7 @@ setup_fdio_repo() {
if [ "${DISTRIB_ID}" == "ubuntu" ]; then
rm -r /etc/apt/sources.list.d/*
- curl -s ${PACKAGECLOUD_RELEASE_REPO_DEB} | sudo bash
+ curl -s ${PACKAGECLOUD_RELEASE_REPO_DEB} | sudo bash
elif [ "${DISTRIB_ID}" == "centos" ]; then
curl -s ${PACKAGECLOUD_RELEASE_REPO_RPM} | sudo bash
curl ${LATEST_EPEL_REPO} > epel-release-latest-7.noarch.rpm
@@ -140,7 +156,7 @@ setup() {
# Install dependencies
if [ ${DISTRIB_ID} == "ubuntu" ]; then
- echo ${BUILD_TOOLS_UBUNTU} ${DEPS_UBUNTU} | xargs sudo ${apt_get} install -y --allow-unauthenticated --no-install-recommends
+ echo ${BUILD_TOOLS_UBUNTU} ${DEPS_UBUNTU_NOVERSION} | xargs sudo ${apt_get} install -y --allow-unauthenticated --no-install-recommends
elif [ ${DISTRIB_ID} == "centos" ]; then
# echo ${BUILD_TOOLS_GROUP_CENTOS} | xargs sudo yum groupinstall -y --nogpgcheck
echo ${DEPS_CENTOS} | xargs sudo yum install -y --nogpgcheck