aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMauro Sardara <msardara@cisco.com>2020-09-23 18:14:14 +0000
committerMauro Sardara <msardara@cisco.com>2020-09-23 18:14:14 +0000
commitbe464ae928413ce7f16fec5742fd6fe461906500 (patch)
tree10cc3b816ab122893829aa633a170f9edc7d2432
parent998aea92186890cc09adcb748647da147e3c54fd (diff)
[HICN-642] Porting of fixes for hicn_plugin punting api.host-stack
Signed-off-by: Mauro Sardara <msardara@cisco.com> Change-Id: Iaf626f3c94d7a37a0472fe781b09373f5e9370d9
-rw-r--r--CMakeLists.txt6
-rw-r--r--hicn-plugin/src/CMakeLists.txt10
-rw-r--r--hicn-plugin/src/hicn_plugin.c2
-rw-r--r--hicn-plugin/src/host_stack/cbr_proto.c5
-rw-r--r--hicn-plugin/src/network/route.c7
-rw-r--r--lib/includes/hicn/name.h68
-rw-r--r--lib/src/name.c12
-rw-r--r--libtransport/src/core/hicn_vapi.c2
8 files changed, 54 insertions, 58 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ba25ddb..56e7caa 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -106,6 +106,12 @@ set(SAFE_VAPI_INCLUDE_DIRS
"" FORCE
)
+set(HICNPLUGIN_INCLUDE_DIRS
+ ${CMAKE_CURRENT_SOURCE_DIR}/${BUILD_HICNPLUGIN_DIR}/includes
+ CACHE INTERNAL
+ "" FORCE
+)
+
foreach(dir ${subdirs})
add_subdirectory(${dir})
endforeach()
diff --git a/hicn-plugin/src/CMakeLists.txt b/hicn-plugin/src/CMakeLists.txt
index eca7e64..f9f925c 100644
--- a/hicn-plugin/src/CMakeLists.txt
+++ b/hicn-plugin/src/CMakeLists.txt
@@ -180,6 +180,10 @@ SET(HICN_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR} CACHE ST
set(COMPILE_FLAGS "-march=native")
set(COMPILE_DEFINITIONS "-DHICN_VPP_PLUGIN=1")
+if (NOT ${CMAKE_BUILD_TYPE} STREQUAL "Release")
+ set(COMPILE_DEFINITIONS ${COMPILE_DEFINITIONS} "-DCLIB_DEBUG")
+endif()
+
file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/hicn)
file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/vapi)
file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/vnet/ip)
@@ -238,7 +242,7 @@ build_library(hicn_plugin
SHARED
SOURCES ${HICN_PLUGIN_SOURCE_FILES} ${HICN_NETWORK_PLUGIN_SOURCE_FILES} ${HICN_HS_PLUGIN_SOURCE_FILES}
INSTALL_HEADERS ${HICN_API_HEADER_FILES} ${HICN_API_GENERATED_FILES}
- LINK_LIBRARIES ${LIBTRANSPORT_LIBRARIES} ${LIBHICN_LIBRARIES}
+ LINK_LIBRARIES ${LIBHICN_LIBRARIES}
DEPENDS ${DEPENDENCIES}
COMPONENT ${HICN_PLUGIN}
INCLUDE_DIRS ${HICN_PLUGIN_INCLUDE_DIRS_INTERNAL}
@@ -263,14 +267,14 @@ build_library(hicn_api_test_plugin
set_target_properties(hicn_plugin.shared
PROPERTIES
LINKER_LANGUAGE C
- INSTALL_RPATH "${VPP_INSTALL_PLUGIN}:${HICN_INSTALL_PREFIX}:/home/ubuntu/host-stack/vpp/build-root/install-vpp_debug-native/vpp/lib"
+ INSTALL_RPATH "${VPP_INSTALL_PLUGIN}:${HICN_INSTALL_PREFIX}:${VPP_HOME}/lib"
PREFIX ""
)
set_target_properties(hicn_api_test_plugin.shared
PROPERTIES
LINKER_LANGUAGE C
- INSTALL_RPATH "${VPP_INSTALL_PLUGIN}:${HICN_INSTALL_PREFIX}:/home/ubuntu/host-stack/vpp/build-root/install-vpp_debug-native/vpp/lib"
+ INSTALL_RPATH "${VPP_INSTALL_PLUGIN}:${HICN_INSTALL_PREFIX}:${VPP_HOME}/lib"
PREFIX ""
)
diff --git a/hicn-plugin/src/hicn_plugin.c b/hicn-plugin/src/hicn_plugin.c
index 5f28f01..b8acc5f 100644
--- a/hicn-plugin/src/hicn_plugin.c
+++ b/hicn-plugin/src/hicn_plugin.c
@@ -59,7 +59,7 @@ hicn_init(vlib_main_t *vm)
udp_tunnel_init();
/* Init the host stack module */
- hicn_hs_init(vm);
+ // hicn_hs_init(vm);
return error;
}
diff --git a/hicn-plugin/src/host_stack/cbr_proto.c b/hicn-plugin/src/host_stack/cbr_proto.c
index 54a851d..b87f257 100644
--- a/hicn-plugin/src/host_stack/cbr_proto.c
+++ b/hicn-plugin/src/host_stack/cbr_proto.c
@@ -16,8 +16,6 @@
#include "host_stack.h"
#include "inlines.h"
-#include <hicn/transport/protocols/transport_algorithm.h>
-
#define WINDOW_SIZE 200
typedef struct hicn_hs_cbr_proto_data_
@@ -35,9 +33,6 @@ reset_protocol(hicn_hs_cbr_proto_data_t *proto_data)
proto_data->in_flight_interests = 0;
proto_data->window_size = WINDOW_SIZE;
proto_data->next_seq_number = 0;
-
- TransportAlgorithm *t = transportAlgorithm_CreateRaaqm(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
- proto_data->next_seq_number = (u64)t;
}
static void
diff --git a/hicn-plugin/src/network/route.c b/hicn-plugin/src/network/route.c
index 3b774cd..b569d43 100644
--- a/hicn-plugin/src/network/route.c
+++ b/hicn-plugin/src/network/route.c
@@ -676,13 +676,6 @@ 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)
diff --git a/lib/includes/hicn/name.h b/lib/includes/hicn/name.h
index 9cee0bc..942c0f9 100644
--- a/lib/includes/hicn/name.h
+++ b/lib/includes/hicn/name.h
@@ -26,21 +26,22 @@
#include <stdbool.h>
#ifndef _WIN32
-#include <netinet/in.h> // struct sockadd
+#include <netinet/in.h> // struct sockadd
#endif
#include <hicn/util/ip_address.h>
#include "common.h"
+#include "error.h"
/******************************************************************************
* hICN names
******************************************************************************/
-#define TCP_SEQNO_LEN 4 /* bytes */
+#define TCP_SEQNO_LEN 4 /* bytes */
#define HICN_V4_PREFIX_LEN IPV4_ADDR_LEN
#define HICN_V6_PREFIX_LEN IPV6_ADDR_LEN
#define HICN_SEGMENT_LEN TCP_SEQNO_LEN
-#define HICN_V6_NAME_LEN (HICN_V6_PREFIX_LEN + HICN_SEGMENT_LEN) /* 20 bytes */
-#define HICN_V4_NAME_LEN (HICN_V4_PREFIX_LEN + HICN_SEGMENT_LEN) /* 8 bytes */
+#define HICN_V6_NAME_LEN (HICN_V6_PREFIX_LEN + HICN_SEGMENT_LEN) /* 20 bytes */
+#define HICN_V4_NAME_LEN (HICN_V4_PREFIX_LEN + HICN_SEGMENT_LEN) /* 8 bytes */
/* Prefix */
@@ -68,8 +69,7 @@ typedef union
u8 buffer[HICN_V6_NAME_LEN];
} hicn_name_t;
-always_inline
-int hicn_name_is_ip4 (const hicn_name_t * name)
+always_inline int hicn_name_is_ip4(const hicn_name_t *name)
{
const ip46_address_t *ip46 = &name->prefix;
return (((ip46)->pad[0] | (ip46)->pad[1] | (ip46)->pad[2]) == 0);
@@ -82,7 +82,7 @@ int hicn_name_is_ip4 (const hicn_name_t * name)
* @param [out] Resulting hICN name
* @return hICN error code
*/
-int hicn_name_create (const char *ip_address, u32 id, hicn_name_t * name);
+int hicn_name_create(const char *ip_address, u32 id, hicn_name_t *name);
/**
* @brief Create an hICN name from IP address
@@ -91,15 +91,15 @@ int hicn_name_create (const char *ip_address, u32 id, hicn_name_t * name);
* @param [out] Resulting - hICN name
* @return hICN error code
*/
-int hicn_name_create_from_ip_prefix (const ip_prefix_t * prefix, u32 id,
- hicn_name_t * name);
+int hicn_name_create_from_ip_prefix(const ip_prefix_t *prefix, u32 id,
+ hicn_name_t *name);
/**
* @brief Returns the length of an hICN name
* @param [in] name - hICN name
* @return Name length
*/
-u8 hicn_name_get_length (const hicn_name_t * name);
+u8 hicn_name_get_length(const hicn_name_t *name);
/**
* @brief Compare two hICN names
@@ -111,8 +111,8 @@ u8 hicn_name_get_length (const hicn_name_t * name);
* found, respectively, to be lest than, to match, or be greater than name_2
* based on numeric order.
*/
-int hicn_name_compare (const hicn_name_t * name_1, const hicn_name_t * name_2,
- bool consider_segment);
+int hicn_name_compare(const hicn_name_t *name_1, const hicn_name_t *name_2,
+ bool consider_segment);
/**
* @brief Provides a 32-bit hash of an hICN name
@@ -121,7 +121,17 @@ int hicn_name_compare (const hicn_name_t * name_1, const hicn_name_t * name_2,
* @param [in] consider_suffix - Consider the suffix in the hash computation
* @return hICN error code
*/
-int hicn_name_hash (const hicn_name_t * name, u32 * hash, bool consider_suffix);
+
+#if !HICN_VPP_PLUGIN
+
+always_inline int hicn_name_hash(const hicn_name_t *name, u32 *hash, bool consider_suffix)
+{
+ size_t size = (u8)consider_suffix * sizeof(hicn_name_suffix_t) + IPV6_ADDR_LEN;
+ *hash = hash32(name->buffer, size);
+ return HICN_LIB_ERROR_NONE;
+}
+
+#endif /* ! HICN_VPP_PLUGIN */
/**
* @brief Test whether an hICN name is empty
@@ -129,9 +139,9 @@ int hicn_name_hash (const hicn_name_t * name, u32 * hash, bool consider_suffix);
* @return 0 if the name is empty, any other value otherwise (implementation
* returns 1)
*/
-always_inline int hicn_name_empty (hicn_name_t * name)
+always_inline int hicn_name_empty(hicn_name_t *name)
{
- return ((name->prefix.ip6.as_u64[0] | name->prefix.ip6.as_u64[1] | (u64)name->suffix) == 0);
+ return ((name->prefix.ip6.as_u64[0] | name->prefix.ip6.as_u64[1] | (u64)name->suffix) != 0);
}
/**
@@ -140,7 +150,7 @@ always_inline int hicn_name_empty (hicn_name_t * name)
* @param [in] src - Source name to copy
* @return hICN error code
*/
-int hicn_name_copy (hicn_name_t * dst, const hicn_name_t * src);
+int hicn_name_copy(hicn_name_t *dst, const hicn_name_t *src);
/**
* @brief Copy an hICN name to a buffer
@@ -149,8 +159,8 @@ int hicn_name_copy (hicn_name_t * dst, const hicn_name_t * src);
* @param [in] copy_suffix - Flag indicating whether the suffix has to be
* considered
*/
-int hicn_name_copy_to_destination (u8 * dst, const hicn_name_t * src,
- bool copy_suffix);
+int hicn_name_copy_to_destination(u8 *dst, const hicn_name_t *src,
+ bool copy_suffix);
/**
* @brief Sets the segment part of an hICN name
@@ -158,7 +168,7 @@ int hicn_name_copy_to_destination (u8 * dst, const hicn_name_t * src,
* @param [in] seq_number - Segment identifier
* @return hICN error code
*/
-int hicn_name_set_seq_number (hicn_name_t * name, u32 seq_number);
+int hicn_name_set_seq_number(hicn_name_t *name, u32 seq_number);
/**
* @brief Retrieves the segment part of an hICN name
@@ -166,7 +176,7 @@ int hicn_name_set_seq_number (hicn_name_t * name, u32 seq_number);
* @param [in] seq_number - Segment identifier
* @return hICN error code
*/
-int hicn_name_get_seq_number (const hicn_name_t * name, u32 * seq_number);
+int hicn_name_get_seq_number(const hicn_name_t *name, u32 *seq_number);
/**
* @brief Convert an hICN name to a socket address
@@ -174,8 +184,8 @@ int hicn_name_get_seq_number (const hicn_name_t * name, u32 * seq_number);
* @param [out] ip_address - Resulting socket address
* @return hICN error code
*/
-int hicn_name_to_sockaddr_address (const hicn_name_t * name,
- struct sockaddr *ip_address);
+int hicn_name_to_sockaddr_address(const hicn_name_t *name,
+ struct sockaddr *ip_address);
/**
* @brief Convert an hICN name to an IP address
@@ -183,8 +193,8 @@ int hicn_name_to_sockaddr_address (const hicn_name_t * name,
* @param [out] ip_address - Resulting IP address
* @return hICN error code
*/
-int hicn_name_to_ip_prefix (const hicn_name_t * name,
- ip_prefix_t * ip_prefix);
+int hicn_name_to_ip_prefix(const hicn_name_t *name,
+ ip_prefix_t *ip_prefix);
/**
* @brief Convert an hICN name to presentation format
@@ -193,7 +203,7 @@ int hicn_name_to_ip_prefix (const hicn_name_t * name,
* @param [in] len - Number of bytes available in the buffer
* @return hICN error code
*/
-int hicn_name_ntop (const hicn_name_t * src, char *dst, size_t len);
+int hicn_name_ntop(const hicn_name_t *src, char *dst, size_t len);
/**
* @brief Convert an hICN name from presentation format
@@ -201,7 +211,7 @@ int hicn_name_ntop (const hicn_name_t * src, char *dst, size_t len);
* @param [out] dst - Resulting name
* @return hICN error code
*/
-int hicn_name_pton (const char *src, hicn_name_t * dst);
+int hicn_name_pton(const char *src, hicn_name_t *dst);
/**
* @brief Returns the IP address family of an hICN name
@@ -209,7 +219,7 @@ int hicn_name_pton (const char *src, hicn_name_t * dst);
* @param [out] family - Resulting IP address family (AF_INET or AF_INET6)
* @return hICN error code
*/
-int hicn_name_get_family (const hicn_name_t * name, int *family);
+int hicn_name_get_family(const hicn_name_t *name, int *family);
/**
* @brief Creates an hICN prefix from an IP address
@@ -217,8 +227,8 @@ int hicn_name_get_family (const hicn_name_t * name, int *family);
* @param [out] prefix - Resulting prefix
* @return hICN error code
*/
-int hicn_prefix_create_from_ip_prefix (const ip_prefix_t * ip_prefix,
- hicn_prefix_t * prefix);
+int hicn_prefix_create_from_ip_prefix(const ip_prefix_t *ip_prefix,
+ hicn_prefix_t *prefix);
#endif /* HICN_NAME_H */
diff --git a/lib/src/name.c b/lib/src/name.c
index 1aa54ad..45e329d 100644
--- a/lib/src/name.c
+++ b/lib/src/name.c
@@ -66,18 +66,6 @@ hicn_name_get_length (const hicn_name_t * name)
return hicn_name_is_ip4(name) ? HICN_V4_NAME_LEN : HICN_V4_NAME_LEN;
}
-#if ! HICN_VPP_PLUGIN
-
-int
-hicn_name_hash (const hicn_name_t * name, u32 * hash, bool consider_suffix)
-{
- size_t size = (u8)consider_suffix * sizeof(hicn_name_suffix_t) + IPV6_ADDR_LEN;
- *hash = hash32 (name->buffer, size);
- return HICN_LIB_ERROR_NONE;
-}
-
-#endif /* ! HICN_VPP_PLUGIN */
-
int
hicn_name_copy (hicn_name_t * dst, const hicn_name_t * src)
{
diff --git a/libtransport/src/core/hicn_vapi.c b/libtransport/src/core/hicn_vapi.c
index be556f3..b585f37 100644
--- a/libtransport/src/core/hicn_vapi.c
+++ b/libtransport/src/core/hicn_vapi.c
@@ -20,7 +20,7 @@
#include <hicn/transport/utils/log.h>
#include <core/hicn_vapi.h>
-#define HICN_VPP_PLUGIN
+#define HICN_VPP_PLUGIN 1
#include <hicn/name.h>
#undef HICN_VPP_PLUGIN