增加bypass_traffic调试开关
* bypass_traffic:0 disable
* bypass_traffic:1 bypass all traffic
* bypass_traffic:2 bypass raw traffic
* bypass_traffic:3 bypass decrypted traffic
This commit is contained in:
@@ -24,7 +24,7 @@
|
||||
|
||||
struct config
|
||||
{
|
||||
int bypass_all_traffic;
|
||||
int bypass_traffic;
|
||||
int rx_burst_max;
|
||||
char app_symbol[256];
|
||||
char dev_endpoint[256];
|
||||
@@ -896,6 +896,22 @@ static void handle_raw_packet(marsio_buff_t *rx_buff, struct thread_ctx *thread_
|
||||
goto error_bypass;
|
||||
}
|
||||
|
||||
// bypass_traffic:0 disable
|
||||
// bypass_traffic:1 bypass all traffic
|
||||
// bypass_traffic:2 bypass raw traffic
|
||||
// bypass_traffic:3 bypass decrypted traffic
|
||||
if (unlikely(thread_ctx->ref_io->config.bypass_traffic == 2 && meta.is_decrypted == 0))
|
||||
{
|
||||
LOG_DEBUG("%s: session %lu bypass, enable raw traffic bypass !!!", LOG_TAG_PKTIO);
|
||||
goto error_bypass;
|
||||
}
|
||||
|
||||
if (unlikely(thread_ctx->ref_io->config.bypass_traffic == 3 && meta.is_decrypted == 1))
|
||||
{
|
||||
LOG_DEBUG("%s: session %lu bypass, enable decrypted traffic bypass !!!", LOG_TAG_PKTIO);
|
||||
goto error_bypass;
|
||||
}
|
||||
|
||||
session_ctx = raw_packet_search_session(session_table, meta.raw_data, meta.raw_len, meta.session_id);
|
||||
if (session_ctx == NULL)
|
||||
{
|
||||
@@ -1033,7 +1049,11 @@ error_block:
|
||||
// return -1 : error
|
||||
static int packet_io_config(const char *profile, struct config *config)
|
||||
{
|
||||
MESA_load_profile_int_def(profile, "PACKET_IO", "bypass_all_traffic", (int *)&(config->bypass_all_traffic), 0);
|
||||
// bypass_traffic:0 disable
|
||||
// bypass_traffic:1 bypass all traffic
|
||||
// bypass_traffic:2 bypass raw traffic
|
||||
// bypass_traffic:3 bypass decrypted traffic
|
||||
MESA_load_profile_int_def(profile, "PACKET_IO", "bypass_traffic", (int *)&(config->bypass_traffic), 0);
|
||||
MESA_load_profile_int_def(profile, "PACKET_IO", "rx_burst_max", (int *)&(config->rx_burst_max), 1);
|
||||
MESA_load_profile_string_nodef(profile, "PACKET_IO", "app_symbol", config->app_symbol, sizeof(config->app_symbol));
|
||||
MESA_load_profile_string_nodef(profile, "PACKET_IO", "dev_endpoint", config->dev_endpoint, sizeof(config->dev_endpoint));
|
||||
@@ -1066,7 +1086,7 @@ static int packet_io_config(const char *profile, struct config *config)
|
||||
return -1;
|
||||
}
|
||||
|
||||
LOG_DEBUG("%s: PACKET_IO->bypass_all_traffic : %d", LOG_TAG_PKTIO, config->bypass_all_traffic);
|
||||
LOG_DEBUG("%s: PACKET_IO->bypass_traffic : %d", LOG_TAG_PKTIO, config->bypass_traffic);
|
||||
LOG_DEBUG("%s: PACKET_IO->rx_burst_max : %d", LOG_TAG_PKTIO, config->rx_burst_max);
|
||||
LOG_DEBUG("%s: PACKET_IO->app_symbol : %s", LOG_TAG_PKTIO, config->app_symbol);
|
||||
LOG_DEBUG("%s: PACKET_IO->dev_endpoint : %s", LOG_TAG_PKTIO, config->dev_endpoint);
|
||||
@@ -1229,7 +1249,7 @@ int packet_io_thread_polling_nf(struct packet_io *handle, struct thread_ctx *thr
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (handle->config.bypass_all_traffic == 1)
|
||||
if (handle->config.bypass_traffic == 1)
|
||||
{
|
||||
for (int j = 0; j < nr_recv; j++)
|
||||
{
|
||||
@@ -1292,7 +1312,7 @@ int packet_io_thread_polling_endpoint(struct packet_io *handle, struct thread_ct
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (handle->config.bypass_all_traffic == 1)
|
||||
if (handle->config.bypass_traffic == 1)
|
||||
{
|
||||
for (int j = 0; j < nr_recv; j++)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user