summaryrefslogtreecommitdiffhomepage
path: root/src/compat/compat.h
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2020-06-21 21:42:21 -0600
committerJason A. Donenfeld <Jason@zx2c4.com>2020-06-22 00:02:35 -0600
commitb8fbf4f4803ca1b2fa181ca3d2555cdb61f6f374 (patch)
treec4b486ce30f07613775b9bd743ab8d98c7e6cd41 /src/compat/compat.h
parentc5e19b2939d490e23b0d0ab19cdef14442910ab7 (diff)
device: avoid circular netns references
Before, we took a reference to the creating netns if the new netns was different. This caused issues with circular references, with two wireguard interfaces swapping namespaces. The solution is to rather not take any extra references at all, but instead simply invalidate the creating netns pointer when that netns is deleted. In order to prevent this from happening again, this commit improves the rough object leak tracking by allowing it to account for created and destroyed interfaces, aside from just peers and keys. That then makes it possible to check for the object leak when having two interfaces take a reference to each others' namespaces. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'src/compat/compat.h')
-rw-r--r--src/compat/compat.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/compat/compat.h b/src/compat/compat.h
index cd1773a..bf0b589 100644
--- a/src/compat/compat.h
+++ b/src/compat/compat.h
@@ -1036,6 +1036,10 @@ static inline void skb_reset_redirect(struct sk_buff *skb)
#define sw_hash ignore_df = 0; skb->nf_trace = skb->ooo_okay
#endif
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 3, 0)
+#define pre_exit exit
+#endif
+
#if defined(ISUBUNTU1604) || defined(ISRHEL7)
#include <linux/siphash.h>
#ifndef _WG_LINUX_SIPHASH_H