diff options
author | dimitri staessens <[email protected]> | 2017-08-09 19:41:57 +0000 |
---|---|---|
committer | Sander Vrijders <[email protected]> | 2017-08-09 19:41:57 +0000 |
commit | afc4342532225fb86d11729ddb783095cb62686a (patch) | |
tree | 58ef8a40142323771eecbd8ce6c2eaea409bc138 /src/irmd/main.c | |
parent | c1d7ff1e1bd44e1a38af8a1b498c68f3378fa342 (diff) | |
parent | 24aa46946349529bf36d3569796a28917d3e756f (diff) | |
download | ouroboros-afc4342532225fb86d11729ddb783095cb62686a.tar.gz ouroboros-afc4342532225fb86d11729ddb783095cb62686a.zip |
Merged in dstaesse/ouroboros/be-libgcrypt (pull request #544)
build, lib, ipcpd, irmd: Add support for libgcrypt
Diffstat (limited to 'src/irmd/main.c')
-rw-r--r-- | src/irmd/main.c | 29 |
1 files changed, 8 insertions, 21 deletions
diff --git a/src/irmd/main.c b/src/irmd/main.c index 3f83ab2c..de4a07ab 100644 --- a/src/irmd/main.c +++ b/src/irmd/main.c @@ -59,10 +59,6 @@ #define SHM_SAN_HOLDOFF 1000 /* ms */ #define IPCP_HASH_LEN(e) hash_len(e->dir_hash_algo) -#define SHIM_ETH_LLC_HASH_ALGO HASH_SHA3_256 -#define SHIM_UDP_HASH_ALGO HASH_MD5 -#define LOCAL_HASH_ALGO HASH_SHA3_256 - struct ipcp_entry { struct list_head next; @@ -410,6 +406,7 @@ static int bootstrap_ipcp(pid_t api, ipcp_config_msg_t * conf) { struct ipcp_entry * entry = NULL; + struct dif_info info; pthread_rwlock_wrlock(&irmd.reg_lock); @@ -426,31 +423,21 @@ static int bootstrap_ipcp(pid_t api, return -1; } - if (entry->type == IPCP_LOCAL) - entry->dir_hash_algo = conf->dif_info->dir_hash_algo - = LOCAL_HASH_ALGO; - else if (entry->type == IPCP_SHIM_ETH_LLC) - entry->dir_hash_algo = conf->dif_info->dir_hash_algo - = SHIM_ETH_LLC_HASH_ALGO; - else if (entry->type == IPCP_SHIM_UDP) - entry->dir_hash_algo = conf->dif_info->dir_hash_algo - = SHIM_UDP_HASH_ALGO; - else - entry->dir_hash_algo = conf->dif_info->dir_hash_algo; - - if (ipcp_bootstrap(entry->api, conf)) { + if (ipcp_bootstrap(entry->api, conf, &info)) { pthread_rwlock_unlock(&irmd.reg_lock); log_err("Could not bootstrap IPCP."); return -1; } - entry->dif_name = strdup(conf->dif_info->dif_name); + entry->dif_name = strdup(info.dif_name); if (entry->dif_name == NULL) { pthread_rwlock_unlock(&irmd.reg_lock); log_warn("Failed to set name of DIF."); return -ENOMEM; } + entry->dir_hash_algo = info.dir_hash_algo; + pthread_rwlock_unlock(&irmd.reg_lock); log_info("Bootstrapped IPCP %d in DIF %s.", @@ -463,7 +450,7 @@ static int enroll_ipcp(pid_t api, char * dst_name) { struct ipcp_entry * entry = NULL; - struct dif_info info; + struct dif_info info; pthread_rwlock_wrlock(&irmd.reg_lock); @@ -813,8 +800,8 @@ static int name_reg(const char * name, if (ipcp_reg(e->api, hash, IPCP_HASH_LEN(e))) { log_err("Could not register " HASH_FMT - " in DIF %s.", - HASH_VAL(hash), e->dif_name); + " in DIF %s (IPCP %d).", + HASH_VAL(hash), e->dif_name, e->api); } else { if (registry_add_name_to_dif(&irmd.registry, name, |