summaryrefslogtreecommitdiff
path: root/module_test
diff options
context:
space:
mode:
author杨威 <[email protected]>2023-01-12 19:55:12 +0800
committer杨威 <[email protected]>2023-01-16 14:42:18 +0800
commitab46cbfc9b24e11f119f56f2dda7adf9d638b205 (patch)
tree7cbd4ca88bd907849e1af67717d14dec7e859b3e /module_test
parent273cf3012e7f026da5661c0b934dfc11d06135fa (diff)
✨ feat(retain packet): 支持retain packet
Diffstat (limited to 'module_test')
-rw-r--r--module_test/src/gtest_sapp_comm.cpp7
-rw-r--r--module_test/src/gtest_sapp_inject_plug.cpp16
2 files changed, 13 insertions, 10 deletions
diff --git a/module_test/src/gtest_sapp_comm.cpp b/module_test/src/gtest_sapp_comm.cpp
index 8c5cb37..257ced1 100644
--- a/module_test/src/gtest_sapp_comm.cpp
+++ b/module_test/src/gtest_sapp_comm.cpp
@@ -1308,8 +1308,6 @@ int sapp_set_mpls_addr(struct layer_addr_mpls *addr, const unsigned char *raw_mp
this_mpls_hdr = (const struct mesa_mpls_hdr *)raw_mpls_pkt_data;
if (this_mpls_hdr)
{
- assert(this_mpls_hdr->mpls_bls!=1);
- //memcpy(&addr->src_mpls_pkt[i], raw_mpls_pkt_data, sizeof(struct mesa_mpls_hdr));
sapp_mpls_addr_net_to_mem(this_mpls_hdr, &addr->c2s_addr_array[i]); /* 函数栈里的地址, 每次暂存在c2s方向, TCP/UDP层再根据流方向翻�?*/
addr->c2s_layer_num += 1;
@@ -1321,6 +1319,11 @@ int sapp_set_mpls_addr(struct layer_addr_mpls *addr, const unsigned char *raw_mp
}
}
+ if(1 != this_mpls_hdr->mpls_bls) /* 超过MAX_MPLS_ADDR_LAYER, MPLS还没有结�?*/
+ {
+ return -1;
+ }
+
if(((*raw_mpls_pkt_data & 0xF0) != 0x40) && ((*raw_mpls_pkt_data & 0xF0) != 0x60)){ //VPLS, MPLS with Control Word
if(__sapp_guess_mpls_with_control_word(raw_mpls_pkt_data) > 0){
memcpy(&addr->c2s_mpls_ctrl_word, raw_mpls_pkt_data, sizeof(int));
diff --git a/module_test/src/gtest_sapp_inject_plug.cpp b/module_test/src/gtest_sapp_inject_plug.cpp
index ca051c3..041bd81 100644
--- a/module_test/src/gtest_sapp_inject_plug.cpp
+++ b/module_test/src/gtest_sapp_inject_plug.cpp
@@ -2003,7 +2003,7 @@ static int MESA_rst_tcp_test_case_c2s(struct streaminfo *pstream, void *a_packet
return -1;
}
- while(g_recv_tun_rst_flag != 2){
+ while((0 == g_recv_tun_rst_flag) && (g_recv_tun_rst_flag != 2)){
usleep(1000);
}
@@ -2097,7 +2097,7 @@ static int MESA_inject_udp_test_case_s2c(struct streaminfo *pstream, void *a_pac
return -1;
}
- while((g_recv_tun_rst_flag != 2)){
+ while((0 == g_recv_tun_rst_flag) && (g_recv_tun_rst_flag != 2)){
usleep(1000);
}
@@ -2219,7 +2219,7 @@ extern "C" char MESA_rst_tcp_plug_entry_in_double_dir(struct streaminfo *pstream
static int MESA_kill_tcp_test_check_pkt(struct streaminfo *pstream, struct inject_pkt_para *inject_paras, void *a_packet)
{
- while((g_recv_tun_rst_flag != 2)){
+ while((0 == g_recv_tun_rst_flag) && (g_recv_tun_rst_flag != 2)){
usleep(1000);
}
@@ -2326,7 +2326,7 @@ extern "C" int sapp_inject_tcp_payload_c2s(struct streaminfo *pstream,void **pme
return APP_STATE_DROPME;
}
- while((g_recv_tun_rst_flag != 2)){
+ while((0 == g_recv_tun_rst_flag) && (g_recv_tun_rst_flag != 2)){
usleep(1000);
}
@@ -2371,7 +2371,7 @@ extern "C" int sapp_inject_tcp_payload_s2c(struct streaminfo *pstream,void **pme
return APP_STATE_DROPME;
}
- while((g_recv_tun_rst_flag != 2)){
+ while((0 == g_recv_tun_rst_flag) && (g_recv_tun_rst_flag != 2)){
usleep(1000);
}
@@ -2422,7 +2422,7 @@ extern "C" int sapp_inject_udp_payload_c2s(struct streaminfo *pstream,void **pme
return APP_STATE_DROPME;
}
- while((g_recv_tun_rst_flag != 2)){
+ while((0 == g_recv_tun_rst_flag) && (g_recv_tun_rst_flag != 2)){
usleep(1000);
}
@@ -2466,7 +2466,7 @@ extern "C" int MESA_inject_tcp_payload_c2s(struct streaminfo *pstream,void **pme
return APP_STATE_DROPME;
}
- while((g_recv_tun_rst_flag != 2)){
+ while((0 == g_recv_tun_rst_flag) && (g_recv_tun_rst_flag != 2)){
usleep(1000);
}
@@ -2510,7 +2510,7 @@ extern "C" int MESA_inject_tcp_payload_s2c(struct streaminfo *pstream,void **pme
return APP_STATE_DROPME;
}
- while((g_recv_tun_rst_flag != 2)){
+ while((0 == g_recv_tun_rst_flag) && (g_recv_tun_rst_flag != 2)){
usleep(1000);
}