summaryrefslogtreecommitdiff
path: root/src/lib/dev.c
diff options
context:
space:
mode:
authorDimitri Staessens <dimitri@ouroboros.rocks>2021-06-29 20:11:37 +0200
committerSander Vrijders <sander@ouroboros.rocks>2021-06-30 09:20:15 +0200
commit7c0c62706f2ae9821dc779db268a28ef986730fe (patch)
treeabe6a2204b93f2070d6270c472ec0d74693657a2 /src/lib/dev.c
parent55e182b5b323c049ea49c79c2d68c8547940c62b (diff)
downloadouroboros-7c0c62706f2ae9821dc779db268a28ef986730fe.tar.gz
ouroboros-7c0c62706f2ae9821dc779db268a28ef986730fe.zip
lib: Application RIB with FRCT statistics
Application flows can now be monitored from the RIB, exposing FRCT statistics (window edges, retransmission timeout, rtt estimate, etc). Application RIB requires user permissions to be able to access /dev/fuse. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
Diffstat (limited to 'src/lib/dev.c')
-rw-r--r--src/lib/dev.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/lib/dev.c b/src/lib/dev.c
index ec4561b2..fbbc096d 100644
--- a/src/lib/dev.c
+++ b/src/lib/dev.c
@@ -44,6 +44,9 @@
#include <ouroboros/shm_rbuff.h>
#include <ouroboros/utils.h>
#include <ouroboros/fqueue.h>
+#ifdef PROC_FLOW_STATS
+#include <ouroboros/rib.h>
+#endif
#include <stdlib.h>
#include <string.h>
@@ -361,7 +364,9 @@ static void init(int argc,
{
const char * prog = argv[0];
int i;
-
+#ifdef PROC_FLOW_STATS
+ char procstr[32];
+#endif
(void) argc;
(void) envp;
@@ -437,6 +442,11 @@ static void init(int argc,
if (timerwheel_init() < 0)
goto fail_timerwheel;
+#if defined PROC_FLOW_STATS
+ sprintf(procstr, "proc.%d", getpid());
+ /* Don't bail, it just won't show metrics */
+ rib_init(procstr);
+#endif
return;
fail_timerwheel:
@@ -470,7 +480,13 @@ static void init(int argc,
static void fini(void)
{
- int i = 0;
+ int i = 0;
+#ifdef PROC_FLOW_STATS
+ char procstr[32];
+
+ sprintf(procstr, "proc.%d", getpid());
+ rib_fini();
+#endif
if (ai.fds == NULL)
return;