From 7abcc9be25efce7a0848bb2ba79d6f142df0cee9 Mon Sep 17 00:00:00 2001 From: Dimitri Staessens Date: Fri, 12 Oct 2018 16:07:59 +0200 Subject: irmd: Don't warn if server leaves The irmd would log a warning when a server application quits during an accept call, but this is just a normal event. This removes the warning log. Signed-off-by: Dimitri Staessens Signed-off-by: Sander Vrijders --- src/irmd/main.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/irmd/main.c b/src/irmd/main.c index 78fcf7b5..d3f7a09e 100644 --- a/src/irmd/main.c +++ b/src/irmd/main.c @@ -2041,10 +2041,8 @@ static void * mainloop(void * o) pthread_cleanup_pop(true); pthread_cleanup_pop(false); - if (result == -EPIPE) { - log_warn("Peer closed socket."); + if (result == -EPIPE) goto fail; - } ret_msg->has_result = true; ret_msg->result = result; -- cgit v1.2.3 From 33e89097c05cb0bb1816a15aa5ef4740d03eb90a Mon Sep 17 00:00:00 2001 From: Sander Vrijders Date: Fri, 12 Oct 2018 17:17:10 +0200 Subject: ipcpd: Make Qdisc bypass configurable This will make bypassing the qdisc configurable, as it might be handy for getting fast data rates but is generally needed. Signed-off-by: Sander Vrijders Signed-off-by: Dimitri Staessens --- src/ipcpd/config.h.in | 1 + src/ipcpd/eth/CMakeLists.txt | 2 ++ src/ipcpd/eth/eth.c | 4 ++++ 3 files changed, 7 insertions(+) diff --git a/src/ipcpd/config.h.in b/src/ipcpd/config.h.in index 567fe971..04565fab 100644 --- a/src/ipcpd/config.h.in +++ b/src/ipcpd/config.h.in @@ -63,3 +63,4 @@ #cmakedefine HAVE_RAW_SOCKETS #define IPCP_ETH_RD_THR @IPCP_ETH_RD_THR@ #define IPCP_ETH_WR_THR @IPCP_ETH_WR_THR@ +#cmakedefine IPCP_ETH_QDISC_BYPASS diff --git a/src/ipcpd/eth/CMakeLists.txt b/src/ipcpd/eth/CMakeLists.txt index 6672f93c..e4acdb7f 100644 --- a/src/ipcpd/eth/CMakeLists.txt +++ b/src/ipcpd/eth/CMakeLists.txt @@ -82,6 +82,8 @@ if (HAVE_ETH) "Number of reader threads in Ethernet IPCP") set(IPCP_ETH_WR_THR 3 CACHE STRING "Number of writer threads in Ethernet IPCP") + set(IPCP_ETH_QDISC_BYPASS false CACHE BOOL + "Bypass the Qdisc in the kernel when using raw sockets") set(ETH_LLC_SOURCES # Add source files here diff --git a/src/ipcpd/eth/eth.c b/src/ipcpd/eth/eth.c index e7a1580c..3a749cf7 100644 --- a/src/ipcpd/eth/eth.c +++ b/src/ipcpd/eth/eth.c @@ -1231,7 +1231,9 @@ static int eth_ipcp_bootstrap(const struct ipcp_config * conf) size_t maxsz; #endif #if defined(HAVE_RAW_SOCKETS) + #if defined(IPCP_ETH_QDISC_BYPASS) int qdisc_bypass = 1; + #endif /* ENABLE_QDISC_BYPASS */ int flags; #endif assert(conf); @@ -1415,10 +1417,12 @@ static int eth_ipcp_bootstrap(const struct ipcp_config * conf) goto fail_device; } + #if defined(IPCP_ETH_QDISC_BYPASS) if (setsockopt(eth_data.s_fd, SOL_PACKET, PACKET_QDISC_BYPASS, &qdisc_bypass, sizeof(qdisc_bypass))) { log_info("Qdisc bypass not supported."); } + #endif if (bind(eth_data.s_fd, (struct sockaddr *) ð_data.device, sizeof(eth_data.device))) { -- cgit v1.2.3 From b8c73d171d4352293b18ddbc71c587233d1f2fa5 Mon Sep 17 00:00:00 2001 From: Dimitri Staessens Date: Fri, 12 Oct 2018 16:56:45 +0200 Subject: lib: Set hash algorithm correctly There was a bug where the hash selection for the local, raptor and ethernet IPCPs was not passed correctly, so they were using a wrong hash. Signed-off-by: Dimitri Staessens Signed-off-by: Sander Vrijders --- src/lib/irm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/lib/irm.c b/src/lib/irm.c index d88475c4..384da7b0 100644 --- a/src/lib/irm.c +++ b/src/lib/irm.c @@ -117,6 +117,9 @@ int irm_bootstrap_ipcp(pid_t pid, config.ipcp_type = conf->type; + if (conf->type != IPCP_UDP) + layer_info.dir_hash_algo = conf->layer_info.dir_hash_algo; + switch (conf->type) { case IPCP_NORMAL: config.has_addr_size = true; @@ -131,7 +134,6 @@ int irm_bootstrap_ipcp(pid_t pid, config.routing_type = conf->routing_type; config.has_pff_type = true; config.pff_type = conf->pff_type; - layer_info.dir_hash_algo = conf->layer_info.dir_hash_algo; break; case IPCP_UDP: config.has_ip_addr = true; -- cgit v1.2.3 From d375c023b5fa68e3a9804687683772c2734be8a4 Mon Sep 17 00:00:00 2001 From: Dimitri Staessens Date: Fri, 12 Oct 2018 17:28:04 +0200 Subject: ipcpd: Configure DHT slack timer at build time This allows configuration of the DHT slack timer at build time. Signed-off-by: Dimitri Staessens Signed-off-by: Sander Vrijders --- src/ipcpd/CMakeLists.txt | 7 +++++++ src/ipcpd/config.h.in | 1 + src/ipcpd/normal/dht.c | 2 +- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/ipcpd/CMakeLists.txt b/src/ipcpd/CMakeLists.txt index 50d23f8e..3fa3bb0f 100644 --- a/src/ipcpd/CMakeLists.txt +++ b/src/ipcpd/CMakeLists.txt @@ -16,6 +16,8 @@ set(DISABLE_CORE_LOCK FALSE CACHE BOOL "Disable locking performance threads to a core") set(IPCP_CONN_WAIT_DIR TRUE CACHE BOOL "Check the running state of the directory when adding a dt connection") +set(DHT_ENROLL_SLACK 50 CACHE STRING + "DHT enrollment waiting time (0-999, ms)") if ((IPCP_QOS_CUBE_BE_PRIO LESS 0) OR (IPCP_QOS_CUBE_BE_PRIO GREATER 99)) message(FATAL_ERROR "Invalid priority for best effort QoS cube") @@ -29,6 +31,11 @@ if ((IPCP_QOS_CUBE_VOICE_PRIO LESS 0) OR (IPCP_QOS_CUBE_VOICE_PRIO GREATER 99)) message(FATAL_ERROR "Invalid priority for voice QoS cube") endif () +if ((DHT_ENROLL_SLACK LESS 0) OR (DHT_ENROLL_SLACK GREATER 999)) + message(FATAL_ERROR "Invalid DHT slack value") +endif () + + set(IPCP_SOURCES # Add source files here ${CMAKE_CURRENT_SOURCE_DIR}/ipcp.c diff --git a/src/ipcpd/config.h.in b/src/ipcpd/config.h.in index 04565fab..f7af0808 100644 --- a/src/ipcpd/config.h.in +++ b/src/ipcpd/config.h.in @@ -47,6 +47,7 @@ #define QOS_PRIO_VOICE @IPCP_QOS_CUBE_VOICE_PRIO@ #define IPCP_SCHED_THR_MUL @IPCP_SCHED_THR_MUL@ #define PFT_SIZE @PFT_SIZE@ +#define DHT_ENROLL_SLACK @DHT_ENROLL_SLACK@ #cmakedefine IPCP_CONN_WAIT_DIR #cmakedefine DISABLE_CORE_LOCK diff --git a/src/ipcpd/normal/dht.c b/src/ipcpd/normal/dht.c index aa1909e9..0ad9d9a7 100644 --- a/src/ipcpd/normal/dht.c +++ b/src/ipcpd/normal/dht.c @@ -2729,7 +2729,7 @@ static void handle_event(void * self, pthread_t thr; struct join_info * inf; struct conn * c = (struct conn *) o; - struct timespec slack = {0, 10 * MILLION}; + struct timespec slack = {0, DHT_ENROLL_SLACK * MILLION}; /* Give the pff some time to update for the new link. */ nanosleep(&slack, NULL); -- cgit v1.2.3 From 3a650d07d2d7540ebee65cef58b35f0373ad14d6 Mon Sep 17 00:00:00 2001 From: Dimitri Staessens Date: Fri, 12 Oct 2018 17:01:39 +0200 Subject: ipcpd: Send link state message before lsdb update When a new link is added, the link state update will be sent before the database update, so the network is a little bit more quickly aware. This improves odds of the DHT successfully enrolling at its first attempt, reducing bootstrap time of a network. Signed-off-by: Dimitri Staessens Signed-off-by: Sander Vrijders --- CMakeLists.txt | 2 +- src/ipcpd/normal/pol/link_state.c | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index badfd4b6..7a5d9671 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,7 +8,7 @@ include(GNUInstallDirs) set(PACKAGE_VERSION_MAJOR 0) set(PACKAGE_VERSION_MINOR 12) -set(PACKAGE_VERSION_PATCH 2) +set(PACKAGE_VERSION_PATCH 3) set(PACKAGE_NAME "${CMAKE_PROJECT_NAME}") set(PACKAGE_DESCRIPTION "The Ouroboros prototype") diff --git a/src/ipcpd/normal/pol/link_state.c b/src/ipcpd/normal/pol/link_state.c index e8677f0d..5f592edf 100644 --- a/src/ipcpd/normal/pol/link_state.c +++ b/src/ipcpd/normal/pol/link_state.c @@ -789,16 +789,15 @@ static void handle_event(void * self, switch (event) { case NOTIFY_DT_CONN_ADD: + pthread_rwlock_rdlock(&ls.db_lock); + send_lsm(ipcpi.dt_addr, c->conn_info.addr, 0); + pthread_rwlock_unlock(&ls.db_lock); + if (lsdb_add_nb(c->conn_info.addr, c->flow_info.fd, NB_DT)) log_dbg("Failed to add neighbor to LSDB."); if (lsdb_add_link(ipcpi.dt_addr, c->conn_info.addr, 0, &qs)) log_dbg("Failed to add new adjacency to LSDB."); - - pthread_rwlock_rdlock(&ls.db_lock); - send_lsm(ipcpi.dt_addr, c->conn_info.addr, 0); - pthread_rwlock_unlock(&ls.db_lock); - break; case NOTIFY_DT_CONN_DEL: flow_event(c->flow_info.fd, false); -- cgit v1.2.3