#endif
};
+extern const char *xtables_modprobe_program;
+
extern void *xtables_calloc(size_t, size_t);
extern void *xtables_malloc(size_t);
+extern int xtables_insmod(const char *, const char *, bool);
+extern int xtables_load_ko(const char *, bool);
+
/* Your shared library should call one of these. */
extern void xtables_register_match(struct xtables_match *me);
extern void xtables_register_target(struct xtables_target *me);
extern char *lib_dir;
-extern const char *modprobe_program;
-extern int xtables_insmod(const char *modname, const char *modprobe, int quiet);
-extern int load_xtables_ko(const char *modprobe, int quiet);
-
/* This is decleared in ip[6]tables.c */
extern struct afinfo afinfo;
#include <getopt.h>
#include <sys/errno.h>
+#include <stdbool.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
if (!handle) {
/* try to insmod the module if iptc_init failed */
- load_xtables_ko(modprobe_program, 0);
+ xtables_load_ko(xtables_modprobe_program, false);
handle = ip6tc_init(tablename);
}
noflush = 1;
break;
case 'M':
- modprobe_program = optarg;
+ xtables_modprobe_program = optarg;
break;
}
}
#include <stdlib.h>
#include <ctype.h>
#include <stdarg.h>
+#include <stdbool.h>
#include <limits.h>
#include <ip6tables.h>
#include <xtables.h>
break;
case 'M':
- modprobe_program = optarg;
+ xtables_modprobe_program = optarg;
break;
case 'c':
*handle = ip6tc_init(*table);
/* try to insmod the module if iptc_init failed */
- if (!*handle && load_xtables_ko(modprobe_program, 0) != -1)
+ if (!*handle && xtables_load_ko(xtables_modprobe_program, false) != -1)
*handle = ip6tc_init(*table);
if (!*handle)
#include <getopt.h>
#include <sys/errno.h>
+#include <stdbool.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
if (!handle) {
/* try to insmod the module if iptc_init failed */
- load_xtables_ko(modprobe_program, 0);
+ xtables_load_ko(xtables_modprobe_program, false);
handle = iptc_init(tablename);
}
noflush = 1;
break;
case 'M':
- modprobe_program = optarg;
+ xtables_modprobe_program = optarg;
break;
case 'T':
tablename = optarg;
#include <string.h>
#include <netdb.h>
#include <errno.h>
+#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
break;
case 'M':
- modprobe_program = optarg;
+ xtables_modprobe_program = optarg;
break;
case 'c':
*handle = iptc_init(*table);
/* try to insmod the module if iptc_init failed */
- if (!*handle && load_xtables_ko(modprobe_program, 0) != -1)
+ if (!*handle && xtables_load_ko(xtables_modprobe_program, false) != -1)
*handle = iptc_init(*table);
if (!*handle)
char *lib_dir;
/* the path to command to load kernel module */
-const char *modprobe_program = NULL;
+const char *xtables_modprobe_program;
/* Keeping track of external matches and targets: linked lists. */
struct xtables_match *xtables_matches;
return NULL;
}
-int xtables_insmod(const char *modname, const char *modprobe, int quiet)
+int xtables_insmod(const char *modname, const char *modprobe, bool quiet)
{
char *buf = NULL;
char *argv[4];
return -1;
}
-int load_xtables_ko(const char *modprobe, int quiet)
+int xtables_load_ko(const char *modprobe, bool quiet)
{
- static int loaded = 0;
+ static bool loaded = false;
static int ret = -1;
if (!loaded) {
exit(1);
}
- load_xtables_ko(modprobe_program, 1);
+ xtables_load_ko(xtables_modprobe_program, true);
strcpy(rev.name, name);
rev.revision = revision;