1
2#ifndef _UAPI_XT_HASHLIMIT_H
3#define _UAPI_XT_HASHLIMIT_H
4
5#include <linux/types.h>
6#include <linux/limits.h>
7#include <linux/if.h>
8
9
10#define XT_HASHLIMIT_SCALE 10000
11#define XT_HASHLIMIT_SCALE_v2 1000000llu
12
13
14
15
16
17#define XT_HASHLIMIT_BYTE_SHIFT 4
18
19
20struct xt_hashlimit_htable;
21
22enum {
23 XT_HASHLIMIT_HASH_DIP = 1 << 0,
24 XT_HASHLIMIT_HASH_DPT = 1 << 1,
25 XT_HASHLIMIT_HASH_SIP = 1 << 2,
26 XT_HASHLIMIT_HASH_SPT = 1 << 3,
27 XT_HASHLIMIT_INVERT = 1 << 4,
28 XT_HASHLIMIT_BYTES = 1 << 5,
29 XT_HASHLIMIT_RATE_MATCH = 1 << 6,
30};
31
32struct hashlimit_cfg {
33 __u32 mode;
34 __u32 avg;
35 __u32 burst;
36
37
38 __u32 size;
39 __u32 max;
40 __u32 gc_interval;
41 __u32 expire;
42};
43
44struct xt_hashlimit_info {
45 char name [IFNAMSIZ];
46 struct hashlimit_cfg cfg;
47
48
49 struct xt_hashlimit_htable *hinfo;
50 union {
51 void *ptr;
52 struct xt_hashlimit_info *master;
53 } u;
54};
55
56struct hashlimit_cfg1 {
57 __u32 mode;
58 __u32 avg;
59 __u32 burst;
60
61
62 __u32 size;
63 __u32 max;
64 __u32 gc_interval;
65 __u32 expire;
66
67 __u8 srcmask, dstmask;
68};
69
70struct hashlimit_cfg2 {
71 __u64 avg;
72 __u64 burst;
73 __u32 mode;
74
75
76 __u32 size;
77 __u32 max;
78 __u32 gc_interval;
79 __u32 expire;
80
81 __u8 srcmask, dstmask;
82};
83
84struct hashlimit_cfg3 {
85 __u64 avg;
86 __u64 burst;
87 __u32 mode;
88
89
90 __u32 size;
91 __u32 max;
92 __u32 gc_interval;
93 __u32 expire;
94
95 __u32 interval;
96 __u8 srcmask, dstmask;
97};
98
99struct xt_hashlimit_mtinfo1 {
100 char name[IFNAMSIZ];
101 struct hashlimit_cfg1 cfg;
102
103
104 struct xt_hashlimit_htable *hinfo __attribute__((aligned(8)));
105};
106
107struct xt_hashlimit_mtinfo2 {
108 char name[NAME_MAX];
109 struct hashlimit_cfg2 cfg;
110
111
112 struct xt_hashlimit_htable *hinfo __attribute__((aligned(8)));
113};
114
115struct xt_hashlimit_mtinfo3 {
116 char name[NAME_MAX];
117 struct hashlimit_cfg3 cfg;
118
119
120 struct xt_hashlimit_htable *hinfo __attribute__((aligned(8)));
121};
122
123#endif
124