diff options
| author | dimitri staessens <dimitri.staessens@ugent.be> | 2017-04-16 11:46:34 +0000 | 
|---|---|---|
| committer | Sander Vrijders <sander.vrijders@ugent.be> | 2017-04-16 11:46:34 +0000 | 
| commit | 5cbeb1586b7a5a0d5975ee7dc0cd6a2d471b940a (patch) | |
| tree | 70abff35ecf47035630d2d3af29600bd6146bd5b /src/ipcpd/normal | |
| parent | 9c6750d70b591af5429fcafbad19aede69e21675 (diff) | |
| parent | 97ef24340da7d3f55a39ba16b400d13f9bbe9e60 (diff) | |
| download | ouroboros-5cbeb1586b7a5a0d5975ee7dc0cd6a2d471b940a.tar.gz ouroboros-5cbeb1586b7a5a0d5975ee7dc0cd6a2d471b940a.zip | |
Merged in dstaesse/ouroboros/be-hashing (pull request #484)
Be hashing
Diffstat (limited to 'src/ipcpd/normal')
| -rw-r--r-- | src/ipcpd/normal/dir.c | 6 | ||||
| -rw-r--r-- | src/ipcpd/normal/fmgr.c | 6 | ||||
| -rw-r--r-- | src/ipcpd/normal/main.c | 24 | 
3 files changed, 18 insertions, 18 deletions
| diff --git a/src/ipcpd/normal/dir.c b/src/ipcpd/normal/dir.c index 0249ba06..5ea8a300 100644 --- a/src/ipcpd/normal/dir.c +++ b/src/ipcpd/normal/dir.c @@ -62,7 +62,7 @@ int dir_fini(void)  int dir_reg(const uint8_t * hash)  { -        char hashstr[DIR_HASH_STRLEN + 1]; +        char hashstr[ipcp_dir_hash_strlen() + 1];          int ret;          assert(hash); @@ -91,7 +91,7 @@ int dir_reg(const uint8_t * hash)  int dir_unreg(const uint8_t * hash)  { -        char hashstr[DIR_HASH_STRLEN + 1]; +        char hashstr[ipcp_dir_hash_strlen() + 1];          size_t len;          assert(hash); @@ -121,7 +121,7 @@ int dir_unreg(const uint8_t * hash)  int dir_query(const uint8_t * hash)  { -        char hashstr[DIR_HASH_STRLEN + 1]; +        char hashstr[ipcp_dir_hash_strlen() + 1];          size_t len;          dir_path_reset(); diff --git a/src/ipcpd/normal/fmgr.c b/src/ipcpd/normal/fmgr.c index 5166cc5d..ba36812f 100644 --- a/src/ipcpd/normal/fmgr.c +++ b/src/ipcpd/normal/fmgr.c @@ -439,7 +439,7 @@ int fmgr_np1_alloc(int             fd,          ssize_t          ch;          ssize_t          i;          char **          children; -        char             hashstr[DIR_HASH_STRLEN + 1]; +        char             hashstr[ipcp_dir_hash_strlen() + 1];          char *           dst_ipcp = NULL;          ipcp_hash_str(hashstr, dst); @@ -477,7 +477,7 @@ int fmgr_np1_alloc(int             fd,          msg.code        = FLOW_ALLOC_CODE__FLOW_REQ;          msg.has_hash    = true; -        msg.hash.len    = ipcpi.dir_hash_len; +        msg.hash.len    = ipcp_dir_hash_len();          msg.hash.data   = (uint8_t *) dst;          msg.has_qoscube = true;          msg.qoscube     = cube; @@ -663,7 +663,7 @@ int fmgr_np1_post_buf(cep_id_t   cep_id,                  fd = ipcp_flow_req_arr(getpid(),                                         msg->hash.data, -                                       ipcpi.dir_hash_len, +                                       ipcp_dir_hash_len(),                                         msg->qoscube);                  if (fd < 0) {                          pthread_mutex_unlock(&ipcpi.alloc_lock); diff --git a/src/ipcpd/normal/main.c b/src/ipcpd/normal/main.c index e37a0fbc..67424914 100644 --- a/src/ipcpd/normal/main.c +++ b/src/ipcpd/normal/main.c @@ -69,16 +69,16 @@ static int boot_components(void)                  return -1;          } -        len = rib_read(BOOT_PATH "/general/dir_hash_len", -                       &ipcpi.dir_hash_len, sizeof(ipcpi.dir_hash_len)); +        len = rib_read(BOOT_PATH "/general/dir_hash_algo", +                       &ipcpi.dir_hash_algo, sizeof(ipcpi.dir_hash_algo));          if (len < 0) {                  log_err("Failed to read hash length: %zd.", len);                  return -1;          } -        ipcpi.dir_hash_len = ntoh16(ipcpi.dir_hash_len); +        ipcpi.dir_hash_algo = ntoh32(ipcpi.dir_hash_algo); -        assert(ipcpi.dir_hash_len != 0); +        assert(ipcp_dir_hash_len() != 0);          if (rib_add(MEMBERS_PATH, ipcpi.name)) {                  log_err("Failed to add name to " MEMBERS_PATH); @@ -229,7 +229,7 @@ static int normal_ipcp_enroll(const char * dst)          log_dbg("Enrolled with " HASH_FMT, HASH_VAL(dst)); -        return 0; +        return ipcpi.dir_hash_algo;  }  const struct ros { @@ -245,7 +245,7 @@ const struct ros {          {BOOT_PATH, "general"},          {BOOT_PATH "/general", "dif_name"}, -        {BOOT_PATH "/general", "dir_hash_len"}, +        {BOOT_PATH "/general", "dir_hash_algo"},          /* DT COMPONENT */          {BOOT_PATH, "dt"}, @@ -293,14 +293,14 @@ int normal_rib_init(void)  static int normal_ipcp_bootstrap(const struct ipcp_config * conf)  { -        uint16_t hash_len; +        uint32_t hash_algo;          assert(conf);          assert(conf->type == THIS_TYPE); -        hash_len = hton16((uint16_t) conf->dir_hash_len); +        hash_algo = hton32((uint32_t) conf->dir_hash_algo); -        assert(ntoh16(hash_len) != 0); +        assert(ntoh32(hash_algo) != 0);          if (normal_rib_init()) {                  log_err("Failed to write initial structure to the RIB."); @@ -310,9 +310,9 @@ static int normal_ipcp_bootstrap(const struct ipcp_config * conf)          if (rib_write(BOOT_PATH "/general/dif_name",                        conf->dif_name,                        strlen(conf->dif_name) + 1) || -            rib_write(BOOT_PATH "/general/dir_hash_len", -                      &hash_len, -                      sizeof(hash_len)) || +            rib_write(BOOT_PATH "/general/dir_hash_algo", +                      &hash_algo, +                      sizeof(hash_algo)) ||              rib_write(BOOT_PATH "/dt/const/addr_size",                        &conf->addr_size,                        sizeof(conf->addr_size)) || | 
