summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Make_global.am2
-rw-r--r--include/libipset/types.h1
-rw-r--r--lib/Makefile.am13
-rw-r--r--lib/ipset_bitmap_ip.c (renamed from src/ipset_bitmap_ip.c)0
-rw-r--r--lib/ipset_bitmap_ipmac.c (renamed from src/ipset_bitmap_ipmac.c)0
-rw-r--r--lib/ipset_bitmap_port.c (renamed from src/ipset_bitmap_port.c)0
-rw-r--r--lib/ipset_hash_ip.c (renamed from src/ipset_hash_ip.c)0
-rw-r--r--lib/ipset_hash_ipport.c (renamed from src/ipset_hash_ipport.c)0
-rw-r--r--lib/ipset_hash_ipportip.c (renamed from src/ipset_hash_ipportip.c)0
-rw-r--r--lib/ipset_hash_ipportnet.c (renamed from src/ipset_hash_ipportnet.c)0
-rw-r--r--lib/ipset_hash_net.c (renamed from src/ipset_hash_net.c)0
-rw-r--r--lib/ipset_hash_netiface.c (renamed from src/ipset_hash_netiface.c)0
-rw-r--r--lib/ipset_hash_netport.c (renamed from src/ipset_hash_netport.c)0
-rw-r--r--lib/ipset_list_set.c (renamed from src/ipset_list_set.c)0
-rw-r--r--lib/libipset.map5
-rw-r--r--lib/types.c44
-rw-r--r--src/Makefile.am14
-rw-r--r--src/ipset.c33
18 files changed, 66 insertions, 46 deletions
diff --git a/Make_global.am b/Make_global.am
index 6275a10..0e81226 100644
--- a/Make_global.am
+++ b/Make_global.am
@@ -68,7 +68,7 @@
# as -version-info 2:0:0. This release has a new, but backwards incompatible
# interface.
-LIBVERSION = 1:0:0
+LIBVERSION = 2:0:0
AM_CPPFLAGS = $(kinclude_CFLAGS) $(all_includes) -I$(top_srcdir)/include \
-I/usr/local/include
diff --git a/include/libipset/types.h b/include/libipset/types.h
index cacce26..950988f 100644
--- a/include/libipset/types.h
+++ b/include/libipset/types.h
@@ -105,5 +105,6 @@ extern const struct ipset_type *ipset_types(void);
extern const char *ipset_typename_resolve(const char *str);
extern bool ipset_match_typename(const char *str,
const struct ipset_type *t);
+extern void ipset_load_types(void);
#endif /* LIBIPSET_TYPES_H */
diff --git a/lib/Makefile.am b/lib/Makefile.am
index d4ea6d6..3d43523 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -15,7 +15,18 @@ libipset_la_SOURCES = \
parse.c \
print.c \
session.c \
- types.c
+ types.c \
+ ipset_bitmap_ip.c \
+ ipset_bitmap_ipmac.c \
+ ipset_bitmap_port.c \
+ ipset_hash_ip.c \
+ ipset_hash_ipport.c \
+ ipset_hash_ipportip.c \
+ ipset_hash_ipportnet.c \
+ ipset_hash_net.c \
+ ipset_hash_netport.c \
+ ipset_hash_netiface.c \
+ ipset_list_set.c
#%.o: %.c
# ${AM_VERBOSE_CC} ${CC} ${AM_DEPFLAGS} ${AM_CFLAGS} ${CFLAGS} -o $@ -c $<
diff --git a/src/ipset_bitmap_ip.c b/lib/ipset_bitmap_ip.c
index 8b8220d..8b8220d 100644
--- a/src/ipset_bitmap_ip.c
+++ b/lib/ipset_bitmap_ip.c
diff --git a/src/ipset_bitmap_ipmac.c b/lib/ipset_bitmap_ipmac.c
index d822bf6..d822bf6 100644
--- a/src/ipset_bitmap_ipmac.c
+++ b/lib/ipset_bitmap_ipmac.c
diff --git a/src/ipset_bitmap_port.c b/lib/ipset_bitmap_port.c
index 69be809..69be809 100644
--- a/src/ipset_bitmap_port.c
+++ b/lib/ipset_bitmap_port.c
diff --git a/src/ipset_hash_ip.c b/lib/ipset_hash_ip.c
index 912b991..912b991 100644
--- a/src/ipset_hash_ip.c
+++ b/lib/ipset_hash_ip.c
diff --git a/src/ipset_hash_ipport.c b/lib/ipset_hash_ipport.c
index 748e452..748e452 100644
--- a/src/ipset_hash_ipport.c
+++ b/lib/ipset_hash_ipport.c
diff --git a/src/ipset_hash_ipportip.c b/lib/ipset_hash_ipportip.c
index 7c046a3..7c046a3 100644
--- a/src/ipset_hash_ipportip.c
+++ b/lib/ipset_hash_ipportip.c
diff --git a/src/ipset_hash_ipportnet.c b/lib/ipset_hash_ipportnet.c
index c4cf97e..c4cf97e 100644
--- a/src/ipset_hash_ipportnet.c
+++ b/lib/ipset_hash_ipportnet.c
diff --git a/src/ipset_hash_net.c b/lib/ipset_hash_net.c
index 76269f0..76269f0 100644
--- a/src/ipset_hash_net.c
+++ b/lib/ipset_hash_net.c
diff --git a/src/ipset_hash_netiface.c b/lib/ipset_hash_netiface.c
index 51d9cad..51d9cad 100644
--- a/src/ipset_hash_netiface.c
+++ b/lib/ipset_hash_netiface.c
diff --git a/src/ipset_hash_netport.c b/lib/ipset_hash_netport.c
index af6adf1..af6adf1 100644
--- a/src/ipset_hash_netport.c
+++ b/lib/ipset_hash_netport.c
diff --git a/src/ipset_list_set.c b/lib/ipset_list_set.c
index d95290b..d95290b 100644
--- a/src/ipset_list_set.c
+++ b/lib/ipset_list_set.c
diff --git a/lib/libipset.map b/lib/libipset.map
index a9f6f41..677c055 100644
--- a/lib/libipset.map
+++ b/lib/libipset.map
@@ -110,3 +110,8 @@ global:
local: *;
};
+
+LIBIPSET_2.0 {
+global:
+ ipset_load_types;
+} LIBIPSET_1.0;
diff --git a/lib/types.c b/lib/types.c
index e93b4bd..0b5826e 100644
--- a/lib/types.c
+++ b/lib/types.c
@@ -19,6 +19,22 @@
#include <libipset/utils.h> /* STREQ */
#include <libipset/types.h> /* prototypes */
+/* The known set types: (typename, revision, family) is unique */
+extern struct ipset_type ipset_bitmap_ip0;
+extern struct ipset_type ipset_bitmap_ipmac0;
+extern struct ipset_type ipset_bitmap_port0;
+extern struct ipset_type ipset_hash_ip0;
+extern struct ipset_type ipset_hash_net0;
+extern struct ipset_type ipset_hash_net1;
+extern struct ipset_type ipset_hash_netport1;
+extern struct ipset_type ipset_hash_netport2;
+extern struct ipset_type ipset_hash_netiface0;
+extern struct ipset_type ipset_hash_ipport1;
+extern struct ipset_type ipset_hash_ipportip1;
+extern struct ipset_type ipset_hash_ipportnet1;
+extern struct ipset_type ipset_hash_ipportnet2;
+extern struct ipset_type ipset_list_set0;
+
/* Userspace cache of sets which exists in the kernel */
struct ipset {
@@ -554,3 +570,31 @@ ipset_cache_fini(void)
free(set);
}
}
+
+/**
+ * ipset_load_types - load known set types
+ *
+ * Load in (register) all known set types for the system
+ */
+ void
+ ipset_load_types(void)
+ {
+ if (typelist != NULL)
+ return;
+
+ ipset_type_add(&ipset_bitmap_ip0);
+ ipset_type_add(&ipset_bitmap_ipmac0);
+ ipset_type_add(&ipset_bitmap_port0);
+ ipset_type_add(&ipset_hash_ip0);
+ ipset_type_add(&ipset_hash_net0);
+ ipset_type_add(&ipset_hash_net1);
+ ipset_type_add(&ipset_hash_netport1);
+ ipset_type_add(&ipset_hash_netport2);
+ ipset_type_add(&ipset_hash_netiface0);
+ ipset_type_add(&ipset_hash_ipport1);
+ ipset_type_add(&ipset_hash_ipportip1);
+ ipset_type_add(&ipset_hash_ipportnet1);
+ ipset_type_add(&ipset_hash_ipportnet2);
+ ipset_type_add(&ipset_list_set0);
+}
+ \ No newline at end of file
diff --git a/src/Makefile.am b/src/Makefile.am
index 5296047..e3f6549 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,19 +1,7 @@
include $(top_srcdir)/Make_global.am
sbin_PROGRAMS = ipset
-ipset_SOURCES = ipset.c \
- ipset_bitmap_ip.c \
- ipset_bitmap_ipmac.c \
- ipset_bitmap_port.c \
- ipset_hash_ip.c \
- ipset_hash_ipport.c \
- ipset_hash_ipportip.c \
- ipset_hash_ipportnet.c \
- ipset_hash_net.c \
- ipset_hash_netport.c \
- ipset_hash_netiface.c \
- ipset_list_set.c \
- ui.c
+ipset_SOURCES = ipset.c ui.c
ipset_LDADD = ../lib/libipset.la
AM_LDFLAGS = -static
diff --git a/src/ipset.c b/src/ipset.c
index e835f06..4a20ca1 100644
--- a/src/ipset.c
+++ b/src/ipset.c
@@ -33,22 +33,6 @@ static char cmdline[1024];
static char *newargv[255];
static int newargc;
-/* The known set types: (typename, revision, family) is unique */
-extern struct ipset_type ipset_bitmap_ip0;
-extern struct ipset_type ipset_bitmap_ipmac0;
-extern struct ipset_type ipset_bitmap_port0;
-extern struct ipset_type ipset_hash_ip0;
-extern struct ipset_type ipset_hash_net0;
-extern struct ipset_type ipset_hash_net1;
-extern struct ipset_type ipset_hash_netport1;
-extern struct ipset_type ipset_hash_netport2;
-extern struct ipset_type ipset_hash_netiface0;
-extern struct ipset_type ipset_hash_ipport1;
-extern struct ipset_type ipset_hash_ipportip1;
-extern struct ipset_type ipset_hash_ipportnet1;
-extern struct ipset_type ipset_hash_ipportnet2;
-extern struct ipset_type ipset_list_set0;
-
enum exittype {
NO_PROBLEM = 0,
OTHER_PROBLEM,
@@ -725,21 +709,8 @@ main(int argc, char *argv[])
{
int ret;
- /* Register types */
- ipset_type_add(&ipset_bitmap_ip0);
- ipset_type_add(&ipset_bitmap_ipmac0);
- ipset_type_add(&ipset_bitmap_port0);
- ipset_type_add(&ipset_hash_ip0);
- ipset_type_add(&ipset_hash_net0);
- ipset_type_add(&ipset_hash_net1);
- ipset_type_add(&ipset_hash_netport1);
- ipset_type_add(&ipset_hash_netport2);
- ipset_type_add(&ipset_hash_netiface0);
- ipset_type_add(&ipset_hash_ipport1);
- ipset_type_add(&ipset_hash_ipportip1);
- ipset_type_add(&ipset_hash_ipportnet1);
- ipset_type_add(&ipset_hash_ipportnet2);
- ipset_type_add(&ipset_list_set0);
+ /* Load set types */
+ ipset_load_types();
/* Initialize session */
session = ipset_session_init(printf);