blob: f0c8aa42ef55192b69f5414bf446d3e728eaf1d5 [file] [log] [blame]
l.yangb8fdece2024-10-10 14:56:17 +08001/************************************************************************
2*¹¦ÄܽéÉÜ£ºlinuxÖÐÍøÂçfastnat¡¢fastbrÏà¹Ø²Ù×÷½Ó¿Ú
3*¸ºÔðÈË£º
4*±¸·ÝÈË£º
5*ÐÞ¸ÄÈÕ£º
6*ÐÞ¸ÄÄÚÈÝ£º
7*°æ±¾ºÅ£º
8************************************************************************/
9#ifndef _NETIO_PROC_H_
10#define _NETIO_PROC_H_
11
12
13#include <net/SI/net_track.h>
14#include <net/SI/ext_mem.h>
15
16
17#define PC_MAX_NUM 100
18#define DEV_NAME_LEN 50
19
20#define DEV_NAME_LEN_20 20
21
22#define ETH_ALEN 6
23
24#define SLAB_NUM 21
25
26#define HASH_ARRAY_COUNT 512
27//SKBͳ¼ÆÖµ£¬°üÀ¨Òì³£µãµÄͳ¼ÆÖµ
28enum skbinfo_type{
29 SKB_TYPE_ALL = 0, //skb½á¹¹ÌåÕýÔÚ¹¤×÷µÄ¸öÊý
30 SKB_TYPE_DATA, //SKBÖеÄslab»úÖÆµÄdataÕýÔÚ¹¤×÷µÄ¸öÊý£¬°üº¬SKB_TYPE_TOCP£¬µ«²»°üº¬SKB_TYPE_FROMCP
31 SKB_TYPE_TOCP, //·¢ÍùCPµÄskbÕýÔÚ¹¤×÷µÄ¸öÊý
32 SKB_TYPE_FROMCP, //´ÓCP½ÓÊÕµ½µÄPSBUFÕýÔÚ¹¤×÷µÄ¸öÊý
33 SKB_DATA_BYTES, //µ±Ç°ÉêÇëµÄdata×Ü×Ö½ÚÊý £¬ksize·½Ê½ÀÛ¼ÓµÄ
34
35 //ÐÔÄÜÏà¹ØµÄÈ«¾ÖÐÅÏ¢£¬Äں˽öÀÛ¼Ó·¢ÉúµÄ´ÎÊý£¬²»¸ºÔð·ÖÎö
36 SKB_QUEUE_STOP, //xmit_stopÔì³ÉµÄ¶ª°ü¸öÊý£¬ÀÛ¼ÓÖµ
37 SKB_QUEUE_LOCK, //QUEUE_LOCKÔì³ÉµÄ¶ª°ü¸öÊý£¬ÀÛ¼ÓÖµ
38 SKB_COPY_CACHE, //net_cacheÔ´ÎļþÖнøÐÐÈ«¿½±´µÄÀÛ¼ÓÖµ£¬Ä¿Ç°½öÔÚPPPºÍ·ÖƬʱ¿½±´£¬Ó°ÏìÐÔÄÜ
39 SKB_IRQ_FREE, //ͨ¹ýÈíÖжÏÊͷŵÄskb£¬ÐÔÄÜÏà¹Ø
40 SKB_COPY, //Êý¾Ý¿½±´µÄskb£¬ÐÔÄÜÏà¹Ø
41 SKB_FLOOD, //·ººéµÄskb£¬ÐÔÄÜÏà¹Ø
42 SKB_ERRFREE, //devÔ´ÎļþÖдíÎóÊͷŵÄskb¼ÆÊý£¬°üÀ¨SKB_QUEUE_STOPºÍSKB_QUEUE_LOCKÁ½¸ö¼ÆÊýÖµ
43 SKB_FRAG, //½ÓÊÕµ½µÄ·ÖƬ±¨ÎÄ£¬ÐÔÄÜÏà¹Ø
44 SKB_OVER_MTU, //fastÖÐÊý¾Ý³¤¶È´óÓÚ³ö¿Údev MTUʱ£¬fastʧ°Ü¸öÊýͳ¼Æ
45 SKB_LOOP, //ͶµÝ¸øÇý¶¯£¬ÓÖ´ÓÇý¶¯ÊÕµ½µÄÒì³£»Ø»·¸öÊýͳ¼Æ£¬´óÓÚ0±íʾÇý¶¯Òì³£
46 SKB_ALLOC_FIAL, //ÉêÇëskbʧ°ÜµÄ¸öÊýÀÛ¼ÓÖµ
47 SKB_INFO_MAX,
48};
49
50//ÍøÂçÄÚºËÔËÐÐʱµÄͳ¼ÆÖµ£¬ÖØµã¹Ø×¢½á¹¹ÌåµÄÉêÇëµã
51enum net_run_info{
52 BR_MAC_CHANGE = 0, //ÍøÇÅmacµØÖ·±»¸Ä±ä´ÎÊý
53 NEIGH_ALLOC, //neighbourÉêÇë´ÎÊý
54 NEIGH_FREE, //neighbourÊͷŵãÀÛ¼ÓÖµ
55 BR_NEIGH_VARY, //ÇŵãµÄ³ö¿ÚdevµÄMACµØÖ·±»¶à¸öPC¹²Ïí
56 CONN_ALLOC, //CONNÉêÇë´ÎÊýÀÛ¼ÓÖµ
57 CONN_FREE, //CONNÊͷŵãÀÛ¼ÓÖµ
58 BRFDB_ALLOC, //ÇŵãÉêÇë´ÎÊýÀÛ¼ÓÖµ
59 DST_ALLOC, //dst_entryÉêÇëÀÛ¼ÓÖµ
60 DST_FREE, //dst_entryÊͷŵãÀÛ¼ÓÖµ
61 HH_UPDATE, //HH¶þ²ãMACÍ·¸üÐÂÀÛ¼ÓÖµ
62 RT_CACHE_INVALID, //Çå¿Õ·ÓÉcacheµÄÀÛ¼ÓÖµ
63 RT_HASH_ADD, //ÐÂÔört_hash_table½ÚµãµÄÀÛ¼ÓÖµ
64 RT_HASH_DEL, //ɾ³ýrt_hash_table½ÚµãµÄÀÛ¼ÓÖµ
65 SSMAC_CHANGE_INDEV, //ͬһԴMACµØÖ·Èë¿Údev¸Ä±äµÄ´ÎÊý
66 NET_INFO_MAX,
67};
68enum dev_opt_state{
69 DEV_UNOPT=0, //ÈôÓû§Î´×öÈκβÙ×÷£¬³õʼֵΪ0
70 DEV_NOPRESENT, //¶ÔÓ¦!netif_device_presentÒì³££¬±íÃ÷Çý¶¯µ×²ãÉÐδ׼±¸ºÃ
71 DEV_OPENED, //dev is opened
72 DEV_OPEN_FAIL, //open fail
73 DEV_CLOSED, //dev is closed
74};
75
76enum slabinfo_file{
77 FAST_SLAB = 0,
78 SKB_SLAB,
79 BRFDB_SLAB,
80 DST_SLAB,
81 FIB_TRIE_SLAB,
82 FLOW_SLAB,
83 INETPEER_SLAB,
84 INET_HASHTABLES_SLAB,
85 INET_TIMEWAIT_SOCK_SLAB,
86 MYSOCKET_SLAB,
87 NF_CONNTRACK_CORE_SLAB,
88 NF_CONNTRACK_EXCEPT_SLAB,
89 REQUEST_SOCK_SLAB,
90 SOCK_SLAB,
91 SOCKET_SLAB,
92 XFRM6_TUNNEL_SLAB,
93 XT_HASHLIMIT_SLAB,
94 SOCK_ALLOC_PAGES, //ÓÉÓÚÎÞ·¨×¼È·ÕÒµ½Êͷŵ㣬ËùÒÔ½öÓÐ++¶¯×÷£¬--Ó¦¸ÃÓÉput_page´¥·¢
95 IP6_OUTPUT_ALLOC_PAGES, //ÓÉÓÚÎÞ·¨×¼È·ÕÒµ½Êͷŵ㣬ËùÒÔ½öÓÐ++¶¯×÷£¬--Ó¦¸ÃÓÉput_page´¥·¢
96 IP_OUTPUT_ALLOC_PAGES, //ÓÉÓÚÎÞ·¨×¼È·ÕÒµ½Êͷŵ㣬ËùÒÔ½öÓÐ++¶¯×÷£¬--Ó¦¸ÃÓÉput_page´¥·¢
97 SKB_ALLOC_PAGES, //ÓÉÓÚÎÞ·¨×¼È·ÕÒµ½Êͷŵ㣬ËùÒÔ½öÓÐ++¶¯×÷£¬--Ó¦¸ÃÓÉput_page´¥·¢
98};
99
100
101/*±¾µØTCPͳ¼ÆÐÅÏ¢*/
102enum tcp_stat_info
103{
104 TCP_RECV_PKTS = 0, /*½ÓÊÕµÄTCPÊýÄ¿*/
105 TCP_SEND_PKTS, /*·¢Ë͵ÄTCPÊýÄ¿*/
106 TCP_RETRANS_PKTS, /*·¢Ë͵ÄÖØ´«TCPÊýÄ¿*/
107 TCP_RECV_DROPS, /*½ÓÊն˵ÄTCP¶ª°üÊý*/
108 TCP_SEND_DROPS, /*·¢ËͶ˵ÄTCP¶ª°üÊý*/
109 TCP_RST_SEND_NUM, /*·¢Ë͵ÄRSTÊý*/
110 TCP_RST_RECV_NUM, /*½ÓÊÕµÄRSTÊý*/
111 TCP_STATS_MAX,
112};
113
114
115struct tcp_sock_stat
116{
117 unsigned long tcp_recv_num;
118 unsigned long tcp_send_num;
119 unsigned long tcp_retrans_num;
120 unsigned long tcp_recv_drops;
121 unsigned long tcp_send_drops;
122 unsigned long tcp_rst_send;
123 unsigned long tcp_rst_recv;
124};
125
126/****×ÊԴʹÓü°ÉÏÏÞÐÅÏ¢£¬ËùÓбê×¼ÄÚºËÓÐÉÏÏÞÇé¿öµÄ£¬½ÔÐè¼ì²â£¬ÒÔ·ÀÖ¹Òì³£·¢Éú****/
127struct net_max_check_msg
128{
129 /*nf_conntrack*/
130 unsigned long nf_conntrack_max; //nf_conntrack_max = 4832
131 unsigned long nf_conntrack_now; //net->ct.count
132 /*enqueue*/
133 int netdev_max_backlog; //netdev_max_backlog=1000
134 int input_queue_len; //²Î¿´enqueue_to_backlog½Ó¿ÚʵÏÖ
135 int rx_dropped; //ÒòΪÈë¶ÓÁÐÒÑÂúÔì³ÉµÄÈë¶ÓÁжª°üµÄÀÛ¼ÓÖµ
136 /*ÐÔÄÜÏà¹Ø*/
137 int fastnat_link_max; //nf_conntrack_max
138 int fastnat_link_now; //working_list.count
139 int fast6_link_max; //nf_conntrack_max
140 int fast6_link_now; //working_list6.count
141
142 /*ÍøÂçÄÚºËÔËÐÐʱµÄͳ¼ÆÖµ£¬ÖØµã¹Ø×¢½á¹¹ÌåµÄÉêÇëµã*/
143 unsigned long br_mac_change; //ÍøÇÅmacµØÖ·±»¸Ä±ä´ÎÊý
144 unsigned long neigh_alloc; //neighbourÉêÇë´ÎÊý
145 unsigned long neigh_free; //neighbourÊͷŵãÀÛ¼ÓÖµ
146 unsigned long br_neigh_vary; //ÇŵãµÄ³ö¿ÚdevµÄmacµØÖ·±»¶à¸öpc¹²Ïí
147 unsigned long conn_alloc; //connÉêÇë´ÎÊýÀÛ¼ÓÖµ
148 unsigned long conn_free; //connÊͷŵãÀÛ¼ÓÖµ
149 unsigned long brfdb_alloc; //ÇŵãÉêÇë´ÎÊýÀÛ¼ÓÖµ
150 unsigned long dst_alloc; //dst_entryÉêÇëÀÛ¼ÓÖµ
151 unsigned long dst_free; //dst_entryÊͷŵãÀÛ¼ÓÖµ
152 unsigned long hh_update; //hh¶þ²ãmacÍ·¸üÐÂÀÛ¼ÓÖµ
153 unsigned long rt_cache_invalid; //Çå¿Õ·ÓÉcacheµÄÀÛ¼ÓÖµ
154 unsigned long rt_hash_add; //ÐÂÔört_hash_table½ÚµãµÄÀÛ¼ÓÖµ
155 unsigned long rt_hash_del; //ɾ³ýrt_hash_table½ÚµãµÄÀÛ¼ÓÖµ
156 unsigned long ssmac_change_indev; //ͬһԴMACµØÖ·Èë¿Údev¸Ä±äµÄ´ÎÊý
157};
158
159/************************* SKBÏà¹ØÐÅÏ¢£¬°üÀ¨Í³¼ÆÐÅÏ¢ºÍfastÐÅÏ¢ ***********************/
160struct skb_and_fast_msg
161{
162 int skb_num4; //½ÓÊÕµ½µÄV4Êý¾Ý°ü
163 int skb_num6; //½ÓÊÕµ½µÄV6Êý¾Ý°ü
164 int skb_big_num; //len³¤¶È³¬¹ý1000µÄÊý¾Ý°ü£¬º¬V4ºÍV6
165 int skb_small_num; //len³¤¶ÈСÓÚ100µÄÊý¾Ý°ü£¬º¬V4ºÍV6
166 int skb_bytes4; //½ÓÊÕµ½µÄV4Êý¾Ý°ü×Ö½ÚÊý
167 int skb_bytes6; //½ÓÊÕµ½µÄV6Êý¾Ý°ü×Ö½ÚÊý
168 int skb_unknown; //½ÓÊÕµ½µÄδ֪ЭÒéÊý¾Ý°ü£¬°üÀ¨ARPµÈ·ÇV4ºÍV6µÄ±¨ÎÄ
169 int skb_tcpnum; //½ÓÊÕµ½µÄtcpÊý¾Ý°ü£¬º¬V4ºÍV6£¬µ«²»º¬fastbrµÄ±¨ÎÄ
170 int skb_udpnum; //½ÓÊÕµ½µÄudpÊý¾Ý°ü£¬º¬V4ºÍV6£¬µ«²»º¬fastbrµÄ±¨ÎÄ
171 int broadcast_num4; //½ÓÊÕµ½µÄV4¹ã²¥°ü
172 int broadcast_num6; //½ÓÊÕµ½µÄV6¹ã²¥°ü
173 int multicast_num4; //½ÓÊÕµ½µÄV4×é²¥±¨
174 int multicast_num6; //½ÓÊÕµ½µÄV6×é²¥±¨
175 int fastnat_num; //fastnat³É¹¦µÄ±¨ÎÄ
176 int fast6_num; //fast6³É¹¦µÄ±¨ÎÄ
177 int fastbr_num; //fastbr³É¹¦µÄ±¨ÎÄ
178 int fastnat_level; //²Î¿´FAST_NET_DEVICE
179 int fastbr_level; //²¼¶ûÀàÐÍ
180 //ÏÂÃæ¼¸¸öֵΪÀÛ¼ÓÖµ£¬ÐÔÄÜÏà¹Ø
181 int irqfree_num; //ͨ¹ýÈíÖжÏÊͷŵÄskb£¬ÐÔÄÜÏà¹Ø
182 int skbcopy_num; //Êý¾Ý¿½±´µÄskb£¬ÐÔÄÜÏà¹Ø
183 int cache_copy; //net_cacheÔ´Îļþ½øÐп½±´µÄÀÛ»ý¼ÆÊý£¬ÐÔÄÜÏà¹Ø
184 int skbflood_num; //·ººéµÄskb£¬ÐÔÄÜÏà¹Ø
185 int errfree_num; //devÔ´ÎļþÖдíÎóÊͷŵÄskb¼ÆÊý£¬°üÀ¨SKB_QUEUE_STOPºÍSKB_QUEUE_LOCKÁ½¸ö¼ÆÊýÖµ
186 int frag_num; //½ÓÊÕµ½µÄ·ÖƬ±¨ÎÄ£¬ÐÔÄÜÏà¹Ø
187 int mtu_num; //fastÖÐÊý¾Ý³¤¶È´óÓÚ³ö¿Údev MTUʱ£¬fastʧ°Ü¸öÊýͳ¼Æ
188 int fast_loop; //ͶµÝ¸øÇý¶¯£¬ÓÖ´ÓÇý¶¯ÊÕµ½µÄÒì³£»Ø»·¸öÊýͳ¼Æ
189 int skb_alloc_fail ; //ÉêÇëskbʧ°ÜµÄ¸öÊýÀÛ¼ÓÖµ
190 int xmit_lock_num; //xmit_lock_owner±»Ëø×¡Ôì³ÉµÄ¶ª°üµÄÀÛ¼Ó¼ÆÊý£¬Çý¶¯Ôì³ÉµÄ
191 int xmit_stop_num; //!netif_xmit_stopped(txq)Ôì³ÉµÄ¶ª°üµÄÀÛ¼Ó¼ÆÊý£¬Çý¶¯Ôì³ÉµÄ
192 int br_mac_change_num; //ÍøÇÅmacµØÖ·±»¸Ä±ä´ÎÊý
193 int fast_tcpdump_num; //fast×¥°ü¸öÊý
194 int fast_switch;
195 int fast_local4_rcv_num; //±¾µØfast_local4³É¹¦½ÓÊÕ±¨ÎÄ
196 int fast_local6_rcv_num; //±¾µØfast_local6³É¹¦½ÓÊÕ±¨ÎÄ
197 int fast_local4_output_num; //±¾µØfast_local4³É¹¦·¢Ëͱ¨ÎÄ
198 int fast_local6_output_num; //±¾µØfast_local6³É¹¦·¢Ëͱ¨ÎÄ
199};
200
201struct skb_using_msg
202{
203 unsigned long skb_all;
204 unsigned long skb_tocp;
205 unsigned long skb_fromcp;
206 unsigned long skb_data_num;
207 unsigned long skb_data_size;
208 unsigned long skb_stop;
209 unsigned long skb_lock;
210 unsigned long skb_panic;
211 unsigned long skb_fail;
212};
213
214/************************* ½á¹¹Ì嶨Òå DEV ***********************/
215//ÍøÂçÌí¼Ó£¬Í³¼ÆÍøÂç²ãÃæÊÕ·¢°üÇé¿ö
216struct net_dev_skbinfo {
217 unsigned long rx_packets; //Çý¶¯·¢ËÍÀ´µÄÊý¾Ý°ü¸öÊý£¬ÔÚnetif_rxÍ·ÀÛ¼Ó
218 unsigned long tx_packets; //·¢Ë͸øÇý¶¯µÄÊý¾Ý°ü¸öÊý£¬ÔÚdev_queue_xmitÍ·ÀÛ¼Ó
219 unsigned long rx_bytes; //×Ö½ÚÊý
220 unsigned long tx_bytes; //×Ö½ÚÊý
221 unsigned long rx_dropped; //netif_rxÄÚ²¿Á÷³ÌÖÐËùÓÐÒì³£ÊÍ·ÅskbµÄÀÛ¼Ó£¬Èç´ïµ½netdev_max_backlogÈë¶ÓÁÐÉÏÏÞ¶ø¶ª°ü
222 unsigned long tx_dropped; //dev_queue_xmitÄÚ²¿Á÷³ÌÖÐËùÓÐÒì³£ÊÍ·ÅskbµÄÀÛ¼Ó£¬Èç(txq->xmit_lock_owner == cpu)Ôì³ÉµÄ¶ª°ü
223};
224
225//ÍøÂçÌí¼Ó£¬connÊÕ·¢°üÇé¿ö
226struct conn_skbinfo {
227 unsigned long packets; //Êý¾Ý°ü¸öÊý
228 unsigned long bytes; //×Ö½ÚÊý
229};
230
231/* ¸Ã½á¹¹ÌåÖеÄËùÓÐÐÅÏ¢½ÔÓÉÇý¶¯¸³Öµ£¬ÍøÂç×é²»»á¸³Öµ */
232//Õâ¸ö½á¹¹Ì屨ÐëºÍ <linux/netdevice.h>ÖеÄnet_device_stats±£³ÖÒ»ÖÂ
233struct net_dev_stats {
234 unsigned long rx_packets;
235 unsigned long tx_packets;
236 unsigned long rx_bytes;
237 unsigned long tx_bytes;
238 unsigned long rx_errors; //Ðè¼à¿Ø
239 unsigned long tx_errors; //Ðè¼à¿Ø
240 unsigned long rx_dropped; //Ðè¼à¿Ø
241 unsigned long tx_dropped; //Ðè¼à¿Ø
242 unsigned long multicast;
243 unsigned long collisions;
244 unsigned long rx_length_errors; //Ðè¼à¿Ø
245 unsigned long rx_over_errors; //Ðè¼à¿Ø
246 unsigned long rx_crc_errors; //Ðè¼à¿Ø
247 unsigned long rx_frame_errors; //Ðè¼à¿Ø
248 unsigned long rx_fifo_errors; //Ðè¼à¿Ø
249 unsigned long rx_missed_errors; //Ðè¼à¿Ø
250 unsigned long tx_aborted_errors; //Ðè¼à¿Ø
251 unsigned long tx_carrier_errors; //Ðè¼à¿Ø
252 unsigned long tx_fifo_errors; //Ðè¼à¿Ø
253 unsigned long tx_heartbeat_errors; //Ðè¼à¿Ø
254 unsigned long tx_window_errors; //Ðè¼à¿Ø
255 unsigned long rx_compressed;
256 unsigned long tx_compressed;
257};
258
259struct ioctl_dev_netstats
260{
261 char dev_name[20];
262 struct net_dev_skbinfo stats_dbg; //ÍøÂçÌí¼ÓµÄ£¬Í³¼ÆÍøÂç²ãÃæÊÕ·¢°üÇé¿ö
263 struct net_dev_stats stats; //Êý¾ÝÊÕ·¢Í³¼ÆÖµ£¬¸Ãֵȫ²¿ÓÉÇý¶¯¸³ÖµµÄ£¬ÍøÂç²»¸³Öµ
264 unsigned int flags; //IFF_UPµÈ
265 unsigned char operstate; //ĿǰûɶÓÃ
266 unsigned long state; //µ×²ãÇý¶¯×´Ì¬£¬__LINK_STATE_NOCARRIER
267 int net_flag; //Óû§ifconfigµÄ½á¹û״̬£¬ÈçDEV_OPEN_FAIL
268 unsigned long que_state; //¶ÓÁÐ״̬£¬¶ÔÓ¦ dev->_tx[0].state£¬Èç__QUEUE_STATE_DRV_XOFF
269 unsigned int num_tx_queues; //TX¶ÓÁÐÊýÁ¿£¬¶àÊýÇý¶¯Ê¹ÓÃΨһ¶ÓÁУ¬ÔòֵΪ1
270};
271
272
273/************************* ½á¹¹Ì嶨Òå OTHER ***********************/
274struct pc_info
275{
276 unsigned char mac_addr[6];
277 char dev_name[DEV_NAME_LEN];
278};
279
280struct pc_node
281{
282 unsigned int num;
283 struct pc_info info[PC_MAX_NUM];
284};
285
286struct leak_info
287{
288 void *addr;
289 int user_num; //µ±Ç°data»òskb±»Ê¹ÓõļÆÊýÖµ£¬°éËæskbÖеÄusersºÍdataref¶ø±ä»¯
290 int track_num; //¼Ç¼ÒѼǼµ½Êý×é¹ì¼£µÄϱêË÷Òý
291 char func_track[10][100];//º¯Êý»ØËݹ켣
292};
293
294struct slab_info
295{
296 int num[SLAB_NUM][2];
297};
298
299
300struct hash_info
301{
302 int max_hash_size;
303 int current_hash_num;
304 int hash[HASH_ARRAY_COUNT][2];
305 int current_array_size;
306};
307
308struct ptype_info
309{
310 unsigned long ptype_all[5];
311 unsigned long ptype_base[15];
312};
313
314struct pkt_lost_stats
315{
316 unsigned int send_drops;
317 unsigned int send_drop_bytes;
318 unsigned int recv_drops;
319 unsigned int recv_drop_bytes;
320 unsigned int total_packets;
321 unsigned int total_bytes;
322};
323
324struct pkt_lost_info
325{
326 struct pkt_lost_stats stats[2];
327};
328
329typedef struct
330{
331 char usb[DEV_NAME_LEN_20];
332 char ps[DEV_NAME_LEN_20];
333 char wifi_wan[DEV_NAME_LEN_20];
334 char wifi_lan[DEV_NAME_LEN_20];
335 char eth_wan[DEV_NAME_LEN_20];
336 char eth_lan[DEV_NAME_LEN_20];
337 char ps_ext1[DEV_NAME_LEN_20];
338 char ps_ext2[DEV_NAME_LEN_20];
339 char ps_ext3[DEV_NAME_LEN_20];
340 char ps_ext4[DEV_NAME_LEN_20];
341} net_dbg_dev_info_t;
342
343struct time_list{
344 struct timeval tv;
345 struct list_head packet_list;
346};
347
348struct net_debug_packet_list{
349 struct list_head list;
350 struct list_head time;
351 int pid;
352 int tgid;
353 char pname[DEV_NAME_LEN];
354 int count;
355};
356
357/******************************±äÁ¿ÉùÃ÷***********************/
358/******************************±äÁ¿ÉùÃ÷***********************/
359/******************************±äÁ¿ÉùÃ÷***********************/
360extern int leak_set; // 1±íʾ¸ú×Ùskb¼°dataÉêÇëÊͷŵ㣻2±íʾ¸ú×Ùusers£¬ÒÔ¼ì²âΪºÎskbʼÖÕ²»ÄÜÊÍ·Å£¬ÔÝʱ¸Ã¹¦ÄÜÉв»¿ÉÓÃ
361extern int leak_list_max; // ÈÝÐí»º´æµÄ´ýÊͷŵÄskb¼°dataµÄ¸öÊý£¬¿Éµ÷Õû£»
362extern int track_max; //¹ì¼£¸ú×ÙÊý×éµÄÉÏÏÞ£¬½öµ±user++--ʱ²ÅÐèÒªÀ©´ó£¬·ñÔò2¼´¿É£»
363extern int stack_lenmax; //Õ»º¯Êý¹ì¼£µÄ×Ö·û¸öÊýÉÏÏÞ£»
364extern int leak_full_panic;
365extern unsigned long now_time; //µ±Ç°Ê±¿Ìµã
366extern spinlock_t leak_lock; //·ÀÖ¹ÔÚbhÖб»µ÷Óã¬Ê¹ÓÃbhËø
367
368
369extern struct leak_list data_leak[TRACK_END];
370extern struct leak_list data_free[TRACK_END];//·Ö±ð¶ÔÓ¦ÕýÔÚʹÓõÄÊý¾ÝºÍÒѾ­ÊͷŵÄÊý¾ÝÁ´±í
371extern void *data_head[TRACK_END];//ÿ¸öÄÚ´æ¼à¿ØÀàÐ͵ijõʼ»¯Ê×µØÖ·£¬È·±£Á´±íµÄÊý¾ÝÇøÁ¬Ðø£¬ÒÔ±ãramdumpʱֱ½ÓËÑË÷
372extern int init_finish ;//Á´±í³õʼ»¯±êÖ¾
373
374/*dump stkÓõ½µÄÏà¹Ø±äÁ¿*/
375extern unsigned int skb_dump_len;
376extern char skb_dump_str[];
377
378/*ºË¼äÖØ¸´Êͷżì²â¿ª¹Ø*/
379extern int set_psbufleak ;
380extern int set_extskbleak ;
381
382extern unsigned long skbinfo_dbg[SKB_INFO_MAX];
383extern unsigned long netruninfo_dbg[NET_INFO_MAX];
384extern unsigned char br_ipchange_flag; //br0 ip´Û¸Ä¶ÏÑÔ
385extern int set_tcpdump; //¶¨µã×¥°ü¿ª¹Ø
386
387extern unsigned char ignoremac[ETH_ALEN];
388
389/*¶Ô±¾µØTCP½øÐÐÏà¹ØÍ³¼Æ*/
390extern unsigned long tcp_stats_dbg[TCP_STATS_MAX];
391
392extern char br_name[];
393extern char ps_name[];
394extern char usb_name[];
395extern char ppp_name[];
396
397
398//sqÌí¼Ó£¬ÓÃÓÚÊý¾Ý°ü½¨Ä£ÒÔ¼°ÐÔÄÜͳ¼ÆÏà¹Ø£¬net_info_numÈ«¾ÖÖÐÐÔÄÜÏà¹ØµÄͳ¼ÆÒ²ÐèÌåÏÖ
399extern int skb_num4; //½ÓÊÕµ½µÄV4Êý¾Ý°ü
400extern int skb_num6; //½ÓÊÕµ½µÄV6Êý¾Ý°ü
401extern int skb_big_num; //len³¤¶È³¬¹ý1000µÄÊý¾Ý°ü£¬º¬V4ºÍV6
402extern int skb_small_num; //len³¤¶ÈСÓÚ100µÄÊý¾Ý°ü£¬º¬V4ºÍV6
403extern int skb_bytes4; //½ÓÊÕµ½µÄV4Êý¾Ý°ü×Ö½ÚÊý
404extern int skb_bytes6; //½ÓÊÕµ½µÄV6Êý¾Ý°ü×Ö½ÚÊý
405extern int skb_unknown; //½ÓÊÕµ½µÄδ֪ЭÒéÊý¾Ý°ü£¬°üÀ¨ARP
406extern int skb_tcpnum; //½ÓÊÕµ½µÄtcpÊý¾Ý°ü£¬º¬V4ºÍV6
407extern int skb_udpnum; //½ÓÊÕµ½µÄudpÊý¾Ý°ü£¬º¬V4ºÍV6
408extern int broadcast_num4; //½ÓÊÕµ½µÄV4¹ã²¥°ü
409extern int broadcast_num6; //½ÓÊÕµ½µÄV6¹ã²¥°ü
410extern int multicast_num4; //½ÓÊÕµ½µÄV4×é²¥±¨
411extern int multicast_num6; //½ÓÊÕµ½µÄV6×é²¥±¨
412extern int fastnat_num; //fastnat³É¹¦µÄ±¨ÎÄ
413extern int fast6_num; //fast6³É¹¦µÄ±¨ÎÄ
414extern int fastbr_num; //fastbr³É¹¦µÄ±¨ÎÄ
415extern int fast_local4_rcv_num; //±¾µØfast_local4³É¹¦½ÓÊÕ±¨ÎÄ
416extern int fast_local6_rcv_num; //±¾µØfast_local6³É¹¦½ÓÊÕ±¨ÎÄ
417extern int fast_local4_output_num; //±¾µØfast_local4³É¹¦·¢Ëͱ¨ÎÄ
418extern int fast_local6_output_num; //±¾µØfast_local6³É¹¦·¢Ëͱ¨ÎÄ
419extern int fast_tcpdump_num; //fast×¥°üÊýÁ¿
420
421extern int double_mac;
422
423extern int net_debug_ping; //×ÔÑÐping°ü¼Ç¼¶ª°üʱÑÓ¹¦ÄÜ
424extern int net_debug_perf; //×ÔÑÐtcp/udp°ü¼Ç¼¶ª°üʱÑÓ¹¦ÄÜ£¬ÐèÒªserver¶ÎÄܰ²×°×ÔÑÐÓ¦ÓÃ
425
426//slabÄÚ´æÊ¹ÓÃÏà¹ØÍ³¼Æ£¬Î´¿¼ÂÇͨÓÃslabµØÖ·³Ø£¬Èçkmalloc
427extern struct slab_info slab_count;
428
429//·¢Ë͸øCP´¦ÀíµÄ£¬´ýÊͷŵÄskbÁ´±í£¬ÓÃÓÚlog¸ú×Ù£¬·ÀÖ¹ºË¼äÄÚ´æÐ¹Â©£»
430extern struct ext_list toCp_listlog[MAX_EXT_MEM_HASH];
431
432//CP·¢Ë͸øAPµÄpsbufÐÅÏ¢Á´±í£¬ÓÃÓÚlog¸ú×Ù£¬·ÀÖ¹ºË¼äÄÚ´æÐ¹Â©;
433extern struct ext_list fromCp_list[MAX_EXT_MEM_HASH];
434
435/*½øÐÐTCPͳ¼Æ*/
436#define TCP_PKT_STATS_INC(_mod) tcp_stats_dbg[_mod]++
437
438
439/******************************Íⲿ½Ó¿ÚÉùÃ÷***********************/
440/******************************Íⲿ½Ó¿ÚÉùÃ÷***********************/
441/******************************Íⲿ½Ó¿ÚÉùÃ÷***********************/
442extern void skbinfo_add(unsigned char *addr,unsigned int skb_type);
443extern void skbinfo_del(unsigned char *addr,unsigned int skb_type);
444extern void netruninfo_add(unsigned char *addr,unsigned int info_type);
445extern void netruninfo_del(unsigned char *addr,unsigned int info_type);
446
447extern int get_skbcnt(unsigned long arg);
448extern int get_dev_info(unsigned long arg);
449extern int get_skb_using(unsigned long arg);
450extern int network_get_pcmac(unsigned long arg);
451extern int get_kernelparam(unsigned long arg);
452extern int get_slab_info(unsigned long arg);
453extern int get_hash_info(unsigned long arg);
454
455extern int set_fastnat_level(void *arg);
456extern int set_fastbr_level(void *arg);
457extern int set_fast_debug_panic(void *arg);
458extern int set_fast_dev_xmit(void *arg);
459extern int set_ackdrop(void *arg);
460extern int set_dumpflag(void *arg);
461extern int set_skb_dump(unsigned long arg);
462extern int set_print_opt(void *arg);
463extern int set_sq_tcpdump(void *arg);
464extern int set_leak(void *arg);
465extern int set_max(unsigned long arg);
466extern int set_stacklenmax(unsigned long arg);
467extern int set_trackmax(unsigned long arg);
468extern int set_tcpdump_opt(unsigned long arg);
469extern int set_br_name(void *arg);
470extern int set_ps_name(void *arg);
471extern int set_usb_name(void *arg);
472extern int set_ppp_name(void *arg);
473extern int set_brip(unsigned long arg);
474extern int set_kernelparam(unsigned long arg);
475extern int set_errno_procname(void *arg);
476extern int get_neigh_ip(unsigned long arg);
477extern int get_skb_fast(unsigned long arg);
478extern int get_max_msg(unsigned long arg);
479extern int get_ptype(unsigned long arg);
480extern int get_process_info(void *arg);
481extern void netslab_inc(int i);
482extern void netslab_dec(int i);
483extern void track_netlink(struct sk_buff *skb,u32 group);
484//extern void record_app_atcive_net();
485
486int get_pkt_lost_info(unsigned long arg);
487
488int get_tcp_stat_info(unsigned long arg);
489
490#endif //end _NETIO_FASTINFO_H_
491
492