1 #ifndef _UAPI_XT_HASHLIMIT_H
2 #define _UAPI_XT_HASHLIMIT_H
4 #include <linux/types.h>
7 /* timings are in milliseconds. */
8 #define XT_HASHLIMIT_SCALE 10000
9 #define XT_HASHLIMIT_SCALE_v2 1000000llu
10 /* 1/10,000 sec period => max of 10,000/sec. Min rate is then 429490
11 * seconds, or one packet every 59 hours.
14 /* packet length accounting is done in 16-byte steps */
15 #define XT_HASHLIMIT_BYTE_SHIFT 4
17 /* details of this structure hidden by the implementation */
18 struct xt_hashlimit_htable;
21 XT_HASHLIMIT_HASH_DIP = 1 << 0,
22 XT_HASHLIMIT_HASH_DPT = 1 << 1,
23 XT_HASHLIMIT_HASH_SIP = 1 << 2,
24 XT_HASHLIMIT_HASH_SPT = 1 << 3,
25 XT_HASHLIMIT_INVERT = 1 << 4,
26 XT_HASHLIMIT_BYTES = 1 << 5,
29 struct hashlimit_cfg {
30 __u32 mode; /* bitmask of XT_HASHLIMIT_HASH_* */
31 __u32 avg; /* Average secs between packets * scale */
32 __u32 burst; /* Period multiplier for upper limit. */
35 __u32 size; /* how many buckets */
36 __u32 max; /* max number of entries */
37 __u32 gc_interval; /* gc interval */
38 __u32 expire; /* when do entries expire? */
41 struct xt_hashlimit_info {
42 char name [IFNAMSIZ]; /* name */
43 struct hashlimit_cfg cfg;
45 /* Used internally by the kernel */
46 struct xt_hashlimit_htable *hinfo;
49 struct xt_hashlimit_info *master;
53 struct hashlimit_cfg1 {
54 __u32 mode; /* bitmask of XT_HASHLIMIT_HASH_* */
55 __u32 avg; /* Average secs between packets * scale */
56 __u32 burst; /* Period multiplier for upper limit. */
59 __u32 size; /* how many buckets */
60 __u32 max; /* max number of entries */
61 __u32 gc_interval; /* gc interval */
62 __u32 expire; /* when do entries expire? */
64 __u8 srcmask, dstmask;
67 struct hashlimit_cfg2 {
68 __u64 avg; /* Average secs between packets * scale */
69 __u64 burst; /* Period multiplier for upper limit. */
70 __u32 mode; /* bitmask of XT_HASHLIMIT_HASH_* */
73 __u32 size; /* how many buckets */
74 __u32 max; /* max number of entries */
75 __u32 gc_interval; /* gc interval */
76 __u32 expire; /* when do entries expire? */
78 __u8 srcmask, dstmask;
81 struct xt_hashlimit_mtinfo1 {
83 struct hashlimit_cfg1 cfg;
85 /* Used internally by the kernel */
86 struct xt_hashlimit_htable *hinfo __attribute__((aligned(8)));
89 struct xt_hashlimit_mtinfo2 {
91 struct hashlimit_cfg2 cfg;
93 /* Used internally by the kernel */
94 struct xt_hashlimit_htable *hinfo __attribute__((aligned(8)));
97 #endif /* _UAPI_XT_HASHLIMIT_H */