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*/
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;
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;
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? */
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,
struct ip6tables_target *t;
const char *jumpto = "";
char *protocol = NULL;
- const char *modprobe = NULL;
int proto_used = 0;
memset(&fw, 0, sizeof(fw));
*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)
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;
exit(1);
}
+ load_iptables_ko(modprobe);
+
strcpy(rev.name, name);
rev.revision = revision;
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,
struct iptables_target *t;
const char *jumpto = "";
char *protocol = NULL;
- const char *modprobe = NULL;
int proto_used = 0;
memset(&fw, 0, sizeof(fw));
*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)