TSG-8025、TSG-8026: 修复block、alert动作的应答页面浏览器未展示的问题

This commit is contained in:
liuxueli
2021-10-14 16:37:52 +08:00
parent b0dd858d58
commit aa49873c4b
2 changed files with 23 additions and 4 deletions

View File

@@ -222,13 +222,26 @@ static int get_response_pages(struct Maat_rule_t *p_result, struct compile_user_
return payload_len;
}
static int set_tcp_flags(char *packet, int ip_tcp_hdr_len)
static int set_tcp_rst_flags(char *packet, int ip_tcp_hdr_len)
{
struct tcphdr *tcp=(struct tcphdr *)(packet+(ip_tcp_hdr_len-20)); // tcp header=20 bytes
tcp->rst=1;
tcp->psh=0;
tcp->ack=1;
tcp->psh=0;
tcp->fin=0;
return 0;
}
static int set_tcp_fin_flags(char *packet, int ip_tcp_hdr_len)
{
struct tcphdr *tcp=(struct tcphdr *)(packet+(ip_tcp_hdr_len-20)); // tcp header=20 bytes
tcp->fin=1;
tcp->ack=1;
tcp->psh=0;
tcp->rst=0;
return 0;
}
@@ -428,7 +441,13 @@ static int http_build_response_packet(const struct streaminfo *a_stream, struct
payload=NULL;
}
set_tcp_flags(message, ip_tcp_hdr_len);
set_tcp_fin_flags(message, ip_tcp_hdr_len);
http_send_reponse_packet(a_stream, message, 0, v4_or_v6, ip_tcp_hdr_len, 0); //fin
reverse_ip_tcp_header(message, ip_tcp_hdr_len, v4_or_v6);
http_send_reponse_packet(a_stream, message, 0, v4_or_v6, ip_tcp_hdr_len, 0); //fin
set_tcp_rst_flags(message, ip_tcp_hdr_len);
http_send_reponse_packet(a_stream, message, 0, v4_or_v6, ip_tcp_hdr_len, 0); //rst
reverse_ip_tcp_header(message, ip_tcp_hdr_len, v4_or_v6);

View File

@@ -1818,7 +1818,7 @@ extern "C" int TSG_MASTER_INIT()
MESA_load_profile_int_def(tsg_conffile, "RESET", "SEED2", &g_tsg_para.reset.seed2, 13);
MESA_load_profile_int_def(tsg_conffile, "RESET", "FLAGS", &g_tsg_para.reset.th_flags, 0x14);
MESA_load_profile_int_def(tsg_conffile, "RESET", "DIR", &g_tsg_para.reset.dir, DIR_DOUBLE);
MESA_load_profile_int_def(tsg_conffile, "RESET", "REMEDY", &g_tsg_para.reset.remedy, 0);
MESA_load_profile_int_def(tsg_conffile, "RESET", "REMEDY", &g_tsg_para.reset.remedy, 1);
MESA_load_profile_int_def(tsg_conffile, "SYSTEM","DEFAULT_POLICY_ID", &g_tsg_para.default_compile_id, 0);
MESA_load_profile_int_def(tsg_conffile, "SYSTEM","DEFAULT_POLICY_SWITCH", &g_tsg_para.default_compile_switch, 0);