增加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:
@@ -27,6 +27,9 @@ extern "C"
|
|||||||
#define ATOMIC_ADD(x, y) __atomic_fetch_add(x, y, __ATOMIC_RELAXED)
|
#define ATOMIC_ADD(x, y) __atomic_fetch_add(x, y, __ATOMIC_RELAXED)
|
||||||
#define ATOMIC_SET(x, y) __atomic_store_n(x, y, __ATOMIC_RELAXED)
|
#define ATOMIC_SET(x, y) __atomic_store_n(x, y, __ATOMIC_RELAXED)
|
||||||
|
|
||||||
|
#define likely(expr) __builtin_expect((expr), 1)
|
||||||
|
#define unlikely(expr) __builtin_expect((expr), 0)
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* fixed_num_array
|
* fixed_num_array
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|||||||
@@ -39,8 +39,11 @@ redis_port_range=6379
|
|||||||
max_chaining_size=32
|
max_chaining_size=32
|
||||||
|
|
||||||
[packet_io]
|
[packet_io]
|
||||||
# bypass_all_traffic:1 NF2NF and SF2SF
|
# bypass_traffic:0 disable
|
||||||
bypass_all_traffic=0
|
# bypass_traffic:1 bypass all traffic
|
||||||
|
# bypass_traffic:2 bypass raw traffic
|
||||||
|
# bypass_traffic:3 bypass decrypted traffic
|
||||||
|
bypass_traffic=0
|
||||||
rx_burst_max=128
|
rx_burst_max=128
|
||||||
app_symbol=sce
|
app_symbol=sce
|
||||||
dev_endpoint=eth_sf_endpoint
|
dev_endpoint=eth_sf_endpoint
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
|
|
||||||
struct config
|
struct config
|
||||||
{
|
{
|
||||||
int bypass_all_traffic;
|
int bypass_traffic;
|
||||||
int rx_burst_max;
|
int rx_burst_max;
|
||||||
char app_symbol[256];
|
char app_symbol[256];
|
||||||
char dev_endpoint[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;
|
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);
|
session_ctx = raw_packet_search_session(session_table, meta.raw_data, meta.raw_len, meta.session_id);
|
||||||
if (session_ctx == NULL)
|
if (session_ctx == NULL)
|
||||||
{
|
{
|
||||||
@@ -1033,7 +1049,11 @@ error_block:
|
|||||||
// return -1 : error
|
// return -1 : error
|
||||||
static int packet_io_config(const char *profile, struct config *config)
|
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_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", "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));
|
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;
|
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->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->app_symbol : %s", LOG_TAG_PKTIO, config->app_symbol);
|
||||||
LOG_DEBUG("%s: PACKET_IO->dev_endpoint : %s", LOG_TAG_PKTIO, config->dev_endpoint);
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (handle->config.bypass_all_traffic == 1)
|
if (handle->config.bypass_traffic == 1)
|
||||||
{
|
{
|
||||||
for (int j = 0; j < nr_recv; j++)
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (handle->config.bypass_all_traffic == 1)
|
if (handle->config.bypass_traffic == 1)
|
||||||
{
|
{
|
||||||
for (int j = 0; j < nr_recv; j++)
|
for (int j = 0; j < nr_recv; j++)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user