From 02b3893b1ec392f1b3ca030a03267c31eb1dc290 Mon Sep 17 00:00:00 2001 From: Dimitri Staessens Date: Sun, 27 Mar 2022 11:09:43 +0200 Subject: lib: Add np1_flow_read and np1_flow_write calls Reading/writing to (N + 1)-flows from the IPCP was using a raw QoS flow to bypass some functions in the ipcp_flow_read call. But this call was broken for keepalive packets. Fixing the ipcp_flow_read call for (N - 1) flows causes the IPCPs to drop 0-byte keepalive packets coming from (N + 1) client flows. >From now on, there is a dedicated call for (N + 1) reads/writes from the IPCPs that's more efficient and cleaner. The (N + 1) flow internal QoS is now also defaulted to a qos_np1 qosspec, instead of tampering with the qosspec requested by the (N + 1) client. Signed-off-by: Dimitri Staessens Signed-off-by: Sander Vrijders --- include/ouroboros/ipcp-dev.h | 6 ++++++ include/ouroboros/np1_flow.h | 19 +++++++++++++++---- 2 files changed, 21 insertions(+), 4 deletions(-) (limited to 'include/ouroboros') diff --git a/include/ouroboros/ipcp-dev.h b/include/ouroboros/ipcp-dev.h index 6472c9fe..307cf3a2 100644 --- a/include/ouroboros/ipcp-dev.h +++ b/include/ouroboros/ipcp-dev.h @@ -47,6 +47,12 @@ int ipcp_flow_read(int fd, int ipcp_flow_write(int fd, struct shm_du_buff * sdb); +int np1_flow_read(int fd, + struct shm_du_buff ** sdb); + +int np1_flow_write(int fd, + struct shm_du_buff * sdb); + int ipcp_flow_fini(int fd); int ipcp_flow_get_qoscube(int fd, diff --git a/include/ouroboros/np1_flow.h b/include/ouroboros/np1_flow.h index b764de91..fdef443b 100644 --- a/include/ouroboros/np1_flow.h +++ b/include/ouroboros/np1_flow.h @@ -27,13 +27,24 @@ #include -int np1_flow_alloc(pid_t n_pid, - int flow_id, - qosspec_t qs); +int np1_flow_alloc(pid_t n_pid, + int flow_id); int np1_flow_resp(int flow_id); -int np1_flow_dealloc(int flow_id, +int np1_flow_dealloc(int flow_id, time_t timeo); +static const qosspec_t qos_np1 = { + .delay = UINT32_MAX, + .bandwidth = 0, + .availability = 0, + .loss = UINT32_MAX, + .ber = UINT32_MAX, + .in_order = 0, + .max_gap = UINT32_MAX, + .cypher_s = 0, + .timeout = 0 +}; + #endif /* OUROBOROS_NP1_FLOW_H */ -- cgit v1.2.3