openwrt/package/network/utils/iptables/patches/600-shared-libext.patch
Ivan Pavlov e1d6013935 iptables: update to 1.8.10
Source archive format changed to tar.xz

Removed upstreamed
  020-treewide-use-uint-instead-of-u_int.patch
  030-revert-fix-build-for-missing-ETH_ALEN-definition.patch
  040-xshared-Fix-build-for-Werror-format-security.patch
  050-build-fix-error-during-out-of-tree-build.patch
  060-libxtables-unexport-init_extensions-declarations.patch
  070-extensions-string-Review-parse_string-function.patch
  104-nft-track-each-register-individually.patch

Manually rebased
  600-shared-libext.patch

Change netfiletr.mk due to module name change
  https://git.netfilter.org/iptables/commit/?id=f30c5edce0413b2b2346c7f58e801f10f6e9bc5a

Signed-off-by: Ivan Pavlov <AuthorReflex@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/16641
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2024-10-22 00:52:03 +02:00

101 lines
4.6 KiB
Diff

--- a/extensions/GNUmakefile.in
+++ b/extensions/GNUmakefile.in
@@ -86,7 +86,7 @@ pfx_symlink_files := $(patsubst %,libxt_
#
# Building blocks
#
-targets := libext.a libext4.a libext6.a libext_ebt.a libext_arpt.a matches.man targets.man
+targets := libiptext.so libiptext4.so libiptext6.so libiptext_ebt.so libiptext_arpt.so matches.man targets.man
targets_install :=
libext_objs := ${pfx_objs}
libext_ebt_objs := ${pfb_objs}
@@ -133,7 +133,7 @@ clean:
distclean: clean
init%.o: init%.c
- ${AM_VERBOSE_CC} ${CC} ${AM_CPPFLAGS} ${AM_DEPFLAGS} ${AM_CFLAGS} -D_INIT=$*_init ${CFLAGS} -o $@ -c $<;
+ ${AM_VERBOSE_CC} ${CC} ${AM_CPPFLAGS} ${AM_DEPFLAGS} ${AM_CFLAGS} -D_INIT=$*_init -DPIC -fPIC ${CFLAGS} -o $@ -c $<;
-include .*.d
@@ -173,22 +173,22 @@ xt_connlabel_LIBADD = @libnetfilter_conn
# handling code in the Makefiles.
#
lib%.o: ${srcdir}/lib%.c
- ${AM_VERBOSE_CC} ${CC} ${AM_CPPFLAGS} ${AM_DEPFLAGS} ${AM_CFLAGS} -DNO_SHARED_LIBS=1 -D_INIT=lib$*_init ${CFLAGS} -o $@ -c $<;
+ ${AM_VERBOSE_CC} ${CC} ${AM_CPPFLAGS} ${AM_DEPFLAGS} ${AM_CFLAGS} -DNO_SHARED_LIBS=1 -D_INIT=lib$*_init -DPIC -fPIC ${CFLAGS} -o $@ -c $<;
-libext.a: initext.o ${libext_objs}
- ${AM_VERBOSE_AR} ${AR} crs $@ $^;
+libiptext.so: initext.o ${libext_objs}
+ ${AM_VERBOSE_CCLD} ${CCLD} ${AM_LDFLAGS} -shared ${LDFLAGS} -o $@ $^ -L../libxtables/.libs -lxtables $(foreach obj,$^,${$(patsubst lib%.o,%,$(obj))_LIBADD});
-libext_ebt.a: initextb.o ${libext_ebt_objs}
- ${AM_VERBOSE_AR} ${AR} crs $@ $^;
+libiptext_ebt.so: initextb.o ${libext_ebt_objs}
+ ${AM_VERBOSE_CCLD} ${CCLD} ${AM_LDFLAGS} -shared ${LDFLAGS} -o $@ $^ -L../libxtables/.libs -lxtables $(foreach obj,$^,${$(patsubst lib%.o,%,$(obj))_LIBADD});
-libext_arpt.a: initexta.o ${libext_arpt_objs}
- ${AM_VERBOSE_AR} ${AR} crs $@ $^;
+libiptext_arpt.so: initexta.o ${libext_arpt_objs}
+ ${AM_VERBOSE_CCLD} ${CCLD} ${AM_LDFLAGS} -shared ${LDFLAGS} -o $@ $^ -L../libxtables/.libs -lxtables $(foreach obj,$^,${$(patsubst lib%.o,%,$(obj))_LIBADD});
-libext4.a: initext4.o ${libext4_objs}
- ${AM_VERBOSE_AR} ${AR} crs $@ $^;
+libiptext4.so: initext4.o ${libext4_objs}
+ ${AM_VERBOSE_CCLD} ${CCLD} ${AM_LDFLAGS} -shared ${LDFLAGS} -o $@ $^ -L../libxtables/.libs -lxtables $(foreach obj,$^,${$(patsubst lib%.o,%,$(obj))_LIBADD});
-libext6.a: initext6.o ${libext6_objs}
- ${AM_VERBOSE_AR} ${AR} crs $@ $^;
+libiptext6.so: initext6.o ${libext6_objs}
+ ${AM_VERBOSE_CCLD} ${CCLD} ${AM_LDFLAGS} -shared ${LDFLAGS} -o $@ $^ -L../libxtables/.libs -lxtables $(foreach obj,$^,${$(patsubst lib%.o,%,$(obj))_LIBADD});
initext_func := $(addprefix xt_,${pfx_build_static})
initextb_func := $(addprefix ebt_,${pfb_build_static})
--- a/iptables/Makefile.am
+++ b/iptables/Makefile.am
@@ -7,7 +7,7 @@ AM_LDFLAGS = ${regular_LDFLAGS}
BUILT_SOURCES =
common_sources = iptables-xml.c xtables-multi.h xshared.c xshared.h
-common_ldadd = ../extensions/libext.a ../libxtables/libxtables.la -lm
+common_ldadd = ../libxtables/libxtables.la -lm
common_cflags = ${AM_CFLAGS}
if ENABLE_STATIC
common_cflags += -DALL_INCLUSIVE
@@ -17,15 +17,18 @@ xtables_legacy_multi_SOURCES = ${common
iptables-restore.c iptables-save.c
xtables_legacy_multi_CFLAGS = ${common_cflags}
xtables_legacy_multi_LDADD = ${common_ldadd}
+xtables_legacy_multi_LDFLAGS = -L../extensions/ -liptext
if ENABLE_IPV4
xtables_legacy_multi_SOURCES += iptables-standalone.c iptables.c iptables-multi.h
xtables_legacy_multi_CFLAGS += -DENABLE_IPV4
-xtables_legacy_multi_LDADD += ../libiptc/libip4tc.la ../extensions/libext4.a
+xtables_legacy_multi_LDADD += ../libiptc/libip4tc.la
+xtables_legacy_multi_LDFLAGS += -liptext4
endif
if ENABLE_IPV6
xtables_legacy_multi_SOURCES += ip6tables-standalone.c ip6tables.c ip6tables-multi.h
xtables_legacy_multi_CFLAGS += -DENABLE_IPV6
-xtables_legacy_multi_LDADD += ../libiptc/libip6tc.la ../extensions/libext6.a
+xtables_legacy_multi_LDADD += ../libiptc/libip6tc.la
+xtables_legacy_multi_LDFLAGS += -liptext6
endif
# iptables using nf_tables api
@@ -33,12 +36,9 @@ if ENABLE_NFTABLES
xtables_nft_multi_SOURCES = ${common_sources} xtables-nft-multi.c
xtables_nft_multi_CFLAGS = ${common_cflags}
xtables_nft_multi_LDADD = ${common_ldadd} \
- ../extensions/libext_arpt.a \
- ../extensions/libext_ebt.a \
- ../extensions/libext4.a \
- ../extensions/libext6.a \
${libmnl_LIBS} ${libnftnl_LIBS} \
${libnetfilter_conntrack_LIBS}
+xtables_nft_multi_LDFLAGS = -L../extensions/ -liptext -liptext_arpt -liptext_ebt -liptext4 -liptext6
xtables_nft_multi_CFLAGS += -DENABLE_NFTABLES -DENABLE_IPV4 -DENABLE_IPV6
xtables_nft_multi_SOURCES += nft.c nft.h \
nft-arp.c nft-ipv4.c nft-ipv6.c \