From e1f203488cc652bbb6b062bf1eb454982e95cca6 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Fri, 25 Nov 2016 21:14:50 +0100 Subject: ratelimiter: load hashlimit at modinsert time This fixes a potential race with net_lock and rtnl_lock. --- src/ratelimiter.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/ratelimiter.h') 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 -- cgit v1.2.3-59-g8ed1b