diff options
author | dimitri staessens <dimitri.staessens@intec.ugent.be> | 2017-02-13 10:55:33 +0000 |
---|---|---|
committer | Sander Vrijders <sander.vrijders@intec.ugent.be> | 2017-02-13 10:55:33 +0000 |
commit | 5ea091f9cde6090c4829e78b7d2ac5a566ede8f1 (patch) | |
tree | d4926c7856344dcc4aba9838b734ad0c67acb4ce /src/ipcpd/normal/dir.c | |
parent | 344f834e85e9c7afc47e19226157c8e834725d2e (diff) | |
parent | 5cc79cfeb7a33c93ae9ef5781f9b0ecd4a958bee (diff) | |
download | ouroboros-5ea091f9cde6090c4829e78b7d2ac5a566ede8f1.tar.gz ouroboros-5ea091f9cde6090c4829e78b7d2ac5a566ede8f1.zip |
Merged in dstaesse/ouroboros/be-endian (pull request #371)
Check time synchronization upon enrollment
Diffstat (limited to 'src/ipcpd/normal/dir.c')
-rw-r--r-- | src/ipcpd/normal/dir.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/ipcpd/normal/dir.c b/src/ipcpd/normal/dir.c index d30b9ec0..703f4e79 100644 --- a/src/ipcpd/normal/dir.c +++ b/src/ipcpd/normal/dir.c @@ -31,21 +31,22 @@ #include <string.h> #include <assert.h> +#define DIR_PATH "/" DIR_NAME + static char dir_path[RIB_MAX_PATH_LEN + 1]; static void dir_path_reset(void) { - dir_path[strlen("/" DIR_NAME)]= '\0'; - assert(strcmp("/" DIR_NAME, dir_path) == 0); + dir_path[strlen(DIR_PATH)]= '\0'; + assert(strcmp(DIR_PATH, dir_path) == 0); } int dir_init(void) { /*FIXME: set ribmgr dissemination here */ - if (rib_add(RIB_ROOT, DIR_NAME)) return -1; - strcpy(dir_path, "/" DIR_NAME); + strcpy(dir_path, DIR_PATH); return 0; } @@ -66,6 +67,9 @@ int dir_name_reg(char * name) assert(name); + if (ipcp_get_state() != IPCP_OPERATIONAL) + return -EPERM; + dir_path_reset(); ret = rib_add(dir_path, name); @@ -91,6 +95,9 @@ int dir_name_unreg(char * name) assert(name); + if (ipcp_get_state() != IPCP_OPERATIONAL) + return -EPERM; + dir_path_reset(); rib_path_append(dir_path, name); @@ -116,6 +123,9 @@ int dir_name_query(char * name) { size_t len; + if (ipcp_get_state() != IPCP_OPERATIONAL) + return -EPERM; + dir_path_reset(); rib_path_append(dir_path, name); |