iproute2/iproute2-2.6.15-ipt-lib-dir.diff

47 lines
1.2 KiB
Diff

--- tc/m_ipt.c.orig 2007-01-29 10:14:01.000000000 +0100
+++ tc/m_ipt.c 2007-01-29 10:50:37.000000000 +0100
@@ -9,7 +9,7 @@
*
* Authors: J Hadi Salim (hadi@cyberus.ca)
*
- * TODO: bad bad hardcoding IPT_LIB_DIR and PROC_SYS_MODPROBE
+ * TODO: bad bad hardcoding PROC_SYS_MODPROBE
*
*/
@@ -47,10 +47,6 @@
#define FALSE 0
#endif
-#ifndef IPT_LIB_DIR
-#define IPT_LIB_DIR "/usr/local/lib/iptables"
-#endif
-
#ifndef PROC_SYS_MODPROBE
#define PROC_SYS_MODPROBE "/proc/sys/kernel/modprobe"
#endif
@@ -233,8 +229,13 @@
char *error;
char *new_name, *lname;
struct iptables_target *m;
+ char ipt_lib_dir[30] = "/usr/lib/iptables";
+
+ if (access (ipt_lib_dir,R_OK)) {
+ strcpy (ipt_lib_dir,"/usr/lib64/iptables");
+ }
- char path[sizeof (IPT_LIB_DIR) + sizeof ("/libipt_.so") + strlen(name)];
+ char path[sizeof (ipt_lib_dir) + sizeof ("/libipt_.so") + strlen(name)];
new_name = malloc(strlen(name) + 1);
lname = malloc(strlen(name) + 1);
@@ -265,7 +266,7 @@
}
}
- sprintf(path, IPT_LIB_DIR "/libipt_%s.so", new_name);
+ sprintf(path, "%s/libipt_%s.so", ipt_lib_dir,new_name);
handle = dlopen(path, RTLD_LAZY);
if (!handle) {
sprintf(path, IPT_LIB_DIR "/libipt_%s.so", lname);