| /************************************************************************ |
| *¹¦ÄܽéÉÜ£ºlinuxÖÐÍøÂçfastnat¡¢fastbrÏà¹Ø²Ù×÷½Ó¿Ú |
| *¸ºÔðÈË£º |
| *±¸·ÝÈË£º |
| *ÐÞ¸ÄÈÕ£º |
| *ÐÞ¸ÄÄÚÈÝ£º |
| *°æ±¾ºÅ£º |
| ************************************************************************/ |
| #ifndef _NETIO_PROC_H_ |
| #define _NETIO_PROC_H_ |
| |
| |
| #include <net/SI/net_track.h> |
| #include <net/SI/ext_mem.h> |
| |
| |
| #define PC_MAX_NUM 100 |
| #define DEV_NAME_LEN 50 |
| |
| #define DEV_NAME_LEN_20 20 |
| |
| #define ETH_ALEN 6 |
| |
| #define SLAB_NUM 21 |
| |
| #define HASH_ARRAY_COUNT 512 |
| //SKBͳ¼ÆÖµ£¬°üÀ¨Òì³£µãµÄͳ¼ÆÖµ |
| enum skbinfo_type{ |
| SKB_TYPE_ALL = 0, //skb½á¹¹ÌåÕýÔÚ¹¤×÷µÄ¸öÊý |
| SKB_TYPE_DATA, //SKBÖеÄslab»úÖÆµÄdataÕýÔÚ¹¤×÷µÄ¸öÊý£¬°üº¬SKB_TYPE_TOCP£¬µ«²»°üº¬SKB_TYPE_FROMCP |
| SKB_TYPE_TOCP, //·¢ÍùCPµÄskbÕýÔÚ¹¤×÷µÄ¸öÊý |
| SKB_TYPE_FROMCP, //´ÓCP½ÓÊÕµ½µÄPSBUFÕýÔÚ¹¤×÷µÄ¸öÊý |
| SKB_DATA_BYTES, //µ±Ç°ÉêÇëµÄdata×Ü×Ö½ÚÊý £¬ksize·½Ê½ÀÛ¼ÓµÄ |
| |
| //ÐÔÄÜÏà¹ØµÄÈ«¾ÖÐÅÏ¢£¬Äں˽öÀÛ¼Ó·¢ÉúµÄ´ÎÊý£¬²»¸ºÔð·ÖÎö |
| SKB_QUEUE_STOP, //xmit_stopÔì³ÉµÄ¶ª°ü¸öÊý£¬ÀÛ¼ÓÖµ |
| SKB_QUEUE_LOCK, //QUEUE_LOCKÔì³ÉµÄ¶ª°ü¸öÊý£¬ÀÛ¼ÓÖµ |
| SKB_COPY_CACHE, //net_cacheÔ´ÎļþÖнøÐÐÈ«¿½±´µÄÀÛ¼ÓÖµ£¬Ä¿Ç°½öÔÚPPPºÍ·ÖƬʱ¿½±´£¬Ó°ÏìÐÔÄÜ |
| SKB_IRQ_FREE, //ͨ¹ýÈíÖжÏÊͷŵÄskb£¬ÐÔÄÜÏà¹Ø |
| SKB_COPY, //Êý¾Ý¿½±´µÄskb£¬ÐÔÄÜÏà¹Ø |
| SKB_FLOOD, //·ººéµÄskb£¬ÐÔÄÜÏà¹Ø |
| SKB_ERRFREE, //devÔ´ÎļþÖдíÎóÊͷŵÄskb¼ÆÊý£¬°üÀ¨SKB_QUEUE_STOPºÍSKB_QUEUE_LOCKÁ½¸ö¼ÆÊýÖµ |
| SKB_FRAG, //½ÓÊÕµ½µÄ·ÖƬ±¨ÎÄ£¬ÐÔÄÜÏà¹Ø |
| SKB_OVER_MTU, //fastÖÐÊý¾Ý³¤¶È´óÓÚ³ö¿Údev MTUʱ£¬fastʧ°Ü¸öÊýͳ¼Æ |
| SKB_LOOP, //ͶµÝ¸øÇý¶¯£¬ÓÖ´ÓÇý¶¯ÊÕµ½µÄÒì³£»Ø»·¸öÊýͳ¼Æ£¬´óÓÚ0±íʾÇý¶¯Òì³£ |
| SKB_ALLOC_FIAL, //ÉêÇëskbʧ°ÜµÄ¸öÊýÀÛ¼ÓÖµ |
| SKB_INFO_MAX, |
| }; |
| |
| //ÍøÂçÄÚºËÔËÐÐʱµÄͳ¼ÆÖµ£¬ÖØµã¹Ø×¢½á¹¹ÌåµÄÉêÇëµã |
| enum net_run_info{ |
| BR_MAC_CHANGE = 0, //ÍøÇÅmacµØÖ·±»¸Ä±ä´ÎÊý |
| NEIGH_ALLOC, //neighbourÉêÇë´ÎÊý |
| NEIGH_FREE, //neighbourÊͷŵãÀÛ¼ÓÖµ |
| BR_NEIGH_VARY, //ÇŵãµÄ³ö¿ÚdevµÄMACµØÖ·±»¶à¸öPC¹²Ïí |
| CONN_ALLOC, //CONNÉêÇë´ÎÊýÀÛ¼ÓÖµ |
| CONN_FREE, //CONNÊͷŵãÀÛ¼ÓÖµ |
| BRFDB_ALLOC, //ÇŵãÉêÇë´ÎÊýÀÛ¼ÓÖµ |
| DST_ALLOC, //dst_entryÉêÇëÀÛ¼ÓÖµ |
| DST_FREE, //dst_entryÊͷŵãÀÛ¼ÓÖµ |
| HH_UPDATE, //HH¶þ²ãMACÍ·¸üÐÂÀÛ¼ÓÖµ |
| RT_CACHE_INVALID, //Çå¿Õ·ÓÉcacheµÄÀÛ¼ÓÖµ |
| RT_HASH_ADD, //ÐÂÔört_hash_table½ÚµãµÄÀÛ¼ÓÖµ |
| RT_HASH_DEL, //ɾ³ýrt_hash_table½ÚµãµÄÀÛ¼ÓÖµ |
| SSMAC_CHANGE_INDEV, //ͬһԴMACµØÖ·Èë¿Údev¸Ä±äµÄ´ÎÊý |
| NET_INFO_MAX, |
| }; |
| enum dev_opt_state{ |
| DEV_UNOPT=0, //ÈôÓû§Î´×öÈκβÙ×÷£¬³õʼֵΪ0 |
| DEV_NOPRESENT, //¶ÔÓ¦!netif_device_presentÒì³££¬±íÃ÷Çý¶¯µ×²ãÉÐδ׼±¸ºÃ |
| DEV_OPENED, //dev is opened |
| DEV_OPEN_FAIL, //open fail |
| DEV_CLOSED, //dev is closed |
| }; |
| |
| enum slabinfo_file{ |
| FAST_SLAB = 0, |
| SKB_SLAB, |
| BRFDB_SLAB, |
| DST_SLAB, |
| FIB_TRIE_SLAB, |
| FLOW_SLAB, |
| INETPEER_SLAB, |
| INET_HASHTABLES_SLAB, |
| INET_TIMEWAIT_SOCK_SLAB, |
| MYSOCKET_SLAB, |
| NF_CONNTRACK_CORE_SLAB, |
| NF_CONNTRACK_EXCEPT_SLAB, |
| REQUEST_SOCK_SLAB, |
| SOCK_SLAB, |
| SOCKET_SLAB, |
| XFRM6_TUNNEL_SLAB, |
| XT_HASHLIMIT_SLAB, |
| SOCK_ALLOC_PAGES, //ÓÉÓÚÎÞ·¨×¼È·ÕÒµ½Êͷŵ㣬ËùÒÔ½öÓÐ++¶¯×÷£¬--Ó¦¸ÃÓÉput_page´¥·¢ |
| IP6_OUTPUT_ALLOC_PAGES, //ÓÉÓÚÎÞ·¨×¼È·ÕÒµ½Êͷŵ㣬ËùÒÔ½öÓÐ++¶¯×÷£¬--Ó¦¸ÃÓÉput_page´¥·¢ |
| IP_OUTPUT_ALLOC_PAGES, //ÓÉÓÚÎÞ·¨×¼È·ÕÒµ½Êͷŵ㣬ËùÒÔ½öÓÐ++¶¯×÷£¬--Ó¦¸ÃÓÉput_page´¥·¢ |
| SKB_ALLOC_PAGES, //ÓÉÓÚÎÞ·¨×¼È·ÕÒµ½Êͷŵ㣬ËùÒÔ½öÓÐ++¶¯×÷£¬--Ó¦¸ÃÓÉput_page´¥·¢ |
| }; |
| |
| |
| /*±¾µØTCPͳ¼ÆÐÅÏ¢*/ |
| enum tcp_stat_info |
| { |
| TCP_RECV_PKTS = 0, /*½ÓÊÕµÄTCPÊýÄ¿*/ |
| TCP_SEND_PKTS, /*·¢Ë͵ÄTCPÊýÄ¿*/ |
| TCP_RETRANS_PKTS, /*·¢Ë͵ÄÖØ´«TCPÊýÄ¿*/ |
| TCP_RECV_DROPS, /*½ÓÊն˵ÄTCP¶ª°üÊý*/ |
| TCP_SEND_DROPS, /*·¢ËͶ˵ÄTCP¶ª°üÊý*/ |
| TCP_RST_SEND_NUM, /*·¢Ë͵ÄRSTÊý*/ |
| TCP_RST_RECV_NUM, /*½ÓÊÕµÄRSTÊý*/ |
| TCP_STATS_MAX, |
| }; |
| |
| |
| struct tcp_sock_stat |
| { |
| unsigned long tcp_recv_num; |
| unsigned long tcp_send_num; |
| unsigned long tcp_retrans_num; |
| unsigned long tcp_recv_drops; |
| unsigned long tcp_send_drops; |
| unsigned long tcp_rst_send; |
| unsigned long tcp_rst_recv; |
| }; |
| |
| /****×ÊԴʹÓü°ÉÏÏÞÐÅÏ¢£¬ËùÓбê×¼ÄÚºËÓÐÉÏÏÞÇé¿öµÄ£¬½ÔÐè¼ì²â£¬ÒÔ·ÀÖ¹Òì³£·¢Éú****/ |
| struct net_max_check_msg |
| { |
| /*nf_conntrack*/ |
| unsigned long nf_conntrack_max; //nf_conntrack_max = 4832 |
| unsigned long nf_conntrack_now; //net->ct.count |
| /*enqueue*/ |
| int netdev_max_backlog; //netdev_max_backlog=1000 |
| int input_queue_len; //²Î¿´enqueue_to_backlog½Ó¿ÚʵÏÖ |
| int rx_dropped; //ÒòΪÈë¶ÓÁÐÒÑÂúÔì³ÉµÄÈë¶ÓÁжª°üµÄÀÛ¼ÓÖµ |
| /*ÐÔÄÜÏà¹Ø*/ |
| int fastnat_link_max; //nf_conntrack_max |
| int fastnat_link_now; //working_list.count |
| int fast6_link_max; //nf_conntrack_max |
| int fast6_link_now; //working_list6.count |
| |
| /*ÍøÂçÄÚºËÔËÐÐʱµÄͳ¼ÆÖµ£¬ÖØµã¹Ø×¢½á¹¹ÌåµÄÉêÇëµã*/ |
| unsigned long br_mac_change; //ÍøÇÅmacµØÖ·±»¸Ä±ä´ÎÊý |
| unsigned long neigh_alloc; //neighbourÉêÇë´ÎÊý |
| unsigned long neigh_free; //neighbourÊͷŵãÀÛ¼ÓÖµ |
| unsigned long br_neigh_vary; //ÇŵãµÄ³ö¿ÚdevµÄmacµØÖ·±»¶à¸öpc¹²Ïí |
| unsigned long conn_alloc; //connÉêÇë´ÎÊýÀÛ¼ÓÖµ |
| unsigned long conn_free; //connÊͷŵãÀÛ¼ÓÖµ |
| unsigned long brfdb_alloc; //ÇŵãÉêÇë´ÎÊýÀÛ¼ÓÖµ |
| unsigned long dst_alloc; //dst_entryÉêÇëÀÛ¼ÓÖµ |
| unsigned long dst_free; //dst_entryÊͷŵãÀÛ¼ÓÖµ |
| unsigned long hh_update; //hh¶þ²ãmacÍ·¸üÐÂÀÛ¼ÓÖµ |
| unsigned long rt_cache_invalid; //Çå¿Õ·ÓÉcacheµÄÀÛ¼ÓÖµ |
| unsigned long rt_hash_add; //ÐÂÔört_hash_table½ÚµãµÄÀÛ¼ÓÖµ |
| unsigned long rt_hash_del; //ɾ³ýrt_hash_table½ÚµãµÄÀÛ¼ÓÖµ |
| unsigned long ssmac_change_indev; //ͬһԴMACµØÖ·Èë¿Údev¸Ä±äµÄ´ÎÊý |
| }; |
| |
| /************************* SKBÏà¹ØÐÅÏ¢£¬°üÀ¨Í³¼ÆÐÅÏ¢ºÍfastÐÅÏ¢ ***********************/ |
| struct skb_and_fast_msg |
| { |
| int skb_num4; //½ÓÊÕµ½µÄV4Êý¾Ý°ü |
| int skb_num6; //½ÓÊÕµ½µÄV6Êý¾Ý°ü |
| int skb_big_num; //len³¤¶È³¬¹ý1000µÄÊý¾Ý°ü£¬º¬V4ºÍV6 |
| int skb_small_num; //len³¤¶ÈСÓÚ100µÄÊý¾Ý°ü£¬º¬V4ºÍV6 |
| int skb_bytes4; //½ÓÊÕµ½µÄV4Êý¾Ý°ü×Ö½ÚÊý |
| int skb_bytes6; //½ÓÊÕµ½µÄV6Êý¾Ý°ü×Ö½ÚÊý |
| int skb_unknown; //½ÓÊÕµ½µÄδ֪ÐÒéÊý¾Ý°ü£¬°üÀ¨ARPµÈ·ÇV4ºÍV6µÄ±¨ÎÄ |
| int skb_tcpnum; //½ÓÊÕµ½µÄtcpÊý¾Ý°ü£¬º¬V4ºÍV6£¬µ«²»º¬fastbrµÄ±¨ÎÄ |
| int skb_udpnum; //½ÓÊÕµ½µÄudpÊý¾Ý°ü£¬º¬V4ºÍV6£¬µ«²»º¬fastbrµÄ±¨ÎÄ |
| int broadcast_num4; //½ÓÊÕµ½µÄV4¹ã²¥°ü |
| int broadcast_num6; //½ÓÊÕµ½µÄV6¹ã²¥°ü |
| int multicast_num4; //½ÓÊÕµ½µÄV4×é²¥±¨ |
| int multicast_num6; //½ÓÊÕµ½µÄV6×é²¥±¨ |
| int fastnat_num; //fastnat³É¹¦µÄ±¨ÎÄ |
| int fast6_num; //fast6³É¹¦µÄ±¨ÎÄ |
| int fastbr_num; //fastbr³É¹¦µÄ±¨ÎÄ |
| int fastnat_level; //²Î¿´FAST_NET_DEVICE |
| int fastbr_level; //²¼¶ûÀàÐÍ |
| //ÏÂÃæ¼¸¸öֵΪÀÛ¼ÓÖµ£¬ÐÔÄÜÏà¹Ø |
| int irqfree_num; //ͨ¹ýÈíÖжÏÊͷŵÄskb£¬ÐÔÄÜÏà¹Ø |
| int skbcopy_num; //Êý¾Ý¿½±´µÄskb£¬ÐÔÄÜÏà¹Ø |
| int cache_copy; //net_cacheÔ´Îļþ½øÐп½±´µÄÀÛ»ý¼ÆÊý£¬ÐÔÄÜÏà¹Ø |
| int skbflood_num; //·ººéµÄskb£¬ÐÔÄÜÏà¹Ø |
| int errfree_num; //devÔ´ÎļþÖдíÎóÊͷŵÄskb¼ÆÊý£¬°üÀ¨SKB_QUEUE_STOPºÍSKB_QUEUE_LOCKÁ½¸ö¼ÆÊýÖµ |
| int frag_num; //½ÓÊÕµ½µÄ·ÖƬ±¨ÎÄ£¬ÐÔÄÜÏà¹Ø |
| int mtu_num; //fastÖÐÊý¾Ý³¤¶È´óÓÚ³ö¿Údev MTUʱ£¬fastʧ°Ü¸öÊýͳ¼Æ |
| int fast_loop; //ͶµÝ¸øÇý¶¯£¬ÓÖ´ÓÇý¶¯ÊÕµ½µÄÒì³£»Ø»·¸öÊýͳ¼Æ |
| int skb_alloc_fail ; //ÉêÇëskbʧ°ÜµÄ¸öÊýÀÛ¼ÓÖµ |
| int xmit_lock_num; //xmit_lock_owner±»Ëø×¡Ôì³ÉµÄ¶ª°üµÄÀÛ¼Ó¼ÆÊý£¬Çý¶¯Ôì³ÉµÄ |
| int xmit_stop_num; //!netif_xmit_stopped(txq)Ôì³ÉµÄ¶ª°üµÄÀÛ¼Ó¼ÆÊý£¬Çý¶¯Ôì³ÉµÄ |
| int br_mac_change_num; //ÍøÇÅmacµØÖ·±»¸Ä±ä´ÎÊý |
| int fast_tcpdump_num; //fast×¥°ü¸öÊý |
| int fast_switch; |
| int fast_local4_rcv_num; //±¾µØfast_local4³É¹¦½ÓÊÕ±¨ÎÄ |
| int fast_local6_rcv_num; //±¾µØfast_local6³É¹¦½ÓÊÕ±¨ÎÄ |
| int fast_local4_output_num; //±¾µØfast_local4³É¹¦·¢Ëͱ¨ÎÄ |
| int fast_local6_output_num; //±¾µØfast_local6³É¹¦·¢Ëͱ¨ÎÄ |
| }; |
| |
| struct skb_using_msg |
| { |
| unsigned long skb_all; |
| unsigned long skb_tocp; |
| unsigned long skb_fromcp; |
| unsigned long skb_data_num; |
| unsigned long skb_data_size; |
| unsigned long skb_stop; |
| unsigned long skb_lock; |
| unsigned long skb_panic; |
| unsigned long skb_fail; |
| }; |
| |
| /************************* ½á¹¹Ì嶨Òå DEV ***********************/ |
| //ÍøÂçÌí¼Ó£¬Í³¼ÆÍøÂç²ãÃæÊÕ·¢°üÇé¿ö |
| struct net_dev_skbinfo { |
| unsigned long rx_packets; //Çý¶¯·¢ËÍÀ´µÄÊý¾Ý°ü¸öÊý£¬ÔÚnetif_rxÍ·ÀÛ¼Ó |
| unsigned long tx_packets; //·¢Ë͸øÇý¶¯µÄÊý¾Ý°ü¸öÊý£¬ÔÚdev_queue_xmitÍ·ÀÛ¼Ó |
| unsigned long rx_bytes; //×Ö½ÚÊý |
| unsigned long tx_bytes; //×Ö½ÚÊý |
| unsigned long rx_dropped; //netif_rxÄÚ²¿Á÷³ÌÖÐËùÓÐÒì³£ÊÍ·ÅskbµÄÀÛ¼Ó£¬Èç´ïµ½netdev_max_backlogÈë¶ÓÁÐÉÏÏÞ¶ø¶ª°ü |
| unsigned long tx_dropped; //dev_queue_xmitÄÚ²¿Á÷³ÌÖÐËùÓÐÒì³£ÊÍ·ÅskbµÄÀÛ¼Ó£¬Èç(txq->xmit_lock_owner == cpu)Ôì³ÉµÄ¶ª°ü |
| }; |
| |
| //ÍøÂçÌí¼Ó£¬connÊÕ·¢°üÇé¿ö |
| struct conn_skbinfo { |
| unsigned long packets; //Êý¾Ý°ü¸öÊý |
| unsigned long bytes; //×Ö½ÚÊý |
| }; |
| |
| /* ¸Ã½á¹¹ÌåÖеÄËùÓÐÐÅÏ¢½ÔÓÉÇý¶¯¸³Öµ£¬ÍøÂç×é²»»á¸³Öµ */ |
| //Õâ¸ö½á¹¹Ì屨ÐëºÍ <linux/netdevice.h>ÖеÄnet_device_stats±£³ÖÒ»Ö |
| struct net_dev_stats { |
| unsigned long rx_packets; |
| unsigned long tx_packets; |
| unsigned long rx_bytes; |
| unsigned long tx_bytes; |
| unsigned long rx_errors; //Ðè¼à¿Ø |
| unsigned long tx_errors; //Ðè¼à¿Ø |
| unsigned long rx_dropped; //Ðè¼à¿Ø |
| unsigned long tx_dropped; //Ðè¼à¿Ø |
| unsigned long multicast; |
| unsigned long collisions; |
| unsigned long rx_length_errors; //Ðè¼à¿Ø |
| unsigned long rx_over_errors; //Ðè¼à¿Ø |
| unsigned long rx_crc_errors; //Ðè¼à¿Ø |
| unsigned long rx_frame_errors; //Ðè¼à¿Ø |
| unsigned long rx_fifo_errors; //Ðè¼à¿Ø |
| unsigned long rx_missed_errors; //Ðè¼à¿Ø |
| unsigned long tx_aborted_errors; //Ðè¼à¿Ø |
| unsigned long tx_carrier_errors; //Ðè¼à¿Ø |
| unsigned long tx_fifo_errors; //Ðè¼à¿Ø |
| unsigned long tx_heartbeat_errors; //Ðè¼à¿Ø |
| unsigned long tx_window_errors; //Ðè¼à¿Ø |
| unsigned long rx_compressed; |
| unsigned long tx_compressed; |
| }; |
| |
| struct ioctl_dev_netstats |
| { |
| char dev_name[20]; |
| struct net_dev_skbinfo stats_dbg; //ÍøÂçÌí¼ÓµÄ£¬Í³¼ÆÍøÂç²ãÃæÊÕ·¢°üÇé¿ö |
| struct net_dev_stats stats; //Êý¾ÝÊÕ·¢Í³¼ÆÖµ£¬¸Ãֵȫ²¿ÓÉÇý¶¯¸³ÖµµÄ£¬ÍøÂç²»¸³Öµ |
| unsigned int flags; //IFF_UPµÈ |
| unsigned char operstate; //ĿǰûɶÓà |
| unsigned long state; //µ×²ãÇý¶¯×´Ì¬£¬__LINK_STATE_NOCARRIER |
| int net_flag; //Óû§ifconfigµÄ½á¹û״̬£¬ÈçDEV_OPEN_FAIL |
| unsigned long que_state; //¶ÓÁÐ״̬£¬¶ÔÓ¦ dev->_tx[0].state£¬Èç__QUEUE_STATE_DRV_XOFF |
| unsigned int num_tx_queues; //TX¶ÓÁÐÊýÁ¿£¬¶àÊýÇý¶¯Ê¹ÓÃΨһ¶ÓÁУ¬ÔòֵΪ1 |
| }; |
| |
| |
| /************************* ½á¹¹Ì嶨Òå OTHER ***********************/ |
| struct pc_info |
| { |
| unsigned char mac_addr[6]; |
| char dev_name[DEV_NAME_LEN]; |
| }; |
| |
| struct pc_node |
| { |
| unsigned int num; |
| struct pc_info info[PC_MAX_NUM]; |
| }; |
| |
| struct leak_info |
| { |
| void *addr; |
| int user_num; //µ±Ç°data»òskb±»Ê¹ÓõļÆÊýÖµ£¬°éËæskbÖеÄusersºÍdataref¶ø±ä»¯ |
| int track_num; //¼Ç¼ÒѼǼµ½Êý×é¹ì¼£µÄϱêË÷Òý |
| char func_track[10][100];//º¯Êý»ØËݹ켣 |
| }; |
| |
| struct slab_info |
| { |
| int num[SLAB_NUM][2]; |
| }; |
| |
| |
| struct hash_info |
| { |
| int max_hash_size; |
| int current_hash_num; |
| int hash[HASH_ARRAY_COUNT][2]; |
| int current_array_size; |
| }; |
| |
| struct ptype_info |
| { |
| unsigned long ptype_all[5]; |
| unsigned long ptype_base[15]; |
| }; |
| |
| struct pkt_lost_stats |
| { |
| unsigned int send_drops; |
| unsigned int send_drop_bytes; |
| unsigned int recv_drops; |
| unsigned int recv_drop_bytes; |
| unsigned int total_packets; |
| unsigned int total_bytes; |
| }; |
| |
| struct pkt_lost_info |
| { |
| struct pkt_lost_stats stats[2]; |
| }; |
| |
| typedef struct |
| { |
| char usb[DEV_NAME_LEN_20]; |
| char ps[DEV_NAME_LEN_20]; |
| char wifi_wan[DEV_NAME_LEN_20]; |
| char wifi_lan[DEV_NAME_LEN_20]; |
| char eth_wan[DEV_NAME_LEN_20]; |
| char eth_lan[DEV_NAME_LEN_20]; |
| char ps_ext1[DEV_NAME_LEN_20]; |
| char ps_ext2[DEV_NAME_LEN_20]; |
| char ps_ext3[DEV_NAME_LEN_20]; |
| char ps_ext4[DEV_NAME_LEN_20]; |
| } net_dbg_dev_info_t; |
| |
| struct time_list{ |
| struct timeval tv; |
| struct list_head packet_list; |
| }; |
| |
| struct net_debug_packet_list{ |
| struct list_head list; |
| struct list_head time; |
| int pid; |
| int tgid; |
| char pname[DEV_NAME_LEN]; |
| int count; |
| }; |
| |
| /******************************±äÁ¿ÉùÃ÷***********************/ |
| /******************************±äÁ¿ÉùÃ÷***********************/ |
| /******************************±äÁ¿ÉùÃ÷***********************/ |
| extern int leak_set; // 1±íʾ¸ú×Ùskb¼°dataÉêÇëÊͷŵ㣻2±íʾ¸ú×Ùusers£¬ÒÔ¼ì²âΪºÎskbʼÖÕ²»ÄÜÊÍ·Å£¬ÔÝʱ¸Ã¹¦ÄÜÉв»¿ÉÓà |
| extern int leak_list_max; // ÈÝÐí»º´æµÄ´ýÊͷŵÄskb¼°dataµÄ¸öÊý£¬¿Éµ÷Õû£» |
| extern int track_max; //¹ì¼£¸ú×ÙÊý×éµÄÉÏÏÞ£¬½öµ±user++--ʱ²ÅÐèÒªÀ©´ó£¬·ñÔò2¼´¿É£» |
| extern int stack_lenmax; //Õ»º¯Êý¹ì¼£µÄ×Ö·û¸öÊýÉÏÏÞ£» |
| extern int leak_full_panic; |
| extern unsigned long now_time; //µ±Ç°Ê±¿Ìµã |
| extern spinlock_t leak_lock; //·ÀÖ¹ÔÚbhÖб»µ÷Óã¬Ê¹ÓÃbhËø |
| |
| |
| extern struct leak_list data_leak[TRACK_END]; |
| extern struct leak_list data_free[TRACK_END];//·Ö±ð¶ÔÓ¦ÕýÔÚʹÓõÄÊý¾ÝºÍÒѾÊͷŵÄÊý¾ÝÁ´±í |
| extern void *data_head[TRACK_END];//ÿ¸öÄÚ´æ¼à¿ØÀàÐ͵ijõʼ»¯Ê×µØÖ·£¬È·±£Á´±íµÄÊý¾ÝÇøÁ¬Ðø£¬ÒÔ±ãramdumpʱֱ½ÓËÑË÷ |
| extern int init_finish ;//Á´±í³õʼ»¯±êÖ¾ |
| |
| /*dump stkÓõ½µÄÏà¹Ø±äÁ¿*/ |
| extern unsigned int skb_dump_len; |
| extern char skb_dump_str[]; |
| |
| /*ºË¼äÖØ¸´Êͷżì²â¿ª¹Ø*/ |
| extern int set_psbufleak ; |
| extern int set_extskbleak ; |
| |
| extern unsigned long skbinfo_dbg[SKB_INFO_MAX]; |
| extern unsigned long netruninfo_dbg[NET_INFO_MAX]; |
| extern unsigned char br_ipchange_flag; //br0 ip´Û¸Ä¶ÏÑÔ |
| extern int set_tcpdump; //¶¨µã×¥°ü¿ª¹Ø |
| |
| extern unsigned char ignoremac[ETH_ALEN]; |
| |
| /*¶Ô±¾µØTCP½øÐÐÏà¹ØÍ³¼Æ*/ |
| extern unsigned long tcp_stats_dbg[TCP_STATS_MAX]; |
| |
| extern char br_name[]; |
| extern char ps_name[]; |
| extern char usb_name[]; |
| extern char ppp_name[]; |
| |
| |
| //sqÌí¼Ó£¬ÓÃÓÚÊý¾Ý°ü½¨Ä£ÒÔ¼°ÐÔÄÜͳ¼ÆÏà¹Ø£¬net_info_numÈ«¾ÖÖÐÐÔÄÜÏà¹ØµÄͳ¼ÆÒ²ÐèÌåÏÖ |
| extern int skb_num4; //½ÓÊÕµ½µÄV4Êý¾Ý°ü |
| extern int skb_num6; //½ÓÊÕµ½µÄV6Êý¾Ý°ü |
| extern int skb_big_num; //len³¤¶È³¬¹ý1000µÄÊý¾Ý°ü£¬º¬V4ºÍV6 |
| extern int skb_small_num; //len³¤¶ÈСÓÚ100µÄÊý¾Ý°ü£¬º¬V4ºÍV6 |
| extern int skb_bytes4; //½ÓÊÕµ½µÄV4Êý¾Ý°ü×Ö½ÚÊý |
| extern int skb_bytes6; //½ÓÊÕµ½µÄV6Êý¾Ý°ü×Ö½ÚÊý |
| extern int skb_unknown; //½ÓÊÕµ½µÄδ֪ÐÒéÊý¾Ý°ü£¬°üÀ¨ARP |
| extern int skb_tcpnum; //½ÓÊÕµ½µÄtcpÊý¾Ý°ü£¬º¬V4ºÍV6 |
| extern int skb_udpnum; //½ÓÊÕµ½µÄudpÊý¾Ý°ü£¬º¬V4ºÍV6 |
| extern int broadcast_num4; //½ÓÊÕµ½µÄV4¹ã²¥°ü |
| extern int broadcast_num6; //½ÓÊÕµ½µÄV6¹ã²¥°ü |
| extern int multicast_num4; //½ÓÊÕµ½µÄV4×é²¥±¨ |
| extern int multicast_num6; //½ÓÊÕµ½µÄV6×é²¥±¨ |
| extern int fastnat_num; //fastnat³É¹¦µÄ±¨ÎÄ |
| extern int fast6_num; //fast6³É¹¦µÄ±¨ÎÄ |
| extern int fastbr_num; //fastbr³É¹¦µÄ±¨ÎÄ |
| extern int fast_local4_rcv_num; //±¾µØfast_local4³É¹¦½ÓÊÕ±¨ÎÄ |
| extern int fast_local6_rcv_num; //±¾µØfast_local6³É¹¦½ÓÊÕ±¨ÎÄ |
| extern int fast_local4_output_num; //±¾µØfast_local4³É¹¦·¢Ëͱ¨ÎÄ |
| extern int fast_local6_output_num; //±¾µØfast_local6³É¹¦·¢Ëͱ¨ÎÄ |
| extern int fast_tcpdump_num; //fast×¥°üÊýÁ¿ |
| |
| extern int double_mac; |
| |
| extern int net_debug_ping; //×ÔÑÐping°ü¼Ç¼¶ª°üʱÑÓ¹¦ÄÜ |
| extern int net_debug_perf; //×ÔÑÐtcp/udp°ü¼Ç¼¶ª°üʱÑÓ¹¦ÄÜ£¬ÐèÒªserver¶ÎÄܰ²×°×ÔÑÐÓ¦Óà |
| |
| //slabÄÚ´æÊ¹ÓÃÏà¹ØÍ³¼Æ£¬Î´¿¼ÂÇͨÓÃslabµØÖ·³Ø£¬Èçkmalloc |
| extern struct slab_info slab_count; |
| |
| //·¢Ë͸øCP´¦ÀíµÄ£¬´ýÊͷŵÄskbÁ´±í£¬ÓÃÓÚlog¸ú×Ù£¬·ÀÖ¹ºË¼äÄÚ´æÐ¹Â©£» |
| extern struct ext_list toCp_listlog[MAX_EXT_MEM_HASH]; |
| |
| //CP·¢Ë͸øAPµÄpsbufÐÅÏ¢Á´±í£¬ÓÃÓÚlog¸ú×Ù£¬·ÀÖ¹ºË¼äÄÚ´æÐ¹Â©; |
| extern struct ext_list fromCp_list[MAX_EXT_MEM_HASH]; |
| |
| /*½øÐÐTCPͳ¼Æ*/ |
| #define TCP_PKT_STATS_INC(_mod) tcp_stats_dbg[_mod]++ |
| |
| |
| /******************************Íⲿ½Ó¿ÚÉùÃ÷***********************/ |
| /******************************Íⲿ½Ó¿ÚÉùÃ÷***********************/ |
| /******************************Íⲿ½Ó¿ÚÉùÃ÷***********************/ |
| extern void skbinfo_add(unsigned char *addr,unsigned int skb_type); |
| extern void skbinfo_del(unsigned char *addr,unsigned int skb_type); |
| extern void netruninfo_add(unsigned char *addr,unsigned int info_type); |
| extern void netruninfo_del(unsigned char *addr,unsigned int info_type); |
| |
| extern int get_skbcnt(unsigned long arg); |
| extern int get_dev_info(unsigned long arg); |
| extern int get_skb_using(unsigned long arg); |
| extern int network_get_pcmac(unsigned long arg); |
| extern int get_kernelparam(unsigned long arg); |
| extern int get_slab_info(unsigned long arg); |
| extern int get_hash_info(unsigned long arg); |
| |
| extern int set_fastnat_level(void *arg); |
| extern int set_fastbr_level(void *arg); |
| extern int set_fast_debug_panic(void *arg); |
| extern int set_fast_dev_xmit(void *arg); |
| extern int set_ackdrop(void *arg); |
| extern int set_dumpflag(void *arg); |
| extern int set_skb_dump(unsigned long arg); |
| extern int set_print_opt(void *arg); |
| extern int set_sq_tcpdump(void *arg); |
| extern int set_leak(void *arg); |
| extern int set_max(unsigned long arg); |
| extern int set_stacklenmax(unsigned long arg); |
| extern int set_trackmax(unsigned long arg); |
| extern int set_tcpdump_opt(unsigned long arg); |
| extern int set_br_name(void *arg); |
| extern int set_ps_name(void *arg); |
| extern int set_usb_name(void *arg); |
| extern int set_ppp_name(void *arg); |
| extern int set_brip(unsigned long arg); |
| extern int set_kernelparam(unsigned long arg); |
| extern int set_errno_procname(void *arg); |
| extern int get_neigh_ip(unsigned long arg); |
| extern int get_skb_fast(unsigned long arg); |
| extern int get_max_msg(unsigned long arg); |
| extern int get_ptype(unsigned long arg); |
| extern int get_process_info(void *arg); |
| extern void netslab_inc(int i); |
| extern void netslab_dec(int i); |
| extern void track_netlink(struct sk_buff *skb,u32 group); |
| //extern void record_app_atcive_net(); |
| |
| int get_pkt_lost_info(unsigned long arg); |
| |
| int get_tcp_stat_info(unsigned long arg); |
| |
| #endif //end _NETIO_FASTINFO_H_ |
| |
| |