drm/rockchip: Don't change hdmi reference clock rate
[drm/drm-misc.git] / drivers / net / wireguard / main.c
bloba00671b58701f5bbbcc499eed34abceda11aefa1
1 // SPDX-License-Identifier: GPL-2.0
2 /*
3 * Copyright (C) 2015-2019 Jason A. Donenfeld <Jason@zx2c4.com>. All Rights Reserved.
4 */
6 #include "version.h"
7 #include "device.h"
8 #include "noise.h"
9 #include "queueing.h"
10 #include "ratelimiter.h"
11 #include "netlink.h"
13 #include <uapi/linux/wireguard.h>
15 #include <linux/init.h>
16 #include <linux/module.h>
17 #include <net/genetlink.h>
18 #include <net/rtnetlink.h>
20 static int __init wg_mod_init(void)
22 int ret;
24 ret = wg_allowedips_slab_init();
25 if (ret < 0)
26 goto err_allowedips;
28 #ifdef DEBUG
29 ret = -ENOTRECOVERABLE;
30 if (!wg_allowedips_selftest() || !wg_packet_counter_selftest() ||
31 !wg_ratelimiter_selftest())
32 goto err_peer;
33 #endif
34 wg_noise_init();
36 ret = wg_peer_init();
37 if (ret < 0)
38 goto err_peer;
40 ret = wg_device_init();
41 if (ret < 0)
42 goto err_device;
44 ret = wg_genetlink_init();
45 if (ret < 0)
46 goto err_netlink;
48 pr_info("WireGuard " WIREGUARD_VERSION " loaded. See www.wireguard.com for information.\n");
49 pr_info("Copyright (C) 2015-2019 Jason A. Donenfeld <Jason@zx2c4.com>. All Rights Reserved.\n");
51 return 0;
53 err_netlink:
54 wg_device_uninit();
55 err_device:
56 wg_peer_uninit();
57 err_peer:
58 wg_allowedips_slab_uninit();
59 err_allowedips:
60 return ret;
63 static void __exit wg_mod_exit(void)
65 wg_genetlink_uninit();
66 wg_device_uninit();
67 wg_peer_uninit();
68 wg_allowedips_slab_uninit();
71 module_init(wg_mod_init);
72 module_exit(wg_mod_exit);
73 MODULE_LICENSE("GPL v2");
74 MODULE_DESCRIPTION("WireGuard secure network tunnel");
75 MODULE_AUTHOR("Jason A. Donenfeld <Jason@zx2c4.com>");
76 MODULE_VERSION(WIREGUARD_VERSION);
77 MODULE_ALIAS_RTNL_LINK(KBUILD_MODNAME);
78 MODULE_ALIAS_GENL_FAMILY(WG_GENL_NAME);