diff options
| author | lijia <[email protected]> | 2021-04-02 18:26:52 +0800 |
|---|---|---|
| committer | lijia <[email protected]> | 2021-04-02 18:26:52 +0800 |
| commit | 62ac0c4ab29b1c6a5d8ce1afa2b73ce086b0b15a (patch) | |
| tree | e36db008e00afe080a5d5f6ea03650761cc7f4f2 | |
| parent | 0bb8539ed21224627d9feebfccfef82ac0d1f62e (diff) | |
修复gtp地址比较逻辑, 之前没有比较gtp->pfather; 配置文件stream_compare_layer.conf默认为空;
| -rw-r--r-- | bin/etc/asymmetric_presence_layer.conf | 10 | ||||
| -rw-r--r-- | bin/etc/stream_compare_layer.conf | 3 | ||||
| -rw-r--r-- | bin/etc/vlan_flipping_map.conf | 7 | ||||
| -rw-r--r-- | src/dealpkt/stream_manage.c | 31 |
4 files changed, 34 insertions, 17 deletions
diff --git a/bin/etc/asymmetric_presence_layer.conf b/bin/etc/asymmetric_presence_layer.conf index 4e45034..26d3777 100644 --- a/bin/etc/asymmetric_presence_layer.conf +++ b/bin/etc/asymmetric_presence_layer.conf @@ -11,8 +11,8 @@ # 需要同时满足under_of_this_asymmetric_layer和upper_of_this_asymmetric_layer才会创建虚拟层 # []表示某个层的index, 从最外层ethernet开始, 从0开始计数, *表示不关心具体在哪层,只要地址类型符合即可 #pattern: asymmetric_layer_name under_of_this_asymmetric_layer[layer_index] upper_of_this_asymmetric_layer[layer_index] - -mpls ethernet[0] ipv4[1] -mpls ethernet[1] ipv4[2] -mpls ethernet[0] ipv6[1] -mpls ethernet[1] ipv6[2] +# +#mpls ethernet[0] ipv4[1] +#mpls ethernet[1] ipv4[2] +#mpls ethernet[0] ipv6[1] +#mpls ethernet[1] ipv6[2] diff --git a/bin/etc/stream_compare_layer.conf b/bin/etc/stream_compare_layer.conf index 92b0dda..aa66522 100644 --- a/bin/etc/stream_compare_layer.conf +++ b/bin/etc/stream_compare_layer.conf @@ -6,5 +6,4 @@ # # compare_layer_name: 表示哪一层协议地址是要比较的 # []表示某个层的index, 从最外层ethernet开始, 从0开始计数, *表示不关心具体在哪层,只要地址类型符合即可 -#pattern: compare_layer_name[layer index] -mpls[*]
\ No newline at end of file +#pattern: compare_layer_name[layer index]
\ No newline at end of file diff --git a/bin/etc/vlan_flipping_map.conf b/bin/etc/vlan_flipping_map.conf index d51460f..dc637a3 100644 --- a/bin/etc/vlan_flipping_map.conf +++ b/bin/etc/vlan_flipping_map.conf @@ -6,6 +6,7 @@ #配置文件格式, pattern: #来自C路由器vlan_id 来自I路由器vlan_id 是否开启mac地址翻转 #C_router_vlan_id I_router_vlan_id mac_flipping_enable -1001 1002 1 -1003 1004 1 -4000 4001 0 + +#1001 1002 1 +#1003 1004 1 +#4000 4001 0 diff --git a/src/dealpkt/stream_manage.c b/src/dealpkt/stream_manage.c index b90a8a3..05c3adc 100644 --- a/src/dealpkt/stream_manage.c +++ b/src/dealpkt/stream_manage.c @@ -1300,6 +1300,10 @@ static int cmpaddr_new(struct streaminfo_private *pheap_stream_pr, #endif + +int checkstreamorder(struct streaminfo_private *pheap_stream_pr, + struct streaminfo_private *pstack_stream_pr, unsigned short hash_elem_count); + /* GTP���������IP��Ԫ��, ���վ��Ǩ��, ���IP���ܱ仯. */ @@ -1309,6 +1313,7 @@ static int checkstreamorder_for_gtp_tunnel(struct streaminfo_private *pheap_stre int ret; const struct streaminfo * pheap_stream = &pheap_stream_pr->stream_public; const struct streaminfo * pstack_stream = &pstack_stream_pr->stream_public; + int this_layer_is_same = 0; if(pheap_stream_pr==NULL){ if(unlikely(pstack_stream_pr!=NULL)){ @@ -1322,25 +1327,33 @@ static int checkstreamorder_for_gtp_tunnel(struct streaminfo_private *pheap_stre } } - /* ����ַ�����ⷽ���ַ��ͬ, ������Ϊ������ͬһ��GTP���� */ + /* ���ip��ַ��仯, ���ĸ�ip�����ܶ���һ��, �����ⷽ���ַ��ͬ, ������Ϊ������ͬһ��GTP���� */ if(pheap_stream->addr.tuple4_v4->saddr == pstack_stream->addr.tuple4_v4->saddr){ - return 0; + this_layer_is_same = 1; } if(pheap_stream->addr.tuple4_v4->daddr == pstack_stream->addr.tuple4_v4->saddr){ - return 0; + this_layer_is_same = 1; } if(pheap_stream->addr.tuple4_v4->daddr == pstack_stream->addr.tuple4_v4->daddr){ - return 0; + this_layer_is_same = 1; } if(pheap_stream->addr.tuple4_v4->saddr == pstack_stream->addr.tuple4_v4->daddr){ - return 0; + this_layer_is_same = 1; } - - return -1; + if(0 == this_layer_is_same){ /* �����ַ��һ��, ֱ�ӷ��ش��� */ + return -1; + } + + /* �����Ƚ���һ���ַ */ + ret=checkstreamorder((struct streaminfo_private *)(pheap_stream_pr->pfather_pr), + (struct streaminfo_private *)(pstack_stream_pr->pfather_pr), + hash_elem_count); + + return ret; } /*�Ƚ��������ṹ���С */ @@ -1404,6 +1417,10 @@ int checkstreamorder(struct streaminfo_private *pheap_stream_pr, return ret; } + + /* GTP��addr_use_as_hash=0, ���Ի�����gtp���Ƚ��²��ip/udp, ����ip�Ͷ˿ڿ��ܻ�Ư��, ���ܰ����淽ʽ�Ƚ�, + ���Դ˴���һ�������. + */ switch(pstack_stream->addr.addrtype){ case ADDR_TYPE_GPRS_TUNNEL: return checkstreamorder_for_gtp_tunnel((struct streaminfo_private *)(pheap_stream_pr->pfather_pr), |
