diff options
| author | liuxueli <[email protected]> | 2022-04-15 09:43:58 +0800 |
|---|---|---|
| committer | liuxueli <[email protected]> | 2022-04-15 09:43:58 +0800 |
| commit | 11fa03babe930b02e0c1dcfd4b5986586d307be2 (patch) | |
| tree | a188cb56d7f5a4c6c716c46b64a653aea7d67ee1 | |
| parent | ab19f51906dccccd5c5889361258202ae7733250 (diff) | |
TSG-10227: 客户端与服务端再同一侧且使用同一个链路方向,错误的封装VNI的方向导致拦截失败v4.2.84
| -rw-r--r-- | src/packet_io/packet_io_hook.c | 2 | ||||
| -rw-r--r-- | src/packet_io/sendpacket.c | 5 | ||||
| -rw-r--r-- | test/test_app_sapp.c | 18 |
3 files changed, 22 insertions, 3 deletions
diff --git a/src/packet_io/packet_io_hook.c b/src/packet_io/packet_io_hook.c index 871be52..581a269 100644 --- a/src/packet_io/packet_io_hook.c +++ b/src/packet_io/packet_io_hook.c @@ -108,7 +108,7 @@ static int packet_io_hook_output_vxlan(raw_pkt_t *raw_pkt, void *raw_pkt_data, u /* keepalive icmp应答不是udp协议, 是g_dev_plug插件直接注入原始包, 是个特例, 此处要判断一下 */ if(IPPROTO_UDP == raw_ip4h->ip_p){ send_outer_udp_hdr->uh_sum = 0; - send_vxlan_hdr->dir = route_dir; + //send_vxlan_hdr->dir = route_dir; //20220415 liuxueli for TSG-10227 } return 0; diff --git a/src/packet_io/sendpacket.c b/src/packet_io/sendpacket.c index a41998c..13a9842 100644 --- a/src/packet_io/sendpacket.c +++ b/src/packet_io/sendpacket.c @@ -1948,13 +1948,14 @@ static void build_net_single_layer_vxlan(struct streaminfo_private *stream_pr, i send_vxlan_hdr->vlan_id_half_low = ntohs(single_addr->vlan_id) & 0xF; send_vxlan_hdr->link_layer_type = single_addr->link_type; send_vxlan_hdr->link_id = single_addr->link_id; - + send_vxlan_hdr->dir = single_addr->dir; //20220415 liuxueli for TSG-10227 +#if 0 //20220415 liuxueli for TSG-10227 if(DIR_C2S == send_stream_dir){ send_vxlan_hdr->dir = stream_pr->stream_c2s_route_dir; }else{ send_vxlan_hdr->dir = stream_pr->stream_c2s_route_dir ^ 1; } - +#endif } static int build_net_layer_vxlan(struct streaminfo_private *stream_pr, int carry_layer_type, diff --git a/test/test_app_sapp.c b/test/test_app_sapp.c index e0df65f..9968859 100644 --- a/test/test_app_sapp.c +++ b/test/test_app_sapp.c @@ -2710,6 +2710,24 @@ char stream_bridge_tcpall_entry(struct streaminfo *pstream,void **pme, int threa return APP_STATE_GIVEME; } +char vxlan_inject_tcp_entry(struct streaminfo *a_tcp, void **pme, int thread_seq,void *a_packet) +{ + if(a_tcp->ptcpdetail->pdata && a_tcp->ptcpdetail->datalen) + { + struct mesa_ip4_hdr *ip4hdr = (struct mesa_ip4_hdr *)a_packet; + int ret = sapp_inject_pkt(a_tcp, SIO_EXCLUDE_THIS_LAYER_HDR, a_packet, ntohs(ip4hdr->ip_len), 0); + printf("polling inject pkt dir = 0: %s, ret = %d \n", printaddr(&a_tcp->addr, thread_seq), ret); + + ret = sapp_inject_pkt(a_tcp, SIO_EXCLUDE_THIS_LAYER_HDR, a_packet, ntohs(ip4hdr->ip_len), 1); + printf("polling inject pkt dir = 1: %s, ret = %d \n", printaddr(&a_tcp->addr, thread_seq), ret); + } + + //ret = sapp_inject_pkt(stream, SIO_EXCLUDE_THIS_LAYER_HDR, a_packet, ntohs(ip4hdr->ip_len), 1); +// printf("polling inject pkt dir = 1: %s, ret = %d \n", printaddr(&stream->addr, thread_seq), ret); + + return APP_STATE_GIVEME; +} + char UDP_ENTRY(struct streaminfo *a_tcp, void **pme, int thread_seq,void *a_packet) { |
