]> git.ipfire.org Git - thirdparty/iproute2.git/commitdiff
iptables compatiablity
authorDenys Fedoryshchenko <nuclearcat@nuclearcat.com>
Mon, 24 Dec 2007 16:51:11 +0000 (11:51 -0500)
committerStephen Hemminger <stephen.hemminger@vyatta.com>
Mon, 31 Dec 2007 19:15:29 +0000 (11:15 -0800)
New iptables 1.4.0 has some library names changed from libipt to libxt.
It is prefferable also to open libxt_ first, as newer "style".

Signed-off-by: Denys Fedoryshchenko <nuclearcat@nuclearcat.com>
Signed-off-by: Jamal Hadi Salim <hadi@cyberus.ca>
Signed-off-by: Stephen Hemminger <stephen.hemminger@vyatta.com>
tc/m_ipt.c

index acbb8d2d89ca619171397af6acd6606acff88328..f2a9305d3d5f2ad4c65724ca9a483be7032731a9 100644 (file)
@@ -68,6 +68,13 @@ register_target(struct iptables_target *me)
 
 }
 
+void
+xtables_register_target(struct iptables_target *me)
+{
+       me->next = t_list;
+       t_list = me;
+}
+
 void
 exit_tryhelp(int status)
 {
@@ -248,11 +255,24 @@ get_target_name(const char *name)
                }
        }
 
-       sprintf(path,  "%s/libipt_%s.so",lib_dir, new_name);
+       /* try libxt_xx first */
+       sprintf(path, "%s/libxt_%s.so", lib_dir, new_name);
        handle = dlopen(path, RTLD_LAZY);
        if (!handle) {
-               sprintf(path, lib_dir, "/libipt_%s.so", lname);
+               /* try libipt_xx next */
+               sprintf(path, "%s/libipt_%s.so", lib_dir, new_name);
                handle = dlopen(path, RTLD_LAZY);
+
+               if (!handle) {
+                       sprintf(path, "%s/libxt_%s.so", lib_dir , lname);
+                       handle = dlopen(path, RTLD_LAZY);
+               }
+
+               if (!handle) {
+                       sprintf(path, "%s/libipt_%s.so", lib_dir , lname);
+                       handle = dlopen(path, RTLD_LAZY);
+               }
+               /* ok, lets give up .. */
                if (!handle) {
                        fputs(dlerror(), stderr);
                        printf("\n");