diff options
author | Dimitri Staessens <dimitri@ouroboros.rocks> | 2021-06-26 13:42:58 +0200 |
---|---|---|
committer | Sander Vrijders <sander@ouroboros.rocks> | 2021-06-28 15:29:23 +0200 |
commit | 9d2688340bea357e2c2206f3c69ea64c866cb2ad (patch) | |
tree | f677da48234c8d38178c0af29a7e680318d229ed /src/ipcpd/unicast/dt.c | |
parent | 18b0de19830e7286ad5eecbba23013e835739cdc (diff) | |
download | ouroboros-9d2688340bea357e2c2206f3c69ea64c866cb2ad.tar.gz ouroboros-9d2688340bea357e2c2206f3c69ea64c866cb2ad.zip |
ipcpd: Fix unregistering fa and dt RIBs
These RIBs were not properly unregistered on shutdown.
Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks>
Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
Diffstat (limited to 'src/ipcpd/unicast/dt.c')
-rw-r--r-- | src/ipcpd/unicast/dt.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/src/ipcpd/unicast/dt.c b/src/ipcpd/unicast/dt.c index 38fb51f3..9f15e2da 100644 --- a/src/ipcpd/unicast/dt.c +++ b/src/ipcpd/unicast/dt.c @@ -58,8 +58,9 @@ #include <inttypes.h> #include <assert.h> -#define QOS_BLOCK_LEN 672 -#define STAT_FILE_LEN (189 + QOS_BLOCK_LEN * QOS_CUBE_MAX) +#define QOS_BLOCK_LEN 672 +#define RIB_FILE_STRLEN (189 + QOS_BLOCK_LEN * QOS_CUBE_MAX) +#define RIB_NAME_STRLEN 256 #ifndef CLOCK_REALTIME_COARSE #define CLOCK_REALTIME_COARSE CLOCK_REALTIME @@ -192,7 +193,7 @@ static int dt_rib_read(const char * path, /* NOTE: we may need stronger checks. */ fd = atoi(path); - if (len < STAT_FILE_LEN) + if (len < RIB_FILE_STRLEN) return 0; buf[0] = '\0'; @@ -261,7 +262,7 @@ static int dt_rib_read(const char * path, pthread_mutex_unlock(&dt.stat[fd].lock); - return STAT_FILE_LEN; + return RIB_FILE_STRLEN; #else (void) path; (void) buf; @@ -339,7 +340,7 @@ static int dt_rib_getattr(const char * path, pthread_mutex_lock(&dt.stat[fd].lock); if (dt.stat[fd].stamp != -1) { - attr->size = STAT_FILE_LEN; + attr->size = RIB_FILE_STRLEN; attr->mtime = dt.stat[fd].stamp; } else { attr->size = 0; @@ -561,7 +562,7 @@ int dt_init(enum pol_routing pr, { int i; int j; - char dtstr[256]; + char dtstr[RIB_NAME_STRLEN + 1]; int pp; struct conn_info info; @@ -676,9 +677,11 @@ int dt_init(enum pol_routing pr, void dt_fini(void) { + char dtstr[RIB_NAME_STRLEN + 1]; int i; - rib_unreg(DT); + sprintf(dtstr, "%s.%" PRIu64, DT, ipcpi.dt_addr); + rib_unreg(dtstr); #ifdef IPCP_FLOW_STATS for (i = 0; i < PROG_MAX_FLOWS; ++i) pthread_mutex_destroy(&dt.stat[i].lock); |