summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryangwei <[email protected]>2024-07-10 19:33:55 +0800
committeryangwei <[email protected]>2024-07-11 14:48:02 +0800
commit6eb849e2498b0ed9a4f9cb8a9163c4a54e2f7aa9 (patch)
tree0aa0f6682ec030cf39b8694db5e875446c649a1f
parentf14d0bcdd230c85fb68814e64f72f3b10051befa (diff)
🐞 fix(TSG-21797): IPv6 delivery GREv4.3.60
-rw-r--r--include/private/deal_ipv6.h29
-rw-r--r--src/dealpkt/deal_ipv6.c116
2 files changed, 75 insertions, 70 deletions
diff --git a/include/private/deal_ipv6.h b/include/private/deal_ipv6.h
index 9bbfa24..86a8734 100644
--- a/include/private/deal_ipv6.h
+++ b/include/private/deal_ipv6.h
@@ -10,21 +10,21 @@
#define IPV6_MAXPLEN (65535)
-#define IPV6_FRAG_RESERVED_HDR_LEN (40) /* Ԥ����һ��IPv6��Ƭͷ������ */
+#define IPV6_FRAG_RESERVED_HDR_LEN (40) /* Ԥ����һ��IPv6��Ƭͷ������ */
-//#define IPV6_FRAG_TIMEOUT (60) /* ���鳬ʱʱ�� */
+//#define IPV6_FRAG_TIMEOUT (60) /* ���鳬ʱʱ�� */
/*
2015-12-02 lijia modify,
- ��ȻRFC�涨, 60�������з�Ƭ������ɾ��ǺϷ���,
- ���ʵ�����, IPv6��Ƭ�����10���ڻ�δ�������, ����Ϊ�ǹ�����Ϊ�򶪰�, ֱ��free.
+ ��ȻRFC�涨, 60�������з�Ƭ������ɾ��ǺϷ���,
+ ���ʵ�����, IPv6��Ƭ�����10���ڻ�δ�������, ����Ϊ�ǹ�����Ϊ�򶪰�, ֱ��free.
*/
-#define IPV6_FRAG_TIMEOUT (10) /* ���鳬ʱʱ�� */
+#define IPV6_FRAG_TIMEOUT (10) /* ���鳬ʱʱ�� */
-#define IPV6_FRAG_MEM_FREE_ONCE (512*1024) /* ÿ���ͷ��ڴ����� */
-#define IPV6_FRAG_MEM_HIGH_THRESH (16*1024*1024) /* �ڴ����� */
+#define IPV6_FRAG_MEM_FREE_ONCE (512*1024) /* ÿ���ͷ��ڴ����� */
+#define IPV6_FRAG_MEM_HIGH_THRESH (16*1024*1024) /* �ڴ����� */
-#define IPV6_FRAG_NUM_PER_IPQ (100) /* ͬһIPQ����Ƭ���� */
+#define IPV6_FRAG_NUM_PER_IPQ (100) /* ͬһIPQ����Ƭ���� */
#if IPV6_DEBUG
#define IPV6_PRINT(fmt, args...) printf(fmt, ##args)
@@ -54,6 +54,7 @@ struct simple_ip6_hdr
#define NEXTHDR_IPV6 41 /* IPv6 in IPv6 */
#define NEXTHDR_ROUTING 43 /* Routing header. */
#define NEXTHDR_FRAGMENT 44 /* Fragmentation/reassembly header. */
+#define NEXTHDR_GRE 47 /* Generic Routing Encapsulation */
#define NEXTHDR_ESP 50 /* Encapsulating security payload. */
#define NEXTHDR_AUTH 51 /* Authentication header. */
#define NEXTHDR_ICMP 58 /* ICMP for IPv6. */
@@ -85,8 +86,8 @@ struct ipv6_hop_hdr{
* fragmentation header
*/
-#define IPv6_FRAG_ISF (1) /* ������һ����Ƭ�� */
-#define IPv6_FRAG_NEW (2) /* ���յ����з�Ƭ��������ɵ��°� */
+#define IPv6_FRAG_ISF (1) /* ������һ����Ƭ�� */
+#define IPv6_FRAG_NEW (2) /* ���յ����з�Ƭ��������ɵ��°� */
#define IP6_MF (0x0001)
@@ -98,16 +99,16 @@ struct ipv6_frag_hdr{
};
struct ipv6_frag_key{
- unsigned int identification; /* ���п��ܲ�ͬ��ֵ���ڽṹ��ǰ�棬�Ƚ�ʱ���һЩ */
- int __pad__; /* ����ṹ8�ֽڶ��� */
+ unsigned int identification; /* ���п��ܲ�ͬ��ֵ���ڽṹ��ǰ�棬�Ƚ�ʱ���һЩ */
+ int __pad__; /* ����ṹ8�ֽڶ��� */
struct in6_addr ip6_src; /* source address */
struct in6_addr ip6_dst; /* dest address */
struct streaminfo_private *pfstream_pr;
};
struct ipv6_frag_private{
- unsigned char raw_next_hdr; /* ԭʼIP���ĵ�һ���ɷ�Ƭ����ͷ������ */
- int unfragmentable_len; /* ԭʼIP���IJ��ɷ�Ƭ���ֳ��� */
+ unsigned char raw_next_hdr; /* ԭʼIP���ĵ�һ���ɷ�Ƭ����ͷ������ */
+ int unfragmentable_len; /* ԭʼIP���IJ��ɷ�Ƭ���ֳ��� */
};
diff --git a/src/dealpkt/deal_ipv6.c b/src/dealpkt/deal_ipv6.c
index a879f6d..1ae6179 100644
--- a/src/dealpkt/deal_ipv6.c
+++ b/src/dealpkt/deal_ipv6.c
@@ -86,7 +86,7 @@ static uchar * ipv6_frag_key_dup(const uchar *key, uint key_size)
raw_frag_key = (struct ipv6_frag_key *)key;
tid = raw_frag_key->pfstream_pr->stream_public.threadnum;
- /* �˺����޷���ȡ�̺߳�, ����ʹ��malloc, ͬ��������ҲҪʹ��free */
+ /* �˺����޷���ȡ�̺߳�, ����ʹ��malloc, ͬ��������ҲҪʹ��free */
new_frag_key = (struct ipv6_frag_key *)sapp_mem_calloc(SAPP_MEM_DYN_IP_FRAG_PKT, tid, sizeof(struct ipv6_frag_key));
memcpy(&new_frag_key->ip6_src, &raw_frag_key->ip6_src, sizeof(struct in6_addr));
@@ -149,7 +149,7 @@ static void ipv6_frag_ipq_free_all(void *data)
{
struct frag_ipq *ipq = (struct frag_ipq *)data;
- /* ���������ɾ��ʱ, Ҫ�ͷ�new_iph�ڴ� */
+ /* ���������ɾ��ʱ, Ҫ�ͷ�new_iph�ڴ� */
if(ipq->new_iph){
sapp_mem_free(SAPP_MEM_DYN_IP_FRAG_PKT,ipq->thread_num, ipq->new_iph);
}
@@ -185,7 +185,7 @@ static inline int checkipv6pkt(const struct mesa_ip6_hdr * iph, int payload_len,
break;
#endif
case NEXTHDR_FRAGMENT :
- /* NOTE: ��ΪIPv6��Ƭ�����, �ֵݹ������ipv6_entry(), ��ʱ���ܼ�⸺�س��ȴ���raw_pkt_len, ֻ��ԭʼ��Ƭ��������ô��� */
+ /* NOTE: ��ΪIPv6��Ƭ�����, �ֵݹ������ipv6_entry(), ��ʱ���ܼ�⸺�س��ȴ���raw_pkt_len, ֻ��ԭʼ��Ƭ��������ô��� */
if(payload_len + (int)sizeof(struct mesa_ip6_hdr) > raw_pkt_len){
sapp_runtime_log(20, "ipv6 packet check error: fragement pkt len:%d, raw_pkt len: %d\n", payload_len, raw_pkt_len);
return -1;
@@ -218,7 +218,7 @@ int ipv6_packet_check(int threadid, int len, struct simple_ip6_hdr *ip6h)
return 1;
}
-/* to do: ������� */
+/* to do: ������� */
static int ipv6_attack_detect(struct frag_ipq *ipv6_qp)
{
if(ipv6_qp->attack_flag != 0)
@@ -232,7 +232,7 @@ static int ipv6_attack_detect(struct frag_ipq *ipv6_qp)
return IP_FRAG_IGNORE;
}
- // to do: ��������
+ // to do: ��������
return IP_FRAG_OK;
}
@@ -273,8 +273,8 @@ static unsigned int ipv6_frag_hash_index(void *hash_key)
/*
return value:
- 0: keyֵ��ͬ
- -1:keyֵ��ͬ
+ 0: keyֵ��ͬ
+ -1:keyֵ��ͬ
*/
int ipv6_frag_hash_cmp(void *hash_key1, void *hash_key2)
{
@@ -322,7 +322,7 @@ static struct frag_ipq *ipv6_frag_queue_find(struct streaminfo_private *pstream_
}
#endif
-/* ��IPv4�����£�ͳ�Ƴ����ڴ�ռ�þ���ֵ */
+/* ��IPv4�����£�ͳ�Ƴ����ڴ�ռ�þ���ֵ */
static inline int ip6_buff_size(int tot_len)
{
return tot_len > 2048 ? (tot_len > 10240 ? 65576 : 10240) : 2048;
@@ -330,7 +330,7 @@ static inline int ip6_buff_size(int tot_len)
#if (USE_MESA_STREAM_HASH==0)
-/* ���ݳ�ʱ���������ڴ� */
+/* ���ݳ�ʱ���������ڴ� */
static void ipv6_frag_mem_clean_by_time(struct frag_manage *handle)
{
struct frag_ipq *tmp, *next;
@@ -343,7 +343,7 @@ static void ipv6_frag_mem_clean_by_time(struct frag_manage *handle)
frag_ipq_kill(handle, tmp);
- /* ÿ��ֻ�ͷ�һ���������ڴ棬���ⳤʱ���ڴ˺������У���������������� */
+ /* ÿ��ֻ�ͷ�һ���������ڴ棬���ⳤʱ���ڴ˺������У���������������� */
if(raw_mem_size-handle->total_mem >= IPV6_FRAG_MEM_FREE_ONCE)
{
break;
@@ -354,7 +354,7 @@ static void ipv6_frag_mem_clean_by_time(struct frag_manage *handle)
}
-/* ����ռ���ڴ����������ڴ� */
+/* ����ռ���ڴ����������ڴ� */
static void ipv6_frag_mem_clean_by_size(struct frag_manage *handle)
{
struct frag_ipq *tmp, *next;
@@ -367,7 +367,7 @@ static void ipv6_frag_mem_clean_by_size(struct frag_manage *handle)
frag_ipq_kill(handle, tmp);
- /* ÿ��ֻ�ͷ�һ���������ڴ棬���ⳤʱ���ڴ˺������У���������������� */
+ /* ÿ��ֻ�ͷ�һ���������ڴ棬���ⳤʱ���ڴ˺������У���������������� */
if(raw_mem_size-handle->total_mem >= IPV6_FRAG_MEM_FREE_ONCE)
{
break;
@@ -378,7 +378,7 @@ static void ipv6_frag_mem_clean_by_size(struct frag_manage *handle)
}
-/* �����ڴ棬��ʱ���ռ���ڴ����� */
+/* �����ڴ棬��ʱ���ռ���ڴ����� */
static inline void ipv6_frag_mem_clean(struct frag_manage *handle)
{
ipv6_frag_mem_clean_by_time(handle);
@@ -413,14 +413,14 @@ static void *frag_reassemble_v6(struct frag_manage *handle, struct frag_ipq *ipq
#endif
/*
- IPv6��Ƭ�������.
- ����˵��:
- pfstream: �ײ�����ָ��.
- thread_num: �߳�ID
- frag_packet: ԭʼIPv6���ݰ�ͷָ��
- ipv6_frag_hdr: IPv6��Ƭͷ��ָ��
- last_hdr_offset: ��Ƭͷ��ǰһ����ͷ��next_hdr�ֶΣ����IPv6ԭʼ��ͷ��ƫ������
- �������֮�󣬲�������Ƭͷ����Ҫ�ѷ�Ƭͷ��ǰһ����ͷ��next_hdrֵ��Ϊ��Ƭͷ֮���next_hdrֵ.
+ IPv6��Ƭ�������.
+ ����˵��:
+ pfstream: �ײ�����ָ��.
+ thread_num: �߳�ID
+ frag_packet: ԭʼIPv6���ݰ�ͷָ��
+ ipv6_frag_hdr: IPv6��Ƭͷ��ָ��
+ last_hdr_offset: ��Ƭͷ��ǰһ����ͷ��next_hdr�ֶΣ����IPv6ԭʼ��ͷ��ƫ������
+ �������֮�󣬲�������Ƭͷ����Ҫ�ѷ�Ƭͷ��ǰһ����ͷ��next_hdrֵ��Ϊ��Ƭͷ֮���next_hdrֵ.
*/
static struct mesa_ip6_hdr *ipv6_defrag(struct streaminfo_private *pstream_pr,
int thread_num, const struct mesa_ip6_hdr *frag_packet,
@@ -458,7 +458,7 @@ static struct mesa_ip6_hdr *ipv6_defrag(struct streaminfo_private *pstream_pr,
return NULL;
}
- /* ������� */
+ /* ������� */
attack_flag = ipv6_attack_detect(ipv6_qp);
switch(attack_flag)
{
@@ -484,7 +484,7 @@ static struct mesa_ip6_hdr *ipv6_defrag(struct streaminfo_private *pstream_pr,
ipv6_qp->frags_num++;
- if(NULL == ipv6_qp->private_info) /* �յ��ĵ�һ����Ƭ�� */
+ if(NULL == ipv6_qp->private_info) /* �յ��ĵ�һ����Ƭ�� */
{
ipv6_qp->private_info = frag_malloc(ip6_frag_handle, sizeof(struct ipv6_frag_private));
ipv6_qp->private_len = sizeof(struct ipv6_frag_private);
@@ -496,7 +496,7 @@ static struct mesa_ip6_hdr *ipv6_defrag(struct streaminfo_private *pstream_pr,
offset = ntohs(ipv6_frag_hdr->frag_off) & ~0x7;
end = offset + (ntohs(frag_packet->ip6_payload_len) -
- ((u_int8_t *)(ipv6_frag_hdr + 1) - (u_int8_t *)(frag_packet + 1)));/* lijia comment, ��Ƭͷǰ���п��ܻ���������ͷ��, */
+ ((u_int8_t *)(ipv6_frag_hdr + 1) - (u_int8_t *)(frag_packet + 1)));/* lijia comment, ��Ƭͷǰ���п��ܻ���������ͷ��, */
if(offset >= end)
{
@@ -507,7 +507,7 @@ static struct mesa_ip6_hdr *ipv6_defrag(struct streaminfo_private *pstream_pr,
goto err;
}
- if(!(ipv6_frag_hdr->frag_off & htons(IP6_MF))) /* ���һ����Ƭ�� */
+ if(!(ipv6_frag_hdr->frag_off & htons(IP6_MF))) /* ���һ����Ƭ�� */
{
if (end < ipv6_qp->tot_len||
((ipv6_qp->last_in & IP_FRAG_LAST_IN) && end != ipv6_qp->tot_len))
@@ -519,11 +519,11 @@ static struct mesa_ip6_hdr *ipv6_defrag(struct streaminfo_private *pstream_pr,
}
else
{
- if(end & 0x7) /* ����8�������� */
+ if(end & 0x7) /* ����8�������� */
{
goto err;
}
- if(end > ipv6_qp->tot_len) /* ���� */
+ if(end > ipv6_qp->tot_len) /* ���� */
{
if(ipv6_qp->last_in & IP_FRAG_LAST_IN)
{
@@ -554,7 +554,7 @@ static struct mesa_ip6_hdr *ipv6_defrag(struct streaminfo_private *pstream_pr,
}
prev = next;
}
-#else /* search backward, һ�������, offset��ֵ���Ǵ�С����ʱ�临�Ӷ�ΪO(1) */
+#else /* search backward, һ�������, offset��ֵ���Ǵ�С����ʱ�临�Ӷ�ΪO(1) */
next = NULL;
for(prev = ipv6_qp->fragments_tail; prev != NULL; prev = prev->prev)
{
@@ -580,13 +580,13 @@ found:
goto discard_fq;
}
- if(prev && (prev->end == offset)) /* �ϲ����ڷ�Ƭ��Ϣ�������½�frags�ṹ */
+ if(prev && (prev->end == offset)) /* �ϲ����ڷ�Ƭ��Ϣ�������½�frags�ṹ */
{
prev->end = end;
goto copy_data;
}
- if(next && (next->offset == end)) /* �ϲ����ڷ�Ƭ��Ϣ�������½�frags�ṹ */
+ if(next && (next->offset == end)) /* �ϲ����ڷ�Ƭ��Ϣ�������½�frags�ṹ */
{
next->offset = offset;
goto copy_data;
@@ -621,13 +621,13 @@ copy_data:
/* The first fragment. */
if(0 == offset)
{
- int this_pkt_unfragmentable_len = (char *)ipv6_frag_hdr - (char *)frag_packet; /* ��ǰ��ʵ�ʲ��ɷ�Ƭ��ͷ���� */
+ int this_pkt_unfragmentable_len = (char *)ipv6_frag_hdr - (char *)frag_packet; /* ��ǰ��ʵ�ʲ��ɷ�Ƭ��ͷ���� */
ipv6_qp->last_in |= IP_FRAG_FIRST_IN;
- if(this_pkt_unfragmentable_len > private_info->unfragmentable_len){ /* ʵ��ͷ���ռ䳬��Ԥ���ռ� */
- if (end + this_pkt_unfragmentable_len > ipv6_qp->buf_size){ /* �Ƿ���Ҫ���仺��ռ� */
+ if(this_pkt_unfragmentable_len > private_info->unfragmentable_len){ /* ʵ��ͷ���ռ䳬��Ԥ���ռ� */
+ if (end + this_pkt_unfragmentable_len > ipv6_qp->buf_size){ /* �Ƿ���Ҫ���仺��ռ� */
new_buf_size = ip6_buff_size(end + this_pkt_unfragmentable_len);
new_ip6h = (struct mesa_ip6_hdr *)frag_malloc(ip6_frag_handle, new_buf_size);
- if(ipv6_qp->meat > 0){ /* meat>0, ֮ǰ�Ѿ��洢������, ͨ�������Ƿ�Ƭ����, �����յ������ķ�Ƭ�� */
+ if(ipv6_qp->meat > 0){ /* meat>0, ֮ǰ�Ѿ��洢������, ͨ�������Ƿ�Ƭ����, �����յ������ķ�Ƭ�� */
memcpy((char *)new_ip6h + this_pkt_unfragmentable_len, (char *)ipv6_qp->new_iph + private_info->unfragmentable_len, ipv6_qp->buf_size);
}
frag_free(ip6_frag_handle, ipv6_qp->new_iph, ipv6_qp->buf_size);
@@ -636,7 +636,7 @@ copy_data:
}
}
private_info->unfragmentable_len = this_pkt_unfragmentable_len;
- private_info->raw_next_hdr = ipv6_frag_hdr->nexthdr; /* ��¼��һ����Ƭ����һ��Э������ */
+ private_info->raw_next_hdr = ipv6_frag_hdr->nexthdr; /* ��¼��һ����Ƭ����һ��Э������ */
memcpy(ipv6_qp->new_iph, frag_packet, this_pkt_unfragmentable_len);
}
@@ -663,7 +663,7 @@ copy_data:
ipv6_qp->ipfrag_list = NULL;
#endif
- int ip6_payload_len = htons(ipv6_qp->meat); /* ʵ�����ݳ���, ����ͷ�� */
+ int ip6_payload_len = htons(ipv6_qp->meat); /* ʵ�����ݳ���, ����ͷ�� */
char raw_next_hdr = private_info->raw_next_hdr;
#if USE_MESA_STREAM_HASH
new_ip6h = (struct mesa_ip6_hdr *)frag_reassemble_v6(ip6_frag_handle, ipv6_qp, &ip6_frag_key);
@@ -671,7 +671,7 @@ copy_data:
new_ip6h = (struct mesa_ip6_hdr *)frag_reassemble(ip6_frag_handle, ipv6_qp);
#endif
new_ip6h->ip6_payload_len = ip6_payload_len;
- *((char *)new_ip6h + last_hdr_offset) = raw_next_hdr; /* ����Ϊ��һ������nexthdr��Ϣ */
+ *((char *)new_ip6h + last_hdr_offset) = raw_next_hdr; /* ����Ϊ��һ������nexthdr��Ϣ */
return new_ip6h;
}
@@ -713,7 +713,7 @@ static void set_ipv6_stream(struct streaminfo_private *pfstream_pr, struct strea
ip6_addr->source = 0;
ip6_addr->dest = 0;
- /* LiJia add, ��Ϊ��ij���㷨���ⶨ��һ�������ַ�ķ���, �����ж�memcmp�Ľ�� */
+ /* LiJia add, ��Ϊ��ij���㷨���ⶨ��һ�������ַ�ķ���, �����ж�memcmp�Ľ�� */
if(memcmp(ip6_addr->saddr, ip6_addr->daddr, IPV6_ADDR_LEN) >= 0){
pstream_pr->layer_dir = 1;
pstream->curdir = DIR_C2S;
@@ -723,7 +723,7 @@ static void set_ipv6_stream(struct streaminfo_private *pfstream_pr, struct strea
}
pstream->addr.ipv6 = ip6_addr;
- /* ��IP��������Ϊ__ADDR_TYPE_IP_PAIR_V4, ����ϲ���TCP/UDP, ����������ΪADDR_TYPE_IPV4, �����Ipv6_over_ipv4����, ������IP���ַ���� */
+ /* ��IP��������Ϊ__ADDR_TYPE_IP_PAIR_V4, ����ϲ���TCP/UDP, ����������ΪADDR_TYPE_IPV4, �����Ipv6_over_ipv4����, ������IP���ַ���� */
pstream->addr.addrtype = __ADDR_TYPE_IP_PAIR_V6;
pstream->addr.addrlen = sizeof(struct layer_addr_ipv6);
pstream_pr->addr_use_as_hash = 1;
@@ -734,7 +734,7 @@ static void set_ipv6_stream(struct streaminfo_private *pfstream_pr, struct strea
pstream_pr->raw_pkt = raw_pkt; /* 2014-12-30 lijia add */
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, ������ɼ� */
+ && (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;
@@ -753,12 +753,12 @@ static void set_ipv6_stream(struct streaminfo_private *pfstream_pr, struct strea
/*
- IPv6���ݰ��������.
- ����˵��:
- pfstream: �ײ�����ָ��.
- a_packet: ԭʼIPv6���ݰ�ͷָ��
- thread_num: �߳�ID
- routedir: �ײ���Ĵ��䷽��
+ IPv6���ݰ��������.
+ ����˵��:
+ pfstream: �ײ�����ָ��.
+ a_packet: ԭʼIPv6���ݰ�ͷָ��
+ thread_num: �߳�ID
+ routedir: �ײ���Ĵ��䷽��
*/
int ipv6_entry(struct streaminfo_private *pfstream_pr, const void *this_layer_hdr, int thread_num,
unsigned char routedir, const raw_pkt_t *raw_pkt, int offset_to_raw_pkt_hdr)
@@ -793,7 +793,7 @@ if(likely(pfstream_pr != NULL && pfstream_pr->layer_index < SAPP_SUPPORT_LAYER_N
return PASS;
}
- /* NOTE: ���߻����·���Ī�������IP��, ��������ѭ��, һ��Ҫ��ͷ���Ϸ��Լ��!! */
+ /* NOTE: ���߻����·���Ī�������IP��, ��������ѭ��, һ��Ҫ��ͷ���Ϸ��Լ��!! */
if(unlikely(checkipv6pkt(a_packet, (int)payload_len, raw_pkt->raw_pkt_len) < 0)){
local_sys_stat->count[SAPP_STAT_DROP_IPV6]++;
local_sys_stat->length[SAPP_STAT_DROP_IPV6]+=raw_pkt->raw_pkt_len;
@@ -811,7 +811,7 @@ if(likely(pfstream_pr != NULL && pfstream_pr->layer_index < SAPP_SUPPORT_LAYER_N
}
if((sapp_global_mthread[thread_num].ipv6_pkt_type_flag & PKT_TYPE_IPREBUILD) == 0){
- /* IP��Ƭ����İ�������ipv6_entry, �����ټ��� */
+ /* IP��Ƭ����İ�������ipv6_entry, �����ټ��� */
local_sys_stat->count[SAPP_STAT_RCV_IPV6]++;
local_sys_stat->length[SAPP_STAT_RCV_IPV6]+=payload_len + sizeof(struct mesa_ip6_hdr);
if (routedir == sapp_global_val->config.packet_io.inbound_route_dir)
@@ -883,18 +883,18 @@ if(likely(pfstream_pr != NULL && pfstream_pr->layer_index < SAPP_SUPPORT_LAYER_N
(struct ipv6_frag_hdr *)next_hdr_ptr, last_hdr-(uchar *)a_packet, raw_pkt);
if(new_ip6h)
{
- //assert(new_ip6h->ip6_nxt_hdr != NEXTHDR_FRAGMENT); /* ǿ��У��, ��Ƭ����İ����������Ƿ�Ƭ, ����ѭ����!! */
+ //assert(new_ip6h->ip6_nxt_hdr != NEXTHDR_FRAGMENT); /* ǿ��У��, ��Ƭ����İ����������Ƿ�Ƭ, ����ѭ����!! */
if(new_ip6h->ip6_nxt_hdr == NEXTHDR_FRAGMENT)
{
need_free=1;
goto done;
}
- /* ��������IP��ַ��Ϣ */
+ /* ��������IP��ַ��Ϣ */
set_ipv6_stream(pfstream_pr, &(tmp_index), &ip6_addr, new_ip6h, routedir, thread_num, raw_pkt, skip_len+offset_to_raw_pkt_hdr);
- /* �ݹ��������һ��,����IPv6����չͷ��,�����ϲ㴦��ģ�� */
+ /* �ݹ��������һ��,����IPv6����չͷ��,�����ϲ㴦��ģ�� */
sapp_global_mthread[thread_num].ipv6_pkt_type_flag = PKT_TYPE_IPREBUILD;
action = ipv6_entry(pfstream_pr, (const void *)new_ip6h, thread_num, routedir, raw_pkt,
- skip_len+offset_to_raw_pkt_hdr); /* ��Ƭ����İ��ݹ��������, �������sizeof(struct mesa_ip6_hdr)ͷ */
+ skip_len+offset_to_raw_pkt_hdr); /* ��Ƭ����İ��ݹ��������, �������sizeof(struct mesa_ip6_hdr)ͷ */
need_free = 1;
sapp_global_mthread[thread_num].ipv6_pkt_type_flag = PKT_TYPE_NORMAL;
IPV6_PRINT("ipv6_frag_reassemble_num: %u\n", ipv6_frag_reassemble_num++);
@@ -909,7 +909,7 @@ if(likely(pfstream_pr != NULL && pfstream_pr->layer_index < SAPP_SUPPORT_LAYER_N
case NEXTHDR_AUTH:
case NEXTHDR_DEST:
//skip_len = *(next_hdr_ptr + 1) + 1;
- skip_len = (*(next_hdr_ptr + 1))*8 + 8; /* ѡ�����8�ֽ�Ϊ��λ */
+ skip_len = (*(next_hdr_ptr + 1))*8 + 8; /* ѡ�����8�ֽ�Ϊ��λ */
break;
case NEXTHDR_NONE:
@@ -944,7 +944,11 @@ if(likely(pfstream_pr != NULL && pfstream_pr->layer_index < SAPP_SUPPORT_LAYER_N
routedir, raw_pkt, sizeof(struct mesa_ip6_hdr)+skip_len+offset_to_raw_pkt_hdr);
goto done;
break;
-
+ case NEXTHDR_GRE:
+ ((raw_pkt_t *)raw_pkt)->offset_to_raw_pkt_hdr = sizeof(struct mesa_ip6_hdr)+skip_len+offset_to_raw_pkt_hdr;
+ ret = gre_entry(pfstream_pr,next_hdr_ptr,thread_num,routedir, raw_pkt, ((raw_pkt_t *)raw_pkt)->offset_to_raw_pkt_hdr);
+ goto done;
+ break;
case NEXTHDR_OSPF_IGP:
case NEXTHDR_ESP:
plocal_stream_pr->plugin_process_context=1;
@@ -1054,8 +1058,8 @@ MESA_htable_handle ipv6_frag_htable_create(void)
hargs.key2index = ipv6_frag_hash_index;
hargs.data_free = ipv6_frag_ipq_free_all;
hargs.data_expire_with_condition = NULL;
- hargs.complex_key_dup = ipv6_frag_key_dup; /* ���ڸ��ӽṹ��key����, ��copyһ����ַ���� */
- hargs.complex_key_free = ipv6_frag_key_free; /* ɾ��ʱ�ͷ�key���ڴ���Դ */
+ hargs.complex_key_dup = ipv6_frag_key_dup; /* ���ڸ��ӽṹ��key����, ��copyһ����ַ���� */
+ hargs.complex_key_free = ipv6_frag_key_free; /* ɾ��ʱ�ͷ�key���ڴ���Դ */
return MESA_htable_create(&hargs, sizeof(MESA_htable_create_args_t));
}