diff options
| author | yangwei <[email protected]> | 2024-08-30 19:49:00 +0800 |
|---|---|---|
| committer | yangwei <[email protected]> | 2024-09-02 14:20:43 +0800 |
| commit | 1c796feca56be18d745ccb838c95e834f4dfd793 (patch) | |
| tree | 694d83f56ae4256c581316eea351767d97091a75 /include | |
| parent | ad01deabef9d3137e181b88901c9a1609d2cb64c (diff) | |
🐞 fix(per flow ipfrag stat error): FIX TSG-22301
Diffstat (limited to 'include')
| -rw-r--r-- | include/private/ip_reassembly.h | 89 | ||||
| -rw-r--r-- | include/private/stream_manage.h | 13 |
2 files changed, 54 insertions, 48 deletions
diff --git a/include/private/ip_reassembly.h b/include/private/ip_reassembly.h index 7df9276..6b91f1c 100644 --- a/include/private/ip_reassembly.h +++ b/include/private/ip_reassembly.h @@ -4,20 +4,20 @@ #include "stream_internal.h"
-#define USE_MESA_STREAM_HASH (1) /* ʹ�û�������ģʽ�µ�HASH�� */
+#define USE_MESA_STREAM_HASH (1) /* ʹ�û�������ģʽ�µ�HASH�� */
#if USE_MESA_STREAM_HASH
#include "MESA_htable.h"
#endif
-#define IP_FRAG_DEFAULT_BUF_SIZE (2048) /* Ԥ����Ĭ��IP��Ƭ���黺������С, ͨ��ͳ�Ƶó�, ������IP������С��2KB��ռ90%���� */
+#define IP_FRAG_DEFAULT_BUF_SIZE (2048) /* Ԥ����Ĭ��IP��Ƭ���黺������С, ͨ��ͳ�Ƶó�, ������IP������С��2KB��ռ90%���� */
-#define IP_FRAG_OK (0x00) /* ������� */
-#define IP_FRAG_INVALID_PACKET (0x10) /* ��Ч��Ƭ�����˷�Ƭ�����ٴ���������������ͬһIPQ����һ����Ƭ�� */
-#define IP_FRAG_DISCARD (0x08) /* ������Ƭ���������ͷ�����IPQ���� */
-#define IP_FRAG_IGNORE (0x04) /* ������Ƭ�����Ժ�ͬһIPQ���еķ�Ƭ�������ٴ������������IPQ��ֱ����ʱ */
+#define IP_FRAG_OK (0x00) /* ������� */
+#define IP_FRAG_INVALID_PACKET (0x10) /* ��Ч��Ƭ�����˷�Ƭ�����ٴ���������������ͬһIPQ����һ����Ƭ�� */
+#define IP_FRAG_DISCARD (0x08) /* ������Ƭ���������ͷ�����IPQ���� */
+#define IP_FRAG_IGNORE (0x04) /* ������Ƭ�����Ժ�ͬһIPQ���еķ�Ƭ�������ٴ������������IPQ��ֱ����ʱ */
-#define IP_FRAG_FIRST_IN (0x02) /* ���յ��˵�һ����Ƭ�� */
-#define IP_FRAG_LAST_IN (0x01) /* ���յ������һ����Ƭ�� */
+#define IP_FRAG_FIRST_IN (0x02) /* ���յ��˵�һ����Ƭ�� */
+#define IP_FRAG_LAST_IN (0x01) /* ���յ������һ����Ƭ�� */
struct addr_list{
@@ -26,59 +26,62 @@ struct addr_list{ };
-/* һ����Ƭ�� */
+/* һ����Ƭ�� */
struct ip_frags{
- int offset; /* �˷�Ƭ����һ���ֽ����ԭʼ����ƫ���� */
- int end; /* �˷�Ƭ�����һ���ֽ����ԭʼ����ƫ���� */
- struct ip_frags *next; /* �˷�Ƭ���ڷ�Ƭ�����еĺ�̽ڵ� */
- struct ip_frags *prev; /* �˷�Ƭ���ڷ�Ƭ�����е�ǰ���ڵ� */
+ int offset; /* �˷�Ƭ����һ���ֽ����ԭʼ����ƫ���� */
+ int end; /* �˷�Ƭ�����һ���ֽ����ԭʼ����ƫ���� */
+ struct ip_frags *next; /* �˷�Ƭ���ڷ�Ƭ�����еĺ�̽ڵ� */
+ struct ip_frags *prev; /* �˷�Ƭ���ڷ�Ƭ�����е�ǰ���ڵ� */
};
-/* ��Ƭ������� */
+/* ��Ƭ������� */
struct frag_ipq{
- int buf_size; /* ��IP������ij��� */
- short last_in; /* ��־λ���յ���һ���������һ���� */
- short attack_flag; /* ��־λ���Ƿ����������ݰ� */
- int tot_len; /* ��ǰ�յ���Ƭ�������ƫ���� */
- int meat; /* ʵ���յ���IP��Ƭ����Ч���ݳ��� */
- unsigned int hash_index; /* ����������HASHֵ���Ժ��ظ�ʹ�ã������ٴμ��� */
+ int buf_size; /* ��IP������ij��� */
+ short last_in; /* ��־λ���յ���һ���������һ���� */
+ short attack_flag; /* ��־λ���Ƿ����������ݰ� */
+ int tot_len; /* ��ǰ�յ���Ƭ�������ƫ���� */
+ int meat; /* ʵ���յ���IP��Ƭ����Ч���ݳ��� */
+ unsigned int hash_index; /* ����������HASHֵ���Ժ��ظ�ʹ�ã������ٴμ��� */
int hash_key_size;
- int private_len; /* ��Э��������صĶ����������� */
- int frags_num; /* �յ��ķ�Ƭ������ */
- time_t create_time; /* ipq����ʱ�䣬���յ���һ����Ƭ����ʱ�� */
- void *new_iph; /* ��������IP��ͷ��ָ�� */
- struct ip_frags *fragments; /* ��Ƭ������ͷ */
- struct ip_frags *fragments_tail; /* ��Ƭ������β */
+ int private_len; /* ��Э��������صĶ����������� */
+ int frags_num; /* �յ��ķ�Ƭ������ */
+ time_t create_time; /* ipq����ʱ�䣬���յ���һ����Ƭ����ʱ�� */
+ void *new_iph; /* ��������IP��ͷ��ָ�� */
+ struct ip_frags *fragments; /* ��Ƭ������ͷ */
+ struct ip_frags *fragments_tail; /* ��Ƭ������β */
+ int frags_len;
#if USE_MESA_STREAM_HASH
- int thread_num; /* ʹ����HASHʱ, thread_num���ô���, ���ڴ˽ṹ�� */
+ int thread_num; /* ʹ����HASHʱ, thread_num���ô���, ���ڴ˽ṹ�� */
#else
- struct frag_ipq *hash_prev; /* HASH��ͻ������ǰ���ڵ� */
- struct frag_ipq *hash_next; /* HASH��ͻ�����ĺ�̽ڵ� */
- struct frag_ipq *lru_prev; /* LRU������ǰ���ڵ� */
- struct frag_ipq *lru_next; /* LRU�����ĺ�̽ڵ� */
+ struct frag_ipq *hash_prev; /* HASH��ͻ������ǰ���ڵ� */
+ struct frag_ipq *hash_next; /* HASH��ͻ�����ĺ�̽ڵ� */
+ struct frag_ipq *lru_prev; /* LRU������ǰ���ڵ� */
+ struct frag_ipq *lru_next; /* LRU�����ĺ�̽ڵ� */
#endif
- void *hash_key; /* hash key����Э���أ��ɹ���ģ������ռ䣬������hash_key_sizeָ�� */
- void *private_info; /* ��Э��������صĶ�������������������ռ�, ������private_lenָ�� */
- raw_ipfrag_list_t *ipfrag_list; /* ��ʱ�洢����ԭʼ��Ƭ�� */
+ void *hash_key; /* hash key����Э���أ��ɹ���ģ������ռ䣬������hash_key_sizeָ�� */
+ void *private_info; /* ��Э��������صĶ�������������������ռ�, ������private_lenָ�� */
+ raw_ipfrag_list_t *ipfrag_list; /* ��ʱ�洢����ԭʼ��Ƭ�� */
};
-/* ��Ƭ����Ĺ����ṹ�������Э��汾�� */
+/* ��Ƭ����Ĺ����ṹ�������Э��汾�� */
struct frag_manage{
- int thread_num; /* �߳�ID */
- unsigned int total_mem; /* ��ǰռ���ڴ����� */
+ int thread_num; /* �߳�ID */
+ unsigned int total_mem; /* ��ǰռ���ڴ����� */
#if USE_MESA_STREAM_HASH
MESA_htable_handle frag_hash_table;
#else
- unsigned int hash_table_size; /* HASH����С */
+ unsigned int hash_table_size; /* HASH����С */
int __pad__;
- struct frag_ipq **frag_hash_table; /* HASH��ͷָ�� */
- unsigned int (*hash_index)(void *hash_key); /* HASH����ָ�� */
- int (*hash_cmp)(void *hash_key1, void *hash_key2); /* key�ȽϺ���ָ�� */
- struct frag_ipq *lru_head; /* lru����ͷ */
- struct frag_ipq *lru_tail; /* lru����β */
+ struct frag_ipq **frag_hash_table; /* HASH��ͷָ�� */
+ unsigned int (*hash_index)(void *hash_key); /* HASH����ָ�� */
+ int (*hash_cmp)(void *hash_key1, void *hash_key2); /* key�ȽϺ���ָ�� */
+ struct frag_ipq *lru_head; /* lru����ͷ */
+ struct frag_ipq *lru_tail; /* lru����β */
#endif
+ int scratch_frag_cnt;
+ int scratch_frag_len;
};
#define JHASH_INITVAL 0xdeadbeef
diff --git a/include/private/stream_manage.h b/include/private/stream_manage.h index 61faf8c..38a7988 100644 --- a/include/private/stream_manage.h +++ b/include/private/stream_manage.h @@ -43,7 +43,7 @@ extern int tcp_support_all; #define UNORDER_MAX_NUM (tcp_default_unorder)
-//�ײ����ӹ�����״̬����
+//�ײ����ӹ�����״̬����
#define TCP_SYN_STATE 0
#define TCP_DATA_STATE 1
#define TCP_NOUSE_STATE 2
@@ -62,7 +62,7 @@ extern int tcp_support_all; #define STREAM_LINK_RESET 4
#define STREAM_LINK_TIMEOUT 5
#define STREAM_LINK_LRU_OUT 6
-#define STREAM_FAKE_CLOSE_BY_DEPRIVE 7 /* �����������KILL_FOLLOW, KILL_OTHER��, ��ǿ��CLOSE�IJ��״̬ */
+#define STREAM_FAKE_CLOSE_BY_DEPRIVE 7 /* �����������KILL_FOLLOW, KILL_OTHER��, ��ǿ��CLOSE�IJ��״̬ */
#define STREAM_CLOSE_BY_DUMPFILE_END 8 /* 2021-05-20 lijia add, for pcap dumpfile mode */
@@ -104,11 +104,11 @@ struct stream_index_list_item struct global_stream
{
struct streamindex **tcp_stream_table;
- unsigned short *tcp_stream_talbe_hash_count; /* lijia comment: һ��HASH_Slot�³�ͻ����Ԫ�ظ��� */
+ unsigned short *tcp_stream_talbe_hash_count; /* lijia comment: һ��HASH_Slot�³�ͻ����Ԫ�ظ��� */
struct stream_list tcpList[MAX_TCP_STATE];
struct streamindex **udp_stream_table;
- unsigned short *udp_stream_talbe_hash_count;/* lijia comment: һ��HASH_Slot�³�ͻ����Ԫ�ظ��� */
+ unsigned short *udp_stream_talbe_hash_count;/* lijia comment: һ��HASH_Slot�³�ͻ����Ԫ�ظ��� */
struct stream_list udpList[MAX_UDP_STATE];
STAILQ_HEAD(STREAM_INDEX_LIST,stream_index_list_item) freeList;
@@ -131,7 +131,7 @@ typedef struct _stStreamFunInfo struct timeout timeout;
const struct streaminfo *pstream;
int set_timer_s;
- int entry_id; /* ȫ��Ψһ��id, ����ÿ�������ں�����ִ��ʱ��ͳ�� */
+ int entry_id; /* ȫ��Ψһ��id, ����ÿ�������ں�����ִ��ʱ��ͳ�� */
char pad[7];
char appState;
enum fun_type_t funtype;/* 2014-12-31 lqy add */
@@ -190,6 +190,9 @@ struct streaminfo_private *copy_stream_info_to_heap_single_layer(int mem_used_ty unsigned int sapp_jhash_4words(unsigned int a, unsigned int b, unsigned int c, unsigned int initval, unsigned int *out_val);
+void stream_get_scratch_frag_stat(struct streaminfo *pstream, int *frag_cnt, int *frag_len);
+
+
#ifdef __cplusplus
}
#endif
|
