From 7c0c62706f2ae9821dc779db268a28ef986730fe Mon Sep 17 00:00:00 2001 From: Dimitri Staessens Date: Tue, 29 Jun 2021 20:11:37 +0200 Subject: 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 Signed-off-by: Sander Vrijders --- src/lib/rib.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'src/lib/rib.c') diff --git a/src/lib/rib.c b/src/lib/rib.c index dfac69d7..8fda19d4 100644 --- a/src/lib/rib.c +++ b/src/lib/rib.c @@ -286,8 +286,17 @@ int rib_init(const char * mountpt) NULL}; struct fuse_args args = FUSE_ARGS_INIT(3, argv); + if (access("/dev/fuse", R_OK)) + goto fail; + if (stat(FUSE_PREFIX, &st) == -1) - return -1; + goto fail; + + /* This is crap to allow IPCP RIB to remount to a different name */ + if (strlen(rib.mnt) > 0) { + fuse_unmount(rib.mnt, rib.ch); + rmdir(rib.mnt); + } sprintf(rib.mnt, FUSE_PREFIX "/%s", mountpt); @@ -295,13 +304,13 @@ int rib_init(const char * mountpt) switch(errno) { case ENOENT: if (mkdir(rib.mnt, 0777)) - return -1; + goto fail_mnt; break; case ENOTCONN: fuse_unmount(rib.mnt, rib.ch); break; default: - return -1; + goto fail_mnt; } fuse_opt_parse(&args, NULL, NULL, NULL); @@ -335,6 +344,9 @@ int rib_init(const char * mountpt) fail_mount: fuse_opt_free_args(&args); rmdir(rib.mnt); + fail_mnt: + memset(rib.mnt, 0, RIB_PATH_LEN + 1); + fail: return -1; #else (void) mountpt; -- cgit v1.2.3