TSG-9215: 修复tamper命中tcp后发送两次数据包问题,重新验证合入,之前合入的代码被覆盖了

This commit is contained in:
yangwenlin
2022-01-11 19:26:10 +08:00
committed by liuxueli
parent 7d9131bec0
commit b1239d556e
2 changed files with 11 additions and 19 deletions

View File

@@ -587,29 +587,28 @@ static unsigned char do_action_tamper(const struct streaminfo *a_stream, Maat_ru
memset(_context, 0, sizeof(struct tcpall_context));
set_struct_project(a_stream, g_tsg_para.tcpall_project_id, (void *)_context);
_context->method_type=TSG_METHOD_TYPE_TAMPER;
_context->tamper_count = 1;
_context->tamper_count = -1;
}else{
if(_context->method_type != TSG_METHOD_TYPE_TAMPER)
{
_context->method_type=TSG_METHOD_TYPE_TAMPER;
_context->tamper_count = 1;
_context->tamper_count = -1;
}
else
{
//to do error log
//_context->method_type
MESA_handle_runtime_log(g_tsg_para.logger,
RLOG_LV_DEBUG,
__FUNCTION__,
"_context->method_type : %d",
"Tamper is been processed, _context->method_type : %d",
_context->method_type);
return STATE_GIVEME;
}
}
if(0 == send_tamper_xxx(a_stream, &_context->tamper_count, user_data)){
return STATE_DROPPKT;
if(a_stream->type != STREAM_TYPE_TCP){
if(0 == send_tamper_xxx(a_stream, &_context->tamper_count, user_data)){
return STATE_DROPPKT;
}
}
return STATE_GIVEME;
}

View File

@@ -1842,18 +1842,11 @@ static unsigned char tsg_master_all_entry(const struct streaminfo *a_stream, uns
}
break;
case TSG_METHOD_TYPE_TAMPER:
if(0 == send_tamper_xxx(a_stream, &context->tamper_count, a_packet)){
state|=APP_STATE_GIVEME|APP_STATE_DROPPKT;
}else{
state=APP_STATE_GIVEME;
if(a_stream->opstate != OP_STATE_PENDING){
if(0 == send_tamper_xxx(a_stream, &context->tamper_count, a_packet)){
state|=APP_STATE_GIVEME|APP_STATE_DROPPKT;
}
}
context->tamper_count += 1;
MESA_handle_runtime_log(g_tsg_para.logger,
RLOG_LV_DEBUG,
__FUNCTION__,
"Addr: %s, send_tamper_xxx num %ld",
PRINTADDR(a_stream, g_tsg_para.level),
context->tamper_count);
break;
case TSG_METHOD_TYPE_DEFAULT:
if(!is_do_default_policy(a_stream, context->after_n_packets) || stream_state==OP_STATE_CLOSE)