diff options
author | Matt Dunwoodie <ncon@noconroy.net> | 2021-04-23 11:22:59 +1000 |
---|---|---|
committer | Matt Dunwoodie <ncon@noconroy.net> | 2021-04-23 12:17:04 +1000 |
commit | 7ea3c638c7bbad8862ba62803e02523c171269eb (patch) | |
tree | 72a8e728665e1ee66f4e56b6e14480397dba833d /src/if_wg.c | |
parent | TODO: more nits (diff) | |
download | wireguard-freebsd-7ea3c638c7bbad8862ba62803e02523c171269eb.tar.xz wireguard-freebsd-7ea3c638c7bbad8862ba62803e02523c171269eb.zip |
wg_cookie: make ratelimiter global
Signed-off-by: Matt Dunwoodie <ncon@noconroy.net>
Diffstat (limited to 'src/if_wg.c')
-rw-r--r-- | src/if_wg.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/if_wg.c b/src/if_wg.c index e6fcfaa..e898caf 100644 --- a/src/if_wg.c +++ b/src/if_wg.c @@ -287,7 +287,6 @@ struct wg_softc { static int clone_count; static uma_zone_t wg_packet_zone; -static uma_zone_t ratelimit_zone; static volatile unsigned long peer_counter = 0; static const char wgname[] = "wg"; static unsigned wg_osd_jail_slot; @@ -2617,8 +2616,7 @@ wg_clone_create(struct if_clone *ifc, int unit, caddr_t params) return (ENOMEM); } - /* TODO check checker_init return value */ - cookie_checker_init(&sc->sc_cookie, ratelimit_zone); + cookie_checker_init(&sc->sc_cookie); sc->sc_socket.so_port = 0; @@ -2834,10 +2832,10 @@ wg_module_init(void) wg_packet_zone = uma_zcreate("wg packet", sizeof(struct wg_packet), NULL, NULL, NULL, NULL, 0, 0); - ratelimit_zone = uma_zcreate("wg ratelimit", sizeof(struct ratelimit), - NULL, NULL, NULL, NULL, 0, 0); wg_osd_jail_slot = osd_jail_register(NULL, methods); + cookie_init(); + wg_run_selftests(); } @@ -2846,8 +2844,8 @@ wg_module_deinit(void) { uma_zdestroy(wg_packet_zone); - uma_zdestroy(ratelimit_zone); osd_jail_deregister(wg_osd_jail_slot); + cookie_deinit(); MPASS(LIST_EMPTY(&wg_list)); } |