aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt2
-rw-r--r--apps/CMakeLists.txt20
-rw-r--r--apps/cmake/Modules/Packaging.cmake4
-rw-r--r--apps/higet/CMakeLists.txt4
-rw-r--r--apps/http-proxy/CMakeLists.txt17
-rw-r--r--apps/http-server/CMakeLists.txt16
-rw-r--r--hicn-plugin/src/cli.c11
-rw-r--r--hicn-plugin/src/faces/ip/face_ip_cli.c61
-rw-r--r--hicn-plugin/src/hicn_api.c63
-rw-r--r--hicn-plugin/src/hicn_api_test.c10
-rw-r--r--hicn-plugin/src/punt.c142
-rw-r--r--hicn-plugin/src/punt.h14
-rw-r--r--hicn-plugin/src/route.c2
-rw-r--r--libtransport/src/hicn/transport/protocols/cbr.cc6
-rw-r--r--libtransport/src/hicn/transport/protocols/cbr.h2
-rw-r--r--libtransport/src/hicn/transport/protocols/protocol.h1
-rw-r--r--libtransport/src/hicn/transport/protocols/raaqm.cc4
-rw-r--r--libtransport/src/hicn/transport/protocols/rtc.cc8
-rw-r--r--scripts/build-packages.sh9
-rw-r--r--utils/CMakeLists.txt9
20 files changed, 274 insertions, 131 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9a4136e3e..63c438fd8 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -79,8 +79,6 @@ if (BUILD_HICNPLUGIN AND "${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
)
set(LIBTRANSPORT ${LIBTRANSPORT}-memif)
- set(HICN_UTILS ${HICN_UTILS}-memif)
- set(HICN_APPS ${HICN_APPS}-memif)
endif()
## Shared targets
diff --git a/apps/CMakeLists.txt b/apps/CMakeLists.txt
index 766c9c7e5..5fed15380 100644
--- a/apps/CMakeLists.txt
+++ b/apps/CMakeLists.txt
@@ -25,8 +25,6 @@ set(CMAKE_MODULE_PATH
include(BuildMacros)
include(WindowsMacros)
-find_package(Asio REQUIRED)
-
if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)
find_package(Libtransport REQUIRED)
include_directories(${LIBTRANSPORT_INCLUDE_DIRS})
@@ -38,20 +36,28 @@ else()
)
endif()
+set(SUFFIX "")
+if (${LIBTRANSPORT_LIBRARIES} MATCHES ".*-memif.*")
+ set(SUFFIX "-memif")
+endif()
+
+set(HICN_APPS "${HICN_APPS}${SUFFIX}")
+
list(APPEND LIBRARIES
${LIBTRANSPORT_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT}
)
-include(Packaging)
-
-set(COMPILER_DEFINITIONS "")
-
-
if (WIN32)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4200 /wd4996")
endif ()
+include(Packaging)
+
+set(HIGET higet)
+set(HTTP_SERVER hicn-http-sever)
+set(HTTP_PROXY hicn-http-proxy)
+
add_subdirectory(http-server)
add_subdirectory(http-proxy)
add_subdirectory(higet) \ No newline at end of file
diff --git a/apps/cmake/Modules/Packaging.cmake b/apps/cmake/Modules/Packaging.cmake
index 6a6e34777..fb5043e46 100644
--- a/apps/cmake/Modules/Packaging.cmake
+++ b/apps/cmake/Modules/Packaging.cmake
@@ -18,11 +18,11 @@ useful for testing and debugging within a hicn network."
)
set(${HICN_APPS}_DEB_DEPENDENCIES
- "lib${LIBTRANSPORT} (>= stable_version)"
+ "lib${LIBTRANSPORT} (>= stable_version), libcurl4"
CACHE STRING "Dependencies for deb/rpm package."
)
set(${HICN_APPS}_RPM_DEPENDENCIES
- "lib${LIBTRANSPORT} >= stable_version"
+ "lib${LIBTRANSPORT} >= stable_version, libcurl"
CACHE STRING "Dependencies for deb/rpm package."
) \ No newline at end of file
diff --git a/apps/higet/CMakeLists.txt b/apps/higet/CMakeLists.txt
index 5dcae66b2..8c7188c49 100644
--- a/apps/higet/CMakeLists.txt
+++ b/apps/higet/CMakeLists.txt
@@ -26,10 +26,10 @@ list(APPEND APPS_SRC
higet.cc
)
-build_executable(higet
+build_executable(${HIGET}
SOURCES ${APPS_SRC}
LINK_LIBRARIES ${LIBTRANSPORT_LIBRARIES} ${WSOCK32_LIBRARY} ${WS2_32_LIBRARY}
DEPENDS ${LIBTRANSPORT}
- COMPONENT higet
+ COMPONENT ${HICN_APPS}
DEFINITIONS ${COMPILER_DEFINITIONS}
)
diff --git a/apps/http-proxy/CMakeLists.txt b/apps/http-proxy/CMakeLists.txt
index 3d6b9c672..010a2c2b6 100644
--- a/apps/http-proxy/CMakeLists.txt
+++ b/apps/http-proxy/CMakeLists.txt
@@ -14,11 +14,6 @@
cmake_minimum_required(VERSION 3.5 FATAL_ERROR)
set(CMAKE_CXX_STANDARD 14)
-if (NOT CMAKE_BUILD_TYPE)
- message(STATUS "No build type selected, default to Release")
- set(CMAKE_BUILD_TYPE "Release")
-endif()
-
set(CMAKE_MODULE_PATH
${CMAKE_MODULE_PATH}
"${CMAKE_SOURCE_DIR}/cmake/Modules/"
@@ -49,7 +44,9 @@ set(APP_SOURCE_FILES
main.cc
)
-build_library(httpproxylib
+set(LIBHTTP_PROXY hicnhttpproxy)
+
+build_library(${LIBHTTP_PROXY}
STATIC
SOURCES ${LIB_SOURCE_FILES}
LINK_LIBRARIES ${LIBRARIES}
@@ -57,10 +54,10 @@ build_library(httpproxylib
INCLUDE_DIRS ${LIBTRANSPORT_INCLUDE_DIRS}
)
-build_executable(hicn-http-proxy
+build_executable(${HTTP_PROXY}
SOURCES ${APP_SOURCE_FILES}
- LINK_LIBRARIES httpproxylib
- DEPENDS httpproxylib
- COMPONENT hicn-http-proxy
+ LINK_LIBRARIES ${LIBHTTP_PROXY}
+ DEPENDS ${LIBHTTP_PROXY}
+ COMPONENT ${HICN_APPS}
DEFINITIONS ${COMPILER_DEFINITIONS}
) \ No newline at end of file
diff --git a/apps/http-server/CMakeLists.txt b/apps/http-server/CMakeLists.txt
index 94aa9d43a..bedb6afc1 100644
--- a/apps/http-server/CMakeLists.txt
+++ b/apps/http-server/CMakeLists.txt
@@ -58,27 +58,25 @@ set(APP_SOURCE_FILES
)
include_directories(
- ${CMAKE_BINARY_DIR}/apps/http-server
http-server
http-client
)
-build_library(hicn-httpserver
+set(LIBHTTP_SERVER hicnhttpserver)
+
+build_library(${LIBHTTP_SERVER}
STATIC
- SOURCES ${LIB_SOURCE_FILES} ${LIB_SERVER_HEADER_FILES} ${LIB_CLIENT_HEADER_FILES}
- INSTALL_HEADERS ${HEADER_FILES}
+ SOURCES ${LIB_SOURCE_FILES}
LINK_LIBRARIES ${LIBRARIES}
DEPENDS ${DEPENDENCIES}
- COMPONENT lib${LIBTRANSPORT}
INCLUDE_DIRS ${LIBTRANSPORT_INCLUDE_DIRS}
- INSTALL_ROOT_DIR hicn/transport
DEFINITIONS ${COMPILER_DEFINITIONS}
)
-build_executable(hicn-http-server
+build_executable(${HTTP_SERVER}
SOURCES ${APP_SOURCE_FILES}
- LINK_LIBRARIES hicn-httpserver ${WSOCK32_LIBRARY} ${WS2_32_LIBRARY}
- DEPENDS hicn-httpserver
+ LINK_LIBRARIES ${LIBHTTP_SERVER} ${WSOCK32_LIBRARY} ${WS2_32_LIBRARY}
+ DEPENDS ${LIBHTTP_SERVER}
COMPONENT ${HICN_APPS}
DEFINITIONS ${COMPILER_DEFINITIONS}
)
diff --git a/hicn-plugin/src/cli.c b/hicn-plugin/src/cli.c
index 12a65495a..3905e0af1 100644
--- a/hicn-plugin/src/cli.c
+++ b/hicn-plugin/src/cli.c
@@ -658,7 +658,7 @@ hicn_cli_punting_command_fn (vlib_main_t * vm, unformat_input_t * main_input,
clib_host_to_net_u16
(src_port),
clib_host_to_net_u16
- (dst_port));
+ (dst_port), NO_L2);
else
return (clib_error_return
(0,
@@ -667,8 +667,8 @@ hicn_cli_punting_command_fn (vlib_main_t * vm, unformat_input_t * main_input,
else
{
ret =
- hicn_punt_interest_data_for_ethernet (vm, &prefix, subnet_mask,
- sw_if_index, type);
+ hicn_punt_interest_data_for_ip (vm, &prefix, subnet_mask,
+ sw_if_index, type, NO_L2);
}
}
break;
@@ -689,9 +689,10 @@ hicn_cli_punting_command_fn (vlib_main_t * vm, unformat_input_t * main_input,
ret = ip46_address_is_ip4 (&prefix) ?
hicn_punt_remove_ip4_address (vm, &(prefix.ip4), subnet_mask, 1,
sw_if_index,
- 0) :
+ 0, NO_L2) :
hicn_punt_remove_ip6_address (vm, (ip6_address_t *) & prefix,
- subnet_mask, 1, sw_if_index, 0);
+ subnet_mask, 1, sw_if_index, 0,
+ NO_L2);
}
}
break;
diff --git a/hicn-plugin/src/faces/ip/face_ip_cli.c b/hicn-plugin/src/faces/ip/face_ip_cli.c
index 534ae7f63..ba7765541 100644
--- a/hicn-plugin/src/faces/ip/face_ip_cli.c
+++ b/hicn-plugin/src/faces/ip/face_ip_cli.c
@@ -60,10 +60,12 @@ hicn_face_ip_cli_set_command_fn (vlib_main_t * vm,
else if (unformat (line_input, "add"))
{
face_op = HICN_FACE_ADD;
- if (unformat (line_input, "local %U remote %U intfc %U",
- unformat_ip46_address, &local_addr, IP46_TYPE_ANY,
- unformat_ip46_address, &remote_addr, IP46_TYPE_ANY,
- unformat_vnet_sw_interface, vnm, &sw_if));
+ if (unformat (line_input, "local %U ",
+ unformat_ip46_address, &local_addr, IP46_TYPE_ANY));
+ else if (unformat (line_input, "remote %U intfc %U",
+ unformat_ip46_address, &remote_addr,
+ IP46_TYPE_ANY, unformat_vnet_sw_interface, vnm,
+ &sw_if));
else
{
return clib_error_return (0, "%s '%U'",
@@ -90,6 +92,57 @@ hicn_face_ip_cli_set_command_fn (vlib_main_t * vm,
}
}
+ if (ip46_address_is_zero (&local_addr))
+ {
+ if (!vnet_sw_interface_is_valid (vnm, sw_if))
+ return clib_error_return (0, "interface not valid");
+
+ if (ip46_address_is_ip4 (&remote_addr))
+ {
+ ip_interface_address_t *interface_address;
+ ip4_address_t *addr =
+ ip4_interface_address_matching_destination (&ip4_main,
+ &remote_addr.ip4,
+ sw_if,
+ &interface_address);
+
+ if (addr == NULL)
+ addr = ip4_interface_first_address (&ip4_main,
+ sw_if, &interface_address);
+
+ if (addr == NULL)
+ return clib_error_return (0,
+ "no valid ip address on interface %d",
+ sw_if);
+
+ ip46_address_set_ip4 (&local_addr, addr);
+ }
+ else
+ {
+ ip_interface_address_t *interface_address;
+ ip6_interface_address_matching_destination (&ip6_main,
+ &remote_addr.ip6, sw_if,
+ &interface_address);
+
+ ip6_address_t *addr = NULL;
+ if (interface_address != NULL)
+ addr =
+ (ip6_address_t *)
+ ip_interface_address_get_address (&ip6_main.lookup_main,
+ interface_address);
+
+ if (addr == NULL)
+ addr = ip6_interface_first_address (&ip6_main, sw_if);
+
+ if (addr == NULL)
+ return clib_error_return (0,
+ "no valid ip address on interface %d",
+ sw_if);
+
+ ip46_address_set_ip6 (&local_addr, addr);
+ }
+ }
+
int rv;
switch (face_op)
{
diff --git a/hicn-plugin/src/hicn_api.c b/hicn-plugin/src/hicn_api.c
index 6249d6e5e..b4d518774 100644
--- a/hicn-plugin/src/hicn_api.c
+++ b/hicn-plugin/src/hicn_api.c
@@ -208,15 +208,68 @@ vl_api_hicn_api_face_ip_add_t_handler (vl_api_hicn_api_face_ip_add_t * mp)
remote_addr.as_u64[1] =
clib_net_to_host_u64 (((u64 *) (&mp->remote_addr))[1]);
- u32 swif = clib_net_to_host_u32 (mp->swif);
+ u32 sw_if = clib_net_to_host_u32 (mp->swif);
+
+ if (ip46_address_is_zero (&local_addr))
+ {
+ if (vnet_sw_interface_is_valid (vnm, sw_if))
+ {
+ rv = HICN_ERROR_NONE;
+ }
+
+ if (rv == HICN_ERROR_NONE && ip46_address_is_ip4 (&remote_addr))
+ {
+ ip_interface_address_t *interface_address;
+ ip4_address_t *addr =
+ ip4_interface_address_matching_destination (&ip4_main,
+ &remote_addr.ip4,
+ sw_if,
+ &interface_address);
+ if (addr == NULL)
+ addr = ip4_interface_first_address (&ip4_main,
+ sw_if, &interface_address);
+
+ if (addr == NULL)
+ rv = HICN_ERROR_UNSPECIFIED;
+ else
+ ip46_address_set_ip4 (&local_addr, addr);
+ }
+ else
+ {
+ ip_interface_address_t *interface_address;
+ ip6_interface_address_matching_destination (&ip6_main,
+ &remote_addr.ip6, sw_if,
+ &interface_address);
+ ip6_address_t *addr = NULL;
+ if (rv == HICN_ERROR_NONE && interface_address != NULL)
+ {
+ addr =
+ (ip6_address_t *)
+ ip_interface_address_get_address (&ip6_main.lookup_main,
+ interface_address);
+ }
+ else
+ {
+ addr = ip6_interface_first_address (&ip6_main, sw_if);
+ }
- if (vnet_get_sw_interface_safe (vnm, swif) != NULL)
- rv = hicn_face_ip_add (&local_addr, &remote_addr, swif, &faceid);
+ if (addr == NULL)
+ rv = HICN_ERROR_UNSPECIFIED;
+ else
+ ip46_address_set_ip6 (&local_addr, addr);
+ }
+ }
+
+ if (rv == HICN_ERROR_NONE)
+ rv = hicn_face_ip_add (&local_addr, &remote_addr, sw_if, &faceid);
+ else
+ faceid = HICN_FACE_NULL;
/* *INDENT-OFF* */
REPLY_MACRO2 (VL_API_HICN_API_FACE_IP_ADD_REPLY /* , rmp, mp, rv */ ,(
{
- rmp->faceid = clib_host_to_net_u16 ((u16) faceid);
+ rmp->faceid = clib_host_to_net_u16 ((u32) faceid);
+ rmp->retval = rv;
}));
/* *INDENT-ON* */
}
@@ -500,7 +553,7 @@ static void vl_api_hicn_api_punting_add_t_handler
u32 swif = clib_net_to_host_u32 (mp->swif);
rv =
- hicn_punt_interest_data_for_ethernet (vm, &prefix, subnet_mask, swif, 0);
+ hicn_punt_interest_data_for_ip (vm, &prefix, subnet_mask, swif, 0, NO_L2);
REPLY_MACRO (VL_API_HICN_API_PUNTING_ADD_REPLY /* , rmp, mp, rv */ );
}
diff --git a/hicn-plugin/src/hicn_api_test.c b/hicn-plugin/src/hicn_api_test.c
index 909bc540f..4225f0078 100644
--- a/hicn-plugin/src/hicn_api_test.c
+++ b/hicn-plugin/src/hicn_api_test.c
@@ -362,11 +362,9 @@ api_hicn_api_face_ip_add (vat_main_t * vam)
}
/* Check for presence of both addresses */
- if ((!ip46_address_is_zero (&local_addr)
- && ! !ip46_address_is_zero (&remote_addr)))
+ if (ip46_address_is_zero (&remote_addr))
{
- clib_warning
- ("Incomplete IP face. Please specify local and remote address");
+ clib_warning ("Incomplete IP face. Please specify remote address");
return (1);
}
/* Construct the API message */
@@ -558,7 +556,7 @@ api_hicn_api_face_stats_dump (vat_main_t * vam)
/* memif-details message handler */
static void
-vl_api_hicn_api_face_stats_details_t_handler
+ vl_api_hicn_api_face_stats_details_t_handler
(vl_api_hicn_api_face_stats_details_t * mp)
{
vat_main_t *vam = hicn_test_main.vat_main;
@@ -1071,7 +1069,7 @@ _(hicn_api_node_params_set, "PIT size <sz> CS size <sz>" \
_(hicn_api_node_params_get, "") \
_(hicn_api_node_stats_get, "") \
_(hicn_api_face_ip_del, "face <faceID>") \
-_(hicn_api_face_ip_add, "add <swif> <address>") \
+_(hicn_api_face_ip_add, "local <address> remote <address> intfc <swif>")\
_(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>") \
diff --git a/hicn-plugin/src/punt.c b/hicn-plugin/src/punt.c
index ea553bf76..68c0bafb9 100644
--- a/hicn-plugin/src/punt.c
+++ b/hicn-plugin/src/punt.c
@@ -89,11 +89,11 @@ ip_version_t ipv66 = {
.ip_version = 0x60,
};
-#define _(NAME, BASE, LAYER, FIELD, PUNT_ID) \
- field_t NAME = { \
- .offset = BASE + offsetof(LAYER, FIELD), \
- .len = STRUCT_SIZE_OF(LAYER, FIELD), \
- .punt_id = PUNT_ID, \
+#define _(NAME, BASE, LAYER, FIELD, PUNT_ID) \
+ field_t NAME = { \
+ .offset = BASE + offsetof(LAYER, FIELD), \
+ .len = STRUCT_SIZE_OF(LAYER, FIELD), \
+ .punt_id = PUNT_ID, \
};
foreach_field
#undef _
@@ -108,7 +108,6 @@ foreach_field
#define NEXT_MAPME_ACK4 hicn_punt_glb.next_hit_data_ipv4
#define NEXT_MAPME_CTRL6 hicn_punt_glb.next_hit_interest_ipv6
#define NEXT_MAPME_ACK6 hicn_punt_glb.next_hit_data_ipv6
-
/* Maximum number of vector allowed in match. Value hardcoded in vnet_classify_hash_packet_inline in vnet_classify.h */
#define MAX_MATCH_SIZE 5
/**
@@ -117,7 +116,7 @@ foreach_field
*
*
*/
-hicn_punt_glb_t hicn_punt_glb;
+ hicn_punt_glb_t hicn_punt_glb;
/**
* We use the function build_bit_array to populate an initially empty buffer
@@ -371,28 +370,29 @@ hicn_punt_add_del_vnettbl (ip_version_t * ip, field_t * field, u8 mask,
int
hicn_punt_add_del_vnettbl_udp (ip_version_t * outer, ip_version_t * inner,
field_t * field, u8 mask, u32 next_tbl_index,
- u32 intfc, u8 base_offset, int is_add)
+ u32 intfc, u8 base_offset, u8 use_current_data,
+ int is_add)
{
u8 udp_mask[inner->addr_len_bits];
build_ip_address_mask (mask, udp_mask, sizeof (udp_mask));
u16 port_value = 0xffff;
u8 protocol_value = 0xff;
-
+
return _hicn_punt_add_del_vnettbl (outer, field->punt_id, mask,
next_tbl_index, intfc, base_offset,
is_add,
- HICN_CLASSIFY_NO_CURRENT_DATA_FLAG,
+ use_current_data,
outer->protocol_field, &protocol_value,
outer->udp_sport, &port_value,
outer->udp_dport, &port_value, field,
udp_mask, NULL);
}
-#define hicn_punt_add_vnettbl_udp(outer, inner, field, mask, next_tbl_index, intfc, base_offset) \
- (hicn_punt_add_del_vnettbl_udp(outer, inner, field, mask, next_tbl_index, intfc, base_offset, OP_ADD))
+#define hicn_punt_add_vnettbl_udp(outer, inner, field, mask, next_tbl_index, intfc, base_offset, use_current_data) \
+ (hicn_punt_add_del_vnettbl_udp(outer, inner, field, mask, next_tbl_index, intfc, base_offset, use_current_data, OP_ADD))
-#define hicn_punt_del_vnettbl_udp(outer, inner, field, mask, next_tbl_index, intfc, base_offset) \
- (hicn_punt_add_del_vnettbl_udp(outer, inner, field, mask, next_tbl_index, intfc, base_offset, OP_DEL))
+#define hicn_punt_del_vnettbl_udp(outer, inner, field, mask, next_tbl_index, intfc, base_offset, use_current_data) \
+ (hicn_punt_add_del_vnettbl_udp(outer, inner, field, mask, next_tbl_index, intfc, base_offset, use_current_data, OP_DEL))
/**
* @brief Add or remove a vnet session matching the list of fields/values passed
@@ -481,7 +481,7 @@ hicn_punt_add_del_vnetssn_udp (ip_version_t * outer, ip_version_t * inner,
u8 mask, u32 next_hit_index, u32 intfc,
u8 base_offset, u8 protocol, u16 sport,
u16 dport, int is_add)
-{
+{
return _hicn_punt_add_del_vnetssn (outer, field->punt_id, mask,
next_hit_index, intfc, base_offset,
is_add, outer->protocol_field, &protocol,
@@ -520,7 +520,7 @@ hicn_punt_enable_disable_vnet_ip4_table_on_intf (vlib_main_t * vm,
int
hicn_punt_remove_ip4_address (vlib_main_t * vm, ip4_address_t * addr,
u8 mask, int skip, u32 sw_if_index,
- int is_enable)
+ int is_enable, u8 with_l2)
{
vnet_classify_main_t *cm = &vnet_classify_main;
@@ -528,7 +528,7 @@ hicn_punt_remove_ip4_address (vlib_main_t * vm, ip4_address_t * addr,
u32 table_index = ~0;
- u32 base_offset = (skip ? ETH_L2 : NO_L2);
+ u32 base_offset = (with_l2 ? ETH_L2 : NO_L2);
ip46_address_t addr46;
ip46_address_set_ip4 (&addr46, addr);
@@ -562,7 +562,7 @@ hicn_punt_remove_ip4_address (vlib_main_t * vm, ip4_address_t * addr,
int
hicn_punt_remove_ip6_address (vlib_main_t * vm, ip6_address_t * addr,
u8 mask, int skip, u32 sw_if_index,
- int is_enable)
+ int is_enable, u8 with_l2)
{
vnet_classify_main_t *cm = &vnet_classify_main;
@@ -570,7 +570,7 @@ hicn_punt_remove_ip6_address (vlib_main_t * vm, ip6_address_t * addr,
u32 table_index = ~0;
- u32 base_offset = (skip ? ETH_L2 : NO_L2);
+ u32 base_offset = (with_l2 ? ETH_L2 : NO_L2);
hicn_punt_del_vnetssn (&ipv6, &ipv6_src, (ip46_address_t *) addr, mask,
hicn_punt_glb.next_hit_data_ipv6, sw_if_index,
@@ -763,10 +763,16 @@ hicn_punt_init (vlib_main_t * vm)
u32
hicn_punt_interest_data_for_udp (vlib_main_t * vm,
ip46_address_t * prefix, u8 mask,
- u32 swif, u8 punt_type, u16 sport, u16 dport)
+ u32 swif, u8 punt_type, u16 sport, u16 dport,
+ u8 with_l2)
{
int skip = 1;
u32 table_index;
+ // If we want l2 then we punt from data (and not current)
+ u8 use_current_data =
+ with_l2 ? HICN_CLASSIFY_NO_CURRENT_DATA_FLAG :
+ HICN_CLASSIFY_CURRENT_DATA_FLAG;
+ u8 base_offset = with_l2 ? ETH_L2 : NO_L2;
if (punt_type != HICN_PUNT_IP_TYPE && punt_type != HICN_PUNT_UDP4_TYPE
&& punt_type != HICN_PUNT_UDP6_TYPE)
@@ -779,16 +785,18 @@ hicn_punt_interest_data_for_udp (vlib_main_t * vm,
if (punt_type == HICN_PUNT_UDP4_TYPE)
{
- skip = 2;
+ //If we consider ethernet we can skip 32 bytes, otherwise only 16
+ skip = 1 + with_l2;
/* Create Vnet table for a given mask */
hicn_punt_add_vnettbl_udp (&ipv44, &ipv4, &udp44_src, mask, ~0,
- swif, ETH_L2);
+ swif, base_offset, use_current_data);
table_index =
hicn_punt_glb.udp44_vnet_tbl_idx[swif][skip][HICN_PUNT_SRC][mask];
hicn_punt_add_vnettbl_udp (&ipv44, &ipv4, &udp44_dst, mask,
- table_index, swif, ETH_L2);
+ table_index, swif, base_offset,
+ use_current_data);
/*
* Add a session for the specified ip address and
* subnet mask
@@ -796,28 +804,32 @@ hicn_punt_interest_data_for_udp (vlib_main_t * vm,
hicn_punt_add_vnetssn_udp (&ipv44, &ipv4, &udp44_src,
prefix, mask,
hicn_punt_glb.next_hit_data_udp4,
- swif, ETH_L2, IPPROTO_UDP, sport, dport);
+ swif, base_offset, IPPROTO_UDP, sport,
+ dport);
hicn_punt_add_vnetssn_udp (&ipv44, &ipv4, &udp44_dst,
prefix, mask,
hicn_punt_glb.next_hit_interest_udp4,
- swif, ETH_L2, IPPROTO_UDP, sport, dport);
+ swif, base_offset, IPPROTO_UDP, sport,
+ dport);
hicn_punt_enable_disable_vnet_ip4_table_on_intf (vm, swif,
OP_ENABLE);
}
else //PUNTING is UDP6
{
- skip = 3;
+ //If we consider ethernet we can skip 48 bytes, otherwise only 32
+ skip = 2 + with_l2;
/* Create Vnet table for a given mask */
hicn_punt_add_vnettbl_udp (&ipv64, &ipv6, &udp64_src, mask, ~0,
- swif, ETH_L2);
+ swif, base_offset, use_current_data);
table_index =
hicn_punt_glb.udp64_vnet_tbl_idx[swif][skip][HICN_PUNT_SRC][mask];
hicn_punt_add_vnettbl_udp (&ipv64, &ipv6, &udp64_dst, mask,
- table_index, swif, ETH_L2);
+ table_index, swif, base_offset,
+ use_current_data);
/*
* Add a session for the specified ip address and
@@ -826,12 +838,14 @@ hicn_punt_interest_data_for_udp (vlib_main_t * vm,
hicn_punt_add_vnetssn_udp (&ipv64, &ipv4, &udp64_src,
prefix, mask,
hicn_punt_glb.next_hit_data_udp6,
- swif, ETH_L2, IPPROTO_UDP, sport, dport);
+ swif, base_offset, IPPROTO_UDP, sport,
+ dport);
hicn_punt_add_vnetssn_udp (&ipv64, &ipv4, &udp64_dst,
prefix, mask,
hicn_punt_glb.next_hit_interest_udp6,
- swif, ETH_L2, IPPROTO_UDP, sport, dport);
+ swif, base_offset, IPPROTO_UDP, sport,
+ dport);
hicn_punt_enable_disable_vnet_ip6_table_on_intf (vm, swif,
OP_ENABLE);
@@ -841,18 +855,20 @@ hicn_punt_interest_data_for_udp (vlib_main_t * vm,
{
if (punt_type == HICN_PUNT_UDP4_TYPE)
{
- skip = 2;
+ //If we consider ethernet we can skip 32 bytes, otherwise only 16
+ skip = 1 + with_l2;
/* Create Vnet table for a given mask */
if (mask > 96)
return HICN_ERROR_PUNT_INVAL;
hicn_punt_add_vnettbl_udp (&ipv46, &ipv4, &udp46_src, mask, ~0,
- swif, ETH_L2);
+ swif, base_offset, use_current_data);
table_index =
hicn_punt_glb.udp46_vnet_tbl_idx[swif][skip][HICN_PUNT_SRC][mask];
hicn_punt_add_vnettbl_udp (&ipv46, &ipv4, &udp46_dst, mask,
- table_index, swif, ETH_L2);
+ table_index, swif, base_offset,
+ use_current_data);
/*
* Add a session for the specified ip address and
@@ -861,11 +877,12 @@ hicn_punt_interest_data_for_udp (vlib_main_t * vm,
hicn_punt_add_vnetssn_udp (&ipv46, &ipv4, &udp46_src,
prefix, mask,
hicn_punt_glb.next_hit_data_udp4,
- swif, ETH_L2, IPPROTO_UDP, sport, dport);
- hicn_punt_add_vnetssn_udp (&ipv46, &ipv4, &udp46_dst,
- prefix, mask,
+ swif, base_offset, IPPROTO_UDP, sport,
+ dport);
+ hicn_punt_add_vnetssn_udp (&ipv46, &ipv4, &udp46_dst, prefix, mask,
hicn_punt_glb.next_hit_interest_udp4,
- swif, ETH_L2, IPPROTO_UDP, sport, dport);
+ swif, base_offset, IPPROTO_UDP, sport,
+ dport);
hicn_punt_enable_disable_vnet_ip4_table_on_intf (vm, swif,
OP_ENABLE);
@@ -874,15 +891,17 @@ hicn_punt_interest_data_for_udp (vlib_main_t * vm,
{
if (mask > 122)
return HICN_ERROR_PUNT_INVAL;
-
- skip = 3;
+
+ //If we consider ethernet we can skip 48 bytes, otherwise only 32
+ skip = 2 + with_l2;
hicn_punt_add_vnettbl_udp (&ipv66, &ipv6, &udp66_src, mask, ~0,
- swif, ETH_L2);
+ swif, base_offset, use_current_data);
table_index =
hicn_punt_glb.udp66_vnet_tbl_idx[swif][skip][HICN_PUNT_SRC][mask];
hicn_punt_add_vnettbl_udp (&ipv66, &ipv6, &udp66_dst, mask,
- table_index, swif, ETH_L2);
+ table_index, swif, base_offset,
+ use_current_data);
/*
* Add a session for the specified ip address and
@@ -891,11 +910,12 @@ hicn_punt_interest_data_for_udp (vlib_main_t * vm,
hicn_punt_add_vnetssn_udp (&ipv66, &ipv6, &udp66_src,
prefix, mask,
hicn_punt_glb.next_hit_data_udp6,
- swif, ETH_L2, IPPROTO_UDP, sport, dport);
- hicn_punt_add_vnetssn_udp (&ipv66, &ipv6, &udp66_dst,
- prefix, mask,
+ swif, base_offset, IPPROTO_UDP, sport,
+ dport);
+ hicn_punt_add_vnetssn_udp (&ipv66, &ipv6, &udp66_dst, prefix, mask,
hicn_punt_glb.next_hit_interest_udp6,
- swif, ETH_L2, IPPROTO_UDP, sport, dport);
+ swif, base_offset, IPPROTO_UDP, sport,
+ dport);
hicn_punt_enable_disable_vnet_ip6_table_on_intf (vm, swif,
OP_ENABLE);
@@ -908,13 +928,17 @@ hicn_punt_interest_data_for_udp (vlib_main_t * vm,
u32
-hicn_punt_interest_data_for_ethernet (vlib_main_t * vm,
- ip46_address_t * prefix, u8 mask,
- u32 swif, u8 punt_type)
+hicn_punt_interest_data_for_ip (vlib_main_t * vm,
+ ip46_address_t * prefix, u8 mask,
+ u32 swif, u8 punt_type, u8 with_l2)
{
int skip = 1;
u32 table_index;
- u8 use_current_data = HICN_CLASSIFY_NO_CURRENT_DATA_FLAG;
+ // If we want l2 then we punt from data (and not current)
+ u8 use_current_data =
+ with_l2 ? HICN_CLASSIFY_NO_CURRENT_DATA_FLAG :
+ HICN_CLASSIFY_CURRENT_DATA_FLAG;
+ u8 base_offset = with_l2 ? ETH_L2 : NO_L2;
if (punt_type != HICN_PUNT_IP_TYPE && punt_type != HICN_PUNT_UDP4_TYPE
&& punt_type != HICN_PUNT_UDP6_TYPE)
@@ -928,14 +952,14 @@ hicn_punt_interest_data_for_ethernet (vlib_main_t * vm,
if (punt_type == HICN_PUNT_IP_TYPE)
{
/* Create Vnet table for a given mask */
- hicn_punt_add_vnettbl (&ipv4, &ipv4_src, mask, ~0, swif, ETH_L2,
- use_current_data);
+ hicn_punt_add_vnettbl (&ipv4, &ipv4_src, mask, ~0, swif,
+ base_offset, use_current_data);
table_index =
hicn_punt_glb.ip4_vnet_tbl_idx[swif][skip][HICN_PUNT_SRC][mask];
hicn_punt_add_vnettbl (&ipv4, &ipv4_dst, mask, table_index, swif,
- ETH_L2, use_current_data);
+ base_offset, use_current_data);
/*
* Add a session for the specified ip address and
@@ -944,11 +968,11 @@ hicn_punt_interest_data_for_ethernet (vlib_main_t * vm,
hicn_punt_add_vnetssn (&ipv4, &ipv4_src,
prefix, mask,
hicn_punt_glb.next_hit_data_ipv4, swif,
- ETH_L2);
+ base_offset);
hicn_punt_add_vnetssn (&ipv4, &ipv4_dst,
prefix, mask,
hicn_punt_glb.next_hit_interest_ipv4, swif,
- ETH_L2);
+ base_offset);
hicn_punt_enable_disable_vnet_ip4_table_on_intf (vm, swif,
OP_ENABLE);
@@ -966,14 +990,14 @@ hicn_punt_interest_data_for_ethernet (vlib_main_t * vm,
return HICN_ERROR_PUNT_INVAL;
/* Create Vnet table for a given mask */
- hicn_punt_add_vnettbl (&ipv6, &ipv6_src, mask, ~0, swif, ETH_L2,
- use_current_data);
+ hicn_punt_add_vnettbl (&ipv6, &ipv6_src, mask, ~0, swif,
+ base_offset, use_current_data);
table_index =
hicn_punt_glb.ip6_vnet_tbl_idx[swif][skip][HICN_PUNT_SRC][mask];
hicn_punt_add_vnettbl (&ipv6, &ipv6_dst, mask, table_index, swif,
- ETH_L2, use_current_data);
+ base_offset, use_current_data);
/*
* Add a session for the specified ip address and
@@ -981,10 +1005,10 @@ hicn_punt_interest_data_for_ethernet (vlib_main_t * vm,
*/
hicn_punt_add_vnetssn (&ipv6, &ipv6_src, prefix,
mask, hicn_punt_glb.next_hit_data_ipv6, swif,
- ETH_L2);
+ base_offset);
hicn_punt_add_vnetssn (&ipv6, &ipv6_dst, prefix,
mask, hicn_punt_glb.next_hit_interest_ipv6,
- swif, ETH_L2);
+ swif, base_offset);
hicn_punt_enable_disable_vnet_ip6_table_on_intf (vm, swif,
OP_ENABLE);
diff --git a/hicn-plugin/src/punt.h b/hicn-plugin/src/punt.h
index ebc27e9d4..3e6900064 100644
--- a/hicn-plugin/src/punt.h
+++ b/hicn-plugin/src/punt.h
@@ -296,14 +296,16 @@ hicn_punt_enable_disable_vnet_ip6_table_on_intf (vlib_main_t * vm,
u32 hicn_punt_interest_data_for_udp (vlib_main_t * vm,
ip46_address_t * prefix, u8 mask,
u32 swif, u8 punt_type, u16 sport,
- u16 dport);
-u32 hicn_punt_interest_data_for_ethernet (vlib_main_t * vm,
- ip46_address_t * prefix, u8 mask,
- u32 swif, u8 type);
+ u16 dport, u8 with_l2);
+u32 hicn_punt_interest_data_for_ip (vlib_main_t * vm,
+ ip46_address_t * prefix, u8 mask,
+ u32 swif, u8 type, u8 with_l2);
int hicn_punt_remove_ip6_address (vlib_main_t * vm, ip6_address_t * addr,
- u8 mask, int skip, u32 swif, int is_enable);
+ u8 mask, int skip, u32 swif, int is_enable,
+ u8 with_l2);
int hicn_punt_remove_ip4_address (vlib_main_t * vm, ip4_address_t * addr,
- u8 mask, int skip, u32 swif, int is_enable);
+ u8 mask, int skip, u32 swif, int is_enable,
+ u8 with_l2);
void hicn_punt_init (vlib_main_t * vm);
int
diff --git a/hicn-plugin/src/route.c b/hicn-plugin/src/route.c
index 9202efbd4..11302aba4 100644
--- a/hicn-plugin/src/route.c
+++ b/hicn-plugin/src/route.c
@@ -108,7 +108,7 @@ hicn_route_add (hicn_face_id_t * face_id, u32 len,
vlib_main_t *vm = vlib_get_main ();
hicn_face_vft_t *face_vft = NULL;
- if (face_id == NULL)
+ if (face_id == NULL || !hicn_dpoi_idx_is_valid (*face_id))
{
return HICN_ERROR_ROUTE_INVAL;
}
diff --git a/libtransport/src/hicn/transport/protocols/cbr.cc b/libtransport/src/hicn/transport/protocols/cbr.cc
index efd2149ad..02bc7b5e4 100644
--- a/libtransport/src/hicn/transport/protocols/cbr.cc
+++ b/libtransport/src/hicn/transport/protocols/cbr.cc
@@ -26,10 +26,12 @@ CbrTransportProtocol::CbrTransportProtocol(
interface::ConsumerSocket *icnet_socket)
: RaaqmTransportProtocol(icnet_socket) {}
-int CbrTransportProtocol::start() {
+int CbrTransportProtocol::start() { return RaaqmTransportProtocol::start(); }
+
+void CbrTransportProtocol::reset() {
+ RaaqmTransportProtocol::reset();
socket_->getSocketOption(GeneralTransportOptions::CURRENT_WINDOW_SIZE,
current_window_size_);
- return RaaqmTransportProtocol::start();
}
void CbrTransportProtocol::afterDataUnsatisfied(uint64_t segment) {}
diff --git a/libtransport/src/hicn/transport/protocols/cbr.h b/libtransport/src/hicn/transport/protocols/cbr.h
index a8eff2182..e80da14f5 100644
--- a/libtransport/src/hicn/transport/protocols/cbr.h
+++ b/libtransport/src/hicn/transport/protocols/cbr.h
@@ -27,6 +27,8 @@ class CbrTransportProtocol : public RaaqmTransportProtocol {
int start() override;
+ void reset() override;
+
private:
void afterContentReception(const Interest &interest,
const ContentObject &content_object) override;
diff --git a/libtransport/src/hicn/transport/protocols/protocol.h b/libtransport/src/hicn/transport/protocols/protocol.h
index 6911eada5..88889bb8c 100644
--- a/libtransport/src/hicn/transport/protocols/protocol.h
+++ b/libtransport/src/hicn/transport/protocols/protocol.h
@@ -62,7 +62,6 @@ class TransportProtocol : public interface::BasePortal::ConsumerCallback,
std::shared_ptr<interface::BasePortal> portal_;
volatile bool is_running_;
TransportStatistics stats_;
- std::shared_ptr<std::vector<uint8_t>> content_buffer_;
};
} // end namespace protocol
diff --git a/libtransport/src/hicn/transport/protocols/raaqm.cc b/libtransport/src/hicn/transport/protocols/raaqm.cc
index b10457f40..b8a7c9610 100644
--- a/libtransport/src/hicn/transport/protocols/raaqm.cc
+++ b/libtransport/src/hicn/transport/protocols/raaqm.cc
@@ -487,7 +487,9 @@ void RaaqmTransportProtocol::sendInterest(std::uint64_t next_suffix) {
return;
}
- interest_retransmissions_[next_suffix & mask] = 0;
+ // This is set to ~0 so that the next interest_retransmissions_ + 1, performed
+ // by sendInterest, will result in 0
+ interest_retransmissions_[next_suffix & mask] = ~0;
interest_timepoints_[next_suffix & mask] = utils::SteadyClock::now();
sendInterest(std::move(interest));
}
diff --git a/libtransport/src/hicn/transport/protocols/rtc.cc b/libtransport/src/hicn/transport/protocols/rtc.cc
index e07a4042b..a993d596b 100644
--- a/libtransport/src/hicn/transport/protocols/rtc.cc
+++ b/libtransport/src/hicn/transport/protocols/rtc.cc
@@ -419,7 +419,6 @@ void RTCTransportProtocol::sendInterest() {
return;
}
- using namespace std::placeholders;
portal_->sendInterest(std::move(interest));
sentInterest_++;
@@ -573,8 +572,9 @@ void RTCTransportProtocol::returnContentToApplication(
// return content to the user
auto a = content_object.getPayload();
- uint8_t *start = ((uint8_t *)a->data()) + HICN_TIMESTAMP_SIZE;
- unsigned size = (unsigned)(a->length() - HICN_TIMESTAMP_SIZE);
+ a->trimStart(HICN_TIMESTAMP_SIZE);
+ uint8_t *start = a->writableData();
+ unsigned size = (unsigned)a->length();
// set offset between hICN and RTP packets
uint16_t rtp_seq = ntohs(*(((uint16_t *)start) + 1));
@@ -582,7 +582,7 @@ void RTCTransportProtocol::returnContentToApplication(
std::shared_ptr<std::vector<uint8_t>> content_buffer;
socket_->getSocketOption(APPLICATION_BUFFER, content_buffer);
- content_buffer->insert(content_buffer_->end(), start, start + size);
+ content_buffer->insert(content_buffer->end(), start, start + size);
ConsumerContentCallback *on_payload = nullptr;
socket_->getSocketOption(CONTENT_RETRIEVED, &on_payload);
diff --git a/scripts/build-packages.sh b/scripts/build-packages.sh
index ed8a95a55..70c41d1e1 100644
--- a/scripts/build-packages.sh
+++ b/scripts/build-packages.sh
@@ -144,14 +144,15 @@ build_package() {
mkdir -p build && pushd build
rm -rf *
- cmake -DCMAKE_INSTALL_PREFIX=/usr ${SCRIPT_PATH}/..
+ cmake -DCMAKE_INSTALL_PREFIX=/usr -DBUILD_APPS=ON ${SCRIPT_PATH}/..
make package
rm -rf libtransport
- cmake -DCMAKE_INSTALL_PREFIX=/usr \
- -DBUILD_HICNPLUGIN=ON \
- -DBUILD_LIBTRANSPORT=ON \
+ cmake -DCMAKE_INSTALL_PREFIX=/usr \
+ -DBUILD_HICNPLUGIN=ON \
+ -DBUILD_LIBTRANSPORT=ON \
+ -DBUILD_APPS=ON \
-DLIBMEMIF_HOME=${MEMIF_HOME} \
${SCRIPT_PATH}/..
diff --git a/utils/CMakeLists.txt b/utils/CMakeLists.txt
index 9d3a77863..b1993e740 100644
--- a/utils/CMakeLists.txt
+++ b/utils/CMakeLists.txt
@@ -32,7 +32,12 @@ else()
set(LIBTRANSPORT_LIBRARIES ${LIBTRANSPORT_SHARED})
endif()
-include(Packaging)
+set(SUFFIX "")
+if (${LIBTRANSPORT_LIBRARIES} MATCHES ".*-memif.*")
+ set(SUFFIX "-memif")
+endif()
+
+set(HICN_UTILS "${HICN_UTILS}${SUFFIX}")
set (COMPILER_DEFINITIONS "")
@@ -40,6 +45,8 @@ if (WIN32)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4200 /wd4996")
endif ()
+include(Packaging)
+
build_executable(hiperf
SOURCES src/hiperf.cc
LINK_LIBRARIES ${LIBTRANSPORT_LIBRARIES} ${WSOCK32_LIBRARY} ${WS2_32_LIBRARY}