TSG-13075 TFE的Decrypted Traffic Steering功能增加第三方设备保活检查

This commit is contained in:
luwenpeng
2022-12-19 14:14:30 +08:00
parent c1d9a1ab0f
commit 42dded52ac
8 changed files with 174 additions and 8 deletions

View File

@@ -33,6 +33,7 @@
#include <proxy.h>
#include <netinet/tcp.h>
#include <event2/bufferevent_struct.h>
#include <watchdog_3rd_device.h>
#ifndef TFE_CONFIG_OUTPUT_LIMIT_DEFAULT
#define TFE_CONFIG_OUTPUT_LIMIT_DEFAULT (1024 * 1024)
@@ -588,7 +589,7 @@ static void __stream_bev_readcb(struct bufferevent * bev, void * arg)
struct evbuffer * inbuf = NULL;
struct evbuffer * outbuf = NULL;
if (_stream->proxy_ref->traffic_steering_options.enable)
if (_stream->proxy_ref->traffic_steering_options.enable && steering_device_is_available())
{
if (bev == _stream->conn_downstream->bev)
{
@@ -773,7 +774,7 @@ static void __stream_bev_writecb(struct bufferevent * bev, void * arg)
struct tfe_conn_private ** ref_peer_conn{};
struct ssl_stream ** ref_this_ssl_stream{};
if (_stream->proxy_ref->traffic_steering_options.enable)
if (_stream->proxy_ref->traffic_steering_options.enable && steering_device_is_available())
{
// TODO 增加计数
TFE_LOG_DEBUG(__STREAM_LOGGER(_stream), "decrypted traffic steering, %s run writecb", bev == _stream->conn_downstream->bev ? "conn_downstream" : "conn_upstream");
@@ -836,7 +837,7 @@ static void __stream_bev_eventcb(struct bufferevent * bev, short events, void *
enum tfe_conn_dir peer_conn_dir{};
size_t rx_offset = 0;
if (_stream->proxy_ref->traffic_steering_options.enable)
if (_stream->proxy_ref->traffic_steering_options.enable && steering_device_is_available())
{
// TODO 增加计数
TFE_LOG_DEBUG(__STREAM_LOGGER(_stream), "decrypted traffic steering, %s run eventcb", bev == _stream->conn_downstream->bev ? "conn_downstream" : "conn_upstream");
@@ -1251,7 +1252,7 @@ void ssl_downstream_create_on_success(future_result_t * result, void * user)
__conn_private_enable(_stream->conn_downstream);
__conn_private_enable(_stream->conn_upstream);
if (_stream->proxy_ref->traffic_steering_options.enable)
if (_stream->proxy_ref->traffic_steering_options.enable && steering_device_is_available())
{
__conn_private_enable(_stream->conn_fake_c);
__conn_private_enable(_stream->conn_fake_s);
@@ -1418,6 +1419,7 @@ void tfe_stream_destory(struct tfe_stream_private * stream)
if (__is_ssl(stream) && stream->ssl_downstream)
{
// TODO core dump
ssl_stream_free(stream->ssl_downstream, ev_base, stream->conn_downstream->bev);
}
@@ -1754,7 +1756,7 @@ int tfe_stream_init_by_fds(struct tfe_stream * stream, evutil_socket_t fd_downst
__stream_fd_option_setup(_stream, fd_downstream, CONN_DIR_DOWNSTREAM);
__stream_fd_option_setup(_stream, fd_upstream, CONN_DIR_UPSTREAM);
if (_stream->proxy_ref->traffic_steering_options.enable)
if (_stream->proxy_ref->traffic_steering_options.enable && steering_device_is_available())
{
__stream_fd_option_setup(_stream, fd_fake_s, CONN_DIR_DOWNSTREAM);
__stream_fd_option_setup(_stream, fd_fake_c, CONN_DIR_UPSTREAM);
@@ -1811,7 +1813,7 @@ int tfe_stream_init_by_fds(struct tfe_stream * stream, evutil_socket_t fd_downst
__conn_private_enable(_stream->conn_downstream);
__conn_private_enable(_stream->conn_upstream);
if (_stream->proxy_ref->traffic_steering_options.enable)
if (_stream->proxy_ref->traffic_steering_options.enable && steering_device_is_available())
{
__conn_private_enable(_stream->conn_fake_s);
__conn_private_enable(_stream->conn_fake_c);