aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2017-10-12 02:19:13 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2017-10-17 19:26:07 +0200
commitd9041e88616b73872087859072aa59ab672752a7 (patch)
treeab901de2522e6e4f5a2da9a5ec060c6aafd355e4 /src
parentnoise: handshake constants can be read-only after init (diff)
downloadwireguard-monolithic-historical-d9041e88616b73872087859072aa59ab672752a7.tar.xz
wireguard-monolithic-historical-d9041e88616b73872087859072aa59ab672752a7.zip
compat: just make ro_after_init read_mostly
Diffstat (limited to 'src')
-rw-r--r--src/compat/compat.h4
-rw-r--r--src/netlink.c4
2 files changed, 5 insertions, 3 deletions
diff --git a/src/compat/compat.h b/src/compat/compat.h
index efd4d45..65a1076 100644
--- a/src/compat/compat.h
+++ b/src/compat/compat.h
@@ -37,6 +37,10 @@
#define headers_end data
#endif
+#ifndef __ro_after_init
+#define __ro_after_init __read_mostly
+#endif
+
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 17, 0)
#include "udp_tunnel/udp_tunnel_partial_compat.h"
#endif
diff --git a/src/netlink.c b/src/netlink.c
index ff32fb6..71da081 100644
--- a/src/netlink.c
+++ b/src/netlink.c
@@ -471,12 +471,10 @@ static const struct genl_ops genl_ops[] = {
}
};
-#ifndef COMPAT_CANNOT_USE_GENL_NOPS
static struct genl_family genl_family __ro_after_init = {
+#ifndef COMPAT_CANNOT_USE_GENL_NOPS
.ops = genl_ops,
.n_ops = ARRAY_SIZE(genl_ops),
-#else
-static struct genl_family genl_family = {
#endif
.name = WG_GENL_NAME,
.version = WG_GENL_VERSION,