diff options
| author | 杨威 <[email protected]> | 2023-01-12 11:24:59 +0800 |
|---|---|---|
| committer | 杨威 <[email protected]> | 2023-01-16 14:42:18 +0800 |
| commit | f644218f2a285f2acf9f53b728616d9ee23a2fef (patch) | |
| tree | 935e145a7cdf9d5ae61e1622676285aa9fdb5164 /module_test | |
| parent | 39d375589e4267f0aaab9d3fd97734147ff6901b (diff) | |
🐞 fix(MSO_STREAM_TIMED): 重命名opt,修复重复计数错误
Diffstat (limited to 'module_test')
| -rw-r--r-- | module_test/src/gtest_sapp_comm.cpp | 12 | ||||
| -rw-r--r-- | module_test/src/gtest_sapp_inject_plug.cpp | 16 |
2 files changed, 14 insertions, 14 deletions
diff --git a/module_test/src/gtest_sapp_comm.cpp b/module_test/src/gtest_sapp_comm.cpp index 5dfafd4..8c5cb37 100644 --- a/module_test/src/gtest_sapp_comm.cpp +++ b/module_test/src/gtest_sapp_comm.cpp @@ -1237,6 +1237,7 @@ int check_tcp_pkt_equal(const struct mesa_tcp_hdr *raw_hdr, const struct mesa_tc /* 此函数copy自sapp : deal_mpls.c->set_mpls_addr */ static int sapp_mpls_addr_net_to_mem(const struct mesa_mpls_hdr *net_mpls_hdr, struct single_layer_mpls_addr *mem_mpls_hdr) { + assert(net_mpls_hdr!=NULL); memset(mem_mpls_hdr, 0, sizeof(struct single_layer_mpls_addr)); mem_mpls_hdr->label = htonl( (net_mpls_hdr->mpls_label_low<<12) | (net_mpls_hdr->mpls_label_mid<<4) | net_mpls_hdr->mpls_label_high ); /* network order */ @@ -1298,13 +1299,16 @@ static int __sapp_guess_mpls_with_control_word(const unsigned char *maybe_eth_hd /* 此函数copy自sapp */ int sapp_set_mpls_addr(struct layer_addr_mpls *addr, const unsigned char *raw_mpls_pkt_data) { - const struct mesa_mpls_hdr *this_mpls_hdr; + const struct mesa_mpls_hdr *this_mpls_hdr=NULL; int i; memset(addr, 0, sizeof(struct layer_addr_mpls)); for(i = 0; i < MAX_MPLS_ADDR_LAYER; i++) { 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层再根据流方向翻�?*/ @@ -1314,11 +1318,7 @@ int sapp_set_mpls_addr(struct layer_addr_mpls *addr, const unsigned char *raw_mp break; } raw_mpls_pkt_data += sizeof(struct mesa_mpls_hdr); - } - - 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 diff --git a/module_test/src/gtest_sapp_inject_plug.cpp b/module_test/src/gtest_sapp_inject_plug.cpp index 041bd81..ca051c3 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((0 == g_recv_tun_rst_flag) && (g_recv_tun_rst_flag != 2)){ + while(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((0 == g_recv_tun_rst_flag) && (g_recv_tun_rst_flag != 2)){ + while((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((0 == g_recv_tun_rst_flag) && (g_recv_tun_rst_flag != 2)){ + while((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((0 == g_recv_tun_rst_flag) && (g_recv_tun_rst_flag != 2)){ + while((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((0 == g_recv_tun_rst_flag) && (g_recv_tun_rst_flag != 2)){ + while((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((0 == g_recv_tun_rst_flag) && (g_recv_tun_rst_flag != 2)){ + while((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((0 == g_recv_tun_rst_flag) && (g_recv_tun_rst_flag != 2)){ + while((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((0 == g_recv_tun_rst_flag) && (g_recv_tun_rst_flag != 2)){ + while((g_recv_tun_rst_flag != 2)){ usleep(1000); } |
