diff --git a/src/tsg_action.cpp b/src/tsg_action.cpp index d52b907..8ca7eda 100644 --- a/src/tsg_action.cpp +++ b/src/tsg_action.cpp @@ -32,8 +32,7 @@ static int set_drop_stream(const struct streaminfo *a_stream) MESA_set_stream_opt(a_stream, MSO_DROP_CURRENT_PKT, (void *)&opt_value, sizeof(opt_value)); MESA_set_stream_opt(a_stream, MSO_TIMEOUT, (void *)&g_tsg_para.timeout, sizeof(g_tsg_para.timeout)); - return 0; - + return STATE_DROPME|STATE_DROPPKT; } static int get_http_header(char *buff, int len, int code, char *user_define) @@ -461,17 +460,6 @@ static int http_get_content_303(const struct streaminfo *a_stream, struct Maat_r return used_len; } -static unsigned char do_action_drop(const struct streaminfo *a_stream, Maat_rule_t *p_result, tsg_protocol_t protocol) -{ - if(protocol==PROTO_DNS) - { - return STATE_GIVEME|STATE_DROPPKT; - } - - set_drop_stream(a_stream); - - return STATE_DROPME|STATE_DROPPKT; -} static unsigned char do_action_reset(const struct streaminfo *a_stream, Maat_rule_t *p_result, tsg_protocol_t protocol) { int ret=0,opt_value=0; @@ -509,6 +497,25 @@ static unsigned char do_action_reset(const struct streaminfo *a_stream, Maat_rul return STATE_DROPPKT|STATE_DROPME; } +static unsigned char do_action_drop(const struct streaminfo *a_stream, Maat_rule_t *p_result, tsg_protocol_t protocol) +{ + if(protocol==PROTO_DNS) + { + return STATE_GIVEME|STATE_DROPPKT; + } + + if(g_tsg_para.deploy_mode==DEPLOY_MODE_MIRROR) + { + return do_action_reset(a_stream, p_result, protocol); + } + else + { + set_drop_stream(a_stream); + } + + return STATE_DROPME|STATE_DROPPKT; +} + static unsigned char do_action_ratelimit(const struct streaminfo *a_stream, Maat_rule_t *p_result, struct compile_user_region *user_region) { struct tcpall_context *context=NULL; @@ -658,9 +665,9 @@ unsigned char tsg_deal_deny_action(const struct streaminfo *a_stream, Maat_rule_ { case TSG_METHOD_TYPE_DROP: local_state=do_action_drop(a_stream, p_result, protocol); - if(g_tsg_para.deploy_mode==DEPLOY_MODE_MIRROR) + if(protocol==PROTO_DNS && type==ACTION_RETURN_TYPE_APP) { - local_state=do_action_reset(a_stream, p_result, protocol); + local_state=set_drop_stream(a_stream); } break; case TSG_METHOD_TYPE_RESET: diff --git a/src/tsg_send_log.cpp b/src/tsg_send_log.cpp index d9a4a35..31c5bf5 100644 --- a/src/tsg_send_log.cpp +++ b/src/tsg_send_log.cpp @@ -69,7 +69,7 @@ static int string_cat(char *dst, int dst_len, char *src) (object)->AddMember(temp_key, (val), (handle)->document->GetAllocator()); \ } -static int copy_rapidjdon(struct TLD_handle_t *_handle, char *field_name, const char *json_string) +static int copy_rapidjson(struct TLD_handle_t *_handle, char *field_name, const char *json_string) { Document nest_document; nest_document.Parse(json_string); @@ -933,7 +933,7 @@ int set_nat_linkinfo(struct tsg_log_instance_t *_instance, struct TLD_handle_t * return 0; } - copy_rapidjdon(_handle, field_name, nat_linkinfo); + copy_rapidjson(_handle, field_name, nat_linkinfo); return 0; }