From 51bb05f15b78fbfdf53417ec1d1c21e999c0e556 Mon Sep 17 00:00:00 2001 From: Dimitri Staessens Date: Wed, 26 Sep 2018 14:49:39 +0200 Subject: include: Remove _DEFAULT_SOURCE in endian.h This removes the _DEFAULT_SOURCE definition in the endian header as it should not be there. This avoids double and conflicting definitions. Signed-off-by: Dimitri Staessens Signed-off-by: Sander Vrijders --- include/ouroboros/endian.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/ouroboros/endian.h b/include/ouroboros/endian.h index f29b674..04c2246 100644 --- a/include/ouroboros/endian.h +++ b/include/ouroboros/endian.h @@ -23,9 +23,12 @@ #ifndef OUROBOROS_ENDIAN_H #define OUROBOROS_ENDIAN_H + #if defined(__linux__) || defined(__CYGWIN__) || \ (defined(__MACH__) && !defined(__APPLE__)) -#define _DEFAULT_SOURCE +#ifndef _DEFAULT_SOURCE +#error You must define _DEFAULT_SOURCE before including this file +#endif #include #elif defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) #include -- cgit v1.1 From c166a030a1be0e4006605dd12190741986e0f9f2 Mon Sep 17 00:00:00 2001 From: Sander Vrijders Date: Thu, 27 Sep 2018 11:36:42 +0200 Subject: tools: Fix memleaks and buffer overflows in irm tool This fixes some memleaks and potential buffer overflows in the irm tool. Signed-off-by: Sander Vrijders Signed-off-by: Dimitri Staessens --- include/ouroboros/ipcp.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/ouroboros/ipcp.h b/include/ouroboros/ipcp.h index c7013f0..e423a01 100644 --- a/include/ouroboros/ipcp.h +++ b/include/ouroboros/ipcp.h @@ -27,7 +27,7 @@ #include #include -#define LAYER_NAME_SIZE 256 +#define LAYER_NAME_SIZE 255 /* * NOTE: the IRMd uses this order to select an IPCP @@ -67,7 +67,7 @@ enum pol_dir_hash { /* Info reported back to the IRMd about the layer on enrollment */ struct layer_info { - char layer_name[LAYER_NAME_SIZE]; + char layer_name[LAYER_NAME_SIZE + 1]; int dir_hash_algo; }; -- cgit v1.1 From b802b25ddfe6f1b6ecabe3ba70e3dac2e99e7a50 Mon Sep 17 00:00:00 2001 From: Dimitri Staessens Date: Thu, 4 Oct 2018 18:06:32 +0200 Subject: lib: Pass qosspec at flow allocation The flow allocator now passes the full qos specification to the endpoint, instead of just a cube. This is a more flexible architecture, as it makes QoS cubes internal to the layers. Adds endianness transforms for the flow allocator protocol in the normal IPCP. Signed-off-by: Dimitri Staessens Signed-off-by: Sander Vrijders --- include/ouroboros/ipcp-dev.h | 2 +- include/ouroboros/np1_flow.h | 2 +- include/ouroboros/qos.h | 22 ++++++++-------------- include/ouroboros/sockets.h.in | 11 +++++++++++ 4 files changed, 21 insertions(+), 16 deletions(-) (limited to 'include') diff --git a/include/ouroboros/ipcp-dev.h b/include/ouroboros/ipcp-dev.h index 9a33c25..a0ed026 100644 --- a/include/ouroboros/ipcp-dev.h +++ b/include/ouroboros/ipcp-dev.h @@ -31,7 +31,7 @@ int ipcp_create_r(pid_t pid, int ipcp_flow_req_arr(pid_t pid, const uint8_t * dst, size_t len, - qoscube_t cube); + qosspec_t qs); int ipcp_flow_alloc_reply(int fd, int response); diff --git a/include/ouroboros/np1_flow.h b/include/ouroboros/np1_flow.h index 789e82d..3435c24 100644 --- a/include/ouroboros/np1_flow.h +++ b/include/ouroboros/np1_flow.h @@ -29,7 +29,7 @@ int np1_flow_alloc(pid_t n_pid, int port_id, - qoscube_t qc); + qosspec_t qs); int np1_flow_resp(int port_id); diff --git a/include/ouroboros/qos.h b/include/ouroboros/qos.h index 011828d..2b93f1d 100644 --- a/include/ouroboros/qos.h +++ b/include/ouroboros/qos.h @@ -27,26 +27,20 @@ #include typedef struct qos_spec { - uint32_t delay; /* In ms */ - uint64_t bandwidth; /* In bits/s */ - uint8_t availability; /* Class of 9s */ - uint32_t loss; /* Packet loss */ - uint8_t in_order; /* In-order delivery, enables FRCT */ - uint32_t maximum_interruption; /* In ms */ + uint32_t delay; /* In ms */ + uint64_t bandwidth; /* In bits/s */ + uint8_t availability; /* Class of 9s */ + uint32_t loss; /* Packet loss */ + uint32_t ber; /* Bit error rate, errors per billion bits */ + uint8_t in_order; /* In-order delivery, enables FRCT */ + uint32_t max_gap; /* In ms */ } qosspec_t; qosspec_t qos_raw; +qosspec_t qos_raw_no_errors; qosspec_t qos_best_effort; qosspec_t qos_video; qosspec_t qos_voice; qosspec_t qos_data; -__BEGIN_DECLS - -int qosspec_init(qosspec_t * qs); - -int qosspec_fini(qosspec_t * qs); - -__END_DECLS - #endif /* OUROBOROS_QOS_H */ diff --git a/include/ouroboros/sockets.h.in b/include/ouroboros/sockets.h.in index 4557a9e..368923d 100644 --- a/include/ouroboros/sockets.h.in +++ b/include/ouroboros/sockets.h.in @@ -23,6 +23,8 @@ #ifndef OUROBOROS_SOCKETS_H #define OUROBOROS_SOCKETS_H +#include + #include #include "ipcp_config.pb-c.h" @@ -36,6 +38,9 @@ typedef IpcpInfoMsg ipcp_info_msg_t; #include "ipcpd_messages.pb-c.h" typedef IpcpMsg ipcp_msg_t; +#include "qosspec.pb-c.h" +typedef QosspecMsg qosspec_msg_t; + #define SOCK_PATH "/var/run/ouroboros/" #define SOCK_PATH_SUFFIX ".sock" @@ -53,4 +58,10 @@ int client_socket_open(char * file_name); irm_msg_t * send_recv_irm_msg(irm_msg_t * msg); + +/* qos message conversion needed in different components */ +qosspec_msg_t spec_to_msg(qosspec_t * qs); + +qosspec_t msg_to_spec(qosspec_msg_t * msg); + #endif -- cgit v1.1 From 5d11a6ad590133c92925c6162eb47b4401f16bef Mon Sep 17 00:00:00 2001 From: Sander Vrijders Date: Fri, 5 Oct 2018 10:24:01 +0200 Subject: ipcpd, lib, irmd, tools: Change SDU to packet This will change SDU (Service Data Unit) to packet everywhere. SDU is OSI terminology, whereas packet is Ouroboros terminology. Signed-off-by: Sander Vrijders Signed-off-by: Dimitri Staessens --- include/ouroboros/shm_rbuff.h | 2 +- include/ouroboros/timerwheel.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/ouroboros/shm_rbuff.h b/include/ouroboros/shm_rbuff.h index b2e27c7..223f6bf 100644 --- a/include/ouroboros/shm_rbuff.h +++ b/include/ouroboros/shm_rbuff.h @@ -1,7 +1,7 @@ /* * Ouroboros - Copyright (C) 2016 - 2018 * - * Ring buffer for incoming SDUs + * Ring buffer for incoming packets * * Dimitri Staessens * Sander Vrijders diff --git a/include/ouroboros/timerwheel.h b/include/ouroboros/timerwheel.h index 231e810..3499418 100644 --- a/include/ouroboros/timerwheel.h +++ b/include/ouroboros/timerwheel.h @@ -1,7 +1,7 @@ /* * Ouroboros - Copyright (C) 2016 - 2018 * - * Ring buffer for incoming SDUs + * Timerwheel * * Dimitri Staessens * Sander Vrijders -- cgit v1.1 From b05354b4af8a4999316c8074ebab496e0214ea15 Mon Sep 17 00:00:00 2001 From: Dimitri Staessens Date: Fri, 5 Oct 2018 11:58:21 +0200 Subject: doc: Update man page for fccntl The FLOWSFLAGS command was recently obsoleted with the removal of online reconfiguration of FRCT. Signed-off-by: Sander Vrijders --- include/ouroboros/fccntl.h | 1 - 1 file changed, 1 deletion(-) (limited to 'include') diff --git a/include/ouroboros/fccntl.h b/include/ouroboros/fccntl.h index bc7c720..fbfc11f 100644 --- a/include/ouroboros/fccntl.h +++ b/include/ouroboros/fccntl.h @@ -48,7 +48,6 @@ #define FRCTFRESCNTRL 00000001 /* Feedback from receiver */ #define FRCTFRTX 00000002 /* Reliable flow */ #define FRCTFERRCHCK 00000004 /* Check for errors */ -#define FRCTFPARTIAL 00000010 /* Allow partial delivery */ /* Flow operations */ #define FLOWSRCVTIMEO 00000001 /* Set read timeout */ -- cgit v1.1 From 04384c0eab88615902025023bb3e1339ea0f9d1a Mon Sep 17 00:00:00 2001 From: Dimitri Staessens Date: Fri, 5 Oct 2018 11:24:55 +0200 Subject: lib: Rename port_id to flow_id Renames port_id to flow_id according to updated nomenclature. Signed-off-by: Dimitri Staessens Signed-off-by: Sander Vrijders --- include/ouroboros/np1_flow.h | 6 +++--- include/ouroboros/shm_flow_set.h | 8 ++++---- include/ouroboros/shm_rbuff.h | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) (limited to 'include') diff --git a/include/ouroboros/np1_flow.h b/include/ouroboros/np1_flow.h index 3435c24..3a2bbd1 100644 --- a/include/ouroboros/np1_flow.h +++ b/include/ouroboros/np1_flow.h @@ -28,11 +28,11 @@ #include int np1_flow_alloc(pid_t n_pid, - int port_id, + int flow_id, qosspec_t qs); -int np1_flow_resp(int port_id); +int np1_flow_resp(int flow_id); -int np1_flow_dealloc(int port_id); +int np1_flow_dealloc(int flow_id); #endif /* OUROBOROS_NP1_FLOW_H */ diff --git a/include/ouroboros/shm_flow_set.h b/include/ouroboros/shm_flow_set.h index ebf63af..45d372a 100644 --- a/include/ouroboros/shm_flow_set.h +++ b/include/ouroboros/shm_flow_set.h @@ -42,18 +42,18 @@ void shm_flow_set_zero(struct shm_flow_set * shm_set, int shm_flow_set_add(struct shm_flow_set * shm_set, size_t idx, - int port_id); + int flow_id); int shm_flow_set_has(struct shm_flow_set * shm_set, size_t idx, - int port_id); + int flow_id); void shm_flow_set_del(struct shm_flow_set * shm_set, size_t idx, - int port_id); + int flow_id); void shm_flow_set_notify(struct shm_flow_set * set, - int port_id, + int flow_id, int event); ssize_t shm_flow_set_wait(const struct shm_flow_set * shm_set, diff --git a/include/ouroboros/shm_rbuff.h b/include/ouroboros/shm_rbuff.h index 223f6bf..447e081 100644 --- a/include/ouroboros/shm_rbuff.h +++ b/include/ouroboros/shm_rbuff.h @@ -35,10 +35,10 @@ struct shm_rbuff; struct shm_rbuff * shm_rbuff_create(pid_t pid, - int port_id); + int flow_id); struct shm_rbuff * shm_rbuff_open(pid_t pid, - int port_id); + int flow_id); void shm_rbuff_close(struct shm_rbuff * rb); -- cgit v1.1 From 3034822918dec909b1e2ffae2447b4ee05426057 Mon Sep 17 00:00:00 2001 From: Dimitri Staessens Date: Fri, 5 Oct 2018 15:06:31 +0200 Subject: doc: Fix fccntl man page Patch for previous commit, which was broken. Signed-off-by: Dimitri Staessens Signed-off-by: Sander Vrijders --- include/ouroboros/fccntl.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'include') diff --git a/include/ouroboros/fccntl.h b/include/ouroboros/fccntl.h index fbfc11f..7d1f7fe 100644 --- a/include/ouroboros/fccntl.h +++ b/include/ouroboros/fccntl.h @@ -61,8 +61,7 @@ #define FLOWGTXQLEN 00000011 /* Get queue length on tx */ /* FRCT operations */ -#define FRCTSFLAGS 00001000 /* Set flags for FRCT */ -#define FRCTGFLAGS 00001001 /* Get flags for FRCT */ +#define FRCTGFLAGS 00001000 /* Get flags for FRCT */ __BEGIN_DECLS -- cgit v1.1 From 070075812728a9949a636e7629fa8235b41ce41b Mon Sep 17 00:00:00 2001 From: Dimitri Staessens Date: Fri, 5 Oct 2018 17:04:16 +0200 Subject: lib: Split error checking from FRCT This splits off the CRC from FRCT so it can be set independently. Ouroboros now allows raw flows with error checking. Signed-off-by: Dimitri Staessens Signed-off-by: Sander Vrijders --- include/ouroboros/fccntl.h | 1 - 1 file changed, 1 deletion(-) (limited to 'include') diff --git a/include/ouroboros/fccntl.h b/include/ouroboros/fccntl.h index 7d1f7fe..b11c14d 100644 --- a/include/ouroboros/fccntl.h +++ b/include/ouroboros/fccntl.h @@ -47,7 +47,6 @@ /* FRCT flags */ #define FRCTFRESCNTRL 00000001 /* Feedback from receiver */ #define FRCTFRTX 00000002 /* Reliable flow */ -#define FRCTFERRCHCK 00000004 /* Check for errors */ /* Flow operations */ #define FLOWSRCVTIMEO 00000001 /* Set read timeout */ -- cgit v1.1 From 10c0c07265d91dbbadb53b77aa5be8a27b7b3cd0 Mon Sep 17 00:00:00 2001 From: Dimitri Staessens Date: Fri, 5 Oct 2018 21:07:26 +0200 Subject: include: Fix QoS include files A lot of files were unnecessarily including qoscube.h. Signed-off-by: Dimitri Staessens Signed-off-by: Sander Vrijders --- include/ouroboros/ipcp-dev.h | 1 + include/ouroboros/np1_flow.h | 2 +- include/ouroboros/shm_rdrbuff.h | 1 - 3 files changed, 2 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/ouroboros/ipcp-dev.h b/include/ouroboros/ipcp-dev.h index a0ed026..4f8b5da 100644 --- a/include/ouroboros/ipcp-dev.h +++ b/include/ouroboros/ipcp-dev.h @@ -21,6 +21,7 @@ */ #include +#include #ifndef OUROBOROS_IPCP_DEV_H #define OUROBOROS_IPCP_DEV_H diff --git a/include/ouroboros/np1_flow.h b/include/ouroboros/np1_flow.h index 3a2bbd1..3f80161 100644 --- a/include/ouroboros/np1_flow.h +++ b/include/ouroboros/np1_flow.h @@ -23,7 +23,7 @@ #ifndef OUROBOROS_NP1_FLOW_H #define OUROBOROS_NP1_FLOW_H -#include +#include #include diff --git a/include/ouroboros/shm_rdrbuff.h b/include/ouroboros/shm_rdrbuff.h index 277609c..4955149 100644 --- a/include/ouroboros/shm_rdrbuff.h +++ b/include/ouroboros/shm_rdrbuff.h @@ -24,7 +24,6 @@ #define OUROBOROS_SHM_RDRBUFF_H #include -#include #include #include -- cgit v1.1