[netfilter-cvslog] r6692 - in trunk/iptables: . include
yasuyuki at netfilter.org
yasuyuki at netfilter.org
Mon Nov 13 06:09:17 CET 2006
Author: yasuyuki at netfilter.org
Date: 2006-11-13 06:09:16 +0100 (Mon, 13 Nov 2006)
New Revision: 6692
Modified:
trunk/iptables/include/ip6tables.h
trunk/iptables/include/iptables_common.h
trunk/iptables/ip6tables.c
trunk/iptables/iptables.c
Log:
load ip_[6]tables.ko just before checking revision support in kernel.
Modified: trunk/iptables/include/ip6tables.h
===================================================================
--- trunk/iptables/include/ip6tables.h 2006-11-13 04:03:26 UTC (rev 6691)
+++ trunk/iptables/include/ip6tables.h 2006-11-13 05:09:16 UTC (rev 6692)
@@ -172,5 +172,6 @@
extern int flush_entries(const ip6t_chainlabel chain, int verbose, ip6tc_handle_t *handle);
extern int delete_chain(const ip6t_chainlabel chain, int verbose, ip6tc_handle_t *handle);
extern int ip6tables_insmod(const char *modname, const char *modprobe);
+extern int load_ip6tables_ko(const char *modprobe);
#endif /*_IP6TABLES_USER_H*/
Modified: trunk/iptables/include/iptables_common.h
===================================================================
--- trunk/iptables/include/iptables_common.h 2006-11-13 04:03:26 UTC (rev 6691)
+++ trunk/iptables/include/iptables_common.h 2006-11-13 05:09:16 UTC (rev 6692)
@@ -28,6 +28,7 @@
unsigned long long int,
unsigned long long *);
extern int iptables_insmod(const char *modname, const char *modprobe);
+extern int load_iptables_ko(const char *modprobe);
void exit_error(enum exittype, char *, ...)__attribute__((noreturn,
format(printf,2,3)));
extern const char *program_name, *program_version;
Modified: trunk/iptables/ip6tables.c
===================================================================
--- trunk/iptables/ip6tables.c 2006-11-13 04:03:26 UTC (rev 6691)
+++ trunk/iptables/ip6tables.c 2006-11-13 05:09:16 UTC (rev 6692)
@@ -193,6 +193,9 @@
const char *program_name;
char *lib_dir;
+/* the path to command to load kernel module */
+const char *modprobe = NULL;
+
/* Keeping track of external matches and targets: linked lists. */
struct ip6tables_match *ip6tables_matches = NULL;
struct ip6tables_target *ip6tables_targets = NULL;
@@ -1118,6 +1121,8 @@
strcpy(rev.name, name);
rev.revision = revision;
+ load_ip6tables_ko(modprobe);
+
max_rev = getsockopt(sockfd, IPPROTO_IPV6, opt, &rev, &s);
if (max_rev < 0) {
/* Definitely don't support this? */
@@ -1777,6 +1782,19 @@
return -1;
}
+int load_ip6tables_ko(const char *modprobe)
+{
+ static int loaded = 0;
+ static int ret = -1;
+
+ if (!loaded) {
+ ret = ip6tables_insmod("ip6_tables", modprobe);
+ loaded = 1;
+ }
+
+ return ret;
+}
+
static struct ip6t_entry *
generate_entry(const struct ip6t_entry *fw,
struct ip6tables_rule_match *matches,
@@ -1855,7 +1873,6 @@
struct ip6tables_target *t;
const char *jumpto = "";
char *protocol = NULL;
- const char *modprobe = NULL;
int proto_used = 0;
memset(&fw, 0, sizeof(fw));
@@ -2333,7 +2350,7 @@
*handle = ip6tc_init(*table);
/* try to insmod the module if iptc_init failed */
- if (!*handle && ip6tables_insmod("ip6_tables", modprobe) != -1)
+ if (!*handle && load_ip6tables_ko(modprobe) != -1)
*handle = ip6tc_init(*table);
if (!*handle)
Modified: trunk/iptables/iptables.c
===================================================================
--- trunk/iptables/iptables.c 2006-11-13 04:03:26 UTC (rev 6691)
+++ trunk/iptables/iptables.c 2006-11-13 05:09:16 UTC (rev 6692)
@@ -197,6 +197,9 @@
int kernel_version;
+/* the path to command to load kernel module */
+const char *modprobe = NULL;
+
/* Keeping track of external matches and targets: linked lists. */
struct iptables_match *iptables_matches = NULL;
struct iptables_target *iptables_targets = NULL;
@@ -1147,6 +1150,8 @@
exit(1);
}
+ load_iptables_ko(modprobe);
+
strcpy(rev.name, name);
rev.revision = revision;
@@ -1845,6 +1850,19 @@
return -1;
}
+int load_iptables_ko(const char *modprobe)
+{
+ static int loaded = 0;
+ static int ret = -1;
+
+ if (!loaded) {
+ ret = iptables_insmod("ip_tables", NULL);
+ loaded = 1;
+ }
+
+ return ret;
+}
+
static struct ipt_entry *
generate_entry(const struct ipt_entry *fw,
struct iptables_rule_match *matches,
@@ -1938,7 +1956,6 @@
struct iptables_target *t;
const char *jumpto = "";
char *protocol = NULL;
- const char *modprobe = NULL;
int proto_used = 0;
memset(&fw, 0, sizeof(fw));
@@ -2426,7 +2443,7 @@
*handle = iptc_init(*table);
/* try to insmod the module if iptc_init failed */
- if (!*handle && iptables_insmod("ip_tables", modprobe) != -1)
+ if (!*handle && load_iptables_ko(modprobe) != -1)
*handle = iptc_init(*table);
if (!*handle)
More information about the netfilter-cvslog
mailing list