After a quick analysis, some work seems to be needed here. I'll try to
summarize the details:

* ldd /sbin/tc confirms it needs libxtables.so.4
  and disabling the build of m_xt via the CONFIG_TC_XT config option
  gets rid of this dependency.

* the old m_ipt, which has been replaced by m_xt since
  the introduction of libxtables in iptables, did runtime
  linking of the libraries it requires while m_xt doesn't
  make use of dlopen() and thus introduces a dependency
  between iproute (tc) and iptables (libxtables.so.4).

* tc (and ip) support plugins by runtime linking parts
  of tc, which we make use of for the atm support.

* tc/m_action.c handles runtime linking of action modules,
  this would be our way of avoiding iptables dependency
  by building m_xt as a plugin instead of part of tc.

tc/Makefile need to be improved to support building
m_xt.so (instead of m_xt.o) and installing it in the tc module
directory.

Hopefully the attached patch together with
  echo "TC_CONFIG_XT_MODULE:=y" >> Config
after configuration and before build should
(or added to the make command line) in debian/rules
should solve this.....  needs testing....

... as always, help would be very appreciated.

-- 
Regards,
Andreas Henriksson
diff --git a/tc/Makefile b/tc/Makefile
index 805c108..3af33cf 100644
--- a/tc/Makefile
+++ b/tc/Makefile
@@ -43,10 +43,18 @@ TCMODULES += em_cmp.o
 TCMODULES += em_u32.o
 TCMODULES += em_meta.o
 
+TCSO :=
+ifeq ($(TC_CONFIG_ATM),y)
+  TCSO += q_atm.so
+endif
 
 ifeq ($(TC_CONFIG_XT),y)
-  TCMODULES += m_xt.o
-  LDLIBS += -lxtables
+  ifeq ($(TC_CONFIG_XT_MODULE),y)
+    TCSO += m_xt.so
+  else
+    TCMODULES += m_xt.o
+    LDLIBS += -lxtables
+  endif
 else
   ifeq ($(TC_CONFIG_XT_OLD),y)
     TCMODULES += m_xt_old.o
@@ -81,11 +89,6 @@ ifneq ($(IPT_LIB_DIR),)
 	CFLAGS += -DIPT_LIB_DIR=\"$(IPT_LIB_DIR)\"
 endif
 
-TCSO :=
-ifeq ($(TC_CONFIG_ATM),y)
-  TCSO += q_atm.so
-endif
-
 YACC := bison
 LEX := flex
 
@@ -114,6 +117,9 @@ clean:
 q_atm.so: q_atm.c
 	$(CC) $(CFLAGS) $(LDFLAGS) -shared -fpic -o q_atm.so q_atm.c -latm
 
+m_xt.so: m_xt.c
+	$(CC) $(CFLAGS) $(LDFLAGS) -shared -fpic -o m_xt.so m_xt.c -lxtables
+
 %.yacc.c: %.y
 	$(YACC) $(YACCFLAGS) -o $@ $<
 

Reply via email to