支持tun模式调通
This commit is contained in:
@@ -284,7 +284,7 @@ error_out:
|
||||
return -1;
|
||||
}
|
||||
|
||||
struct tfe_mgr* tfe_mgr_init(int tfe_node_count, const char* profile, void *logger){
|
||||
struct tfe_mgr* tfe_mgr_init(int tfe_node_count, const char* profile, enum kni_deploy_mode depoly_mode, void *logger){
|
||||
struct tfe_mgr* mgr = ALLOC(struct tfe_mgr, 1);
|
||||
mgr->logger = logger;
|
||||
int ret;
|
||||
@@ -329,22 +329,27 @@ struct tfe_mgr* tfe_mgr_init(int tfe_node_count, const char* profile, void *logg
|
||||
//load tfe_ipaddr
|
||||
j = 0;
|
||||
for(int i = 0; i < tfe_node_count; i++){
|
||||
snprintf(section, sizeof(section), "tfe%d", i);
|
||||
MESA_load_profile_int_def(profile, section, "enabled", &tfe_node_enabled, 1);
|
||||
if(tfe_node_enabled != 1){
|
||||
continue;
|
||||
if(depoly_mode == KNI_DEPLOY_MODE_NORMAL){
|
||||
snprintf(section, sizeof(section), "tfe%d", i);
|
||||
MESA_load_profile_int_def(profile, section, "enabled", &tfe_node_enabled, 1);
|
||||
if(tfe_node_enabled != 1){
|
||||
continue;
|
||||
}
|
||||
ret = MESA_load_profile_string_nodef(profile, section, "ip_addr", tfe_ipaddr_str, sizeof(tfe_ipaddr_str));
|
||||
if(ret < 0){
|
||||
KNI_LOG_ERROR(logger, "MESA_prof_load: ip_addr not set, profile is %s, section is %s", profile, section);
|
||||
goto error_out;
|
||||
}
|
||||
KNI_LOG_ERROR(logger, "MESA_prof_load, [%s]:\n ip_addr: %s", section, tfe_ipaddr_str);
|
||||
ret = inet_pton(AF_INET, tfe_ipaddr_str, &tfe_node_ipaddr);
|
||||
if(ret != 1){
|
||||
KNI_LOG_ERROR(logger, "Failed at inet_pton, ret is %d, errno is %d, errmsg is %s, tfe_id is %d, ip_addr is %s",
|
||||
ret, errno, strerror(errno), i, tfe_ipaddr_str);
|
||||
goto error_out;
|
||||
}
|
||||
}
|
||||
ret = MESA_load_profile_string_nodef(profile, section, "ip_addr", tfe_ipaddr_str, sizeof(tfe_ipaddr_str));
|
||||
if(ret < 0){
|
||||
KNI_LOG_ERROR(logger, "MESA_prof_load: ip_addr not set, profile is %s, section is %s", profile, section);
|
||||
goto error_out;
|
||||
}
|
||||
KNI_LOG_ERROR(logger, "MESA_prof_load, [%s]:\n ip_addr: %s", section, tfe_ipaddr_str);
|
||||
ret = inet_pton(AF_INET, tfe_ipaddr_str, &tfe_node_ipaddr);
|
||||
if(ret != 1){
|
||||
KNI_LOG_ERROR(logger, "Failed at inet_pton, ret is %d, errno is %d, errmsg is %s, tfe_id is %d, ip_addr is %s",
|
||||
ret, errno, strerror(errno), i, tfe_ipaddr_str);
|
||||
goto error_out;
|
||||
else{
|
||||
tfe_node_ipaddr = keepalive_listen_ip;
|
||||
}
|
||||
mgr->tfe_enabled_nodes[j].tfe_id = i;
|
||||
mgr->tfe_enabled_nodes[j].ipaddr = tfe_node_ipaddr;
|
||||
|
||||
Reference in New Issue
Block a user