[iptables] libxtables: prefix names and order #3
Pablo Neira
netfilter-cvslog-bounces at lists.netfilter.org
Sun Feb 1 22:35:46 CET 2009
Gitweb: http://git.netfilter.org/cgi-bin/gitweb.cgi?p=iptables.git;a=commit;h=212092173b63be8532d95241bbd86db96e110220
commit 212092173b63be8532d95241bbd86db96e110220
Author: Jan Engelhardt <jengelh at medozas.de>
AuthorDate: Sun Feb 1 22:33:37 2009 +0100
Commit: Pablo Neira Ayuso <pablo at netfilter.org>
CommitDate: Sun Feb 1 22:33:37 2009 +0100
libxtables: prefix names and order #3
This change affects:
find_{match,target} -> xtables_find_{match,target}
enum xt_tryload -> enum xtables_tryload
loose flags like DONT_LOAD -> XTF_DONT_LOAD
Signed-off-by: Jan Engelhardt <jengelh at medozas.de>
Signed-off-by: Pablo Neira Ayuso <pablo at netfilter.org>
commit c6132022905b10ac70223e8116f3903ea0039e75
Author: Jan Engelhardt <jengelh at medozas.de>
AuthorDate: Sun Feb 1 22:32:56 2009 +0100
Commit: Pablo Neira Ayuso <pablo at netfilter.org>
CommitDate: Sun Feb 1 22:32:56 2009 +0100
libxtables: prefix names and order it #2
This change affects:
load_xtables_ko -> xtables_load_ko
modprobe_program -> xtables_modprobe_program
Now uses bool for the "quiet" flag.
Signed-off-by: Jan Engelhardt <jengelh at medozas.de>
Signed-off-by: Pablo Neira Ayuso <pablo at netfilter.org>
via 212092173b63be8532d95241bbd86db96e110220 (commit)
via c6132022905b10ac70223e8116f3903ea0039e75 (commit)
from 43270796c709584b67343c333adaf28faea56265 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 212092173b63be8532d95241bbd86db96e110220
Author: Jan Engelhardt <jengelh at medozas.de>
Date: Sun Feb 1 22:33:37 2009 +0100
libxtables: prefix names and order #3
This change affects:
find_{match,target} -> xtables_find_{match,target}
enum xt_tryload -> enum xtables_tryload
loose flags like DONT_LOAD -> XTF_DONT_LOAD
Signed-off-by: Jan Engelhardt <jengelh at medozas.de>
Signed-off-by: Pablo Neira Ayuso <pablo at netfilter.org>
commit c6132022905b10ac70223e8116f3903ea0039e75
Author: Jan Engelhardt <jengelh at medozas.de>
Date: Sun Feb 1 22:32:56 2009 +0100
libxtables: prefix names and order it #2
This change affects:
load_xtables_ko -> xtables_load_ko
modprobe_program -> xtables_modprobe_program
Now uses bool for the "quiet" flag.
Signed-off-by: Jan Engelhardt <jengelh at medozas.de>
Signed-off-by: Pablo Neira Ayuso <pablo at netfilter.org>
-----------------------------------------------------------------------
include/xtables.h.in | 27 +++++++++++++++++++++++
include/xtables/internal.h | 27 -----------------------
ip6tables-restore.c | 5 ++-
ip6tables.c | 50 ++++++++++++++++++++++++-------------------
iptables-restore.c | 5 ++-
iptables.c | 50 ++++++++++++++++++++++++-------------------
xtables.c | 51 +++++++++++++++++++++++--------------------
7 files changed, 116 insertions(+), 99 deletions(-)
This change affects:
load_xtables_ko -> xtables_load_ko
modprobe_program -> xtables_modprobe_program
Now uses bool for the "quiet" flag.
Signed-off-by: Jan Engelhardt <jengelh at medozas.de>
Signed-off-by: Pablo Neira Ayuso <pablo at netfilter.org>
diff --git a/include/xtables.h.in b/include/xtables.h.in
index e63d171..2512d79 100644
--- a/include/xtables.h.in
+++ b/include/xtables.h.in
@@ -140,9 +140,14 @@ struct xtables_target
#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);
diff --git a/include/xtables/internal.h b/include/xtables/internal.h
index 6b78d3a..62fe2ed 100644
--- a/include/xtables/internal.h
+++ b/include/xtables/internal.h
@@ -43,10 +43,6 @@ struct xtables_rule_match {
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;
diff --git a/ip6tables-restore.c b/ip6tables-restore.c
index a84c2e3..097711f 100644
--- a/ip6tables-restore.c
+++ b/ip6tables-restore.c
@@ -12,6 +12,7 @@
#include <getopt.h>
#include <sys/errno.h>
+#include <stdbool.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
@@ -64,7 +65,7 @@ static struct ip6tc_handle *create_handle(const char *tablename)
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);
}
@@ -165,7 +166,7 @@ int main(int argc, char *argv[])
noflush = 1;
break;
case 'M':
- modprobe_program = optarg;
+ xtables_modprobe_program = optarg;
break;
}
}
diff --git a/ip6tables.c b/ip6tables.c
index 59c1011..580a644 100644
--- a/ip6tables.c
+++ b/ip6tables.c
@@ -33,6 +33,7 @@
#include <stdlib.h>
#include <ctype.h>
#include <stdarg.h>
+#include <stdbool.h>
#include <limits.h>
#include <ip6tables.h>
#include <xtables.h>
@@ -1769,7 +1770,7 @@ int do_command6(int argc, char *argv[], char **table, struct ip6tc_handle **hand
break;
case 'M':
- modprobe_program = optarg;
+ xtables_modprobe_program = optarg;
break;
case 'c':
@@ -1967,7 +1968,7 @@ int do_command6(int argc, char *argv[], char **table, struct ip6tc_handle **hand
*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)
diff --git a/iptables-restore.c b/iptables-restore.c
index 7cc6d6d..3fbc908 100644
--- a/iptables-restore.c
+++ b/iptables-restore.c
@@ -9,6 +9,7 @@
#include <getopt.h>
#include <sys/errno.h>
+#include <stdbool.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
@@ -63,7 +64,7 @@ static struct iptc_handle *create_handle(const char *tablename)
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);
}
@@ -167,7 +168,7 @@ main(int argc, char *argv[])
noflush = 1;
break;
case 'M':
- modprobe_program = optarg;
+ xtables_modprobe_program = optarg;
break;
case 'T':
tablename = optarg;
diff --git a/iptables.c b/iptables.c
index 0b7edd8..61e7aab 100644
--- a/iptables.c
+++ b/iptables.c
@@ -29,6 +29,7 @@
#include <string.h>
#include <netdb.h>
#include <errno.h>
+#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
@@ -1786,7 +1787,7 @@ int do_command(int argc, char *argv[], char **table, struct iptc_handle **handle
break;
case 'M':
- modprobe_program = optarg;
+ xtables_modprobe_program = optarg;
break;
case 'c':
@@ -1996,7 +1997,7 @@ int do_command(int argc, char *argv[], char **table, struct iptc_handle **handle
*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)
diff --git a/xtables.c b/xtables.c
index 83c72ee..94ea764 100644
--- a/xtables.c
+++ b/xtables.c
@@ -47,7 +47,7 @@
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;
@@ -108,7 +108,7 @@ static char *get_modprobe(void)
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];
@@ -150,9 +150,9 @@ int xtables_insmod(const char *modname, const char *modprobe, int quiet)
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) {
@@ -502,7 +502,7 @@ static int compatible_revision(const char *name, u_int8_t revision, int opt)
exit(1);
}
- load_xtables_ko(modprobe_program, 1);
+ xtables_load_ko(xtables_modprobe_program, true);
strcpy(rev.name, name);
rev.revision = revision;
More information about the netfilter-cvslog
mailing list