summaryrefslogtreecommitdiff
path: root/src/ipcpd/udp
diff options
context:
space:
mode:
authorDimitri Staessens <[email protected]>2022-03-06 15:15:51 +0100
committerSander Vrijders <[email protected]>2022-03-08 17:40:17 +0100
commit40ca5385e97f393d0c231446f117ad43465735a7 (patch)
tree019bfcefe5899c545403648807372d7b2e97ee73 /src/ipcpd/udp
parent22526848c5a7b48f8b45988bdfbc6e0ce7a9f712 (diff)
downloadouroboros-40ca5385e97f393d0c231446f117ad43465735a7.tar.gz
ouroboros-40ca5385e97f393d0c231446f117ad43465735a7.zip
ipdpd: Pass MPL to application at flow_allocation
The maximum packet lifetime (MPL) is a property of the flow that needs to be passed to the reliable transmission protocol (FRCP) for its correct operation. Previously, the value of MPL was set fixed as one of the (fixed) Delta-t parameters. This patch makes the MPL a property of the layer, and it can now be set per layer-type at build time. This is a step towards a proper MPL estimator in the flow allocator. Signed-off-by: Dimitri Staessens <[email protected]> Signed-off-by: Sander Vrijders <[email protected]>
Diffstat (limited to 'src/ipcpd/udp')
-rw-r--r--src/ipcpd/udp/CMakeLists.txt2
-rw-r--r--src/ipcpd/udp/main.c7
2 files changed, 7 insertions, 2 deletions
diff --git a/src/ipcpd/udp/CMakeLists.txt b/src/ipcpd/udp/CMakeLists.txt
index f1a29ef6..8ae5518e 100644
--- a/src/ipcpd/udp/CMakeLists.txt
+++ b/src/ipcpd/udp/CMakeLists.txt
@@ -58,6 +58,8 @@ set(IPCP_UDP_RD_THR 3 CACHE STRING
"Number of reader threads in UDP IPCP")
set(IPCP_UDP_WR_THR 3 CACHE STRING
"Number of writer threads in UDP IPCP")
+set(IPCP_UDP_MPL 60 CACHE STRING
+ "Default maximum packet lifetime for the UDP IPCP, in seconds")
include(AddCompileFlags)
if (CMAKE_BUILD_TYPE MATCHES "Debug*")
diff --git a/src/ipcpd/udp/main.c b/src/ipcpd/udp/main.c
index 5c57e6b8..3b354ceb 100644
--- a/src/ipcpd/udp/main.c
+++ b/src/ipcpd/udp/main.c
@@ -279,6 +279,7 @@ static int ipcp_udp_port_req(struct sockaddr_in * c_saddr,
struct timespec ts = {0, FD_UPDATE_TIMEOUT * 1000};
struct timespec abstime;
int fd;
+ time_t mpl = IPCP_UDP_MPL;
clock_gettime(PTHREAD_COND_CLOCK, &abstime);
@@ -297,7 +298,7 @@ static int ipcp_udp_port_req(struct sockaddr_in * c_saddr,
}
/* reply to IRM */
- fd = ipcp_flow_req_arr(dst, ipcp_dir_hash_len(), qs, data, len);
+ fd = ipcp_flow_req_arr(dst, ipcp_dir_hash_len(), qs, mpl, data, len);
if (fd < 0) {
pthread_mutex_unlock(&ipcpi.alloc_lock);
log_err("Could not get new flow from IRMd.");
@@ -329,6 +330,8 @@ static int ipcp_udp_port_alloc_reply(const struct sockaddr_in * saddr,
const void * data,
size_t len)
{
+ time_t mpl = IPCP_UDP_MPL;
+
pthread_rwlock_wrlock(&udp_data.flows_lock);
if (memcmp(&udp_data.fd_to_uf[s_eid].r_saddr, saddr, sizeof(*saddr))) {
@@ -343,7 +346,7 @@ static int ipcp_udp_port_alloc_reply(const struct sockaddr_in * saddr,
pthread_rwlock_unlock(&udp_data.flows_lock);
- if (ipcp_flow_alloc_reply(s_eid, response, data, len) < 0) {
+ if (ipcp_flow_alloc_reply(s_eid, response, mpl, data, len) < 0) {
log_dbg("Failed to reply to flow allocation.");
return -1;
}