netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Denys Fedoryshchenko <denys@visp.net.lb>
To: netdev@vger.kernel.org
Subject: iproute2 / xtables / undefined symbol in m_ipt again
Date: Tue, 1 Jul 2008 18:54:00 +0300	[thread overview]
Message-ID: <200807011854.00319.denys@visp.net.lb> (raw)

[-- Attachment #1: Type: text/plain, Size: 1086 bytes --]

After building git iproute2 and trying to use with iptables 1.4.1.1 i notice error.

/sbin/tc: symbol lookup error: /lib/iptables/libxt_MARK.so: undefined symbol: param_act

I remember that many functions "stolen" from iptables source. It is defined in iptables package, in xtables.h, but ugly thing, 
all this functions not available over some shared library, but available in xtables.o, which is linked statically with many iptables binaries on build time.
No idea, why they didn't make it dynamic, and as result reduce binaries size? And also they can make by that life for m_ipt.c MUCH easier (and binary smaller too).

There is two ways to fix it:
1)Easiest and ugliest. Add all missing functions there, it works and tested. Patch attached.
2)Tricky. Get xtables.c from iptables build, add to iproute2 binaries and link with m_ipt
3)Normal. Someone must talk with iptables guys to make xtables.c as shared library. It will remove all headache with updating m_ipt and 
  incompatibility with different/new iptables versions.

-- 
------
Technical Manager
Virtual ISP S.A.L.
Lebanon

[-- Attachment #2: iproute2-01052008-git.patch --]
[-- Type: text/x-diff, Size: 3673 bytes --]

diff -Naur iproute2-ok/include/iptables_common.h iproute2/include/iptables_common.h
--- iproute2-ok/include/iptables_common.h	2008-07-01 18:28:41.000000000 +0300
+++ iproute2/include/iptables_common.h	2008-07-01 18:39:11.000000000 +0300
@@ -3,10 +3,14 @@
 /* Shared definitions between ipv4 and ipv6. */
 
 enum exittype {
-	OTHER_PROBLEM = 1,
-	PARAMETER_PROBLEM,
-	VERSION_PROBLEM,
-	RESOURCE_PROBLEM
+        OTHER_PROBLEM = 1,
+        PARAMETER_PROBLEM,
+        VERSION_PROBLEM,
+        RESOURCE_PROBLEM,
+        P_ONLY_ONCE,
+        P_NO_INVERT,
+        P_BAD_VALUE,
+        P_ONE_ACTION,
 };
 
 /* this is a special 64bit data type that is 8-byte aligned */
diff -Naur iproute2-ok/tc/m_ipt.c iproute2/tc/m_ipt.c
--- iproute2-ok/tc/m_ipt.c	2008-07-01 18:28:41.000000000 +0300
+++ iproute2/tc/m_ipt.c	2008-07-01 18:42:59.000000000 +0300
@@ -22,6 +22,7 @@
 #include "tc_util.h"
 #include <linux/tc_act/tc_ipt.h>
 #include <stdio.h>
+#include <stdbool.h>
 #include <dlfcn.h>
 #include <getopt.h>
 #include <errno.h>
@@ -59,6 +60,91 @@
 
 char *lib_dir;
 
+bool strtonuml(const char *s, char **end, unsigned long *value,
+               unsigned long min, unsigned long max)
+{
+        unsigned long v;
+        char *my_end;
+
+        errno = 0;
+        v = strtoul(s, &my_end, 0);
+
+        if (my_end == s)
+                return false;
+        if (end != NULL)
+                *end = my_end;
+
+        if (errno != ERANGE && min <= v && (max == 0 || v <= max)) {
+                if (value != NULL)
+                        *value = v;
+                if (end == NULL)
+                        return *my_end == '\0';
+                return true;
+        }
+
+        return false;
+}
+
+bool strtonum(const char *s, char **end, unsigned int *value,
+                  unsigned int min, unsigned int max)
+{
+        unsigned long v;
+        bool ret;
+
+        ret = strtonuml(s, end, &v, min, max);
+        if (value != NULL)
+                *value = v;
+        return ret;
+}
+
+void param_act(unsigned int status, const char *p1, ...)
+{
+        const char *p2, *p3;
+        va_list args;
+        bool b;
+
+        va_start(args, p1);
+
+        switch (status) {
+        case P_ONLY_ONCE:
+                p2 = va_arg(args, const char *);
+                b  = va_arg(args, unsigned int);
+                if (!b)
+                        return;
+                exit_error(PARAMETER_PROBLEM,
+                           "%s: \"%s\" option may only be specified once",
+                           p1, p2);
+                break;
+        case P_NO_INVERT:
+                p2 = va_arg(args, const char *);
+                b  = va_arg(args, unsigned int);
+                if (!b)
+                        return;
+                exit_error(PARAMETER_PROBLEM,
+                           "%s: \"%s\" option cannot be inverted", p1, p2);
+                break;
+        case P_BAD_VALUE:
+                p2 = va_arg(args, const char *);
+                p3 = va_arg(args, const char *);
+                exit_error(PARAMETER_PROBLEM,
+                           "%s: Bad value for \"%s\" option: \"%s\"",
+                           p1, p2, p3);
+                break;
+        case P_ONE_ACTION:
+                b = va_arg(args, unsigned int);
+                if (!b)
+                        return;
+                exit_error(PARAMETER_PROBLEM,
+                           "%s: At most one action is possible", p1);
+                break;
+        default:
+                exit_error(status, p1, args);
+                break;
+        }
+
+        va_end(args);
+}
+
 void
 register_target(struct iptables_target *me)
 {

                 reply	other threads:[~2008-07-01 15:54 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200807011854.00319.denys@visp.net.lb \
    --to=denys@visp.net.lb \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).