tfe.conf中系统参数的section改为system,兼容kniv1测试完毕。
This commit is contained in:
@@ -206,8 +206,8 @@ void __kni_event_cb(evutil_socket_t fd, short what, void * user)
|
||||
struct tfe_cmsg * __tfe_cmsg;
|
||||
struct tfe_proxy_accept_para __accept_para{};
|
||||
|
||||
uint16_t session_type;
|
||||
uint16_t keyring_id;
|
||||
uint8_t session_type;
|
||||
int32_t keyring_id;
|
||||
|
||||
int * __fds = NULL;
|
||||
assert(__ctx != NULL && __ctx->thread == pthread_self());
|
||||
|
||||
@@ -258,8 +258,8 @@ int tfe_proxy_work_thread_run(struct tfe_proxy * proxy)
|
||||
int tfe_proxy_config(struct tfe_proxy * proxy, const char * profile)
|
||||
{
|
||||
/* Worker threads */
|
||||
MESA_load_profile_uint_def(profile, "main", "nr_worker_threads", &proxy->nr_work_threads, 1);
|
||||
MESA_load_profile_uint_def(profile, "main", "buffer_output_limit", &proxy->buffer_output_limit, 0);
|
||||
MESA_load_profile_uint_def(profile, "system", "nr_worker_threads", &proxy->nr_work_threads, 1);
|
||||
MESA_load_profile_uint_def(profile, "system", "buffer_output_limit", &proxy->buffer_output_limit, 0);
|
||||
|
||||
/* Debug */
|
||||
MESA_load_profile_uint_def(profile, "debug", "passthrough_all_tcp", &proxy->tcp_all_passthrough, 0);
|
||||
@@ -355,13 +355,13 @@ int tfe_stat_init(struct tfe_proxy * proxy, const char * profile)
|
||||
|
||||
void tfe_proxy_acceptor_init(struct tfe_proxy * proxy, const char * profile)
|
||||
{
|
||||
MESA_load_profile_uint_def(profile, "acceptor", "en_kni_v1", &proxy->en_kni_v1_acceptor, 0);
|
||||
MESA_load_profile_uint_def(profile, "acceptor", "en_kni_v2", &proxy->en_kni_v2_acceptor, 1);
|
||||
MESA_load_profile_uint_def(profile, "system", "enable_kni_v1", &proxy->en_kni_v1_acceptor, 0);
|
||||
MESA_load_profile_uint_def(profile, "system", "enable_kni_v2", &proxy->en_kni_v2_acceptor, 1);
|
||||
|
||||
if (proxy->en_kni_v1_acceptor)
|
||||
{
|
||||
g_default_proxy->kni_v1_acceptor = acceptor_kni_v1_create(proxy, profile, proxy->logger);
|
||||
CHECK_OR_EXIT(g_default_proxy->kni_v2_acceptor, "Failed at init KNIv2 acceptor. Exit. ");
|
||||
CHECK_OR_EXIT(g_default_proxy->kni_v1_acceptor, "Failed at init KNIv1 acceptor. Exit. ");
|
||||
}
|
||||
|
||||
if (proxy->en_kni_v2_acceptor)
|
||||
@@ -438,7 +438,7 @@ int main(int argc, char * argv[])
|
||||
tfe_proxy_acceptor_init(g_default_proxy, main_profile);
|
||||
|
||||
/* SCM Sender */
|
||||
g_default_proxy->scm_sender = sender_scm_init(main_profile, "sender_scm", g_default_logger);
|
||||
g_default_proxy->scm_sender = sender_scm_init(main_profile, "kni", g_default_logger);
|
||||
CHECK_OR_EXIT(g_default_proxy->scm_sender != NULL, "Failed at creating scm sender, Exit.");
|
||||
|
||||
/* PLUGIN INIT */
|
||||
|
||||
@@ -41,26 +41,14 @@ struct sender_scm* sender_scm_init(const char *profile, const char *section, voi
|
||||
struct sockaddr_in server_addr;
|
||||
struct sender_scm *sender = ALLOC(struct sender_scm, 1);
|
||||
sender->logger = logger;
|
||||
int ret = MESA_load_profile_int_nodef(profile, section, "send_switch", &send_switch);
|
||||
if(ret < 0)
|
||||
MESA_load_profile_int_def(profile, section, "send_switch", &send_switch, 1);
|
||||
if(send_switch)
|
||||
{
|
||||
TFE_LOG_ERROR(logger, "MESA_prof_load: send_switch not set, profile is %s, section is %s", profile, section);
|
||||
goto error_out;
|
||||
MESA_load_profile_string_def(profile, section, "ip", kni_ip, sizeof(kni_ip), "127.0.0.1");
|
||||
MESA_load_profile_int_def(profile, section, "cmsg_port", &kni_port, 2475);
|
||||
TFE_LOG_INFO(logger, "MESA_prof_load, [%s]:\n kni_ip: %s\n kni_port: %d",
|
||||
section, kni_ip, kni_port);
|
||||
}
|
||||
ret = MESA_load_profile_string_nodef(profile, section, "kni_ip", kni_ip, sizeof(kni_ip));
|
||||
if(ret < 0)
|
||||
{
|
||||
TFE_LOG_ERROR(logger, "MESA_prof_load: kni_ip not set, profile is %s, section is %s", profile, section);
|
||||
goto error_out;
|
||||
}
|
||||
ret = MESA_load_profile_int_nodef(profile, section, "kni_port", &kni_port);
|
||||
if(ret < 0)
|
||||
{
|
||||
TFE_LOG_ERROR(logger, "MESA_prof_load: kni_port not set, profile is %s, section is %s", profile, section);
|
||||
goto error_out;
|
||||
}
|
||||
TFE_LOG_INFO(logger, "MESA_prof_load, [%s]:\n kni_ip: %s\n kni_port: %d",
|
||||
section, kni_ip, kni_port);
|
||||
sender->send_switch = send_switch;
|
||||
if(send_switch == 0)
|
||||
{
|
||||
|
||||
@@ -1179,7 +1179,7 @@ static void ssl_server_connected_eventcb(struct bufferevent * bev, short events,
|
||||
TFE_LOG_ERROR(mgr->logger, "Warning: ssl connect server latency %ld ms: addr=%s, sni=%s", jiffies_ms, s_stream->tcp_stream->str_stream_info, sni);
|
||||
}
|
||||
s_stream->connect_latency_ms=jiffies_ms;
|
||||
ssl_stream_set_cmsg_integer(s_stream, TFE_CMSG_SSL_UPSTREAM_LATENCY, jiffies_ms);
|
||||
ssl_stream_set_cmsg_integer(s_stream, TFE_CMSG_SSL_SERVER_SIDE_LATENCY, jiffies_ms);
|
||||
|
||||
if(!SSL_session_reused(s_stream->ssl))
|
||||
{
|
||||
@@ -1253,7 +1253,7 @@ static void ssl_server_connected_eventcb(struct bufferevent * bev, short events,
|
||||
}
|
||||
}
|
||||
s_stream->negotiated_version=SSL_version(s_stream->ssl);
|
||||
ssl_stream_set_cmsg_string(s_stream, TFE_CMSG_SSL_UPSTREAM_VERSION, SSL_get_version(s_stream->ssl));
|
||||
ssl_stream_set_cmsg_string(s_stream, TFE_CMSG_SSL_SERVER_SIDE_VERSION, SSL_get_version(s_stream->ssl));
|
||||
ssl_stream_set_cmsg_integer(s_stream, TFE_CMSG_SSL_CERT_VERIFY, s_upstream->is_server_cert_verify_passed);
|
||||
promise_success(p, ctx);
|
||||
}
|
||||
@@ -1777,7 +1777,7 @@ static void ssl_client_connected_eventcb(struct bufferevent * bev, short events,
|
||||
TFE_LOG_ERROR(mgr->logger, "Warning: ssl connect client latency %ld ms: addr=%s, sni=%s", jiffies_ms, s_stream->tcp_stream->str_stream_info, sni);
|
||||
}
|
||||
s_stream->connect_latency_ms=jiffies_ms;
|
||||
ssl_stream_set_cmsg_integer(s_stream, TFE_CMSG_SSL_DOWNSTREAM_LATENCY, jiffies_ms);
|
||||
ssl_stream_set_cmsg_integer(s_stream, TFE_CMSG_SSL_CLIENT_SIDE_LATENCY, jiffies_ms);
|
||||
bufferevent_disable(ctx->bev_down, EV_READ | EV_WRITE);
|
||||
bufferevent_setcb(ctx->bev_down, NULL, NULL, NULL, NULL); //leave a clean bev for on_success
|
||||
|
||||
@@ -1786,7 +1786,7 @@ static void ssl_client_connected_eventcb(struct bufferevent * bev, short events,
|
||||
log_ssl_master_key(s_stream->ssl, ctx->fd_downstream, CONN_DIR_DOWNSTREAM, mgr->fp_master_key);
|
||||
}
|
||||
s_stream->negotiated_version=SSL_version(s_stream->ssl);
|
||||
ssl_stream_set_cmsg_string(s_stream, TFE_CMSG_SSL_DOWNSTREAM_VERSION, SSL_get_version(s_stream->ssl));
|
||||
ssl_stream_set_cmsg_string(s_stream, TFE_CMSG_SSL_CLIENT_SIDE_VERSION, SSL_get_version(s_stream->ssl));
|
||||
promise_success(p, ctx);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user