diff options
author | Dimitri Staessens <[email protected]> | 2021-06-29 20:11:37 +0200 |
---|---|---|
committer | Sander Vrijders <[email protected]> | 2021-06-30 09:20:15 +0200 |
commit | 7c0c62706f2ae9821dc779db268a28ef986730fe (patch) | |
tree | abe6a2204b93f2070d6270c472ec0d74693657a2 /src/lib/rib.c | |
parent | 55e182b5b323c049ea49c79c2d68c8547940c62b (diff) | |
download | ouroboros-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 <[email protected]>
Signed-off-by: Sander Vrijders <[email protected]>
Diffstat (limited to 'src/lib/rib.c')
-rw-r--r-- | src/lib/rib.c | 18 |
1 files changed, 15 insertions, 3 deletions
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; |