+++ /dev/null
-SECTIONS {
- .rodata : {
- . = ALIGN(8);
- __madinit = . ;
- *( .mad.init )
- QUAD(0)
- *( .mad.exit )
- __madexit = . ;
- }
-}
LIBS = lib
TESTS = tst-trie
-lib_SOURCES = str.c buffer.c common.c epoll.c server.c trie.c file.c rbl.c
+lib_SOURCES = str.c buffer.c common.c server.c trie.c file.c rbl.c
tst-trie_SOURCES = tst-trie.c lib.a
all:
#include "common.h"
-sig_atomic_t sigint = false;
-sig_atomic_t sighup = false;
-
bool daemon_process = true;
int log_level = LOG_INFO;
bool log_syslog = false;
void common_sighandler(int sig)
{
switch (sig) {
- case SIGTERM:
- case SIGINT:
- sigint = true;
- return;
-
- case SIGHUP:
- sighup = true;
- return;
-
default:
err("Killed (got signal %d)...", sig);
exit(-1);
return EXIT_SUCCESS;
}
-extern initcall_t __madinit[];
-extern exitcall_t __madexit[];
+#include "array.h"
+
+ARRAY(exitcall_t)
+
+static A(exitcall_t) __exit = ARRAY_INIT;
+
+void common_register_exit(exitcall_t _exit)
+{
+ array_add(__exit, _exit);
+}
static void common_shutdown(void)
{
info("stopping...");
}
pidfile_close();
- for (int i = -1; __madexit[i]; i--) {
- (*__madexit[i])();
+ for (int i = array_len(__exit) - 1 ; i >= 0 ; --i) {
+ array_elt(__exit, i)();
}
+ array_wipe(__exit);
}
-static void __attribute__((__constructor__,__used__))
-common_initialize(void)
+void common_init(void)
{
+ static bool __ran = false;
+ if (__ran) {
+ return;
+ }
if (atexit(common_shutdown)) {
fputs("Cannot hook my atexit function, quitting !\n", stderr);
abort();
}
-
- for (int i = 0; __madinit[i]; i++) {
- if ((*__madinit[i])()) {
- exit(EXIT_FAILURE);
- }
- }
+ __ran = true;
}
typedef int (*initcall_t)(void);
typedef void (*exitcall_t)(void);
-#define __init __attribute__((__used__,__section__(".mad.init")))
-#define __exit __attribute__((__used__,__section__(".mad.exit")))
-
-#define module_init(fn) static __init initcall_t __init_##fn = fn;
-#define module_exit(fn) static __exit exitcall_t __exit_##fn = fn;
+void common_register_exit(exitcall_t _exit);
+void common_init(void);
+
+#define module_init(fn) \
+ __attribute__((constructor,used)) \
+ static void __init_wrapper__ ## fn (void) { \
+ common_init(); \
+ if (fn() != 0) { \
+ exit(-1); \
+ } \
+ }
+#define module_exit(fn) \
+ __attribute__((constructor,used)) \
+ static void __exit_wrapper ## fn(void) { \
+ common_init(); \
+ common_register_exit(fn); \
+ }
#define likely(expr) __builtin_expect((expr) != 0, 1)
#define unlikely(expr) __builtin_expect((expr) != 0, 0)
#define UNIXERR(fun) err("%s:%d:%s %s: %m", \
__FILE__, __LINE__, __func__, fun)
-extern sig_atomic_t sigint;
-extern sig_atomic_t sighup;
extern int log_level;
extern bool log_syslog;
static inline void common_startup(void)
{
signal(SIGPIPE, SIG_IGN);
- signal(SIGINT, &common_sighandler);
- signal(SIGTERM, &common_sighandler);
- signal(SIGHUP, &common_sighandler);
signal(SIGSEGV, &common_sighandler);
}
+++ /dev/null
-/******************************************************************************/
-/* pfixtools: a collection of postfix related tools */
-/* ~~~~~~~~~ */
-/* ________________________________________________________________________ */
-/* */
-/* Redistribution and use in source and binary forms, with or without */
-/* modification, are permitted provided that the following conditions */
-/* are met: */
-/* */
-/* 1. Redistributions of source code must retain the above copyright */
-/* notice, this list of conditions and the following disclaimer. */
-/* 2. Redistributions in binary form must reproduce the above copyright */
-/* notice, this list of conditions and the following disclaimer in the */
-/* documentation and/or other materials provided with the distribution. */
-/* 3. The names of its contributors may not be used to endorse or promote */
-/* products derived from this software without specific prior written */
-/* permission. */
-/* */
-/* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND */
-/* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE */
-/* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR */
-/* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS */
-/* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR */
-/* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF */
-/* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS */
-/* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN */
-/* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) */
-/* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF */
-/* THE POSSIBILITY OF SUCH DAMAGE. */
-/******************************************************************************/
-
-/*
- * Copyright © 2007 Pierre Habouzit
- */
-
-#include "epoll.h"
-
-static int epollfd = -1;
-
-static int epoll_initialize(void)
-{
- epollfd = epoll_create(128);
- return epollfd < 0 ? -1 : 0;
-}
-
-static void epoll_shutdown(void)
-{
- close(epollfd);
-}
-
-module_init(epoll_initialize);
-module_exit(epoll_shutdown);
-
-void epoll_register(int fd, uint32_t events, void *ptr)
-{
- struct epoll_event evt = { .events = events, .data.ptr = ptr };
- if (epoll_ctl(epollfd, EPOLL_CTL_ADD, fd, &evt)) {
- UNIXERR("epoll_ctl");
- abort();
- }
-}
-
-void epoll_modify(int fd, uint32_t events, void *ptr)
-{
- struct epoll_event evt = { .events = events, .data.ptr = ptr };
- if (epoll_ctl(epollfd, EPOLL_CTL_MOD, fd, &evt)) {
- UNIXERR("epoll_ctl");
- abort();
- }
-}
-
-void epoll_unregister(int fd)
-{
- if (epoll_ctl(epollfd, EPOLL_CTL_DEL, fd, NULL)) {
- UNIXERR("epoll_ctl");
- abort();
- }
-}
-
-int epoll_select(struct epoll_event *events, int maxevents, int timeout)
-{
- return epoll_wait(epollfd, events, maxevents, timeout);
-}
+++ /dev/null
-/******************************************************************************/
-/* pfixtools: a collection of postfix related tools */
-/* ~~~~~~~~~ */
-/* ________________________________________________________________________ */
-/* */
-/* Redistribution and use in source and binary forms, with or without */
-/* modification, are permitted provided that the following conditions */
-/* are met: */
-/* */
-/* 1. Redistributions of source code must retain the above copyright */
-/* notice, this list of conditions and the following disclaimer. */
-/* 2. Redistributions in binary form must reproduce the above copyright */
-/* notice, this list of conditions and the following disclaimer in the */
-/* documentation and/or other materials provided with the distribution. */
-/* 3. The names of its contributors may not be used to endorse or promote */
-/* products derived from this software without specific prior written */
-/* permission. */
-/* */
-/* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND */
-/* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE */
-/* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR */
-/* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS */
-/* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR */
-/* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF */
-/* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS */
-/* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN */
-/* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) */
-/* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF */
-/* THE POSSIBILITY OF SUCH DAMAGE. */
-/******************************************************************************/
-
-/*
- * Copyright © 2007 Pierre Habouzit
- */
-
-#ifndef PFIXTOOLS_EPOLL_H
-#define PFIXTOOLS_EPOLL_H
-
-#include <sys/epoll.h>
-#include "common.h"
-
-void epoll_register(int fd, uint32_t events, void *ptr);
-void epoll_modify(int fd, uint32_t events, void *ptr);
-void epoll_unregister(int fd);
-int epoll_select(struct epoll_event *events, int maxevents, int timeout);
-
-#endif
#include <unbound.h>
#include <netdb.h>
#include "array.h"
-#include "epoll.h"
#include "server.h"
#include "rbl.h"
{
int retval = 0;
debug("rbl_handler called: ub_fd triggered");
- epoll_modify(event->fd, 0, event);
+ server_none(event);
if ((retval = ub_process(ctx)) != 0) {
err("error in DNS resolution: %s", ub_strerror(retval));
}
- epoll_modify(event->fd, EPOLLIN, event);
+ server_ro(event);
return 0;
}
*/
#include "server.h"
-#include "epoll.h"
#include "common.h"
static PA(server_t) listeners = ARRAY_INIT;
static PA(server_t) server_pool = ARRAY_INIT;
+struct ev_loop *global_loop = NULL;
+static start_client_t client_start = NULL;
+static delete_client_t client_delete = NULL;
+static run_client_t client_run = NULL;
+static refresh_t config_refresh = NULL;
+static void *config_ptr = NULL;
+
static server_t* server_new(void)
{
server_t* server = p_new(server_t, 1);
static void server_wipe(server_t *server)
{
- server->listener = false;
if (server->fd >= 0) {
- epoll_unregister(server->fd);
+ ev_io_stop(global_loop, &server->io);
close(server->fd);
server->fd = -1;
}
}
}
-static void server_delete(server_t **server)
+void server_delete(server_t **server)
{
if (*server) {
buffer_wipe(&(*server)->ibuf);
array_add(server_pool, server);
}
+static int server_init(void)
+{
+ global_loop = ev_default_loop(0);
+ return 0;
+}
+
static void server_shutdown(void)
{
- printf("Server shutdown");
array_deep_wipe(listeners, server_delete);
array_deep_wipe(server_pool, server_delete);
}
-
+module_init(server_init);
module_exit(server_shutdown);
-int start_server(int port, start_listener_t starter, delete_client_t deleter)
+static void client_cb(EV_P_ struct ev_io *w, int events)
+{
+ server_t *server = (server_t*)w;
+
+ debug("Entering client_cb for %p, %d (%d | %d)", w, events, EV_WRITE, EV_READ);
+
+ if (events & EV_WRITE && server->obuf.len) {
+ if (buffer_write(&server->obuf, server->fd) < 0) {
+ server_release(server);
+ return;
+ }
+ if (!server->obuf.len) {
+ ev_io_set(&server->io, server->fd, EV_READ);
+ }
+ }
+
+ if (events & EV_READ) {
+ if (server->run(server, config_ptr) < 0) {
+ server_release(server);
+ return;
+ }
+ }
+}
+
+static int start_client(server_t *server, start_client_t starter,
+ run_client_t runner, delete_client_t deleter)
{
- struct sockaddr_in addr = {
- .sin_family = AF_INET,
- .sin_addr = { htonl(INADDR_LOOPBACK) },
- };
server_t *tmp;
void* data = NULL;
int sock;
- addr.sin_port = htons(port);
- sock = tcp_listen_nonblock((const struct sockaddr *)&addr, sizeof(addr));
+ sock = accept_nonblock(server->fd);
if (sock < 0) {
+ UNIXERR("accept");
return -1;
}
if (starter) {
- data = starter();
- if (data == NULL) {
- close(sock);
- return -1;
- }
+ data = starter(server);
+ if (data == NULL) {
+ close(sock);
+ return -1;
+ }
}
tmp = server_acquire();
tmp->fd = sock;
- tmp->listener = true;
tmp->data = data;
- tmp->run = NULL;
+ tmp->run = runner;
tmp->clear_data = deleter;
- epoll_register(sock, EPOLLIN, tmp);
- array_add(listeners, tmp);
+ ev_io_init(&tmp->io, client_cb, tmp->fd, EV_READ);
+ ev_io_start(global_loop, &tmp->io);
return 0;
}
-static int start_client(server_t *server, start_client_t starter,
- run_client_t runner, delete_client_t deleter)
+static void server_cb(EV_P_ struct ev_io *w, int events)
{
+ server_t *server = (server_t*)w;
+ if (start_client(server, client_start, client_run, client_delete) != 0) {
+ ev_unloop(EV_A_ EVUNLOOP_ALL);
+ }
+}
+
+int start_server(int port, start_listener_t starter, delete_client_t deleter)
+{
+ struct sockaddr_in addr = {
+ .sin_family = AF_INET,
+ .sin_addr = { htonl(INADDR_LOOPBACK) },
+ };
server_t *tmp;
void* data = NULL;
int sock;
- sock = accept_nonblock(server->fd);
+ addr.sin_port = htons(port);
+ sock = tcp_listen_nonblock((const struct sockaddr *)&addr, sizeof(addr));
if (sock < 0) {
- UNIXERR("accept");
return -1;
}
if (starter) {
- data = starter(server);
- if (data == NULL) {
- close(sock);
- return -1;
- }
+ data = starter();
+ if (data == NULL) {
+ close(sock);
+ return -1;
+ }
}
tmp = server_acquire();
- tmp->listener = false;
tmp->fd = sock;
tmp->data = data;
- tmp->run = runner;
+ tmp->run = NULL;
tmp->clear_data = deleter;
- epoll_register(sock, EPOLLIN, tmp);
+ ev_io_init(&tmp->io, server_cb, tmp->fd, EV_READ);
+ ev_io_start(global_loop, &tmp->io);
+ array_add(listeners, tmp);
return 0;
}
}
server_t *tmp = server_acquire();
- tmp->listener = false;
tmp->fd = fd;
tmp->data = data;
tmp->run = runner;
tmp->clear_data = NULL;
- epoll_register(fd, EPOLLIN, tmp);
+ ev_io_init(&tmp->io, client_cb, tmp->fd, EV_READ);
+ ev_io_start(global_loop, &tmp->io);
return tmp;
}
+static void refresh_cb(EV_P_ struct ev_signal *w, int event)
+{
+ if (!config_refresh(config_ptr)) {
+ ev_unloop(EV_A_ EVUNLOOP_ALL);
+ }
+}
+
+static void exit_cb(EV_P_ struct ev_signal *w, int event)
+{
+ ev_unloop(EV_A_ EVUNLOOP_ALL);
+}
+
int server_loop(start_client_t starter, delete_client_t deleter,
run_client_t runner, refresh_t refresh, void* config)
{
- info("entering processing loop");
- while (!sigint) {
- struct epoll_event evts[1024];
- int n;
-
- if (sighup && refresh) {
- sighup = false;
- info("refreshing...");
- if (!refresh(config)) {
- crit("error while refreshing configuration");
- return EXIT_FAILURE;
- }
- info("refresh done, processing loop restarts");
- }
+ struct ev_signal ev_sighup;
+ struct ev_signal ev_sigint;
+ struct ev_signal ev_sigterm;
- n = epoll_select(evts, countof(evts), -1);
- if (n < 0) {
- if (errno != EAGAIN && errno != EINTR) {
- UNIXERR("epoll_wait");
- return EXIT_FAILURE;
- }
- continue;
- }
+ client_start = starter;
+ client_delete = deleter;
+ client_run = runner;
+ config_refresh = refresh;
+ config_ptr = config;
- while (--n >= 0) {
- server_t *d = evts[n].data.ptr;
-
- if (d->listener) {
- (void)start_client(d, starter, runner, deleter);
- continue;
- }
-
- if ((evts[n].events & EPOLLOUT) && d->obuf.len) {
- if (buffer_write(&d->obuf, d->fd) < 0) {
- server_release(d);
- continue;
- }
- if (!d->obuf.len) {
- epoll_modify(d->fd, EPOLLIN, d);
- }
- }
-
- if (evts[n].events & EPOLLIN) {
- if (d->run(d, config) < 0) {
- server_release(d);
- }
- continue;
- }
- }
+ if (refresh != NULL) {
+ ev_signal_init(&ev_sighup, refresh_cb, SIGHUP);
+ ev_signal_start(global_loop, &ev_sighup);
}
+ ev_signal_init(&ev_sigint, exit_cb, SIGINT);
+ ev_signal_start(global_loop, &ev_sigint);
+ ev_signal_init(&ev_sigterm, exit_cb, SIGTERM);
+ ev_signal_start(global_loop, &ev_sigterm);
+
+ info("entering processing loop");
+ ev_loop(global_loop, 0);
info("exit requested");
return EXIT_SUCCESS;
}
#ifndef PFIXTOOLS_SERVER_H
#define PFIXTOOLS_SERVER_H
+#include <ev.h>
#include "buffer.h"
typedef struct server_t server_t;
-#define INVALID_EVENT (NULL)
-
typedef void *(*start_listener_t)(void);
typedef void (*delete_client_t)(void*);
typedef void *(*start_client_t)(server_t*);
typedef int (*run_client_t)(server_t*, void*);
typedef bool (*refresh_t)(void*);
-typedef bool (*event_handler_t)(server_t *, void*);
-struct server_t {
- unsigned listener : 1;
+extern struct ev_loop *global_loop;
+struct server_t {
+ struct ev_io io;
int fd;
buffer_t ibuf;
int start_server(int port, start_listener_t starter, delete_client_t deleter);
server_t *server_register(int fd, run_client_t runner, void *data);
+void server_delete(server_t **server);
void server_release(server_t *server);
+static inline void server_none(server_t *server)
+{
+ ev_io_stop(global_loop, &server->io);
+}
+
+static inline void server_rw(server_t *server)
+{
+ ev_io_stop(global_loop, &server->io);
+ ev_io_set(&server->io, server->fd, EV_READ | EV_WRITE);
+ ev_io_start(global_loop, &server->io);
+}
+
+static inline void server_ro(server_t *server)
+{
+ ev_io_stop(global_loop, &server->io);
+ ev_io_set(&server->io, server->fd, EV_READ);
+ ev_io_start(global_loop, &server->io);
+}
+
int server_loop(start_client_t starter, delete_client_t deleter,
run_client_t runner, refresh_t refresh, void *config);
# warn about undefined preprocessor identifiers
CFLAGS += -Wundef
# warn about local variable shadowing another local variable
-CFLAGS += -Wshadow
+#CFLAGS += -Wshadow
# warn about casting of pointers to increased alignment requirements
CFLAGS += -Wcast-align
# make string constants const
# warn about pointer arithmetic on void* and function pointers
CFLAGS += -Wpointer-arith
# warn about multiple declarations
-CFLAGS += -Wredundant-decls
+#CFLAGS += -Wredundant-decls
# warn if the format string is not a string literal
CFLAGS += -Wformat-nonliteral
# do not warn about zero-length formats.
include ../mk/cflags.mk
prefix ?= /usr/local
-LDFLAGS += -Wl,--warn-common
-CFLAGS += --std=gnu99 -D_GNU_SOURCE -I../ -I../common
+LDFLAGS += -L/opt/local/lib
+CFLAGS += --std=gnu99 -I../ -I../common -I/opt/local/include
INSTALL_PROGS = $(addprefix install-,$(PROGRAMS))
$(RM) $@
$(AR) rcs $@ $(filter %.o,$^)
-$(PROGRAMS) $(TESTS): $$(patsubst %.c,.%.o,$$($$@_SOURCES)) Makefile ../common.ld
- $(CC) -o $@ $(filter %.ld,$^) $(filter %.o,$^) $(LDFLAGS) $($@_LIBADD) $(filter %.a,$^)
+$(PROGRAMS) $(TESTS): $$(patsubst %.c,.%.o,$$($$@_SOURCES)) Makefile
+ $(CC) -o $@ $(filter %.o,$^) $(LDFLAGS) $($@_LIBADD) $(filter %.a,$^)
-include $(foreach p,$(PROGRAMS) $(TESTS),$(patsubst %.c,.%.dep,$(filter %.c,$($p_SOURCES))))
PROGRAMS = pfix-srsd
pfix-srsd_SOURCES = main-srsd.c ../common/lib.a
-pfix-srsd_LIBADD = -lsrs2
+pfix-srsd_LIBADD = -lsrs2 -lev
all:
#include <srs2.h>
-#include "epoll.h"
#include "mem.h"
#include "buffer.h"
#include "server.h"
return -1;
}
if (srsd->obuf.len) {
- epoll_modify(srsd->fd, EPOLLIN | EPOLLOUT, srsd);
+ server_rw(srsd);
}
return 0;
}
buffer_consume(&srsd->ibuf, nl - srsd->ibuf.data);
}
if (srsd->obuf.len) {
- epoll_modify(srsd->fd, EPOLLIN | EPOLLOUT, srsd);
+ server_rw(srsd);
}
return 0;
}
FILTERS = iplist.c greylist.c strlist.c match.c counters.c
postlicyd_SOURCES = main-postlicyd.c ../common/lib.a filter.c config.c query.c $(FILTERS) $(GENERATED)
-postlicyd_LIBADD = $(UB_LIBS) $(TC_LIBS)
+postlicyd_LIBADD = $(UB_LIBS) $(TC_LIBS) -lev
tst-rbl_SOURCES = tst-rbl.c ../common/lib.a filter.c config.c query.c iplist.c $(GENERATED)
const char *value, int value_len)
{
filter_hook_t hook;
+ hook.filter_id = -1;
hook.type = hook_tokenize(name, name_len);
if (hook.type == HTK_UNKNOWN) {
err("unknown hook type %.*s", name_len, name);
/* Value format is (counter:id:incr)?(postfix:reply|filter_name)
*/
+ hook.value = NULL;
if (strncmp(value, "counter:", 8) == 0) {
char *end = NULL;
value += 8;
return false;
}
hook.value = m_strdup(hook.postfix ? value + 8 : value);
- hook.filter_id = -1;
array_add(filter->hooks, hook);
return true;
}
#include "buffer.h"
#include "common.h"
-#include "epoll.h"
#include "policy_tokens.h"
#include "server.h"
#include "config.h"
DECLARE_MAIN
-static config_t *config = NULL;
-
+static config_t *config = NULL;
+static bool refresh = false;
+static PA(server_t) busy = ARRAY_INIT;
static void *query_starter(server_t* server)
{
static bool config_refresh(void *mconfig)
{
+ refresh = true;
if (filter_running > 0) {
- sighup = true;
- sleep(1);
return true;
}
- return config_reload(mconfig);
+ bool ret = config_reload(mconfig);
+ foreach (server_t **server, busy) {
+ server_ro(*server);
+ }}
+ array_len(busy) = 0;
+ refresh = false;
+ return ret;
}
static void policy_answer(server_t *pcy, const char *message)
}
buffer_addstr(&pcy->obuf, "\n\n");
buffer_consume(&pcy->ibuf, query->eoq - pcy->ibuf.data);
- epoll_modify(pcy->fd, EPOLLIN | EPOLLOUT, pcy);
+ server_rw(pcy);
}
static const filter_t *next_filter(server_t *pcy, const filter_t *filter,
static int policy_run(server_t *pcy, void* vconfig)
{
- if (sighup) {
+ if (refresh) {
+ array_add(busy, pcy);
return 0;
}
filter_context_clean(&context->context);
m_strcat(context->context.instance, 64, query->instance);
}
- epoll_modify(pcy->fd, 0, pcy);
+ server_none(pcy);
return policy_process(pcy, mconfig) ? 0 : -1;
}
if (!ok) {
server_release(server);
}
+ if (refresh && filter_running == 0) {
+ config_refresh(config);
+ }
}
static int postlicyd_init(void)
filter_async_handler_register(policy_async_handler);
return 0;
}
+
+static void postlicyd_shutdown(void)
+{
+ array_deep_wipe(busy, server_delete);
+}
module_init(postlicyd_init);
+module_exit(postlicyd_shutdown);
int start_listener(int port)
{