summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlijia <[email protected]>2021-01-12 18:05:35 +0800
committerlijia <[email protected]>2021-01-12 18:05:35 +0800
commitd051c6da0cdd76b9efafd65ac44b1e121c3ff0e3 (patch)
tree08024f1ad1dfbad0d086bad9e348f43032382226
parentabe9d5e96f52dde15ebeb9b4323779311df5f027 (diff)
inline模式xia,使插件看不到vxlan等封装协议.v4.2.22
-rw-r--r--include/private/sapp_pkt_stat.h7
-rw-r--r--include/private/stream_internal.h2
-rw-r--r--src/common/net_common.c3
-rw-r--r--src/dealpkt/deal_ethernet.c31
-rw-r--r--src/dealpkt/deal_gprs_tunnel.c1
-rw-r--r--src/dealpkt/deal_gre.c1
-rw-r--r--src/dealpkt/deal_ipv4.c51
-rw-r--r--src/dealpkt/deal_ipv6.c9
-rw-r--r--src/dealpkt/deal_mpls.c4
-rw-r--r--src/dealpkt/deal_pppoe.c1
-rw-r--r--src/dealpkt/deal_proxy.c3
-rw-r--r--src/dealpkt/deal_tcp.c12
-rw-r--r--src/dealpkt/deal_udp.c39
-rw-r--r--src/dealpkt/deal_vlan.c3
-rw-r--r--src/dealpkt/deal_vxlan.c1
-rw-r--r--src/dealpkt/plug_support.c27
-rw-r--r--src/dealpkt/stream_manage.c32
-rw-r--r--src/inner_plug/sapp_assistant.cpp3
-rw-r--r--src/packet_io/packet_io.c8
-rw-r--r--src/packet_io/packet_io_hook.c2
-rw-r--r--src/packet_io/packet_io_marsio.c1
-rw-r--r--src/packet_io/packet_io_pcap.c1
-rw-r--r--src/packet_io/packet_io_status.cpp8
-rw-r--r--src/packet_io/sendpacket.c35
24 files changed, 194 insertions, 91 deletions
diff --git a/include/private/sapp_pkt_stat.h b/include/private/sapp_pkt_stat.h
index 6f1b52c..8487a9c 100644
--- a/include/private/sapp_pkt_stat.h
+++ b/include/private/sapp_pkt_stat.h
@@ -8,6 +8,13 @@
*/
typedef enum __sapp_sys_stat_type{
+ /*
+ ����overlay������, ���²���LINE�Ķ��������е���ʵͨ��˫��������, ����vxlan�ȷ�װ���ֽ���,
+ ����һ��vxlan���ܳ�����1000�ֽ�, vxlan overlay�����ethernet,ipv4,udp,vxlan, �ܳ�����50�ֽ�,
+ ��SAPP_STAT_RCV_LINE��1000�ֽ�, SAPP_STAT_RCV_RAW��950�ֽ�.
+ */
+ SAPP_STAT_RCV_LINE,
+
/************* receive packet ****************/
SAPP_STAT_RCV_RAW, /* �յ�����ʵԭʼ������, ethernet����mac-in-mac, vpls��ԭ��Ҳ���ܻ��ظ����� */
diff --git a/include/private/stream_internal.h b/include/private/stream_internal.h
index d678d6c..416864d 100644
--- a/include/private/stream_internal.h
+++ b/include/private/stream_internal.h
@@ -76,6 +76,7 @@ typedef struct {
unsigned short vlan_flipping_couple[2]; /*2020-09-28 lijia add, in host order, vlan flipping for adev, index0��ʾ�յ���ǰ����vlan_id, index1��ʾԭ��ת����vlan_id */
unsigned char mac_flipping_enable;
char diagnose_error_to_dump; /* ��ij�ִ������ݰ�, ����pkt_dump�洢��udp socket���͸�tcpdump_mesa */
+ unsigned char overlay_layer_bytes; /* ������װ�㳤��, ����vxlanģʽ����50�ֽ� */
}raw_pkt_t;
@@ -134,6 +135,7 @@ struct streaminfo_private
{
/* ����ṹ�����ڽṹ����ǰ, ָ���ַ���Ի���ǿת */
struct streaminfo stream_public;
+ struct streaminfo_private *pfather_pr; /* ��ʵ�������ϲ���ָ��, ������vxlan�ȷ�װ��, stream_public.pfather�Ǹ�ҵ��������,������vxlan��� */
/* ���±���Ϊƽ̨�ڲ�˽��, ���ⲻ�ɼ� */
void *pproject; //ÿ�����̿����Զ���ʹ�ã�
diff --git a/src/common/net_common.c b/src/common/net_common.c
index 174d00d..bcf1f29 100644
--- a/src/common/net_common.c
+++ b/src/common/net_common.c
@@ -1028,7 +1028,7 @@ void MESA_stream_list_free(struct streaminfo_private *pstream_pr)
return;
}
/* �Ƚ�pfather���浽��ʱ���� */
- pfather_pr = (struct streaminfo_private *)pstream_pr->stream_public.pfather;
+ pfather_pr = (struct streaminfo_private *)pstream_pr->stream_public.pfather; /* 2021-01-11, ������ip��Ƭȷ����ַ, �˴�ʹ���ڴ���Ԫ��,ʹ��pfather������pfather_pr */
dictator_free(pstream->threadnum, pstream->addr.paddr);
dictator_free(pstream->threadnum, pstream_pr);
@@ -1066,6 +1066,7 @@ struct streaminfo_private *MESA_stream_list_dup(struct streaminfo_private *stack
heap_stream->addr.paddr = heap_addr;
heap_stream->addr.addrlen = stack_stream->addr.addrlen;
+ /* 2021-01-11, ������ip��Ƭȷ����ַ, �˴�ʹ���ڴ���Ԫ��,ʹ��pfather������pfather_pr */
heap_stream->pfather = (struct streaminfo *)MESA_stream_list_dup((struct streaminfo_private *)(stack_stream->pfather), reverse);
return (struct streaminfo_private *)heap_stream;
diff --git a/src/dealpkt/deal_ethernet.c b/src/dealpkt/deal_ethernet.c
index 9cd6f43..24d79ba 100644
--- a/src/dealpkt/deal_ethernet.c
+++ b/src/dealpkt/deal_ethernet.c
@@ -55,11 +55,12 @@ int eth_entry(struct streaminfo_private *fstream_pr, const void *this_layer_hdr,
struct streaminfo_private *pstream_pr;
struct streaminfo *pstream;
sapp_gval_mthread_sys_stat_t *local_sys_stat = &sapp_global_val->mthread_volatile[thread_num]->sys_stat;
+ int this_layer_len = raw_pkt->raw_pkt_len - ((char *)this_layer_hdr - (char *)raw_pkt->raw_pkt_data);
if(NET_CONN_SERIAL_GDEV == g_topology_mode){
if(unlikely(sapp_identify_broad_multicast_pkt(this_layer_hdr, raw_pkt) != 0)){
local_sys_stat->count[SAPP_STAT_DROP_ETHERNET]++;
- local_sys_stat->length[SAPP_STAT_DROP_ETHERNET]+=raw_pkt->raw_pkt_len;
+ local_sys_stat->length[SAPP_STAT_DROP_ETHERNET]+=this_layer_len;
return DROP;
}
}
@@ -81,7 +82,13 @@ int eth_entry(struct streaminfo_private *fstream_pr, const void *this_layer_hdr,
pstream_pr->offset_to_raw_pkt_hdr = offset_to_raw_pkt_hdr;
pstream_pr->raw_pkt = raw_pkt; /* 2014-12-30 lijia add */
- pstream->pfather = (struct streaminfo *)fstream_pr;
+ if((fstream_pr != NULL)
+ && (g_overlay_layer_set[fstream_pr->stream_public.addr.addrtype][fstream_pr->layer_index] != 0)){ /* 2021-01-11 lijia add, overlay���pfather��ΪNULL, ������ɼ� */
+ pstream->pfather = NULL;
+ }else{
+ pstream->pfather = (struct streaminfo *)fstream_pr;
+ }
+ pstream_pr->pfather_pr = fstream_pr;
pstream->type = STREAM_TYPE_NON;
pstream->routedir = dir;
pstream->threadnum = thread_num;
@@ -94,14 +101,16 @@ int eth_entry(struct streaminfo_private *fstream_pr, const void *this_layer_hdr,
pstream->curdir = DIR_S2C;
}
- local_sys_stat->count[SAPP_STAT_RCV_ETHERNET]++;
- local_sys_stat->length[SAPP_STAT_RCV_ETHERNET] += (unsigned long long)raw_pkt->raw_pkt_len;
- if(dir == sapp_global_val->config.packet_io.inbound_route_dir){
- local_sys_stat->count[SAPP_STAT_ETH_INBOUND]++;
- local_sys_stat->length[SAPP_STAT_ETH_INBOUND] += (unsigned long long)raw_pkt->raw_pkt_len;
- }else{
- local_sys_stat->count[SAPP_STAT_ETH_OUTBOUND]++;
- local_sys_stat->length[SAPP_STAT_ETH_OUTBOUND] += (unsigned long long)raw_pkt->raw_pkt_len;
+ if(g_overlay_layer_set[ADDR_TYPE_MAC][pstream_pr->layer_index] == 0){ /* ��overlay����ۼ���ز���� */
+ local_sys_stat->count[SAPP_STAT_RCV_ETHERNET]++;
+ local_sys_stat->length[SAPP_STAT_RCV_ETHERNET] += (unsigned long long)this_layer_len;
+ if(dir == sapp_global_val->config.packet_io.inbound_route_dir){
+ local_sys_stat->count[SAPP_STAT_ETH_INBOUND]++;
+ local_sys_stat->length[SAPP_STAT_ETH_INBOUND] += (unsigned long long)this_layer_len;
+ }else{
+ local_sys_stat->count[SAPP_STAT_ETH_OUTBOUND]++;
+ local_sys_stat->length[SAPP_STAT_ETH_OUTBOUND] += (unsigned long long)this_layer_len;
+ }
}
if(NULL == fstream_pr){
@@ -194,7 +203,7 @@ int eth_entry(struct streaminfo_private *fstream_pr, const void *this_layer_hdr,
sapp_runtime_log(RLOG_LV_DEBUG, "is not raw inline ethernet pkt, type is:0x%x, drop it.", eth_type);
}
}
- sapp_runtime_log(20, "eth_entry() recv unknown pkt, protocol is:0x%04x, pkt seq:%llu", eth_type, local_sys_stat->count[SAPP_STAT_RCV_RAW]);
+ sapp_runtime_log(20, "eth_entry() recv unknown pkt, protocol is:0x%04x, pkt seq:%llu", eth_type, local_sys_stat->count[SAPP_STAT_RCV_LINE]);
break;
}
}
diff --git a/src/dealpkt/deal_gprs_tunnel.c b/src/dealpkt/deal_gprs_tunnel.c
index ad61eeb..031699f 100644
--- a/src/dealpkt/deal_gprs_tunnel.c
+++ b/src/dealpkt/deal_gprs_tunnel.c
@@ -101,6 +101,7 @@ int gtp_entry(struct streaminfo_private *pfstream_pr,void *this_layer_data,int t
pstream_pr->layer_index = pfstream_pr->layer_index + 1;
pstream->pfather=&pfstream_pr->stream_public;
+ pstream_pr->pfather_pr=pfstream_pr;
pstream->type=STREAM_TYPE_NON;
pstream->routedir=routedir;
pstream->threadnum=(UCHAR)thread_num;
diff --git a/src/dealpkt/deal_gre.c b/src/dealpkt/deal_gre.c
index 2fde100..b1bed6f 100644
--- a/src/dealpkt/deal_gre.c
+++ b/src/dealpkt/deal_gre.c
@@ -259,6 +259,7 @@ int gre_entry(struct streaminfo_private *pfstream_pr,const void *this_layer_data
pstream_pr->layer_index = pfstream_pr->layer_index + 1;
pstream->pfather=&pfstream_pr->stream_public;
+ pstream_pr->pfather_pr=pfstream_pr;
pstream->type=STREAM_TYPE_NON;
pstream->routedir=routedir;
pstream->threadnum=thread_num;
diff --git a/src/dealpkt/deal_ipv4.c b/src/dealpkt/deal_ipv4.c
index 7362fad..893b53c 100644
--- a/src/dealpkt/deal_ipv4.c
+++ b/src/dealpkt/deal_ipv4.c
@@ -592,6 +592,8 @@ int ipv4_entry(struct streaminfo_private *pfstream_pr, const void *this_layer_da
struct streaminfo_private *pstream_pr;
struct streaminfo *pstream;
sapp_gval_mthread_sys_stat_t *local_sys_stat = &sapp_global_val->mthread_volatile[thread_num]->sys_stat;
+ /* ע��, �˴���ȡ��ǰ�㳤����ipͷ���ֶμ���ó�, ������this_layer_data- raw_pkt->raw_pkt_data, ��ΪijЩ����64�ֽڵ�С���������triler, �������߼��㲻һ�� */
+ int this_layer_len = ntohs(a_packet->ip_len);
#if DEBUG
//timestamp_record(TS_LEVEL_IP_ENTRY, raw_pkt, thread_num);
@@ -603,7 +605,7 @@ int ipv4_entry(struct streaminfo_private *pfstream_pr, const void *this_layer_da
*/
if(unlikely(checkipv4pkt(a_packet, raw_pkt) < 0)){
local_sys_stat->count[SAPP_STAT_DROP_IPV4]++;
- local_sys_stat->length[SAPP_STAT_DROP_IPV4]+=raw_pkt->raw_pkt_len;
+ local_sys_stat->length[SAPP_STAT_DROP_IPV4]+=this_layer_len;
((raw_pkt_t *)raw_pkt)->diagnose_error_to_dump = 1;
return PASS;
}
@@ -620,7 +622,7 @@ int ipv4_entry(struct streaminfo_private *pfstream_pr, const void *this_layer_da
*/
if(is_multicast_addr_v4(ntohl(a_packet->ip_dst.s_addr))){
local_sys_stat->count[SAPP_STAT_DROP_IPV4]++;
- local_sys_stat->length[SAPP_STAT_DROP_IPV4]+=raw_pkt->raw_pkt_len;
+ local_sys_stat->length[SAPP_STAT_DROP_IPV4]+=this_layer_len;
return DROP;
}
}
@@ -663,7 +665,13 @@ int ipv4_entry(struct streaminfo_private *pfstream_pr, const void *this_layer_da
pstream->curdir = DIR_S2C;
}
- pstream->pfather=pfstream;
+ if((pfstream_pr != NULL)
+ && (g_overlay_layer_set[pfstream_pr->stream_public.addr.addrtype][pfstream_pr->layer_index] != 0)){ /* 2021-01-11 lijia add, overlay���pfather��ΪNULL, ������ɼ� */
+ pstream->pfather = NULL;
+ }else{
+ pstream->pfather=pfstream;
+ }
+ pstream_pr->pfather_pr = pfstream_pr;
pstream->type=STREAM_TYPE_NON;
pstream->routedir=routedir;
pstream->threadnum=thread_num;
@@ -712,6 +720,26 @@ int ipv4_entry(struct streaminfo_private *pfstream_pr, const void *this_layer_da
}
+ if(need_free){
+ local_sys_stat->count[SAPP_STAT_RCV_IPV4_FRAG]++;
+ local_sys_stat->length[SAPP_STAT_RCV_IPV4_FRAG] += this_layer_len;
+ }else{
+ if(g_overlay_layer_set[__ADDR_TYPE_IP_PAIR_V4][pstream_pr->layer_index] == 0){ /* ��overlay����ۼ���ز���� */
+ local_sys_stat->count[SAPP_STAT_RCV_IPV4]++;
+ local_sys_stat->length[SAPP_STAT_RCV_IPV4] += this_layer_len;
+ if (routedir == sapp_global_val->config.packet_io.inbound_route_dir)
+ {
+ local_sys_stat->count[SAPP_STAT_IPV4_INBOUND]++;
+ local_sys_stat->length[SAPP_STAT_IPV4_INBOUND] += (unsigned long long)this_layer_len;
+ }
+ else
+ {
+ local_sys_stat->count[SAPP_STAT_IPV4_OUTBOUND]++;
+ local_sys_stat->length[SAPP_STAT_IPV4_OUTBOUND] += (unsigned long long)this_layer_len;
+ }
+ }
+ }
+
/* 2017-05-11 lijia add,
�ж�IP��IPFRAG��˭�����ȵ���,
������ģʽ��, "����"���һ��IP��Ƭ��, �ﵽ��������ԭʼIP����Ŀ��!
@@ -733,23 +761,6 @@ int ipv4_entry(struct streaminfo_private *pfstream_pr, const void *this_layer_da
}
}
- if(need_free){
- local_sys_stat->count[SAPP_STAT_RCV_IPV4_FRAG]++;
- local_sys_stat->length[SAPP_STAT_RCV_IPV4_FRAG] += ntohs(a_packet->ip_len);
- }else{
- local_sys_stat->count[SAPP_STAT_RCV_IPV4]++;
- local_sys_stat->length[SAPP_STAT_RCV_IPV4] += ntohs(a_packet->ip_len);
- if (routedir == sapp_global_val->config.packet_io.inbound_route_dir)
- {
- local_sys_stat->count[SAPP_STAT_IPV4_INBOUND]++;
- local_sys_stat->length[SAPP_STAT_IPV4_INBOUND] += (unsigned long long)raw_pkt->raw_pkt_len;
- }
- else
- {
- local_sys_stat->count[SAPP_STAT_IPV4_OUTBOUND]++;
- local_sys_stat->length[SAPP_STAT_IPV4_OUTBOUND] += (unsigned long long)raw_pkt->raw_pkt_len;
- }
- }
if(unlikely(need_free)){
#if (0 == HIGH_PERF)
diff --git a/src/dealpkt/deal_ipv6.c b/src/dealpkt/deal_ipv6.c
index e964708..e9ed505 100644
--- a/src/dealpkt/deal_ipv6.c
+++ b/src/dealpkt/deal_ipv6.c
@@ -731,7 +731,14 @@ static void set_ipv6_stream(struct streaminfo_private *pfstream_pr, struct strea
pstream_pr->offset_to_raw_pkt_hdr = offset_to_raw_pkt_hdr;
pstream_pr->raw_pkt = raw_pkt; /* 2014-12-30 lijia add */
- pstream->pfather=&pfstream_pr->stream_public;
+ if((pfstream_pr != NULL)
+ && (g_overlay_layer_set[pfstream_pr->stream_public.addr.addrtype][pfstream_pr->layer_index] != 0)){ /* 2021-01-11 lijia add, overlay���pfather��ΪNULL, ������ɼ� */
+ pstream->pfather = NULL;
+ }else{
+ pstream->pfather=&pfstream_pr->stream_public;
+ }
+ pstream_pr->pfather_pr = pfstream_pr;
+
pstream->type=STREAM_TYPE_NON;
pstream->routedir=routedir;
pstream->threadnum=thread_num;
diff --git a/src/dealpkt/deal_mpls.c b/src/dealpkt/deal_mpls.c
index cd5116a..fc3d13f 100644
--- a/src/dealpkt/deal_mpls.c
+++ b/src/dealpkt/deal_mpls.c
@@ -141,6 +141,7 @@ int mpls_uc_entry(struct streaminfo_private *pfstream_pr,const void *this_layer_
pstream_pr->raw_pkt = raw_pkt;
pstream->pfather=&pfstream_pr->stream_public;
+ pstream_pr->pfather_pr=pfstream_pr;
pstream->type=STREAM_TYPE_NON;
pstream->routedir=routedir;
pstream->threadnum=thread_num;
@@ -223,7 +224,7 @@ int mpls_uc_entry(struct streaminfo_private *pfstream_pr,const void *this_layer_
local_sys_stat->length[SAPP_STAT_RCV_UNKNOWN]+= raw_pkt->raw_pkt_len;
((raw_pkt_t *)raw_pkt)->diagnose_error_to_dump = 1;
- sapp_runtime_log(20, "MPLS next layer type: 0x%x, but left len only:%d, pkt seq:%llu\n", *next_layer_hdr,left_pkt_len, local_sys_stat->count[SAPP_STAT_RCV_RAW]);
+ sapp_runtime_log(20, "MPLS next layer type: 0x%x, but left len only:%d, pkt seq:%llu\n", *next_layer_hdr,left_pkt_len, local_sys_stat->count[SAPP_STAT_RCV_LINE]);
return PASS;
}
@@ -264,6 +265,7 @@ int mpls_empty_entry(struct streaminfo_private *pfstream_pr,const void *this_lay
pstream_pr->offset_to_raw_pkt_hdr = offset_to_raw_pkt_hdr;
pstream_pr->raw_pkt = raw_pkt;
pstream->pfather=&pfstream_pr->stream_public;
+ pstream_pr->pfather_pr=pfstream_pr;
pstream->type=STREAM_TYPE_NON;
pstream->routedir=routedir;
pstream->threadnum=thread_num;
diff --git a/src/dealpkt/deal_pppoe.c b/src/dealpkt/deal_pppoe.c
index e4b8d2d..14f36d7 100644
--- a/src/dealpkt/deal_pppoe.c
+++ b/src/dealpkt/deal_pppoe.c
@@ -49,6 +49,7 @@ int pppoe_session_entry(struct streaminfo_private *pfstream_pr,const void *this_
pstream_pr->raw_pkt = raw_pkt;
pstream->pfather=&pfstream_pr->stream_public;
+ pstream_pr->pfather_pr=pfstream_pr;
pstream->type=STREAM_TYPE_PPPOE;
pstream->routedir=routedir;
pstream->threadnum=thread_num;
diff --git a/src/dealpkt/deal_proxy.c b/src/dealpkt/deal_proxy.c
index 3d97704..fd324a2 100644
--- a/src/dealpkt/deal_proxy.c
+++ b/src/dealpkt/deal_proxy.c
@@ -182,7 +182,8 @@ int deal_tcp_in_proxy_stream(struct streaminfo *stream,void * a_packet,struct st
//�������Ӷ�Ӧ��ϵ��ʹ����α���������Ч
pProxy->pfather=stream->pfather;
- stream->pfather=pProxy;
+ stream->pfather=pProxy;
+
//add by lqy 2 0150123
addrtype=stream->addr.addrtype;
diff --git a/src/dealpkt/deal_tcp.c b/src/dealpkt/deal_tcp.c
index 7f1a4ba..b3a8def 100644
--- a/src/dealpkt/deal_tcp.c
+++ b/src/dealpkt/deal_tcp.c
@@ -620,8 +620,9 @@ static struct streamindex *tcp_add_new_stream_bysyn(struct streamindex *pindex,
hash_add_stream(pindex_tcp);
- pstream->pfather = (struct streaminfo *)copy_stream_info_to_heap((struct streaminfo_private *)pindex->stream.stream_public.pfather, need_reverse);
-
+ pstream_pr->pfather_pr = copy_stream_info_to_heap((struct streaminfo_private *)pindex->stream.pfather_pr, need_reverse);
+ pstream->pfather = (struct streaminfo *)pstream_pr->pfather_pr;
+
#if SAPP_INSECTICIDE
iterate_stream_list(pstream);
#endif
@@ -821,7 +822,8 @@ static struct streamindex *tcp_add_new_stream_bydata(struct streamindex *pindex,
copy_ipport_union_addr(pstream, &pindex->stream.stream_public, pstream_pr->layer_dir ^1);
- pstream->pfather = (struct streaminfo *)copy_stream_info_to_heap((struct streaminfo_private *)(pindex->stream.stream_public.pfather), pstream_pr->layer_dir ^1);
+ pstream_pr->pfather_pr = copy_stream_info_to_heap((struct streaminfo_private *)(pindex->stream.pfather_pr), pstream_pr->layer_dir ^1);
+ pstream->pfather = (struct streaminfo *)pstream_pr->pfather_pr;
#if SAPP_INSECTICIDE
iterate_stream_list(pstream);
@@ -2653,8 +2655,8 @@ static int deal_tcp_stream(struct streamindex *pindex, const void *this_iphdr, s
if(try_to_update_addr_info == 1)
{
- update_opposite_addr_info((struct streaminfo_private *)(pstream->pfather),
- (struct streaminfo_private *)(pindex->stream.stream_public.pfather), pstream->curdir);
+ update_opposite_addr_info((struct streaminfo_private *)(pstream_pr->pfather_pr),
+ (struct streaminfo_private *)(pindex->stream.pfather_pr), pstream->curdir);
}
/* flow_stat��ȫ����״̬��¼, �������ش����������� */
diff --git a/src/dealpkt/deal_udp.c b/src/dealpkt/deal_udp.c
index 5675a76..ac5f80f 100644
--- a/src/dealpkt/deal_udp.c
+++ b/src/dealpkt/deal_udp.c
@@ -154,8 +154,9 @@ static struct streamindex *udp_add_new_stream(struct streamindex *pindex,
pstream_udp->stream_state=UDP_ONE_STATE;
copy_ipport_union_addr(pstream_udp, &pindex->stream.stream_public, pstream_udp_pr->layer_dir ^1);
-
- pstream_udp->pfather = (struct streaminfo *)copy_stream_info_to_heap((const struct streaminfo_private *)(pindex->stream.stream_public.pfather), pstream_udp_pr->layer_dir ^1);
+
+ pstream_udp_pr->pfather_pr = copy_stream_info_to_heap((const struct streaminfo_private *)(pindex->stream.pfather_pr), pstream_udp_pr->layer_dir ^1);
+ pstream_udp->pfather = (struct streaminfo *)pstream_udp_pr->pfather_pr;
#if SAPP_INSECTICIDE
iterate_stream_list(pstream_udp);
@@ -460,17 +461,19 @@ int dealipv4udppkt(struct streamindex *pindex, const struct mesa_ip4_hdr * this_
pstream->routedir=routedir;
pstream->threadnum=thread_num;
- local_sys_stat->count[SAPP_STAT_RCV_UDP]++;
- local_sys_stat->length[SAPP_STAT_RCV_UDP]+=ulen;
- if (routedir == sapp_global_val->config.packet_io.inbound_route_dir)
- {
- local_sys_stat->count[SAPP_STAT_UDP_INBOUND]++;
- local_sys_stat->length[SAPP_STAT_UDP_INBOUND] += ulen;
- }
- else
- {
- local_sys_stat->count[SAPP_STAT_UDP_OUTBOUND]++;
- local_sys_stat->length[SAPP_STAT_UDP_OUTBOUND] += ulen;
+ if(g_overlay_layer_set[__ADDR_TYPE_IP_PAIR_V4][pstream_pr->layer_index] == 0){ /* ��overlay����ۼ���ز���� */
+ local_sys_stat->count[SAPP_STAT_RCV_UDP]++;
+ local_sys_stat->length[SAPP_STAT_RCV_UDP]+=ulen;
+ if (routedir == sapp_global_val->config.packet_io.inbound_route_dir)
+ {
+ local_sys_stat->count[SAPP_STAT_UDP_INBOUND]++;
+ local_sys_stat->length[SAPP_STAT_UDP_INBOUND] += ulen;
+ }
+ else
+ {
+ local_sys_stat->count[SAPP_STAT_UDP_OUTBOUND]++;
+ local_sys_stat->length[SAPP_STAT_UDP_OUTBOUND] += ulen;
+ }
}
//add by lqy 20130530
@@ -558,8 +561,8 @@ int dealipv4udppkt(struct streamindex *pindex, const struct mesa_ip4_hdr * this_
}
}
if(try_to_update_addr_info == 1){
- update_opposite_addr_info((struct streaminfo_private *)(pstream->pfather),
- (struct streaminfo_private *)(pindex->stream.stream_public.pfather), pstream->curdir);
+ update_opposite_addr_info((struct streaminfo_private *)(pstream_pr->pfather_pr),
+ (struct streaminfo_private *)(pindex->stream.pfather_pr), pstream->curdir);
}
update_polling_inject_context(pstream_pr, raw_pkt);
@@ -742,8 +745,8 @@ int dealipv6udppkt(struct streamindex *pindex,const struct mesa_ip6_hdr *a_packe
}
}
if(try_to_update_addr_info == 1){
- update_opposite_addr_info((struct streaminfo_private *)(pstream->pfather),
- (struct streaminfo_private *)(pindex->stream.stream_public.pfather), pstream->curdir);
+ update_opposite_addr_info((struct streaminfo_private *)(pstream_pr->pfather_pr),
+ (struct streaminfo_private *)(pindex->stream.pfather_pr), pstream->curdir);
}
udp_change_stream_state(a_index,udph, raw_pkt);
@@ -867,7 +870,7 @@ int process_ipv4_pkt (struct streamindex *pfindex,const struct mesa_ip4_hdr * a_
/* unknown protocol */
local_sys_stat->count[SAPP_STAT_RCV_UNKNOWN]++;
local_sys_stat->length[SAPP_STAT_RCV_UNKNOWN]+= raw_pkt->raw_pkt_len;
- sapp_runtime_log(RLOG_LV_INFO, "unsupport Ipv4 protocol:%u, pkt seq:%llu\n", a_packet->ip_p,local_sys_stat->count[SAPP_STAT_RCV_RAW]);
+ sapp_runtime_log(RLOG_LV_INFO, "unsupport Ipv4 protocol:%u, pkt seq:%llu\n", a_packet->ip_p,local_sys_stat->count[SAPP_STAT_RCV_LINE]);
break;
}
diff --git a/src/dealpkt/deal_vlan.c b/src/dealpkt/deal_vlan.c
index ba47233..c071e76 100644
--- a/src/dealpkt/deal_vlan.c
+++ b/src/dealpkt/deal_vlan.c
@@ -72,6 +72,7 @@ int IEEE_8021_entry(struct streaminfo_private *pfstream_pr,const void *this_laye
pstream_pr->raw_pkt = raw_pkt; /* 2014-12-30 lijia add */
pstream->pfather=&pfstream_pr->stream_public;
+ pstream_pr->pfather_pr = pfstream_pr;
pstream->type=STREAM_TYPE_NON;
pstream->routedir=routedir;
pstream->threadnum=thread_num;
@@ -129,7 +130,7 @@ int IEEE_8021_entry(struct streaminfo_private *pfstream_pr,const void *this_laye
local_sys_stat->count[SAPP_STAT_RCV_UNKNOWN]++;
local_sys_stat->length[SAPP_STAT_RCV_UNKNOWN]+= raw_pkt->raw_pkt_len;
- sapp_runtime_log(20, "VLAN unknown protocol: 0x%x, pkt seq:%llu\n", next_layer_type, local_sys_stat->count[SAPP_STAT_RCV_RAW]);
+ sapp_runtime_log(20, "VLAN unknown protocol: 0x%x, pkt seq:%llu\n", next_layer_type, local_sys_stat->count[SAPP_STAT_RCV_LINE]);
if(NET_CONN_SERIAL_GDEV == g_topology_mode){
if(sapp_identify_tunnel_inner_pkt(raw_pkt) != 0){
diff --git a/src/dealpkt/deal_vxlan.c b/src/dealpkt/deal_vxlan.c
index e490a51..3859db5 100644
--- a/src/dealpkt/deal_vxlan.c
+++ b/src/dealpkt/deal_vxlan.c
@@ -51,6 +51,7 @@ int vxlan_entry(struct streaminfo_private *pfstream_pr,const void *this_layer_hd
pstream_pr->raw_pkt = raw_pkt;
pstream->pfather=&pfstream_pr->stream_public;
+ pstream_pr->pfather_pr = pfstream_pr;
pstream->type=STREAM_TYPE_NON;
pstream->routedir=routedir;
pstream->threadnum=thread_num;
diff --git a/src/dealpkt/plug_support.c b/src/dealpkt/plug_support.c
index 66e2a9a..c1b9228 100644
--- a/src/dealpkt/plug_support.c
+++ b/src/dealpkt/plug_support.c
@@ -1483,6 +1483,33 @@ enum sapp_state_t sapp_get_current_state(void)
return (enum sapp_state_t)sapp_global_val->individual_volatile->current_state;
}
+int sapp_size_of_sapp_global(void)
+{
+ return sizeof(sapp_global_t);
+}
+
+
+int sapp_size_of_streaminfo_private(void)
+{
+ return sizeof(struct streaminfo_private);
+}
+
+int sapp_size_of_tcpdetail_private(void)
+{
+ return sizeof(struct tcpdetail_private);
+}
+
+int sapp_size_of_udpdetail_private(void)
+{
+ return sizeof(struct udpdetail_private);
+}
+
+int sapp_size_of_raw_pkt_t(void)
+{
+ return sizeof(raw_pkt_t);
+}
+
+
#ifdef __cplusplus
}
diff --git a/src/dealpkt/stream_manage.c b/src/dealpkt/stream_manage.c
index 59091d1..42e20b7 100644
--- a/src/dealpkt/stream_manage.c
+++ b/src/dealpkt/stream_manage.c
@@ -1335,8 +1335,8 @@ int checkstreamorder(struct streaminfo_private *pheap_stream_pr,
/* 2014-04-01 lijia add, ��������Ƚ�, ֱ������ */
if((0 == pheap_stream_pr->addr_use_as_hash) && (0 == pstack_stream_pr->addr_use_as_hash)){
pheap_stream_pr->offset_to_raw_pkt_hdr = pstack_stream_pr->offset_to_raw_pkt_hdr;
- return checkstreamorder((struct streaminfo_private *)(pheap_stream->pfather),
- (struct streaminfo_private *)(pstack_stream->pfather),
+ return checkstreamorder((struct streaminfo_private *)(pheap_stream_pr->pfather_pr),
+ (struct streaminfo_private *)(pstack_stream_pr->pfather_pr),
hash_elem_count);
}
@@ -1348,8 +1348,8 @@ int checkstreamorder(struct streaminfo_private *pheap_stream_pr,
pheap_stream_pr->stream_public.addr.pktipfragtype = pstack_stream_pr->stream_public.addr.pktipfragtype;
}
- ret=checkstreamorder((struct streaminfo_private *)(pheap_stream->pfather),
- (struct streaminfo_private *)(pstack_stream->pfather),
+ ret=checkstreamorder((struct streaminfo_private *)(pheap_stream_pr->pfather_pr),
+ (struct streaminfo_private *)(pstack_stream_pr->pfather_pr),
hash_elem_count);
if(ret != 0)
{
@@ -2504,14 +2504,15 @@ void free_thread_stream(int thread_seq)
/* 2014-04-08 LiJia add */
void free_heap_stream_info(struct streaminfo *heap_stream, int layer)
{
- struct streaminfo *pfather;
+ struct streaminfo_private *heap_stream_pr = (struct streaminfo_private *)(heap_stream);
+ struct streaminfo_private *pfather_pr;
struct layer_addr *addr;
if(NULL == heap_stream){
return;
}
- pfather = heap_stream->pfather;
+ pfather_pr = heap_stream_pr->pfather_pr;
addr = &heap_stream->addr;
/* Ϊ�˽�ʡ�ռ�, ��ַ����ADDR_TYPE_IPV4/6ʵ�ʴ洢����һ���IP��, ����free */
@@ -2527,7 +2528,7 @@ void free_heap_stream_info(struct streaminfo *heap_stream, int layer)
*/
dictator_free(heap_stream->threadnum, heap_stream);
}
- return free_heap_stream_info(pfather, layer+1);
+ return free_heap_stream_info((struct streaminfo *)pfather_pr, layer+1);
}
/* 2014-12-03 lijia add for sysinfo.log
@@ -2670,6 +2671,7 @@ int get_stream_carry_tunnel_type(const struct streaminfo *this_stream,
break;
}
+ /* 2021-01-11, �˴����Բ�����vxlan�ȷ�װ��, ֱ����pfather */
return get_stream_carry_tunnel_type(pfather, this_stream, tunnel_type);
}
@@ -2777,8 +2779,8 @@ void update_opposite_addr_info(struct streaminfo_private *pstream_pr,
}
}
- return update_opposite_addr_info((struct streaminfo_private *) pstream_pr->stream_public.pfather,
- (struct streaminfo_private *) p_stack->stream_public.pfather, cur_dir);
+ return update_opposite_addr_info((struct streaminfo_private *) pstream_pr->pfather_pr,
+ (struct streaminfo_private *) p_stack->pfather_pr, cur_dir);
}
@@ -2908,6 +2910,7 @@ struct streaminfo_private *copy_stream_info_to_heap(const struct streaminfo_priv
void *heap_addr;
struct streaminfo *heap_stream;
const struct streaminfo *stack_stream;
+ struct streaminfo_private *pfather_pr;
if(NULL == stack_stream_pr){
return NULL;
@@ -2919,8 +2922,15 @@ struct streaminfo_private *copy_stream_info_to_heap(const struct streaminfo_priv
memcpy(heap_stream_pr, stack_stream_pr, sizeof(struct streaminfo_private));
heap_stream = &(heap_stream_pr->stream_public);
- heap_stream->pfather = (struct streaminfo *)copy_stream_info_to_heap((const struct streaminfo_private *)stack_stream->pfather, reverse);
-
+ heap_stream_pr->pfather_pr = copy_stream_info_to_heap((const struct streaminfo_private *)stack_stream_pr->pfather_pr, reverse);
+ pfather_pr = stack_stream_pr->pfather_pr;
+ if((pfather_pr != NULL)
+ && (g_overlay_layer_set[pfather_pr->stream_public.addr.addrtype][pfather_pr->layer_index] != 0)){ /* 2021-01-11 lijia add, overlay���pfather��ΪNULL, ������ɼ� */
+ heap_stream->pfather = NULL;
+ }else{
+ heap_stream->pfather = (struct streaminfo *)heap_stream_pr->pfather_pr;
+ }
+
heap_addr = dictator_malloc(stack_stream->threadnum, stack_stream->addr.addrlen);
memset(heap_addr, 0, stack_stream->addr.addrlen);
diff --git a/src/inner_plug/sapp_assistant.cpp b/src/inner_plug/sapp_assistant.cpp
index 56d8123..6679dcb 100644
--- a/src/inner_plug/sapp_assistant.cpp
+++ b/src/inner_plug/sapp_assistant.cpp
@@ -981,6 +981,9 @@ static int sapp_fs2_init(void)
fs2_opt = 1;
FS_set_para(fs2_handle, OUTPUT_PROMETHEUS, &fs2_opt, sizeof(int));
}
+
+ pfs_para->fs_id_count_array[SAPP_STAT_RCV_LINE] = FS_register(fs2_handle, FS_STYLE_FIELD, FS_CALC_CURRENT, "Line_Pkt");
+ pfs_para->fs_id_length_array[SAPP_STAT_RCV_LINE] = FS_register(fs2_handle, FS_STYLE_FIELD, FS_CALC_CURRENT, "Line_Bit");
pfs_para->fs_id_count_array[SAPP_STAT_RCV_ETHERNET] = FS_register(fs2_handle, FS_STYLE_FIELD, FS_CALC_CURRENT, "Eth_Pkt");
pfs_para->fs_id_length_array[SAPP_STAT_RCV_ETHERNET] = FS_register(fs2_handle, FS_STYLE_FIELD, FS_CALC_CURRENT, "Eth_Bit");
diff --git a/src/packet_io/packet_io.c b/src/packet_io/packet_io.c
index 9e48f77..707971e 100644
--- a/src/packet_io/packet_io.c
+++ b/src/packet_io/packet_io.c
@@ -586,8 +586,8 @@ static int mesa_default_pkt_cb(const raw_pkt_t *p_raw_pkt, unsigned char dir, in
long long timecost;
struct timespec start, end;
sapp_gval_mthread_sys_stat_t *local_sys_stat = &sapp_global_val->mthread_volatile[thread_num]->sys_stat;
- local_sys_stat->count[SAPP_STAT_RCV_RAW]++;
- local_sys_stat->length[SAPP_STAT_RCV_RAW] += p_raw_pkt->raw_pkt_len;
+ local_sys_stat->count[SAPP_STAT_RCV_LINE]++;
+ local_sys_stat->length[SAPP_STAT_RCV_LINE] += p_raw_pkt->raw_pkt_len;
sapp_global_val->mthread_volatile[thread_num]->raw_pkt = p_raw_pkt;
@@ -601,12 +601,12 @@ static int mesa_default_pkt_cb(const raw_pkt_t *p_raw_pkt, unsigned char dir, in
if (p_raw_pkt->route_dir == sapp_global_val->config.packet_io.inbound_route_dir)
{
local_sys_stat->count[SAPP_STAT_RAW_INBOUND]++;
- local_sys_stat->length[SAPP_STAT_RAW_INBOUND] += (unsigned long long)p_raw_pkt->raw_pkt_len;
+ local_sys_stat->length[SAPP_STAT_RAW_INBOUND] += ((unsigned long long)p_raw_pkt->raw_pkt_len - p_raw_pkt->overlay_layer_bytes);
}
else
{
local_sys_stat->count[SAPP_STAT_RAW_OUTBOUND]++;
- local_sys_stat->length[SAPP_STAT_RAW_OUTBOUND] += (unsigned long long)p_raw_pkt->raw_pkt_len;
+ local_sys_stat->length[SAPP_STAT_RAW_OUTBOUND] += ((unsigned long long)p_raw_pkt->raw_pkt_len - p_raw_pkt->overlay_layer_bytes);
}
if(unlikely(g_timestamp_record_sw))
diff --git a/src/packet_io/packet_io_hook.c b/src/packet_io/packet_io_hook.c
index aa69afe..25bb79f 100644
--- a/src/packet_io/packet_io_hook.c
+++ b/src/packet_io/packet_io_hook.c
@@ -155,6 +155,7 @@ static int packet_io_hook_input_vlan_flipping(raw_pkt_t *raw_pkt, unsigned char
if((vlan_id > 1) && (vlan_map[vlan_id].couple_vlan_id > 1)){ /* vlan_id 不在vlan flipping表中, 不算作overlay packet */
packet_io_hook_update_vlan_couple(raw_pkt, vlan_id);
ret= 0;
+ raw_pkt->overlay_layer_bytes = 0;
}else{
vlan_id = get_vlan_id_from_rawpkt(raw_pkt);
if((vlan_id > 1) && (vlan_map[vlan_id].couple_vlan_id > 1)){ /* vlan_id 不在vlan flipping表中, 不算作overlay packet */
@@ -192,6 +193,7 @@ static int packet_io_hook_input_vxlan(raw_pkt_t *raw_pkt, unsigned char dir, int
vxlan_hdr = (inline_vxlan_hdr_t *)((char *)raw_pkt->raw_pkt_data + sizeof(struct mesa_ethernet_hdr) + sizeof(struct mesa_ip4_hdr) + sizeof(struct mesa_udp_hdr));
raw_pkt->is_overlay_pkt = 1; /* vxlan */
raw_pkt->route_dir = vxlan_hdr->dir;
+ raw_pkt->overlay_layer_bytes = VXLAN_HDR_RESERVED_LEN;
}else{
ret = -1;
}
diff --git a/src/packet_io/packet_io_marsio.c b/src/packet_io/packet_io_marsio.c
index 66f71e6..0b1e575 100644
--- a/src/packet_io/packet_io_marsio.c
+++ b/src/packet_io/packet_io_marsio.c
@@ -630,6 +630,7 @@ static inline int marsio4_pkt_hand(int tid, marsio_buff_t *rx_buff, raw_pkt_t *r
raw_pkt->diagnose_error_to_dump = 0;
raw_pkt->vlan_flipping_couple[0] = 0;
raw_pkt->vlan_flipping_couple[1] = 0;
+ raw_pkt->overlay_layer_bytes = 0;
ret = (*g_marsio4_work_fun)((const raw_pkt_t *)raw_pkt, mr_ctrlzone->route_dir, tid);
diff --git a/src/packet_io/packet_io_pcap.c b/src/packet_io/packet_io_pcap.c
index 1020158..9933480 100644
--- a/src/packet_io/packet_io_pcap.c
+++ b/src/packet_io/packet_io_pcap.c
@@ -1115,6 +1115,7 @@ retry:
pkt_queue_node.raw_pkt.hd_hash = 0; /* 2016-05-05 lijia add, pcapģʽ��֧��Ӳ��HASH */
pkt_queue_node.raw_pkt.io_lib_pkt_reference = pkt_queue_node.raw_pkt.__lib_raw_pkt_data; /* ����dpdkģʽ, ���˱�����ֵ */
pkt_queue_node.raw_pkt.diagnose_error_to_dump = 0;
+ pkt_queue_node.raw_pkt.overlay_layer_bytes = 0;
if(CAP_MODEL_PCAP_DUMPFILE == g_pcap_cap_mode){
/* ����ģʽ�±���û��routedir�ĸ���, Ϊ�˱��ڲ����ϲ�ҵ��, ʹ����ײ��ַ�Ƚ����һ��routedir */
diff --git a/src/packet_io/packet_io_status.cpp b/src/packet_io/packet_io_status.cpp
index 23c5a54..81321fe 100644
--- a/src/packet_io/packet_io_status.cpp
+++ b/src/packet_io/packet_io_status.cpp
@@ -117,6 +117,9 @@ static void field_stat2_update_metrics(void)
/* 2018-08-29 lijia add field statsd */
sapp_fs2_update_count(SAPP_STAT_RCV_UNKNOWN, cur_count[SAPP_STAT_RCV_UNKNOWN]);
sapp_fs2_update_length(SAPP_STAT_RCV_UNKNOWN, 8 *( cur_length[SAPP_STAT_RCV_UNKNOWN])); /* to bps, bit per second */
+
+ sapp_fs2_update_count(SAPP_STAT_RCV_LINE, cur_count[SAPP_STAT_RCV_LINE]);
+ sapp_fs2_update_length(SAPP_STAT_RCV_LINE, 8 *( cur_length[SAPP_STAT_RCV_LINE])); /* to bps, bit per second */
sapp_fs2_update_count(SAPP_STAT_RCV_ETHERNET, cur_count[SAPP_STAT_RCV_ETHERNET]);
sapp_fs2_update_length(SAPP_STAT_RCV_ETHERNET, 8 *( cur_length[SAPP_STAT_RCV_ETHERNET])); /* to bps, bit per second */
@@ -214,6 +217,8 @@ void sysinfo_output(void)
fprintf(fp,"%-12s %12llu %12llu %12llu %12llu\n", "Polling_work", 0,0,(cur_count[SAPP_POLLING_WORK]-history_count[SAPP_POLLING_WORK]),0);
fprintf(fp,"%-12s %12llu %12llu %12llu %12llu\n", "Polling_idle", 0,0,(cur_count[SAPP_POLLING_IDLE]-history_count[SAPP_POLLING_IDLE]),0);
+ fprintf(fp,"%-12s %12llu %12llu %12llu %12llu\n", "Line", cur_count[SAPP_STAT_RCV_LINE],cur_length[SAPP_STAT_RCV_LINE],(cur_count[SAPP_STAT_RCV_LINE]-history_count[SAPP_STAT_RCV_LINE]),(cur_length[SAPP_STAT_RCV_LINE]-history_length[SAPP_STAT_RCV_LINE]));
+
fprintf(fp,"%-12s %12llu %12llu %12llu %12llu\n", "Raw", cur_count[SAPP_STAT_RCV_RAW],cur_length[SAPP_STAT_RCV_RAW],(cur_count[SAPP_STAT_RCV_RAW]-history_count[SAPP_STAT_RCV_RAW]),(cur_length[SAPP_STAT_RCV_RAW]-history_length[SAPP_STAT_RCV_RAW]));
fprintf(fp,"%-12s %12llu %12llu %12llu %12llu\n", "Ethernet", cur_count[SAPP_STAT_RCV_ETHERNET],cur_length[SAPP_STAT_RCV_ETHERNET],(cur_count[SAPP_STAT_RCV_ETHERNET]-history_count[SAPP_STAT_RCV_ETHERNET]),(cur_length[SAPP_STAT_RCV_ETHERNET]-history_length[SAPP_STAT_RCV_ETHERNET]));
fprintf(fp,"%-12s %12llu %12llu %12llu %12llu\n", "IPv4", cur_count[SAPP_STAT_RCV_IPV4],cur_length[SAPP_STAT_RCV_IPV4],(cur_count[SAPP_STAT_RCV_IPV4]-history_count[SAPP_STAT_RCV_IPV4]),(cur_length[SAPP_STAT_RCV_IPV4]-history_length[SAPP_STAT_RCV_IPV4]));
@@ -287,6 +292,9 @@ void sysinfo_output(void)
fprintf(fp,"%-12s %12s %12s %12s %12s\n", "RCV-PKT", "total_pkt", "total_len","pps", "bps");
fprintf(fp,"%-12s %12llu %12llu %12llu %12llu\n", "Polling_work", 0,0,(cur_count[SAPP_POLLING_WORK]-history_count[SAPP_POLLING_WORK]),0);
fprintf(fp,"%-12s %12llu %12llu %12llu %12llu\n", "Polling_idle", 0,0,(cur_count[SAPP_POLLING_IDLE]-history_count[SAPP_POLLING_IDLE]),0);
+
+ fprintf(fp,"%-12s %12llu %12s %12llu %12s\n","Line",cur_count[SAPP_STAT_RCV_LINE],byte_convert_human(cur_length[SAPP_STAT_RCV_LINE],1 ,1,s1),(cur_count[SAPP_STAT_RCV_LINE]-history_count[SAPP_STAT_RCV_LINE]),byte_convert_human((cur_length[SAPP_STAT_RCV_LINE]-history_length[SAPP_STAT_RCV_LINE]),1,8,s2));
+
fprintf(fp,"%-12s %12llu %12s %12llu %12s\n","Raw",cur_count[SAPP_STAT_RCV_RAW],byte_convert_human(cur_length[SAPP_STAT_RCV_RAW],1 ,1,s1),(cur_count[SAPP_STAT_RCV_RAW]-history_count[SAPP_STAT_RCV_RAW]),byte_convert_human((cur_length[SAPP_STAT_RCV_RAW]-history_length[SAPP_STAT_RCV_RAW]),1,8,s2));
fprintf(fp,"%-12s %12llu %12s %12llu %12s\n","Ethernet",cur_count[SAPP_STAT_RCV_ETHERNET],byte_convert_human(cur_length[SAPP_STAT_RCV_ETHERNET],1 ,1,s1),(cur_count[SAPP_STAT_RCV_ETHERNET]-history_count[SAPP_STAT_RCV_ETHERNET]),byte_convert_human((cur_length[SAPP_STAT_RCV_ETHERNET]-history_length[SAPP_STAT_RCV_ETHERNET]),1,8,s2));
fprintf(fp,"%-12s %12llu %12s %12llu %12s\n","IPv4",cur_count[SAPP_STAT_RCV_IPV4],byte_convert_human(cur_length[SAPP_STAT_RCV_IPV4],1 ,1,s1),(cur_count[SAPP_STAT_RCV_IPV4]-history_count[SAPP_STAT_RCV_IPV4]),byte_convert_human((cur_length[SAPP_STAT_RCV_IPV4]-history_length[SAPP_STAT_RCV_IPV4]),1,8,s2));
diff --git a/src/packet_io/sendpacket.c b/src/packet_io/sendpacket.c
index 627f711..6e935a7 100644
--- a/src/packet_io/sendpacket.c
+++ b/src/packet_io/sendpacket.c
@@ -1066,8 +1066,8 @@ static int calc_reserved_hdr_len(struct streaminfo *stream, int *net_layer_type,
if(stream->pfather && (ADDR_TYPE_MAC == stream->pfather->addr.addrtype)){
#else
if(CAP_LEVEL_MAC == g_packet_io_cap_level) {
- if(stream->pfather
- && ((ADDR_TYPE_MAC_IN_MAC == stream->pfather->addr.addrtype) || (ADDR_TYPE_MAC == stream->pfather->addr.addrtype))){
+ if(stream_pr->pfather_pr
+ && ((ADDR_TYPE_MAC_IN_MAC == stream_pr->pfather_pr->stream_public.addr.addrtype) || (ADDR_TYPE_MAC == stream_pr->pfather_pr->stream_public.addr.addrtype))){
/* ��¼MAC��֮�ϵ�Э���ַ����, �������Ethernet->type�ֶ�, ����MAC-in-MAC��inner_eth, ��¼�ϲ�Э������ */
*net_layer_type = (int)stream->addr.addrtype;
}
@@ -1075,7 +1075,7 @@ static int calc_reserved_hdr_len(struct streaminfo *stream, int *net_layer_type,
/* to do:
����������Զ�������ethernet��, ����������vlan�Ȳ���һ�Ҫ������ô��?
*/
- if(NULL == stream->pfather){
+ if(NULL == stream_pr->pfather_pr){
if(g_packet_io_cap_level == stream->addr.addrtype){
*net_layer_type = (int)stream->addr.addrtype;
}
@@ -1089,7 +1089,7 @@ static int calc_reserved_hdr_len(struct streaminfo *stream, int *net_layer_type,
done:
- pfather_hdr_len = calc_reserved_hdr_len(stream->pfather, net_layer_type, send_stream_dir);
+ pfather_hdr_len = calc_reserved_hdr_len((struct streaminfo *)stream_pr->pfather_pr, net_layer_type, send_stream_dir);
if(pfather_hdr_len < 0){
return -1;
}
@@ -1347,9 +1347,9 @@ static int build_net_layer_ipv4(struct streaminfo_private *stream_pr, int carry_
NULL,
0,
(unsigned char *)buf);
- if(stream_pr->stream_public.pfather != NULL &&
- stream_pr->stream_public.pfather->addr.addrtype == ADDR_TYPE_GPRS_TUNNEL &&
- g_gtp_info_hash[threadnum] != NULL)
+ if((stream_pr->pfather_pr != NULL)
+ && (stream_pr->pfather_pr->stream_public.addr.addrtype == ADDR_TYPE_GPRS_TUNNEL)
+ && (g_gtp_info_hash[threadnum] != NULL))
{
g_addr_register_for_gtp_cache[threadnum].addr_type = ADDR_TYPE_IPV4;
g_addr_register_for_gtp_cache[threadnum].v4[0] = raw_ip4_hdr->ip_dst.s_addr;
@@ -1399,9 +1399,9 @@ static int build_net_layer_ipv6(struct streaminfo_private *stream_pr, int carry_
NULL,
0,
(unsigned char *)buf);
- if(stream_pr->stream_public.pfather != NULL &&
- stream_pr->stream_public.pfather->addr.addrtype == ADDR_TYPE_GPRS_TUNNEL &&
- g_gtp_info_hash[threadnum] != NULL)
+ if((stream_pr->pfather_pr != NULL)
+ && (stream_pr->pfather_pr->stream_public.addr.addrtype == ADDR_TYPE_GPRS_TUNNEL)
+ && (g_gtp_info_hash[threadnum] != NULL))
{
g_addr_register_for_gtp_cache[threadnum].addr_type = ADDR_TYPE_IPV6;
memcpy(g_addr_register_for_gtp_cache[threadnum].v6, &raw_ip6_hdr->ip6_dst, sizeof(struct in6_addr));
@@ -2141,7 +2141,7 @@ static int build_net_layer_pkt(const struct streaminfo *top_stream, const struct
}
done:
- return build_net_layer_pkt(top_stream, carry_layer_stream, (struct streaminfo_private *)stream->pfather,carry_layer_type,
+ return build_net_layer_pkt(top_stream, carry_layer_stream, (struct streaminfo_private *)stream_pr->pfather_pr,carry_layer_type,
this_layer_len+carry_layer_len, buf, reverse, raw_pkt, send_stream_dir);
err:
@@ -2982,15 +2982,16 @@ static int skip_asymmetric_presence_layer(const struct streaminfo *stream, UCHAR
static int get_eth_carry_layer_type(struct streaminfo *stream, UCHAR send_stream_dir)
{
int ret = stream->addr.addrtype;
+ struct streaminfo_private *stream_pr = (struct streaminfo_private *)stream;
- while(stream && stream->pfather){
+ while(stream_pr && stream_pr->pfather_pr){
if(skip_asymmetric_presence_layer(stream, send_stream_dir)){
- stream = stream->pfather;
+ stream_pr = stream_pr->pfather_pr;
continue;
}
if(CAP_LEVEL_MAC == g_packet_io_cap_level) {
- if(stream->pfather
- && ((ADDR_TYPE_MAC_IN_MAC == stream->pfather->addr.addrtype) || (ADDR_TYPE_MAC == stream->pfather->addr.addrtype))){
+ if(stream_pr->pfather_pr
+ && ((ADDR_TYPE_MAC_IN_MAC == stream_pr->pfather_pr->stream_public.addr.addrtype) || (ADDR_TYPE_MAC == stream_pr->pfather_pr->stream_public.addr.addrtype))){
/* ��¼MAC��֮�ϵ�Э���ַ����, �������Ethernet->type�ֶ�, ����MAC-in-MAC��inner_eth, ��¼�ϲ�Э������ */
ret = (int)stream->addr.addrtype;
}
@@ -2998,7 +2999,7 @@ static int get_eth_carry_layer_type(struct streaminfo *stream, UCHAR send_stream
/* to do:
����������Զ�������ethernet��, ����������vlan�Ȳ���һ�Ҫ������ô��?
*/
- if(NULL == stream->pfather){
+ if(NULL == stream_pr->pfather_pr){
if(g_packet_io_cap_level == stream->addr.addrtype){
ret = (int)stream->addr.addrtype;
}
@@ -3010,7 +3011,7 @@ static int get_eth_carry_layer_type(struct streaminfo *stream, UCHAR send_stream
}
ret = stream->addr.addrtype;
- stream = stream->pfather;
+ stream_pr = stream_pr->pfather_pr;
}
return ret;