mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2025-08-05 21:37:15 +02:00
87 lines
3.9 KiB
Diff
87 lines
3.9 KiB
Diff
Patch-Source: https://github.com/NICMx/Jool/commit/490ddb0933061cab3c2a7952dffc61789deed565
|
|
fixes a
|
|
/usr/lib/gcc/x86_64-alpine-linux-musl/12.2.1/../../../../x86_64-alpine-linux-musl/bin/ld: libxt_JOOL_SIIT.o: in function `_init':
|
|
libxt_JOOL_SIIT.c:(.text+0xde): multiple definition of `_init'; /usr/lib/gcc/x86_64-alpine-linux-musl/12.2.1/../../../../lib/crti.o:/home/buildozer/aports/main/musl/src/c1b42c4a3a0324ec25877980f59db233fa420925/crt/x86_64/crti.s:4: first defined here
|
|
collect2: error: ld returned 1 exit status
|
|
/usr/lib/gcc/x86_64-alpine-linux-musl/12.2.1/../../../../x86_64-alpine-linux-musl/bin/ld: libxt_JOOL_SIIT.o: in function `_init':
|
|
libxt_JOOL_SIIT.c:(.text+0xde): multiple definition of `_init'; /usr/lib/gcc/x86_64-alpine-linux-musl/12.2.1/../../../../lib/crti.o:/home/buildozer/aports/main/musl/src/c1b42c4a3a0324ec25877980f59db233fa420925/crt/x86_64/crti.s:4: first defined here
|
|
collect2: error: ld returned 1 exit status
|
|
--
|
|
From 490ddb0933061cab3c2a7952dffc61789deed565 Mon Sep 17 00:00:00 2001
|
|
From: Alberto Leiva Popper <ydahhrk@gmail.com>
|
|
Date: Fri, 27 Jan 2023 09:50:45 -0600
|
|
Subject: [PATCH] Modernize the iptables shared object exports
|
|
|
|
Fixes Debian bug 1029268:
|
|
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1029268
|
|
|
|
man 3 dlopen:
|
|
|
|
> Use of _init and _fini is now deprecated in favor of the
|
|
> aforementioned constructors and destructors, which among other
|
|
> advantages, permit multiple initialization and finalization functions
|
|
> to be defined.
|
|
|
|
Replace _init() with __attribute__((constructor)). Vincent Bernat
|
|
already confirmed this works.
|
|
|
|
Also returns the static keyword, which was removed during #337. I'm
|
|
conjecturing that patch likely was a misled accident, and the current
|
|
one should be the proper fix for both bugs. This, I'm not completely
|
|
sure will work, but we'll see.
|
|
---
|
|
src/usr/iptables/common.c | 17 ++++++++++++++---
|
|
src/usr/iptables/libxt_JOOL.c | 1 +
|
|
src/usr/iptables/libxt_JOOL_SIIT.c | 1 +
|
|
3 files changed, 16 insertions(+), 3 deletions(-)
|
|
|
|
diff --git a/src/usr/iptables/common.c b/src/usr/iptables/common.c
|
|
index 33b7eb018..9bf90046c 100644
|
|
--- a/src/usr/iptables/common.c
|
|
+++ b/src/usr/iptables/common.c
|
|
@@ -124,10 +124,21 @@ static struct xtables_target targets[] = {
|
|
};
|
|
|
|
/*
|
|
- * Please don't add the static modifier to this function.
|
|
- * https://github.com/NICMx/Jool/issues/337
|
|
+ * This function has been problematic.
|
|
+ *
|
|
+ * In issue #337, someone found out that removing the static keyword fixed some
|
|
+ * Python crash: https://github.com/NICMx/Jool/issues/337. This seemed to work
|
|
+ * fine for a while, until Debian bug #1029268 happened:
|
|
+ * https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1029268
|
|
+ *
|
|
+ * Looking at the dlopen(3) manual page, it would seem both bugs were caused by
|
|
+ * our (by now deprecated) use of the "_init" function. Turns out people
|
|
+ * nowadays use __attribute__((constructor)) instead.
|
|
+ *
|
|
+ * Now that the code has been modernized, I decided to return the static
|
|
+ * keyword. Try removing it again if someone complains.
|
|
*/
|
|
-void _init(void)
|
|
+static void __attribute__((constructor)) IPTABLES_MODULE_MAIN(void)
|
|
{
|
|
xtables_register_targets(targets, sizeof(targets) / sizeof(targets[0]));
|
|
}
|
|
diff --git a/src/usr/iptables/libxt_JOOL.c b/src/usr/iptables/libxt_JOOL.c
|
|
index 701c8165d..e3a9385ff 100644
|
|
--- a/src/usr/iptables/libxt_JOOL.c
|
|
+++ b/src/usr/iptables/libxt_JOOL.c
|
|
@@ -2,4 +2,5 @@
|
|
|
|
#define IPTABLES_MODULE_NAME IPTABLES_NAT64_MODULE_NAME
|
|
#define IPTABLES_MODULE_TYPE XT_NAT64
|
|
+#define IPTABLES_MODULE_MAIN jool_nat64_xtables_init
|
|
#include "common.c"
|
|
diff --git a/src/usr/iptables/libxt_JOOL_SIIT.c b/src/usr/iptables/libxt_JOOL_SIIT.c
|
|
index e30ca7b96..217387c90 100644
|
|
--- a/src/usr/iptables/libxt_JOOL_SIIT.c
|
|
+++ b/src/usr/iptables/libxt_JOOL_SIIT.c
|
|
@@ -2,4 +2,5 @@
|
|
|
|
#define IPTABLES_MODULE_NAME IPTABLES_SIIT_MODULE_NAME
|
|
#define IPTABLES_MODULE_TYPE XT_SIIT
|
|
+#define IPTABLES_MODULE_MAIN jool_siit_xtables_init
|
|
#include "common.c"
|