summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorliuxueli <[email protected]>2021-09-13 15:43:03 +0800
committerliuxueli <[email protected]>2021-09-13 15:43:03 +0800
commit427a0d7faf42b8e4de1e6918f3f5c13c81bb3c8f (patch)
tree5175d93623ddb117c4fea87ec22b23532364ba04
parent4578ad32000c97231158435ed69a7e67120fafda (diff)
TSG-7542: 执行RST动作之后,设置丢弃整个流的标志v5.3.6
修复IP定位结果最后的,分割符
-rw-r--r--src/tsg_action.cpp39
-rw-r--r--src/tsg_send_log.cpp1
2 files changed, 26 insertions, 14 deletions
diff --git a/src/tsg_action.cpp b/src/tsg_action.cpp
index c64cd62..38ebeca 100644
--- a/src/tsg_action.cpp
+++ b/src/tsg_action.cpp
@@ -25,20 +25,31 @@
extern "C" int sendpacket_do_checksum(unsigned char *buf, int protocol, int len);
-static int set_drop_stream(const struct streaminfo *a_stream)
+static int set_drop_stream(const struct streaminfo *a_stream, tsg_protocol_t protocol)
{
- int opt_value=1;
+ int ret=0, opt_value=1;
MESA_set_stream_opt(a_stream, MSO_DROP_STREAM, (void *)&opt_value, sizeof(opt_value));
MESA_set_stream_opt(a_stream, MSO_DROP_CURRENT_PKT, (void *)&opt_value, sizeof(opt_value));
- int ret=MESA_set_stream_opt(a_stream, MSO_TIMEOUT, (void *)&g_tsg_para.timeout, sizeof(g_tsg_para.timeout));
- if(ret<0)
- {
- FS_operate(g_tsg_para.fs2_handle, g_tsg_para.fs2_field_id[TSG_FS2_SET_TIMOUT_FAILED], 0, FS_OP_ADD, 1);
- }
- else
+ switch(protocol)
{
- FS_operate(g_tsg_para.fs2_handle, g_tsg_para.fs2_field_id[TSG_FS2_SET_TIMOUT_SUCCESS], 0, FS_OP_ADD, 1);
+ case PROTO_MAIL:
+ case PROTO_POP3:
+ case PROTO_SMTP:
+ case PROTO_IMAP:
+ case PROTO_FTP:
+ ret=MESA_set_stream_opt(a_stream, MSO_TIMEOUT, (void *)&g_tsg_para.timeout, sizeof(g_tsg_para.timeout));
+ if(ret<0)
+ {
+ FS_operate(g_tsg_para.fs2_handle, g_tsg_para.fs2_field_id[TSG_FS2_SET_TIMOUT_FAILED], 0, FS_OP_ADD, 1);
+ }
+ else
+ {
+ FS_operate(g_tsg_para.fs2_handle, g_tsg_para.fs2_field_id[TSG_FS2_SET_TIMOUT_SUCCESS], 0, FS_OP_ADD, 1);
+ }
+ break;
+ default:
+ break;
}
return STATE_DROPME|STATE_DROPPKT;
@@ -512,6 +523,8 @@ static unsigned char do_action_reset(const struct streaminfo *a_stream, Maat_rul
opt_value=1;
MESA_set_stream_opt(a_stream, MSO_TCP_RST_REMEDY, (void *)&opt_value, sizeof(opt_value));
}
+
+ set_drop_stream(a_stream, protocol);
}
return STATE_DROPPKT|STATE_DROPME;
@@ -524,7 +537,7 @@ static unsigned char do_action_drop(const struct streaminfo *a_stream, Maat_rule
case PROTO_DNS:
return STATE_GIVEME|STATE_DROPPKT;
default:
- set_drop_stream(a_stream);
+ set_drop_stream(a_stream, protocol);
if(g_tsg_para.deploy_mode==DEPLOY_MODE_MIRROR)
{
return do_action_reset(a_stream, p_result, protocol);
@@ -621,7 +634,7 @@ static unsigned char do_action_block_xxx(const struct streaminfo *a_stream, Maat
break;
}
- set_drop_stream(a_stream);
+ set_drop_stream(a_stream, protocol);
return STATE_DROPME|STATE_DROPPKT;
}
@@ -665,7 +678,7 @@ static unsigned char do_action_redirect_xxx(const struct streaminfo *a_stream, M
break;
case PROTO_HTTP:
do_action_redirect_http(a_stream, p_result, user_region);
- set_drop_stream(a_stream);
+ set_drop_stream(a_stream, protocol);
break;
default:
break;
@@ -698,7 +711,7 @@ unsigned char tsg_deal_deny_action(const struct streaminfo *a_stream, Maat_rule_
local_state=do_action_drop(a_stream, p_result, protocol);
if(protocol==PROTO_DNS && type==ACTION_RETURN_TYPE_APP)
{
- local_state=set_drop_stream(a_stream);
+ local_state=set_drop_stream(a_stream, protocol);
}
break;
case TSG_METHOD_TYPE_RESET:
diff --git a/src/tsg_send_log.cpp b/src/tsg_send_log.cpp
index 0166e37..e4a63eb 100644
--- a/src/tsg_send_log.cpp
+++ b/src/tsg_send_log.cpp
@@ -239,7 +239,6 @@ static int set_location(struct TLD_handle_t *_handle, struct streaminfo *a_strea
len+=string_cat(buff+len, buff_len-len, location_info->province_full);
buff[len++]=',';
len+=string_cat(buff+len, buff_len-len, location_info->country_full);
- buff[len++]=',';
TLD_append(_handle, field_name, (void *)buff, TLD_TYPE_STRING);
}