aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/ratelimiter.h
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2016-11-25 21:14:50 +0100
committerJason A. Donenfeld <Jason@zx2c4.com>2016-11-29 13:18:33 +0100
commite1f203488cc652bbb6b062bf1eb454982e95cca6 (patch)
tree4bd4b17848a983aaad7b1fc024ba21ef8afffd42 /src/ratelimiter.h
parentdevice: conntrack is optional (diff)
downloadwireguard-monolithic-historical-e1f203488cc652bbb6b062bf1eb454982e95cca6.tar.xz
wireguard-monolithic-historical-e1f203488cc652bbb6b062bf1eb454982e95cca6.zip
ratelimiter: load hashlimit at modinsert time
This fixes a potential race with net_lock and rtnl_lock.
Diffstat (limited to 'src/ratelimiter.h')
-rw-r--r--src/ratelimiter.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/ratelimiter.h b/src/ratelimiter.h
index e23097d..d934eab 100644
--- a/src/ratelimiter.h
+++ b/src/ratelimiter.h
@@ -10,12 +10,17 @@ struct sk_buff;
struct ratelimiter {
struct net *net;
- struct xt_match *v4_match, *v6_match;
- struct xt_hashlimit_mtinfo1 v4_info, v6_info;
+ struct xt_hashlimit_mtinfo1 v4_info;
+#if IS_ENABLED(CONFIG_IPV6)
+ struct xt_hashlimit_mtinfo1 v6_info;
+#endif
};
int ratelimiter_init(struct ratelimiter *ratelimiter, struct wireguard_device *wg);
void ratelimiter_uninit(struct ratelimiter *ratelimiter);
bool ratelimiter_allow(struct ratelimiter *ratelimiter, struct sk_buff *skb);
+int ratelimiter_module_init(void);
+void ratelimiter_module_deinit(void);
+
#endif