1 #ifndef _UAPI_XT_HASHLIMIT_H
2 #define _UAPI_XT_HASHLIMIT_H
4 #include <linux/types.h>
5 #include <linux/limits.h>
8 /* timings are in milliseconds. */
9 #define XT_HASHLIMIT_SCALE 10000
10 #define XT_HASHLIMIT_SCALE_v2 1000000llu
11 /* 1/10,000 sec period => max of 10,000/sec. Min rate is then 429490
12 * seconds, or one packet every 59 hours.
15 /* packet length accounting is done in 16-byte steps */
16 #define XT_HASHLIMIT_BYTE_SHIFT 4
18 /* details of this structure hidden by the implementation */
19 struct xt_hashlimit_htable;
22 XT_HASHLIMIT_HASH_DIP = 1 << 0,
23 XT_HASHLIMIT_HASH_DPT = 1 << 1,
24 XT_HASHLIMIT_HASH_SIP = 1 << 2,
25 XT_HASHLIMIT_HASH_SPT = 1 << 3,
26 XT_HASHLIMIT_INVERT = 1 << 4,
27 XT_HASHLIMIT_BYTES = 1 << 5,
30 struct hashlimit_cfg {
31 __u32 mode; /* bitmask of XT_HASHLIMIT_HASH_* */
32 __u32 avg; /* Average secs between packets * scale */
33 __u32 burst; /* Period multiplier for upper limit. */
36 __u32 size; /* how many buckets */
37 __u32 max; /* max number of entries */
38 __u32 gc_interval; /* gc interval */
39 __u32 expire; /* when do entries expire? */
42 struct xt_hashlimit_info {
43 char name [IFNAMSIZ]; /* name */
44 struct hashlimit_cfg cfg;
46 /* Used internally by the kernel */
47 struct xt_hashlimit_htable *hinfo;
50 struct xt_hashlimit_info *master;
54 struct hashlimit_cfg1 {
55 __u32 mode; /* bitmask of XT_HASHLIMIT_HASH_* */
56 __u32 avg; /* Average secs between packets * scale */
57 __u32 burst; /* Period multiplier for upper limit. */
60 __u32 size; /* how many buckets */
61 __u32 max; /* max number of entries */
62 __u32 gc_interval; /* gc interval */
63 __u32 expire; /* when do entries expire? */
65 __u8 srcmask, dstmask;
68 struct hashlimit_cfg2 {
69 __u64 avg; /* Average secs between packets * scale */
70 __u64 burst; /* Period multiplier for upper limit. */
71 __u32 mode; /* bitmask of XT_HASHLIMIT_HASH_* */
74 __u32 size; /* how many buckets */
75 __u32 max; /* max number of entries */
76 __u32 gc_interval; /* gc interval */
77 __u32 expire; /* when do entries expire? */
79 __u8 srcmask, dstmask;
82 struct xt_hashlimit_mtinfo1 {
84 struct hashlimit_cfg1 cfg;
86 /* Used internally by the kernel */
87 struct xt_hashlimit_htable *hinfo __attribute__((aligned(8)));
90 struct xt_hashlimit_mtinfo2 {
92 struct hashlimit_cfg2 cfg;
94 /* Used internally by the kernel */
95 struct xt_hashlimit_htable *hinfo __attribute__((aligned(8)));
98 #endif /* _UAPI_XT_HASHLIMIT_H */