diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2016-11-25 21:14:50 +0100 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2016-11-29 13:18:33 +0100 |
commit | fa449736cd339c8b81a757ce5f156625a05810e4 (patch) | |
tree | 735a0690b5348d52928dfeff4231e34521470000 /src/ratelimiter.h | |
parent | 5442adf8d39675989193a7d29c6e5be59e3942e1 (diff) |
ratelimiter: load hashlimit at modinsert time
This fixes a potential race with net_lock and rtnl_lock.
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'src/ratelimiter.h')
-rw-r--r-- | src/ratelimiter.h | 9 |
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 |