Skip to contentSkip to conversation

iproute2 : fix to catchup with xtables/iptables >= 1.4.2

PATCH In review jamal 2 participants 3 messages Feb 7, 2009

Subsystems (2)
lore
Share & tools
lore

jamal

author
#0 lore raw

PATCH 1/1 iproute2 : fix to catchup with xtables/iptables >= 1.4.2

Against this morning's git tree (small compile fix in some environments).

Please apply this one instead of previous one i posted last week. This is needed for users of tc ipt using iptables >= 1.4.2 such as current debian releases.

cheers,
jamal

commit 1ee18def5f5ccd362799bb321b7bc1bced19d65e

Author: Jamal Hadi Salim <[email protected]>
Date:   Sat Feb 7 08:19:20 2009 -0500

Breakage noticed when debian upgraded to xtables (iptables > 1.4.1)

Many thanks to Yevgeny Kosarzhevsky <[email protected]> for reporting and a lot of testing

Thanks to Jan Engelhardt <[email protected]> for a lot of advice Thanks to Denys Fedoryschenko <[email protected]> for some sample code that he tried and thanks to Andreas Henriksson <[email protected]> (who maintains iproute2 on debian) for the persistent followup.

configure +67 -0
index dc14e54..df40370 100755
@@ -25,3 +25,70 @@ else
     echo no
 fi
 rm -f /tmp/atmtest.c /tmp/atmtest
+
+echo -n " IPT	"
+
+#check if we need dont our internal header ..
+cat >/tmp/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
+gcc -I$INCLUDE $IPTC -o /tmp/ipttest /tmp/ipttest.c $IPTL -ldl >/dev/null 2>&1
+
+if [ $? -eq 0 ]
+then
+	echo "TC_CONFIG_XT:=y" >>Config
+	echo "using xtables seems no need for internal.h"
+else
+	echo "failed test 2"
+fi
+
+#check if we need our own internal.h
+cat >/tmp/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
+gcc -I$INCLUDE $IPTC -o /tmp/ipttest /tmp/ipttest.c $IPTL -ldl >/dev/null 2>&1
+
+if [ $? -eq 0 ]
+then
+	echo "using xtables instead of iptables (need for internal.h)"
+	echo "TC_CONFIG_XT_H:=y" >>Config
+
+else
+	echo "failed test 3 using iptables"
+fi
+rm -f /tmp/ipttest.c /tmp/ipttest
include/xt-internal.h new file +66 -0

66 lines not on this page · raw message

tc/Makefile +15 -2
index eb67ede..227fc40 100644
@@ -29,7 +29,6 @@ TCMODULES += q_htb.o
 TCMODULES += q_drr.o
 TCMODULES += m_gact.o
 TCMODULES += m_mirred.o
-TCMODULES += m_ipt.o
 TCMODULES += m_nat.o
 TCMODULES += m_pedit.o
 TCMODULES += m_skbedit.o
@@ -42,7 +41,22 @@ TCMODULES += em_cmp.o
 TCMODULES += em_u32.o
 TCMODULES += em_meta.o
 
+
+ifeq ($(TC_CONFIG_XT),y)
+  TCMODULES += m_xt.o
+  LDLIBS += -lxtables
+else
+  ifeq ($(TC_CONFIG_XT_H),y)
+	CFLAGS += -DTC_CONFIG_XT_H
+	TCMODULES += m_xt.o
+	LDLIBS += -lxtables
+  else
+  TCMODULES += m_ipt.o
+  endif
+endif
+
 TCOBJ += $(TCMODULES)
+LDLIBS += -L. -ltc -lm -ldl
 
 TCLIB := tc_core.o
 TCLIB += tc_red.o
@@ -57,7 +71,6 @@ ifeq ($(TC_CONFIG_ATM),y)
   TCSO += q_atm.so
 endif
 
-LDLIBS += -L. -ltc -lm -ldl
 
 LDFLAGS += -Wl,-export-dynamic
 
tc/m_xt.c new file +434 -0

434 lines not on this page · raw message

#1 lore raw
Quoted 3 lines · jamal

Against this morning's git tree (small compile fix in some environments).

What about the proposed symbol rename in libxtables, would not it invalidate the patch?

Quoted 3 lines

Please apply this one instead of previous one i posted last week. This is needed for users of tc ipt using iptables >= 1.4.2 such as current debian releases.

author
#2 lore raw
Quoted 2 lines · Jan Engelhardt

What about the proposed symbol rename in libxtables, would not it invalidate the patch?

The rename would be for post iptables 1.4.2. We have a problem right now with distros already deploying iptables 1.4.2. This patch resolves that.

cheers,
jamal