Netdev List
 help / color / mirror / Atom feed
* [PATCH iproute2-next 1/2] configure: drop leftovers from removed iptables/xtables support
@ 2026-11-30 17:23 Stephen Hemminger
  2026-11-30 17:23 ` [PATCH iproute2-next 2/2] configure: remove stale ipset compat shim and unused IP_CONFIG_SETNS Stephen Hemminger
  0 siblings, 1 reply; 2+ messages in thread
From: Stephen Hemminger @ 2026-11-30 17:23 UTC (permalink / raw)
  To: netdev; +Cc: dsahern, jhs, Stephen Hemminger

Commit 45dc10463dd5 ("remove support for iptables action") deleted
tc/m_ipt.c and tc/m_xt.c, but left a trail of build glue behind.

 - check_xt_old() and check_xt_old_internal_h() probed for xtables
   from before iptables 1.4.5 (2009). Nothing has consumed the
   resulting TC_CONFIG_XT_OLD and TC_CONFIG_XT_OLD_H symbols since
   that commit, so both tests only slowed configure down.
 - include/xt-internal.h was the private header those tests looked
   for. No source file includes it anymore.
 - $IPTC and $IPTL in check_xt() are never assigned; they expanded to
   nothing on every build.
 - tc/Makefile still had rules to build m_xt.so and m_xt_old.so from
   sources that no longer exist, plus install logic symlinking
   m_ipt.so at whichever of them it found.

Also refresh the check_xt() comment: check_xtables() already gates on
the pkg-config module being present, so the stale version reference is
just noise.

No change to the generated config.mk.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 configure             | 74 ++-----------------------------------------
 include/xt-internal.h | 67 ---------------------------------------
 tc/Makefile           | 13 --------
 3 files changed, 2 insertions(+), 152 deletions(-)
 delete mode 100644 include/xt-internal.h

diff --git a/configure b/configure
index 4e68dd44..d81a6a81 100755
--- a/configure
+++ b/configure
@@ -35,7 +35,7 @@ check_xtables()
 
 check_xt()
 {
-    #check if we have xtables from iptables >= 1.4.5.
+    #check that the xtables library is usable
     cat >$TMPDIR/ipttest.c <<EOF
 #include <xtables.h>
 #include <linux/netfilter.h>
@@ -55,7 +55,7 @@ int main(int argc, char **argv)
 }
 EOF
 
-    if $CC -I$INCLUDE $IPTC -o $TMPDIR/ipttest $TMPDIR/ipttest.c $IPTL \
+    if $CC -I$INCLUDE -o $TMPDIR/ipttest $TMPDIR/ipttest.c \
 	$(${PKG_CONFIG} xtables --cflags --libs) -ldl >/dev/null 2>&1; then
 	echo "TC_CONFIG_XT:=y" >>$CONFIG
 	echo "using xtables"
@@ -63,74 +63,6 @@ EOF
     rm -f $TMPDIR/ipttest.c $TMPDIR/ipttest
 }
 
-check_xt_old()
-{
-    # bail if previous XT checks has already succeeded.
-    grep -q TC_CONFIG_XT $CONFIG && return
-
-    #check if we don't need our internal header ..
-    cat >$TMPDIR/ipttest.c <<EOF
-#include <xtables.h>
-char *lib_dir;
-unsigned int global_option_offset = 0;
-const char *program_version = XTABLES_VERSION;
-const char *program_name = "tc-ipt";
-struct afinfo afinfo = {
-	.libprefix      = "libxt_",
-};
-
-void exit_error(enum exittype status, const char *msg, ...)
-{
-}
-
-int main(int argc, char **argv) {
-
-	return 0;
-}
-
-EOF
-
-    if $CC -I$INCLUDE $IPTC -o $TMPDIR/ipttest $TMPDIR/ipttest.c $IPTL -ldl >/dev/null 2>&1; then
-	echo "TC_CONFIG_XT_OLD:=y" >>$CONFIG
-	echo "using old xtables (no need for xt-internal.h)"
-    fi
-    rm -f $TMPDIR/ipttest.c $TMPDIR/ipttest
-}
-
-check_xt_old_internal_h()
-{
-    # bail if previous XT checks has already succeeded.
-    grep -q TC_CONFIG_XT $CONFIG && return
-
-    #check if we need our own internal.h
-    cat >$TMPDIR/ipttest.c <<EOF
-#include <xtables.h>
-#include "xt-internal.h"
-char *lib_dir;
-unsigned int global_option_offset = 0;
-const char *program_version = XTABLES_VERSION;
-const char *program_name = "tc-ipt";
-struct afinfo afinfo = {
-	.libprefix      = "libxt_",
-};
-
-void exit_error(enum exittype status, const char *msg, ...)
-{
-}
-
-int main(int argc, char **argv) {
-
-	return 0;
-}
-
-EOF
-	if $CC -I$INCLUDE $IPTC -o $TMPDIR/ipttest $TMPDIR/ipttest.c $IPTL -ldl >/dev/null 2>&1; then
-	    echo "using old xtables with xt-internal.h"
-	    echo "TC_CONFIG_XT_OLD_H:=y" >>$CONFIG
-	fi
-	rm -f $TMPDIR/ipttest.c $TMPDIR/ipttest
-}
-
 check_lib_dir()
 {
 	LIBDIR=$(echo $LIBDIR | sed "s|\${prefix}|$PREFIX|")
@@ -501,8 +433,6 @@ check_xtables
 if ! grep -q TC_CONFIG_NO_XT $CONFIG; then
 	echo -n " IPT	"
 	check_xt
-	check_xt_old
-	check_xt_old_internal_h
 
 	echo -n " IPSET  "
 	check_ipset
diff --git a/include/xt-internal.h b/include/xt-internal.h
deleted file mode 100644
index 07216140..00000000
--- a/include/xt-internal.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-#ifndef _XTABLES_INTERNAL_H
-#define _XTABLES_INTERNAL_H 1
-
-#ifndef XT_LIB_DIR
-#	define XT_LIB_DIR "/lib/xtables"
-#endif
-
-/* protocol family dependent information */
-struct afinfo {
-	/* protocol family */
-	int family;
-
-	/* prefix of library name (ex "libipt_" */
-	char *libprefix;
-
-	/* used by setsockopt (ex IPPROTO_IP */
-	int ipproto;
-
-	/* kernel module (ex "ip_tables" */
-	char *kmod;
-
-	/* optname to check revision support of match */
-	int so_rev_match;
-
-	/* optname to check revision support of match */
-	int so_rev_target;
-};
-
-enum xt_tryload {
-	DONT_LOAD,
-	DURING_LOAD,
-	TRY_LOAD,
-	LOAD_MUST_SUCCEED
-};
-
-struct xtables_rule_match {
-	struct xtables_rule_match *next;
-	struct xtables_match *match;
-	/* Multiple matches of the same type: the ones before
-	   the current one are completed from parsing point of view */
-	unsigned int completed;
-};
-
-extern char *lib_dir;
-
-extern void *fw_calloc(size_t count, size_t size);
-extern void *fw_malloc(size_t size);
-
-extern const char *modprobe_program;
-extern int xtables_insmod(const char *modname, const char *modprobe, int quiet);
-extern int load_xtables_ko(const char *modprobe, int quiet);
-
-/* This is decleared in ip[6]tables.c */
-extern struct afinfo afinfo;
-
-/* Keeping track of external matches and targets: linked lists.  */
-extern struct xtables_match *xtables_matches;
-extern struct xtables_target *xtables_targets;
-
-extern struct xtables_match *find_match(const char *name, enum xt_tryload,
-					struct xtables_rule_match **match);
-extern struct xtables_target *find_target(const char *name, enum xt_tryload);
-
-extern void _init(void);
-
-#endif /* _XTABLES_INTERNAL_H */
diff --git a/tc/Makefile b/tc/Makefile
index 6264a772..0e48ba38 100644
--- a/tc/Makefile
+++ b/tc/Makefile
@@ -132,24 +132,11 @@ install: all
 	for i in $(TCSO); \
 	do install -m 755 $$i $(MODDESTDIR); \
 	done
-	if [ ! -f $(MODDESTDIR)/m_ipt.so ]; then \
-	if [ -f $(MODDESTDIR)/m_xt.so ]; \
-		then ln -s m_xt.so $(MODDESTDIR)/m_ipt.so ; \
-	elif [ -f $(MODDESTDIR)/m_xt_old.so ]; \
-		then ln -s m_xt_old.so $(MODDESTDIR)/m_ipt.so ; \
-	fi; \
-	fi
 
 clean:
 	rm -f $(TCOBJ) $(TCLIB) libtc.a tc *.so emp_ematch.tab.h; \
 	rm -f emp_ematch.tab.*
 
-m_xt.so: m_xt.c
-	$(QUIET_CC)$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -shared -fpic -o m_xt.so m_xt.c $$($(PKG_CONFIG) xtables --cflags --libs)
-
-m_xt_old.so: m_xt_old.c
-	$(QUIET_CC)$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -shared -fpic -o m_xt_old.so m_xt_old.c $$($(PKG_CONFIG) xtables --cflags --libs)
-
 em_ipset.o: CFLAGS += $$($(PKG_CONFIG) xtables --cflags)
 
 em_ipt.o: CFLAGS += $$($(PKG_CONFIG) xtables --cflags)
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-30 17:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-30 17:23 [PATCH iproute2-next 1/2] configure: drop leftovers from removed iptables/xtables support Stephen Hemminger
2026-11-30 17:23 ` [PATCH iproute2-next 2/2] configure: remove stale ipset compat shim and unused IP_CONFIG_SETNS Stephen Hemminger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox