diff options
author | dimitri staessens <[email protected]> | 2017-04-27 16:17:39 +0000 |
---|---|---|
committer | Sander Vrijders <[email protected]> | 2017-04-27 16:17:39 +0000 |
commit | ee2c0eb9f0777e08b00fe7cdfac912a84dd29cf4 (patch) | |
tree | 137c34f79897b5f371a65dd14208b77201d1e907 /src/ipcpd | |
parent | 1f8f2ebe3bb385593755b69bd264ff5f831a22ae (diff) | |
parent | b398dbe5cfd12b928e00f9a22cd6826bbdfb18d7 (diff) | |
download | ouroboros-ee2c0eb9f0777e08b00fe7cdfac912a84dd29cf4.tar.gz ouroboros-ee2c0eb9f0777e08b00fe7cdfac912a84dd29cf4.zip |
Merged in dstaesse/ouroboros/be-cap (pull request #495)
Be cap
Diffstat (limited to 'src/ipcpd')
-rw-r--r-- | src/ipcpd/ipcp.c | 12 | ||||
-rw-r--r-- | src/ipcpd/ipcp.h | 3 | ||||
-rw-r--r-- | src/ipcpd/normal/main.c | 29 |
3 files changed, 29 insertions, 15 deletions
diff --git a/src/ipcpd/ipcp.c b/src/ipcpd/ipcp.c index d682309d..7f3ebc73 100644 --- a/src/ipcpd/ipcp.c +++ b/src/ipcpd/ipcp.c @@ -143,9 +143,10 @@ static void * ipcp_main_loop(void * o) ipcp_config_msg_t * conf_msg; struct ipcp_config conf; + struct dif_info info; struct timeval ltv = {(SOCKET_TIMEOUT / 1000), - (SOCKET_TIMEOUT % 1000) * 1000}; + (SOCKET_TIMEOUT % 1000) * 1000}; ssize_t id = (ssize_t) o; @@ -259,7 +260,14 @@ static void * ipcp_main_loop(void * o) break; } - ret_msg.result = ipcpi.ops->ipcp_enroll(msg->dst_name); + ret_msg.result = ipcpi.ops->ipcp_enroll(msg->dst_name, + &info); + + if (ret_msg.result == 0) { + ret_msg.has_dir_hash_algo = true; + ret_msg.dir_hash_algo = info.algo; + ret_msg.dif_name = info.dif_name; + } break; case IPCP_MSG_CODE__IPCP_REG: ret_msg.has_result = true; diff --git a/src/ipcpd/ipcp.h b/src/ipcpd/ipcp.h index c78aa5a6..3f5e1bd6 100644 --- a/src/ipcpd/ipcp.h +++ b/src/ipcpd/ipcp.h @@ -43,7 +43,8 @@ enum ipcp_state { struct ipcp_ops { int (* ipcp_bootstrap)(const struct ipcp_config * conf); - int (* ipcp_enroll)(const char * dst); + int (* ipcp_enroll)(const char * dst, + struct dif_info * info); int (* ipcp_reg)(const uint8_t * hash); diff --git a/src/ipcpd/normal/main.c b/src/ipcpd/normal/main.c index ab8cf387..9228f36b 100644 --- a/src/ipcpd/normal/main.c +++ b/src/ipcpd/normal/main.c @@ -116,21 +116,21 @@ static int boot_components(void) log_dbg("Starting ribmgr."); - if (ribmgr_init()) { - log_err("Failed to initialize RIB manager."); + if (dir_init()) { + log_err("Failed to initialize directory."); goto fail_addr_auth; } - if (dir_init()) { - log_err("Failed to initialize directory."); - goto fail_ribmgr; + if (ribmgr_init()) { + log_err("Failed to initialize RIB manager."); + goto fail_dir; } log_dbg("Ribmgr started."); if (frct_init()) { log_err("Failed to initialize FRCT."); - goto fail_dir; + goto fail_ribmgr; } if (fa_init()) { @@ -180,10 +180,10 @@ static int boot_components(void) fa_fini(); fail_frct: frct_fini(); - fail_dir: - dir_fini(); fail_ribmgr: ribmgr_fini(); + fail_dir: + dir_fini(); fail_addr_auth: addr_auth_fini(); fail_name: @@ -208,16 +208,17 @@ void shutdown_components(void) frct_fini(); - dir_fini(); - ribmgr_fini(); + dir_fini(); + addr_auth_fini(); free(ipcpi.dif_name); } -static int normal_ipcp_enroll(const char * dst) +static int normal_ipcp_enroll(const char * dst, + struct dif_info * info) { if (rib_add(RIB_ROOT, MEMBERS_NAME)) { log_err("Failed to create members."); @@ -237,7 +238,11 @@ static int normal_ipcp_enroll(const char * dst) log_dbg("Enrolled with " HASH_FMT, HASH_VAL(dst)); - return ipcpi.dir_hash_algo; + info->algo = ipcpi.dir_hash_algo; + + strcpy(info->dif_name, ipcpi.dif_name); + + return 0; } const struct ros { |