aboutsummaryrefslogtreecommitdiffstats
path: root/libtransport
diff options
context:
space:
mode:
Diffstat (limited to 'libtransport')
-rw-r--r--libtransport/CMakeLists.txt1
-rw-r--r--libtransport/cmake/Modules/Packaging.cmake8
-rw-r--r--libtransport/src/core/forwarder_interface.h5
-rw-r--r--libtransport/src/core/memif_connector.cc7
-rw-r--r--libtransport/src/core/memif_connector.h5
-rw-r--r--libtransport/src/core/vpp_forwarder_interface.cc21
-rw-r--r--libtransport/src/core/vpp_forwarder_interface.h1
-rw-r--r--libtransport/src/http/response.cc5
-rw-r--r--libtransport/src/utils/epoll_event_reactor.cc7
9 files changed, 40 insertions, 20 deletions
diff --git a/libtransport/CMakeLists.txt b/libtransport/CMakeLists.txt
index 28124b26e..b07c8cccb 100644
--- a/libtransport/CMakeLists.txt
+++ b/libtransport/CMakeLists.txt
@@ -152,7 +152,6 @@ list(APPEND LIBRARIES
${ANDROID_LIBRARIES}
${OPENSSL_LIBRARIES}
${WINDOWS_LIBRARIES}
- ${LIBHICNCTRL_LIBRARIES}
)
# Include dirs -- Order does matter!
diff --git a/libtransport/cmake/Modules/Packaging.cmake b/libtransport/cmake/Modules/Packaging.cmake
index 274eb4c59..e24172661 100644
--- a/libtransport/cmake/Modules/Packaging.cmake
+++ b/libtransport/cmake/Modules/Packaging.cmake
@@ -32,22 +32,22 @@ set(lib${LIBTRANSPORT}-devel_DESCRIPTION ${lib${LIBTRANSPORT}_DESCRIPTION}
if ((BUILD_MEMIF_CONNECTOR OR BUILD_HICNPLUGIN) AND "${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
set(lib${LIBTRANSPORT}_DEB_DEPENDENCIES
- "lib${LIBHICN} (>= stable_version), libparc (>= 1.0), libmemif (>= stable_version), vpp (>= stable_version-release), vpp (<< next_version-release), libhicnctrl-memif (>= stable_version-release), libhicnctrl-memif (<< next_version-release)"
+ "lib${LIBHICN} (>= stable_version), libparc (>= 1.0), libmemif (>= stable_version), vpp (>= stable_version-release), vpp (<< next_version-release), hicn-plugin (>= stable_version)"
CACHE STRING "Dependencies for deb/rpm package."
)
set(lib${LIBTRANSPORT}_RPM_DEPENDENCIES
- "lib${LIBHICN} >= stable_version, libparc >= 1.0, libmemif >= stable_version, vpp >= stable_version-release, vpp < next_version-release, libhicnctrl-memif >= stable_version-release, libhicnctrl-memif < stable_version-release"
+ "lib${LIBHICN} >= stable_version, libparc >= 1.0, libmemif >= stable_version, vpp >= stable_version-release, vpp < next_version-release, hicn-plugin >= stable_version"
CACHE STRING "Dependencies for deb/rpm package."
)
set(lib${LIBTRANSPORT}-dev_DEB_DEPENDENCIES
- "lib${LIBTRANSPORT} (>= stable_version), libasio-dev (>= 1.10), libhicn-dev (>= stable_version), libmemif-dev (>= stable_version), libparc-dev (>= 1.0), vpp-dev (>= stable_version-release), vpp-dev (<< next_version-release), hicn-plugin-dev (>= stable_version-release), hicn-plugin-dev (<< next_version-release)"
+ "lib${LIBTRANSPORT} (>= stable_version), libasio-dev (>= 1.10), libhicn-dev (>= stable_version), libmemif-dev (>= stable_version), libparc-dev (>= 1.0), vpp-dev (>= stable_version-release), vpp-dev (<< next_version-release), hicn-plugin-dev (>= stable_version)"
CACHE STRING "Dependencies for deb/rpm package."
)
set(lib${LIBTRANSPORT}-dev_RPM_DEPENDENCIES
- "lib${LIBTRANSPORT} >= stable_version, asio-devel >= 1.10, lib${LIBHICN}-devel >= stable_version, libmemif-devel >= stable_version, libparc-devel >= 1.0, vpp-devel >= stable_version-release, vpp-devel < next_version-release, hicn-plugin-dev >= stable_version-release, hicn-plugin-dev < next_version-release"
+ "lib${LIBTRANSPORT} >= stable_version, asio-devel >= 1.10, lib${LIBHICN}-devel >= stable_version, libmemif-devel >= stable_version, libparc-devel >= 1.0, vpp-devel >= stable_version-release, vpp-devel < next_version-release, hicn-plugin-dev >= stable_version"
CACHE STRING "Dependencies for deb/rpm package."
)
diff --git a/libtransport/src/core/forwarder_interface.h b/libtransport/src/core/forwarder_interface.h
index 772cfbb52..a94414d38 100644
--- a/libtransport/src/core/forwarder_interface.h
+++ b/libtransport/src/core/forwarder_interface.h
@@ -49,7 +49,10 @@ class ForwarderInterface {
inet6_address_({}),
mtu_(1500),
output_interface_(""),
- content_store_reserved_(standard_cs_reserved) {}
+ content_store_reserved_(standard_cs_reserved) {
+ inet_address_.v4.as_u32 = htonl(0x7f00001);
+ inet6_address_.v6.as_u8[15] = 0x01;
+ }
public:
virtual ~ForwarderInterface() {}
diff --git a/libtransport/src/core/memif_connector.cc b/libtransport/src/core/memif_connector.cc
index 553aab42a..087e8cba8 100644
--- a/libtransport/src/core/memif_connector.cc
+++ b/libtransport/src/core/memif_connector.cc
@@ -267,6 +267,7 @@ int MemifConnector::bufferAlloc(long n, uint16_t qid) {
if (TRANSPORT_EXPECT_FALSE(err != MEMIF_ERR_SUCCESS)) {
TRANSPORT_LOGE("memif_buffer_alloc: %s", memif_strerror(err));
+ return -1;
}
c->tx_buf_num += r;
@@ -441,7 +442,7 @@ void MemifConnector::send(const Packet::MemBufPtr &packet) {
int MemifConnector::doSend() {
std::size_t max = 0;
- uint16_t n = 0;
+ int32_t n = 0;
std::size_t size = 0;
{
@@ -451,9 +452,9 @@ int MemifConnector::doSend() {
do {
max = size < MAX_MEMIF_BUFS ? size : MAX_MEMIF_BUFS;
+ n = bufferAlloc(max, memif_connection_->tx_qid);
- if (TRANSPORT_EXPECT_FALSE(
- (n = bufferAlloc(max, memif_connection_->tx_qid)) < 0)) {
+ if (TRANSPORT_EXPECT_FALSE(n < 0)) {
TRANSPORT_LOGE("Error allocating buffers.");
return -1;
}
diff --git a/libtransport/src/core/memif_connector.h b/libtransport/src/core/memif_connector.h
index 693efd14c..8a0e9efad 100644
--- a/libtransport/src/core/memif_connector.h
+++ b/libtransport/src/core/memif_connector.h
@@ -15,11 +15,10 @@
#pragma once
+#include <core/connector.h>
#include <hicn/transport/config.h>
#include <hicn/transport/portability/portability.h>
#include <hicn/transport/utils/ring_buffer.h>
-
-#include <core/connector.h>
//#include <hicn/transport/core/hicn_vapi.h>
#include <utils/epoll_event_reactor.h>
#include <utils/fd_deadline_timer.h>
@@ -43,7 +42,7 @@ typedef struct memif_connection memif_connection_t;
#define IF_NAME "vpp_connection"
#define MEMIF_BUF_SIZE 2048
-#define MEMIF_LOG2_RING_SIZE 11
+#define MEMIF_LOG2_RING_SIZE 13
#define MAX_MEMIF_BUFS (1 << MEMIF_LOG2_RING_SIZE)
class MemifConnector : public Connector {
diff --git a/libtransport/src/core/vpp_forwarder_interface.cc b/libtransport/src/core/vpp_forwarder_interface.cc
index 28a2560b3..9f7beeb37 100644
--- a/libtransport/src/core/vpp_forwarder_interface.cc
+++ b/libtransport/src/core/vpp_forwarder_interface.cc
@@ -36,8 +36,6 @@ namespace transport {
namespace core {
-std::mutex VPPForwarderInterface::global_lock_;
-
VPPForwarderInterface::VPPForwarderInterface(MemifConnector &connector)
: ForwarderInterface<VPPForwarderInterface, MemifConnector>(connector),
sw_if_index_(~0),
@@ -112,9 +110,24 @@ void VPPForwarderInterface::producerConnection() {
}
void VPPForwarderInterface::connect(bool is_consumer) {
- std::lock_guard<std::mutex> connection_lock(global_lock_);
+ int retry = 20;
+
+ TRANSPORT_LOGI("Connecting to VPP through vapi.");
+ vapi_error_e ret = vapi_connect_safe(&sock_, 0);
+
+ while (ret != VAPI_OK && retry > 0) {
+ TRANSPORT_LOGE("Error connecting to VPP through vapi. Retrying..");
+ --retry;
+ ret = vapi_connect_safe(&sock_, 0);
+ }
+
+ if (ret != VAPI_OK) {
+ throw std::runtime_error(
+ "Impossible to connect to forwarder. Is VPP running?");
+ }
+
- vapi_connect_safe(&sock_, 0);
+ TRANSPORT_LOGI("Connected to VPP through vapi.");
sw_if_index_ = getMemifConfiguration();
diff --git a/libtransport/src/core/vpp_forwarder_interface.h b/libtransport/src/core/vpp_forwarder_interface.h
index bc83f476e..31d23b40d 100644
--- a/libtransport/src/core/vpp_forwarder_interface.h
+++ b/libtransport/src/core/vpp_forwarder_interface.h
@@ -79,7 +79,6 @@ class VPPForwarderInterface
uint32_t face_id2_;
bool is_consumer_;
vapi_ctx_t sock_;
- static std::mutex global_lock_;
};
} // namespace core
diff --git a/libtransport/src/http/response.cc b/libtransport/src/http/response.cc
index 79550898b..c665fbc5f 100644
--- a/libtransport/src/http/response.cc
+++ b/libtransport/src/http/response.cc
@@ -98,7 +98,10 @@ std::size_t HTTPResponse::parseHeaders(const uint8_t *buffer, std::size_t size,
value_start++;
}
if (value_start < line.size()) {
- headers[line.substr(0, param_end)] =
+ auto header = line.substr(0, param_end);
+ std::transform(header.begin(), header.end(), header.begin(),
+ [](unsigned char c) { return std::tolower(c); });
+ headers[header] =
line.substr(value_start, line.size() - value_start - 1);
}
}
diff --git a/libtransport/src/utils/epoll_event_reactor.cc b/libtransport/src/utils/epoll_event_reactor.cc
index 0e6590d0e..63c08df95 100644
--- a/libtransport/src/utils/epoll_event_reactor.cc
+++ b/libtransport/src/utils/epoll_event_reactor.cc
@@ -104,12 +104,15 @@ void EpollEventReactor::runEventLoop(int timeout) {
while (run_event_loop_) {
memset(&evt, 0, sizeof(evt));
-
en = epoll_pwait(epoll_fd_, evt, 128, timeout, &sigset);
if (TRANSPORT_EXPECT_FALSE(en < 0)) {
TRANSPORT_LOGE("epoll_pwait: %s", strerror(errno));
- return;
+ if (errno == EINTR) {
+ continue;
+ } else {
+ return;
+ }
}
for (int i = 0; i < en; i++) {