yuezonghe | 824eb0c | 2024-06-27 02:32:26 -0700 | [diff] [blame] | 1 | /* * Copyright (c) 2011 Qualcomm Atheros, Inc. * */ |
| 2 | #ifndef _FAST_NAT_H |
| 3 | #define _FAST_NAT_H |
| 4 | |
| 5 | #include <linux/in.h> |
| 6 | #include <linux/ip.h> |
| 7 | #include <linux/udp.h> |
| 8 | #include <linux/tcp.h> |
| 9 | #include <linux/icmp.h> |
| 10 | #include <net/ip.h> |
| 11 | #include <linux/if_arp.h> |
| 12 | |
| 13 | #include <linux/inetdevice.h> |
| 14 | #include <linux/netfilter.h> |
| 15 | #include <linux/netfilter_ipv4.h> |
| 16 | #include <linux/netfilter_arp.h> |
| 17 | #include <linux/netfilter_ipv4/ip_tables.h> |
| 18 | #include <linux/netfilter/xt_multiport.h> |
| 19 | #include <linux/netfilter/xt_iprange.h> |
| 20 | #include <linux/netfilter/nf_conntrack_tcp.h> |
| 21 | #include <net/checksum.h> |
| 22 | #include <net/dsfield.h> |
| 23 | #include <net/route.h> |
| 24 | #include <net/netfilter/nf_nat.h> |
| 25 | #include <net/netfilter/nf_nat_core.h> |
| 26 | #include <net/netfilter/nf_nat_rule.h> |
| 27 | #include <net/netfilter/nf_conntrack_helper.h> |
| 28 | #include <linux/module.h> |
| 29 | |
| 30 | #include <linux/proc_fs.h> |
| 31 | |
| 32 | #include <net/SI/fast_common.h> |
| 33 | #include <net/SI/pkt_lost_track.h> |
| 34 | |
| 35 | /******************************ºê¶¨Òå***********************/ |
| 36 | /******************************ºê¶¨Òå***********************/ |
| 37 | /******************************ºê¶¨Òå***********************/ |
| 38 | |
| 39 | /******************************½á¹¹Ì嶨Òå***********************/ |
| 40 | /******************************½á¹¹Ì嶨Òå***********************/ |
| 41 | /******************************½á¹¹Ì嶨Òå***********************/ |
| 42 | typedef struct ack_delay_stats_s{ |
| 43 | unsigned long total_count; //×ÓÍø·¢Ë͸øÍâÍø¿ÚµÄ¶Ìack×ܸöÊý |
| 44 | unsigned long forword_count; //ÕæÕý·¢Ë͸øÍâÍø¿ÚµÄ¶Ìack±¨ÎĸöÊý |
| 45 | unsigned long drop_count; //Ö÷¶¯¶ªÆúµÄ¶Ìack±¨ÎĸöÊý |
| 46 | unsigned long timeout_xmit_count; //ack³¬Ê±ºó³ö·¢µÄ¶Ìack·¢Ë͸öÊý |
| 47 | unsigned long timeout_drop_count; //ûÓÐʵ¼ÊÒâÒ壬½¨ÒéÈ¥³ý |
| 48 | }ack_delay_stats_t; |
| 49 | |
| 50 | /******************************±äÁ¿ÉùÃ÷***********************/ |
| 51 | /******************************±äÁ¿ÉùÃ÷***********************/ |
| 52 | /******************************±äÁ¿ÉùÃ÷***********************/ |
| 53 | |
| 54 | extern spinlock_t fastnat_spinlock; //×ÔÐýËø£¬±£»¤Á´±íµÄ²Ù×÷ |
| 55 | extern fast_list_t working_list; |
| 56 | extern struct hlist_nulls_head *working_hash; |
| 57 | extern traverse_command_t timeout_cmd; |
| 58 | |
| 59 | extern struct ack_delay_stats_s ack_delay_stats; |
| 60 | |
| 61 | extern int ackdrop_maxnum; |
| 62 | extern int ackdrop_tick_num; |
| 63 | extern int fastnat_ack_param; |
| 64 | |
| 65 | /******************************½Ó¿ÚÉùÃ÷***********************/ |
| 66 | /******************************½Ó¿ÚÉùÃ÷***********************/ |
| 67 | /******************************½Ó¿ÚÉùÃ÷***********************/ |
| 68 | int fast_nat_get_tuple(struct sk_buff *skb, struct nf_conntrack_tuple *tuple); |
| 69 | |
| 70 | int fast_nat_recv(struct sk_buff *skb); |
| 71 | |
| 72 | unsigned int napt_handle(unsigned int hooknum, |
| 73 | struct sk_buff *skb, |
| 74 | const struct net_device *in, |
| 75 | const struct net_device *out, int (*okfn) (struct sk_buff *)); |
| 76 | |
| 77 | int ackfilter(struct sk_buff *skb, fast_entry_t *nat_entry, fast_list_t *list_head); |
| 78 | int tcpack_timeout(fast_entry_t *entry, unsigned long *next_schedule, int *set_next); |
| 79 | int tcpack_rel(fast_entry_t *entry); |
| 80 | |
| 81 | #endif //_FAST_NAT_H |
| 82 | |