summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--accel-pptpd/cli/cli.c4
-rw-r--r--accel-pptpd/cli/std_cmd.c29
-rw-r--r--accel-pptpd/cli/telnet.c2
-rw-r--r--accel-pptpd/ctrl/l2tp/l2tp.c31
-rw-r--r--accel-pptpd/ctrl/pptp/pptp.c41
-rw-r--r--accel-pptpd/extra/chap-secrets.c18
-rw-r--r--accel-pptpd/extra/pppd_compat.c17
-rw-r--r--accel-pptpd/extra/shaper_tbf.c14
-rw-r--r--accel-pptpd/include/events.h1
-rw-r--r--accel-pptpd/log.c37
-rw-r--r--accel-pptpd/logs/log_file.c5
-rw-r--r--accel-pptpd/logs/log_pgsql.c4
-rw-r--r--accel-pptpd/main.c20
-rw-r--r--accel-pptpd/memdebug.c4
-rw-r--r--accel-pptpd/ppp/lcp_opt_mru.c14
-rw-r--r--accel-pptpd/ppp/ppp.c25
-rw-r--r--accel-pptpd/ppp/ppp_ccp.c13
-rw-r--r--accel-pptpd/ppp/ppp_fsm.c9
-rw-r--r--accel-pptpd/ppp/ppp_lcp.c14
-rw-r--r--accel-pptpd/radius/dm_coa.c2
-rw-r--r--accel-pptpd/radius/radius.c71
-rw-r--r--accel-pptpd/radius/radius_p.h8
-rw-r--r--accel-pptpd/radius/req.c8
-rw-r--r--accel-pptpd/triton/conf_file.c91
-rw-r--r--accel-pptpd/triton/triton.c61
-rw-r--r--accel-pptpd/triton/triton.h5
-rw-r--r--accel-pptpd/triton/triton_p.h1
27 files changed, 413 insertions, 136 deletions
diff --git a/accel-pptpd/cli/cli.c b/accel-pptpd/cli/cli.c
index 534c2c8..b8f82c8 100644
--- a/accel-pptpd/cli/cli.c
+++ b/accel-pptpd/cli/cli.c
@@ -9,6 +9,8 @@
#include "cli_p.h"
#include "log.h"
+#include "memdebug.h"
+
#define MAX_CMD_ITEMS 100
#define MSG_SYNTAX_ERROR "syntax error\r\n"
#define MSG_INVAL_ERROR "invalid argument\r\n"
@@ -201,5 +203,5 @@ static void __init init(void)
conf_cli_passwd = conf_get_opt("cli", "passwd");
opt = conf_get_opt("cli", "prompt");
if (opt)
- conf_cli_prompt = opt;
+ conf_cli_prompt = _strdup(opt);
}
diff --git a/accel-pptpd/cli/std_cmd.c b/accel-pptpd/cli/std_cmd.c
index a5cfd38..3563db9 100644
--- a/accel-pptpd/cli/std_cmd.c
+++ b/accel-pptpd/cli/std_cmd.c
@@ -450,11 +450,40 @@ static int shutdown_exec(const char *cmd, char * const *f, int f_cnt, void *cli)
return CLI_CMD_OK;
}
+//==========================
+static int conf_reload_res;
+static struct triton_context_t *conf_reload_ctx;
+static void conf_reload_notify(int r)
+{
+ if (!r)
+ triton_event_fire(EV_CONFIG_RELOAD, NULL);
+ conf_reload_res = r;
+ triton_context_wakeup(conf_reload_ctx);
+}
+static int reload_exec(const char *cmd, char * const *f, int f_cnt, void *cli)
+{
+ if (f_cnt == 1) {
+ conf_reload_ctx = triton_context_self();
+ triton_conf_reload(conf_reload_notify);
+ triton_context_schedule();
+ if (conf_reload_res)
+ cli_send(cli, "failed\r\n");
+ return CLI_CMD_OK;
+ } else
+ return CLI_CMD_SYNTAX;
+}
+
+static void reload_help(char * const *fields, int fields_cnt, void *client)
+{
+ cli_send(client, "reload - reload config file\r\n");
+}
+
static void __init init(void)
{
cli_register_simple_cmd2(show_stat_exec, show_stat_help, 2, "show", "stat");
cli_register_simple_cmd2(show_ses_exec, show_ses_help, 2, "show", "sessions");
cli_register_simple_cmd2(terminate_exec, terminate_help, 1, "terminate");
+ cli_register_simple_cmd2(reload_exec, reload_help, 1, "reload");
cli_register_simple_cmd2(shutdown_exec, shutdown_help, 1, "shutdown");
cli_register_simple_cmd2(exit_exec, exit_help, 1, "exit");
}
diff --git a/accel-pptpd/cli/telnet.c b/accel-pptpd/cli/telnet.c
index 35af316..b191864 100644
--- a/accel-pptpd/cli/telnet.c
+++ b/accel-pptpd/cli/telnet.c
@@ -735,7 +735,7 @@ static void __init init(void)
opt = conf_get_opt("cli", "history-file");
if (opt)
- conf_history_file = opt;
+ conf_history_file = _strdup(opt);
recv_buf = malloc(RECV_BUF_SIZE);
temp_buf = malloc(RECV_BUF_SIZE);
diff --git a/accel-pptpd/ctrl/l2tp/l2tp.c b/accel-pptpd/ctrl/l2tp/l2tp.c
index 4c21af4..ca56051 100644
--- a/accel-pptpd/ctrl/l2tp/l2tp.c
+++ b/accel-pptpd/ctrl/l2tp/l2tp.c
@@ -48,7 +48,7 @@ int conf_timeout = 60;
int conf_rtimeout = 5;
int conf_retransmit = 5;
int conf_hello_interval = 60;
-const char *conf_host_name = "accel-pptp";
+char *conf_host_name = NULL;
static unsigned int stat_active;
static unsigned int stat_starting;
@@ -504,7 +504,7 @@ static void l2tp_send_SCCRP(struct l2tp_conn_t *conn)
if (l2tp_packet_add_int16(pack, Protocol_Version, L2TP_V2_PROTOCOL_VERSION, 1))
goto out_err;
- if (l2tp_packet_add_string(pack, Host_Name, conf_host_name, 1))
+ if (conf_host_name && l2tp_packet_add_string(pack, Host_Name, conf_host_name, 1))
goto out_err;
if (l2tp_packet_add_int32(pack, Framing_Capabilities, conn->framing_cap, 1))
goto out_err;
@@ -1090,15 +1090,10 @@ static int show_stat_exec(const char *cmd, char * const *fields, int fields_cnt,
return CLI_CMD_OK;
}
-static void __init l2tp_init(void)
+static void load_config(void)
{
char *opt;
- l2tp_conn = malloc(L2TP_MAX_TID * sizeof(void *));
- memset(l2tp_conn, 0, L2TP_MAX_TID * sizeof(void *));
-
- l2tp_conn_pool = mempool_create(sizeof(struct l2tp_conn_t));
-
opt = conf_get_opt("l2tp", "verbose");
if (opt && atoi(opt) > 0)
conf_verbose = 1;
@@ -1119,12 +1114,28 @@ static void __init l2tp_init(void)
if (opt && atoi(opt) > 0)
conf_retransmit = atoi(opt);
+ if (conf_host_name)
+ _free(conf_host_name);
opt = conf_get_opt("l2tp", "host-name");
- if (opt && atoi(opt) > 0)
- conf_host_name = opt;
+ if (opt)
+ conf_host_name = _strdup(opt);
+ else
+ conf_host_name = NULL;
+}
+
+static void __init l2tp_init(void)
+{
+ l2tp_conn = malloc(L2TP_MAX_TID * sizeof(void *));
+ memset(l2tp_conn, 0, L2TP_MAX_TID * sizeof(void *));
+
+ l2tp_conn_pool = mempool_create(sizeof(struct l2tp_conn_t));
+
+ load_config();
start_udp_server();
cli_register_simple_cmd2(&show_stat_exec, NULL, 2, "show", "stat");
+
+ triton_event_register_handler(EV_CONFIG_RELOAD, (triton_event_func)load_config);
}
diff --git a/accel-pptpd/ctrl/pptp/pptp.c b/accel-pptpd/ctrl/pptp/pptp.c
index 0b92474..687aecb 100644
--- a/accel-pptpd/ctrl/pptp/pptp.c
+++ b/accel-pptpd/ctrl/pptp/pptp.c
@@ -700,6 +700,27 @@ static int show_stat_exec(const char *cmd, char * const *fields, int fields_cnt,
return CLI_CMD_OK;
}
+static void load_config(void)
+{
+ char *opt;
+
+ opt = conf_get_opt("pptp", "timeout");
+ if (opt && atoi(opt) > 0)
+ conf_timeout = atoi(opt);
+
+ opt = conf_get_opt("pptp", "echo-interval");
+ if (opt && atoi(opt) >= 0)
+ conf_echo_interval = atoi(opt);
+
+ opt = conf_get_opt("pptp", "echo-failure");
+ if (opt && atoi(opt) > 0)
+ conf_echo_failure = atoi(opt);
+
+ opt = conf_get_opt("pptp", "verbose");
+ if (opt && atoi(opt) > 0)
+ conf_verbose = 1;
+}
+
static void __init pptp_init(void)
{
struct sockaddr_in addr;
@@ -738,29 +759,17 @@ static void __init pptp_init(void)
return;
}
- opt = conf_get_opt("pptp", "timeout");
- if (opt && atoi(opt) > 0)
- conf_timeout = atoi(opt);
-
- opt = conf_get_opt("pptp", "echo-interval");
- if (opt && atoi(opt) >= 0)
- conf_echo_interval = atoi(opt);
-
- opt = conf_get_opt("pptp", "echo-failure");
- if (opt && atoi(opt) > 0)
- conf_echo_failure = atoi(opt);
-
- opt = conf_get_opt("pptp", "verbose");
- if (opt && atoi(opt) > 0)
- conf_verbose = 1;
-
conn_pool = mempool_create(sizeof(struct pptp_conn_t));
+ load_config();
+
triton_context_register(&serv.ctx, NULL);
triton_md_register_handler(&serv.ctx, &serv.hnd);
triton_md_enable_handler(&serv.hnd, MD_MODE_READ);
triton_context_wakeup(&serv.ctx);
cli_register_simple_cmd2(show_stat_exec, NULL, 2, "show", "stat");
+
+ triton_event_register_handler(EV_CONFIG_RELOAD, (triton_event_func)load_config);
}
diff --git a/accel-pptpd/extra/chap-secrets.c b/accel-pptpd/extra/chap-secrets.c
index 410b4e8..8983f90 100644
--- a/accel-pptpd/extra/chap-secrets.c
+++ b/accel-pptpd/extra/chap-secrets.c
@@ -13,7 +13,8 @@
#include "memdebug.h"
-static const char *conf_chap_secrets = "/etc/ppp/chap-secrets";
+static char *def_chap_secrets = "/etc/ppp/chap-secrets";
+static char *conf_chap_secrets;
static in_addr_t conf_gw_ip_address = 0;
static void *pd_key;
@@ -220,21 +221,32 @@ static struct pwdb_t pwdb = {
.get_passwd = get_passwd,
};
-static void __init init(void)
+static void load_config(void)
{
const char *opt;
+ if (conf_chap_secrets && conf_chap_secrets != def_chap_secrets)
+ _free(conf_chap_secrets);
opt = conf_get_opt("chap-secrets", "chap-secrets");
if (opt)
- conf_chap_secrets = opt;
+ conf_chap_secrets = _strdup(opt);
+ else
+ conf_chap_secrets = def_chap_secrets;
opt = conf_get_opt("chap-secrets", "gw-ip-address");
if (opt)
conf_gw_ip_address = inet_addr(opt);
+}
+
+static void __init init(void)
+{
+ load_config();
pwdb_register(&pwdb);
ipdb_register(&ipdb);
triton_event_register_handler(EV_PPP_FINISHED, (triton_event_func)ev_ppp_finished);
triton_event_register_handler(EV_PPP_PRE_UP, (triton_event_func)ev_ppp_pre_up);
+ triton_event_register_handler(EV_CONFIG_RELOAD, (triton_event_func)load_config);
}
+
diff --git a/accel-pptpd/extra/pppd_compat.c b/accel-pptpd/extra/pppd_compat.c
index 3a28c93..f6e85b0 100644
--- a/accel-pptpd/extra/pppd_compat.c
+++ b/accel-pptpd/extra/pppd_compat.c
@@ -151,7 +151,7 @@ static void ev_ppp_pre_up(struct ppp_t *ppp)
if (conf_verbose)
log_ppp_info2("pppd_compat: ip-pre-up started (pid %i)\n", pid);
sigchld_unlock();
- triton_context_schedule(pd->ppp->ctrl->ctx);
+ triton_context_schedule();
pthread_mutex_lock(&pd->ip_pre_up_hnd.lock);
pthread_mutex_unlock(&pd->ip_pre_up_hnd.lock);
if (pd->res != 0) {
@@ -274,7 +274,7 @@ static void ev_ppp_finished(struct ppp_t *ppp)
if (conf_verbose)
log_ppp_info2("pppd_compat: ip-down started (pid %i)\n", pid);
sigchld_unlock();
- triton_context_schedule(pd->ppp->ctrl->ctx);
+ triton_context_schedule();
pthread_mutex_lock(&pd->ip_down_hnd.lock);
pthread_mutex_unlock(&pd->ip_down_hnd.lock);
} else if (pid == 0) {
@@ -344,7 +344,7 @@ static void ev_radius_coa(struct ev_radius_t *ev)
sigchld_unlock();
if (conf_verbose)
log_ppp_info2("pppd_compat: ip-change started (pid %i)\n", pid);
- triton_context_schedule(pd->ppp->ctrl->ctx);
+ triton_context_schedule();
if (!ev->res)
ev->res = pd->res;
} else if (pid == 0) {
@@ -490,23 +490,23 @@ static void __init init(void)
opt = conf_get_opt("pppd-compat", "ip-pre-up");
if (opt)
- conf_ip_pre_up = opt;
+ conf_ip_pre_up = _strdup(opt);
opt = conf_get_opt("pppd-compat", "ip-up");
if (opt)
- conf_ip_up = opt;
+ conf_ip_up = _strdup(opt);
opt = conf_get_opt("pppd-compat", "ip-down");
if (opt)
- conf_ip_down = opt;
+ conf_ip_down = _strdup(opt);
opt = conf_get_opt("pppd-compat", "ip-change");
if (opt)
- conf_ip_change = opt;
+ conf_ip_change = _strdup(opt);
opt = conf_get_opt("pppd-compat", "radattr-prefix");
if (opt)
- conf_radattr_prefix = opt;
+ conf_radattr_prefix = _strdup(opt);
opt = conf_get_opt("pppd-compat", "verbose");
if (opt && atoi(opt) > 0)
@@ -522,4 +522,3 @@ static void __init init(void)
triton_event_register_handler(EV_RADIUS_COA, (triton_event_func)ev_radius_coa);
#endif
}
-
diff --git a/accel-pptpd/extra/shaper_tbf.c b/accel-pptpd/extra/shaper_tbf.c
index 965fd16..d974bda 100644
--- a/accel-pptpd/extra/shaper_tbf.c
+++ b/accel-pptpd/extra/shaper_tbf.c
@@ -897,13 +897,10 @@ static int parse_vendor_opt(const char *opt)
}
#endif
-static void __init init(void)
+void load_config(void)
{
const char *opt;
- if (clock_init())
- return;
-
#ifdef RADIUS
opt = conf_get_opt("tbf", "vendor");
if (opt)
@@ -954,6 +951,14 @@ static void __init init(void)
opt = conf_get_opt("tbf", "verbose");
if (opt && atoi(opt) > 0)
conf_verbose = 1;
+}
+
+static void __init init(void)
+{
+ if (clock_init())
+ return;
+
+ load_config();
#ifdef RADIUS
triton_event_register_handler(EV_RADIUS_ACCESS_ACCEPT, (triton_event_func)ev_radius_access_accept);
@@ -961,6 +966,7 @@ static void __init init(void)
#endif
triton_event_register_handler(EV_CTRL_FINISHED, (triton_event_func)ev_ctrl_finished);
triton_event_register_handler(EV_SHAPER, (triton_event_func)ev_shaper);
+ triton_event_register_handler(EV_CONFIG_RELOAD, (triton_event_func)load_config);
cli_register_simple_cmd2(shaper_change_exec, shaper_change_help, 2, "shaper", "change");
cli_register_simple_cmd2(shaper_restore_exec, shaper_restore_help, 2, "shaper", "restore");
diff --git a/accel-pptpd/include/events.h b/accel-pptpd/include/events.h
index 5958f27..6a8caf0 100644
--- a/accel-pptpd/include/events.h
+++ b/accel-pptpd/include/events.h
@@ -13,6 +13,7 @@
#define EV_CTRL_FINISHED 8
#define EV_PPP_PRE_UP 9
#define EV_PPP_ACCT_START 10
+#define EV_CONFIG_RELOAD 11
#define EV_IP_CHANGED 100
#define EV_SHAPER 101
#define EV_MPPE_KEYS 102
diff --git a/accel-pptpd/log.c b/accel-pptpd/log.c
index 5fbd93a..6994d86 100644
--- a/accel-pptpd/log.c
+++ b/accel-pptpd/log.c
@@ -447,13 +447,10 @@ static void sighup(int n)
t->reopen();
}
-static void __init log_init(void)
+static void load_config(void)
{
char *opt;
- struct sigaction sa = {
- .sa_handler = sighup,
- };
-
+ FILE *f;
opt = conf_get_opt("log", "level");
if (opt && atoi(opt) >= 0)
@@ -461,23 +458,45 @@ static void __init log_init(void)
opt = conf_get_opt("log", "log-emerg");
if (opt) {
- emerg_file = fopen(opt, "a");
+ if (emerg_file)
+ emerg_file = freopen(opt, "a", emerg_file);
+ else
+ emerg_file = fopen(opt, "a");
if (!emerg_file)
fprintf(stderr, "log:open: %s\n", strerror(errno));
+ } else if (emerg_file) {
+ fclose(emerg_file);
+ emerg_file = NULL;
}
opt = conf_get_opt("log", "log-debug");
if (opt) {
- debug_file = fopen(opt, "a");
- if (!emerg_file)
+ if (debug_file)
+ debug_file = freopen(opt, "a", debug_file);
+ else
+ debug_file = fopen(opt, "a");
+ if (!debug_file)
fprintf(stderr, "log:open: %s\n", strerror(errno));
+ } else if (debug_file) {
+ fclose(debug_file);
+ debug_file = NULL;
}
+}
+
+static void __init log_init(void)
+{
+ struct sigaction sa = {
+ .sa_handler = sighup,
+ };
msg_pool = mempool_create(sizeof(struct log_msg_t));
_msg_pool = mempool_create(sizeof(struct _log_msg_t));
chunk_pool = mempool_create(sizeof(struct log_chunk_t) + LOG_CHUNK_SIZE + 1);
- sigaction(SIGHUP, &sa, NULL);
+ load_config();
+ triton_event_register_handler(EV_CONFIG_RELOAD, (triton_event_func)load_config);
+
+ sigaction(SIGHUP, &sa, NULL);
}
diff --git a/accel-pptpd/logs/log_file.c b/accel-pptpd/logs/log_file.c
index c559d4d..08a6053 100644
--- a/accel-pptpd/logs/log_file.c
+++ b/accel-pptpd/logs/log_file.c
@@ -583,11 +583,11 @@ static void __init init(void)
opt = conf_get_opt("log", "per-user-dir");
if (opt)
- conf_per_user_dir = opt;
+ conf_per_user_dir = _strdup(opt);
opt = conf_get_opt("log", "per-session-dir");
if (opt)
- conf_per_session_dir = opt;
+ conf_per_session_dir = _strdup(opt);
opt = conf_get_opt("log", "per-session");
if (opt && atoi(opt) > 0)
@@ -610,4 +610,3 @@ static void __init init(void)
triton_event_register_handler(EV_PPP_STARTING, (triton_event_func)ev_ppp_starting);
triton_event_register_handler(EV_PPP_AUTHORIZED, (triton_event_func)ev_ppp_authorized);
}
-
diff --git a/accel-pptpd/logs/log_pgsql.c b/accel-pptpd/logs/log_pgsql.c
index fcaa193..af67e0b 100644
--- a/accel-pptpd/logs/log_pgsql.c
+++ b/accel-pptpd/logs/log_pgsql.c
@@ -287,7 +287,7 @@ static void __init init(void)
opt = conf_get_opt("log-pgsql", "conninfo");
if (!opt)
return;
- conf_conninfo = opt;
+ conf_conninfo = _strdup(opt);
opt = conf_get_opt("log-pgsql", "connect-inteval");
if (opt && atoi(opt) > 0)
@@ -295,7 +295,7 @@ static void __init init(void)
opt = conf_get_opt("log-pgsql", "log-query");
if (opt)
- conf_query = opt;
+ conf_query = _strdup(opt);
else {
opt = conf_get_opt("log-pgsql", "log-table");
if (!opt || strlen(opt) > 32)
diff --git a/accel-pptpd/main.c b/accel-pptpd/main.c
index 71083a2..5a02685 100644
--- a/accel-pptpd/main.c
+++ b/accel-pptpd/main.c
@@ -12,6 +12,7 @@
#include "memdebug.h"
#include "log.h"
+#include "events.h"
static int goto_daemon;
static char *pid_file;
@@ -103,6 +104,16 @@ static void change_limits(void)
log_emerg("main: failed to open '/proc/sys/fs/file-max': %s\n", strerror(errno));
}
+static void config_reload_notify(int r)
+{
+ if (!r)
+ triton_event_fire(EV_CONFIG_RELOAD, NULL);
+}
+static void config_reload(int num)
+{
+ triton_conf_reload(config_reload_notify);
+}
+
int main(int argc, char **argv)
{
sigset_t set;
@@ -150,6 +161,14 @@ int main(int argc, char **argv)
triton_run();
sigfillset(&set);
+
+ struct sigaction sa = {
+ .sa_handler = config_reload,
+ .sa_mask = set,
+ };
+
+ sigaction(SIGUSR1, &sa, NULL);
+
sigdelset(&set, SIGKILL);
sigdelset(&set, SIGSTOP);
sigdelset(&set, SIGSEGV);
@@ -159,6 +178,7 @@ int main(int argc, char **argv)
sigdelset(&set, SIGHUP);
sigdelset(&set, SIGIO);
sigdelset(&set, SIGINT);
+ sigdelset(&set, SIGUSR1);
sigdelset(&set, 35);
sigdelset(&set, 36);
pthread_sigmask(SIG_SETMASK, &set, NULL);
diff --git a/accel-pptpd/memdebug.c b/accel-pptpd/memdebug.c
index c443ec1..c33e34b 100644
--- a/accel-pptpd/memdebug.c
+++ b/accel-pptpd/memdebug.c
@@ -44,6 +44,10 @@ static spinlock_t mem_list_lock = SPINLOCK_INITIALIZER;
struct mem_t *_md_malloc(size_t size, const char *fname, int line)
{
struct mem_t *mem = malloc(sizeof(*mem) + size + 8);
+
+ if (size > 4096)
+ line = 0;
+
strcpy(mem->fname, fname);
mem->line = line;
mem->size = size;
diff --git a/accel-pptpd/ppp/lcp_opt_mru.c b/accel-pptpd/ppp/lcp_opt_mru.c
index 6a8c430..78e06b5 100644
--- a/accel-pptpd/ppp/lcp_opt_mru.c
+++ b/accel-pptpd/ppp/lcp_opt_mru.c
@@ -11,6 +11,7 @@
#include "ppp.h"
#include "ppp_lcp.h"
#include "log.h"
+#include "events.h"
#include "memdebug.h"
@@ -149,7 +150,7 @@ static void mru_print(void (*print)(const char *fmt,...), struct lcp_option_t *o
print("<mru %i>",mru_opt->mru);
}
-static void __init mru_opt_init()
+static void load_config(void)
{
char *opt;
@@ -171,19 +172,24 @@ static void __init mru_opt_init()
if (conf_min_mtu > conf_mru) {
log_emerg("min-mtu cann't be greater then mtu/mru\n");
- _exit(-1);
+ conf_min_mtu = conf_mru;
}
if (conf_min_mtu > 1500) {
log_emerg("min-mtu cann't be greater then 1500\n");
- _exit(-1);
+ conf_min_mtu = 1500;
}
if (conf_mru > 1500 || conf_mtu > 1500) {
log_emerg("mtu/mru cann't be greater then 1500\n");
- _exit(-1);
+ conf_mru = 1500;
}
+}
+static void __init mru_opt_init()
+{
+ load_config();
lcp_option_register(&mru_opt_hnd);
+ triton_event_register_handler(EV_CONFIG_RELOAD, (triton_event_func)load_config);
}
diff --git a/accel-pptpd/ppp/ppp.c b/accel-pptpd/ppp/ppp.c
index 1489898..6cf1c72 100644
--- a/accel-pptpd/ppp/ppp.c
+++ b/accel-pptpd/ppp/ppp.c
@@ -634,16 +634,9 @@ static void save_seq(void)
}
}
-static void __init init(void)
+static void load_config(void)
{
char *opt;
- FILE *f;
-
- sock_fd = socket(AF_INET, SOCK_DGRAM, 0);
- if (sock_fd < 0) {
- perror("socket");
- _exit(EXIT_FAILURE);
- }
opt = conf_get_opt("ppp", "verbose");
if (opt && atoi(opt) > 0)
@@ -656,6 +649,18 @@ static void __init init(void)
else if (strcmp(opt, "lower"))
log_emerg("ppp: sid-case: invalid format\n");
}
+}
+
+static void __init init(void)
+{
+ char *opt;
+ FILE *f;
+
+ sock_fd = socket(AF_INET, SOCK_DGRAM, 0);
+ if (sock_fd < 0) {
+ perror("socket");
+ _exit(EXIT_FAILURE);
+ }
opt = conf_get_opt("ppp", "seq-file");
if (!opt)
@@ -666,9 +671,11 @@ static void __init init(void)
fscanf(f, "%llu", &seq);
fclose(f);
} else
- //log_emerg("ppp: failed to open seq-file (%s): %s\n", opt, strerror(errno));
seq = (unsigned long long)random() * (unsigned long long)random();
+ load_config();
+ triton_event_register_handler(EV_CONFIG_RELOAD, (triton_event_func)load_config);
+
atexit(save_seq);
}
diff --git a/accel-pptpd/ppp/ppp_ccp.c b/accel-pptpd/ppp/ppp_ccp.c
index e5b183d..721dd9b 100644
--- a/accel-pptpd/ppp/ppp_ccp.c
+++ b/accel-pptpd/ppp/ppp_ccp.c
@@ -8,6 +8,7 @@
#include "triton.h"
#include "log.h"
+#include "events.h"
#include "ppp.h"
#include "ppp_ccp.h"
@@ -739,14 +740,20 @@ static struct ppp_layer_t ccp_layer=
.free = ccp_layer_free,
};
-static void __init ccp_init(void)
+static void load_config(void)
{
const char *opt;
- ppp_register_layer("ccp", &ccp_layer);
-
opt = conf_get_opt("ppp", "ccp");
if (opt && atoi(opt) >= 0)
conf_ccp = atoi(opt);
}
+static void __init ccp_init(void)
+{
+ ppp_register_layer("ccp", &ccp_layer);
+
+ load_config();
+ triton_event_register_handler(EV_CONFIG_RELOAD, (triton_event_func)load_config);
+}
+
diff --git a/accel-pptpd/ppp/ppp_fsm.c b/accel-pptpd/ppp/ppp_fsm.c
index 6daf42c..c6bc430 100644
--- a/accel-pptpd/ppp/ppp_fsm.c
+++ b/accel-pptpd/ppp/ppp_fsm.c
@@ -7,6 +7,7 @@
#include "ppp_fsm.h"
#include "ppp_lcp.h"
#include "log.h"
+#include "events.h"
#include "memdebug.h"
@@ -514,7 +515,7 @@ static void restart_timer_func(struct triton_timer_t *t)
ppp_fsm_timeout1(layer);
}
-void __init fsm_init(void)
+static void load_config(void)
{
char *opt;
@@ -535,3 +536,9 @@ void __init fsm_init(void)
conf_timeout = atoi(opt);
}
+void __init fsm_init(void)
+{
+ load_config();
+ triton_event_register_handler(EV_CONFIG_RELOAD, (triton_event_func)load_config);
+}
+
diff --git a/accel-pptpd/ppp/ppp_lcp.c b/accel-pptpd/ppp/ppp_lcp.c
index 0b5a517..e40e321 100644
--- a/accel-pptpd/ppp/ppp_lcp.c
+++ b/accel-pptpd/ppp/ppp_lcp.c
@@ -10,6 +10,7 @@
#include "ppp.h"
#include "ppp_lcp.h"
+#include "events.h"
#include "memdebug.h"
@@ -822,12 +823,10 @@ static struct ppp_layer_t lcp_layer=
.free = lcp_layer_free,
};
-static void __init lcp_init(void)
+static void load_config(void)
{
char *opt;
- ppp_register_layer("lcp", &lcp_layer);
-
opt = conf_get_opt("lcp", "echo-interval");
if (opt && atoi(opt) > 0)
conf_echo_interval = atoi(opt);
@@ -837,3 +836,12 @@ static void __init lcp_init(void)
conf_echo_failure = atoi(opt);
}
+static void __init lcp_init(void)
+{
+ load_config();
+
+ ppp_register_layer("lcp", &lcp_layer);
+
+ triton_event_register_handler(EV_CONFIG_RELOAD, (triton_event_func)load_config);
+}
+
diff --git a/accel-pptpd/radius/dm_coa.c b/accel-pptpd/radius/dm_coa.c
index d78f91a..baf51b5 100644
--- a/accel-pptpd/radius/dm_coa.c
+++ b/accel-pptpd/radius/dm_coa.c
@@ -273,7 +273,7 @@ static void __init init(void)
addr.sin_family = AF_INET;
addr.sin_port = htons (conf_dm_coa_port);
if (conf_dm_coa_server)
- addr.sin_addr.s_addr = inet_addr(conf_dm_coa_server);
+ addr.sin_addr.s_addr = conf_dm_coa_server;
else
addr.sin_addr.s_addr = htonl (INADDR_ANY);
if (bind (serv.hnd.fd, (struct sockaddr *) &addr, sizeof (addr)) < 0) {
diff --git a/accel-pptpd/radius/radius.c b/accel-pptpd/radius/radius.c
index 11b2717..8d0c887 100644
--- a/accel-pptpd/radius/radius.c
+++ b/accel-pptpd/radius/radius.c
@@ -25,21 +25,22 @@
int conf_max_try = 3;
int conf_timeout = 3;
int conf_acct_timeout = 600;
-char *conf_nas_identifier = "accel-pptpd";
+char *conf_nas_identifier;
in_addr_t conf_nas_ip_address;
in_addr_t conf_gw_ip_address;
in_addr_t conf_bind;
int conf_verbose;
int conf_interim_verbose;
-char *conf_auth_server;
+in_addr_t conf_auth_server;
int conf_auth_server_port = 1812;
char *conf_auth_secret;
-char *conf_acct_server;
+in_addr_t conf_acct_server;
int conf_acct_server_port = 1813;
char *conf_acct_secret;
-char *conf_dm_coa_server;
+
+in_addr_t conf_dm_coa_server;
int conf_dm_coa_port = 3799;
char *conf_dm_coa_secret;
@@ -344,7 +345,7 @@ static struct pwdb_t pwdb = {
.check = check,
};
-static int parse_server(const char *opt, char **name, int *port, char **secret)
+static int parse_server(const char *opt, in_addr_t *addr, int *port, char **secret)
{
char *str = _strdup(opt);
char *p1, *p2;
@@ -359,23 +360,28 @@ static int parse_server(const char *opt, char **name, int *port, char **secret)
else
return -1;
- *name = str;
+ *addr = inet_addr(str);
+
if (p1) {
*port = atoi(p1 + 1);
if (*port <=0 )
return -1;
}
- *secret = p2 + 1;
+
+ p1 = _strdup(p2 + 1);
+ p2 = *secret;
+ *secret = p1;
+ if (p2)
+ _free(p2);
+
+ _free(str);
return 0;
}
-static void __init radius_init(void)
+static int load_config(void)
{
char *opt;
- char *dict = DICTIONARY;
-
- rpd_pool = mempool_create(sizeof(struct radius_pd_t));
opt = conf_get_opt("radius", "max-try");
if (opt && atoi(opt) > 0)
@@ -401,9 +407,13 @@ static void __init radius_init(void)
if (opt)
conf_nas_ip_address = inet_addr(opt);
+ if (conf_nas_identifier)
+ _free(conf_nas_identifier);
opt = conf_get_opt("radius", "nas-identifier");
if (opt)
- conf_nas_identifier = opt;
+ conf_nas_identifier = _strdup(opt);
+ else
+ conf_nas_identifier = NULL;
opt = conf_get_opt("radius", "gw-ip-address");
if (opt)
@@ -420,10 +430,10 @@ static void __init radius_init(void)
opt = conf_get_opt("radius", "auth_server");
if (!opt) {
log_emerg("radius: auth-server not specified\n");
- _exit(EXIT_FAILURE);
+ return -1;
} else if (parse_server(opt, &conf_auth_server, &conf_auth_server_port, &conf_auth_secret)) {
log_emerg("radius: failed to parse auth_server\n");
- _exit(EXIT_FAILURE);
+ return -1;
}
opt = conf_get_opt("radius", "acct-server");
@@ -433,23 +443,15 @@ static void __init radius_init(void)
log_emerg("radius: acct-server not specified\n");
if (opt && parse_server(opt, &conf_acct_server, &conf_acct_server_port, &conf_acct_secret)) {
log_emerg("radius: failed to parse acct_server\n");
- _exit(EXIT_FAILURE);
+ return -1;
}
opt = conf_get_opt("radius", "dae-server");
if (opt && parse_server(opt, &conf_dm_coa_server, &conf_dm_coa_port, &conf_dm_coa_secret)) {
log_emerg("radius: failed to parse dae-server\n");
- _exit(EXIT_FAILURE);
- } else {
- opt = conf_get_opt("radius", "dm_coa_secret");
- if (opt)
- conf_dm_coa_secret = opt;
+ return -1;
}
- opt = conf_get_opt("radius", "dictionary");
- if (opt)
- dict = opt;
-
opt = conf_get_opt("radius", "sid_in_auth");
if (opt && atoi(opt) > 0)
conf_sid_in_auth = 1;
@@ -461,7 +463,24 @@ static void __init radius_init(void)
opt = conf_get_opt("radius", "acct-interim-interval");
if (opt && atoi(opt) > 0)
conf_acct_interim_interval = atoi(opt);
-
+
+ return 0;
+}
+
+static void __init radius_init(void)
+{
+ char *opt;
+ char *dict = DICTIONARY;
+
+ rpd_pool = mempool_create(sizeof(struct radius_pd_t));
+
+ if (load_config())
+ _exit(EXIT_FAILURE);
+
+ opt = conf_get_opt("radius", "dictionary");
+ if (opt)
+ dict = opt;
+
if (rad_dict_load(dict))
_exit(EXIT_FAILURE);
@@ -472,4 +491,6 @@ static void __init radius_init(void)
triton_event_register_handler(EV_PPP_ACCT_START, (triton_event_func)ppp_acct_start);
triton_event_register_handler(EV_PPP_FINISHING, (triton_event_func)ppp_finishing);
triton_event_register_handler(EV_PPP_FINISHED, (triton_event_func)ppp_finished);
+ triton_event_register_handler(EV_CONFIG_RELOAD, (triton_event_func)load_config);
+
}
diff --git a/accel-pptpd/radius/radius_p.h b/accel-pptpd/radius/radius_p.h
index 570c496..2bd3ff8 100644
--- a/accel-pptpd/radius/radius_p.h
+++ b/accel-pptpd/radius/radius_p.h
@@ -48,7 +48,7 @@ struct rad_req_t
uint8_t RA[16];
struct rad_packet_t *pack;
struct rad_packet_t *reply;
- const char *server_name;
+ in_addr_t server_addr;
int server_port;
struct radius_pd_t *rpd;
@@ -63,16 +63,16 @@ extern char *conf_nas_identifier;
extern in_addr_t conf_nas_ip_address;
extern in_addr_t conf_bind;
extern in_addr_t conf_gw_ip_address;
-extern char *conf_auth_server;
+extern in_addr_t conf_auth_server;
extern char *conf_auth_secret;
extern int conf_auth_server_port;
-extern char *conf_acct_server;
+extern in_addr_t conf_acct_server;
extern char *conf_acct_secret;
extern int conf_acct_server_port;
extern char *conf_dm_coa_secret;
extern int conf_sid_in_auth;
extern int conf_require_nas_ident;
-extern char *conf_dm_coa_server;
+extern in_addr_t conf_dm_coa_server;
extern int conf_dm_coa_port;
extern int conf_acct_interim_interval;
diff --git a/accel-pptpd/radius/req.c b/accel-pptpd/radius/req.c
index 818ceb4..94c10c3 100644
--- a/accel-pptpd/radius/req.c
+++ b/accel-pptpd/radius/req.c
@@ -31,7 +31,7 @@ struct rad_req_t *rad_req_alloc(struct radius_pd_t *rpd, int code, const char *u
req->hnd.fd = -1;
req->ctx.before_switch = log_switch;
- req->server_name = conf_auth_server;
+ req->server_addr = conf_auth_server;
req->server_port = conf_auth_server_port;
while (1) {
@@ -83,7 +83,7 @@ out_err:
int rad_req_acct_fill(struct rad_req_t *req)
{
- req->server_name = conf_acct_server;
+ req->server_addr = conf_acct_server;
req->server_port = conf_acct_server_port;
memset(req->RA, 0, sizeof(req->RA));
@@ -148,7 +148,7 @@ static int make_socket(struct rad_req_t *req)
}
}
- addr.sin_addr.s_addr = inet_addr(req->server_name);
+ addr.sin_addr.s_addr = req->server_addr;
addr.sin_port = htons(req->server_port);
if (connect(req->hnd.fd, (struct sockaddr *) &addr, sizeof(addr))) {
@@ -244,7 +244,7 @@ int rad_req_wait(struct rad_req_t *req, int timeout)
triton_context_wakeup(&req->ctx);
- triton_context_schedule(req->rpd->ppp->ctrl->ctx);
+ triton_context_schedule();
if (conf_verbose && req->reply) {
log_ppp_info1("recv ");
diff --git a/accel-pptpd/triton/conf_file.c b/accel-pptpd/triton/conf_file.c
index 6eb2e7a..ce8549c 100644
--- a/accel-pptpd/triton/conf_file.c
+++ b/accel-pptpd/triton/conf_file.c
@@ -2,6 +2,7 @@
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
+#include <pthread.h>
#include "triton_p.h"
@@ -14,7 +15,9 @@ struct sect_t
struct conf_sect_t *sect;
};
+static pthread_mutex_t conf_lock = PTHREAD_MUTEX_INITIALIZER;
static LIST_HEAD(sections);
+static char *conf_fname;
static char* skip_space(char *str);
static char* skip_word(char *str);
@@ -24,12 +27,12 @@ static struct conf_sect_t *create_sect(const char *name);
static void sect_add_item(struct conf_sect_t *sect, const char *name, const char *val);
static struct conf_option_t *find_item(struct conf_sect_t *, const char *name);
-int conf_load(const char *fname)
+static char *buf;
+
+int __conf_load(const char *fname, struct conf_sect_t *cur_sect)
{
- char *buf,*str,*str2;
- char *path0,*path;
+ char *str,*str2;
int cur_line = 0;
- static struct conf_sect_t *cur_sect = NULL;
FILE *f = fopen(fname, "r");
if (!f) {
@@ -37,12 +40,6 @@ int conf_load(const char *fname)
return -1;
}
- buf = _malloc(1024);
- path0 = _malloc(4096);
- path = _malloc(4096);
-
- getcwd(path0, 1024);
-
while(!feof(f)) {
if (!fgets(buf, 1024, f))
break;
@@ -56,7 +53,8 @@ int conf_load(const char *fname)
if (strncmp(str, "$include", 8) == 0) {
str = skip_word(str);
str = skip_space(str);
- conf_load(str);
+ if (__conf_load(str, cur_sect));
+ break;
continue;
}
if (*str == '[') {
@@ -104,14 +102,77 @@ int conf_load(const char *fname)
sect_add_item(cur_sect, str, str2);
}
- _free(buf);
- _free(path);
- _free(path0);
fclose(f);
return 0;
}
+int conf_load(const char *fname)
+{
+ int r;
+
+ if (fname) {
+ if (conf_fname)
+ _free(conf_fname);
+ conf_fname = _strdup(fname);
+ } else
+ fname = conf_fname;
+
+ buf = _malloc(1024);
+
+ r = __conf_load(fname, NULL);
+
+ _free(buf);
+
+ return r;
+}
+
+int conf_reload(const char *fname)
+{
+ struct sect_t *sect;
+ struct conf_option_t *opt;
+ int r;
+ LIST_HEAD(sections_bak);
+
+ pthread_mutex_lock(&conf_lock);
+
+ while (!list_empty(&sections)) {
+ sect = list_entry(sections.next, typeof(*sect), entry);
+ list_del(&sect->entry);
+ list_add_tail(&sect->entry, &sections_bak);
+ }
+
+ r = conf_load(fname);
+
+ if (r) {
+ while (!list_empty(&sections_bak)) {
+ sect = list_entry(sections_bak.next, typeof(*sect), entry);
+ list_del(&sect->entry);
+ list_add_tail(&sect->entry, &sections);
+ }
+ pthread_mutex_unlock(&conf_lock);
+ } else {
+ pthread_mutex_unlock(&conf_lock);
+ while (!list_empty(&sections_bak)) {
+ sect = list_entry(sections_bak.next, typeof(*sect), entry);
+ list_del(&sect->entry);
+ while (!list_empty(&sect->sect->items)) {
+ opt = list_entry(sect->sect->items.next, typeof(*opt), entry);
+ list_del(&opt->entry);
+ if (opt->val)
+ _free(opt->val);
+ _free(opt->name);
+ _free(opt);
+ }
+ _free((char *)sect->sect->name);
+ _free(sect->sect);
+ _free(sect);
+ }
+ }
+
+ return r;
+}
+
static char* skip_space(char *str)
{
for (; *str && *str == ' '; str++);
@@ -136,7 +197,7 @@ static struct conf_sect_t *create_sect(const char *name)
struct sect_t *s = _malloc(sizeof(struct sect_t));
s->sect = _malloc(sizeof(struct conf_sect_t));
- s->sect->name = (char*)strdup(name);
+ s->sect->name = (char*)_strdup(name);
INIT_LIST_HEAD(&s->sect->items);
list_add_tail(&s->entry, &sections);
diff --git a/accel-pptpd/triton/triton.c b/accel-pptpd/triton/triton.c
index 3ed14ff..7d26251 100644
--- a/accel-pptpd/triton/triton.c
+++ b/accel-pptpd/triton/triton.c
@@ -24,6 +24,9 @@ static LIST_HEAD(ctx_list);
static int terminate;
static int need_terminate;
+static int need_config_reload;
+static void (*config_reload_notify)(int);
+
static mempool_t *ctx_pool;
static mempool_t *call_pool;
static mempool_t *ctx_stack_pool;
@@ -41,6 +44,8 @@ static struct triton_timer_t ru_timer = {
};
struct triton_context_t default_ctx;
+static struct triton_context_t __thread *this_ctx;
+
#define log_debug2(fmt, ...)
void triton_thread_wakeup(struct _triton_thread_t *thread)
@@ -49,6 +54,23 @@ void triton_thread_wakeup(struct _triton_thread_t *thread)
pthread_kill(thread->thread, SIGUSR1);
}
+static void __config_reload(void (*notify)(int))
+{
+ struct _triton_thread_t *t;
+ int r;
+
+ log_debug2("config_reload: enter\n");
+ r = conf_reload(NULL);
+ notify(r);
+
+ spin_lock(&threads_lock);
+ need_config_reload = 0;
+ list_for_each_entry(t, &threads, entry)
+ triton_thread_wakeup(t);
+ spin_unlock(&threads_lock);
+ log_debug2("config_reload: exit\n");
+}
+
static void* triton_thread(struct _triton_thread_t *thread)
{
sigset_t set;
@@ -65,7 +87,7 @@ static void* triton_thread(struct _triton_thread_t *thread)
while (1) {
spin_lock(&threads_lock);
- if (!list_empty(&ctx_queue)) {
+ if (!list_empty(&ctx_queue) && !need_config_reload) {
thread->ctx = list_entry(ctx_queue.next, typeof(*thread->ctx), entry2);
log_debug2("thread: %p: dequeued ctx %p\n", thread, thread->ctx);
list_del(&thread->ctx->entry2);
@@ -79,18 +101,24 @@ static void* triton_thread(struct _triton_thread_t *thread)
log_debug2("thread: %p: sleeping\n", thread);
if (!terminate)
list_add(&thread->entry2, &sleep_threads);
- spin_unlock(&threads_lock);
+
+ if (--triton_stat.thread_active == 0 && need_config_reload) {
+ spin_unlock(&threads_lock);
+ __config_reload(config_reload_notify);
+ } else
+ spin_unlock(&threads_lock);
+
if (terminate)
return NULL;
- __sync_sub_and_fetch(&triton_stat.thread_active, 1);
//printf("thread %p: enter sigwait\n", thread);
sigwait(&set, &sig);
//printf("thread %p: exit sigwait\n", thread);
- __sync_add_and_fetch(&triton_stat.thread_active, 1);
spin_lock(&threads_lock);
+ ++triton_stat.thread_active;
if (!thread->ctx) {
+ list_del(&thread->entry2);
spin_unlock(&threads_lock);
continue;
}
@@ -99,6 +127,7 @@ static void* triton_thread(struct _triton_thread_t *thread)
cont:
log_debug2("thread %p: ctx=%p %p\n", thread, thread->ctx, thread->ctx ? thread->ctx->thread : NULL);
+ this_ctx = thread->ctx->ud;
if (thread->ctx->ud->before_switch)
thread->ctx->ud->before_switch(thread->ctx->ud, thread->ctx->bf_arg);
@@ -229,7 +258,7 @@ int triton_queue_ctx(struct _triton_context_t *ctx)
return 0;
spin_lock(&threads_lock);
- if (list_empty(&sleep_threads)) {
+ if (list_empty(&sleep_threads) || need_config_reload) {
if (ctx->priority)
list_add(&ctx->entry2, &ctx_queue);
else
@@ -343,7 +372,6 @@ void __export triton_context_unregister(struct triton_context_t *ud)
}
spin_unlock(&ctx_list_lock);
-
if (terminate) {
list_for_each_entry(t, &threads, entry)
triton_thread_wakeup(t);
@@ -357,9 +385,9 @@ void __export triton_context_set_priority(struct triton_context_t *ud, int prio)
ctx->priority = prio > 0;
}
-void __export triton_context_schedule(struct triton_context_t *ud)
+void __export triton_context_schedule()
{
- struct _triton_context_t *ctx = (struct _triton_context_t *)ud->tpd;
+ struct _triton_context_t *ctx = (struct _triton_context_t *)this_ctx->tpd;
ucontext_t *uctx = &ctx->thread->uctx;
spin_lock(&ctx->lock);
@@ -380,6 +408,11 @@ void __export triton_context_schedule(struct triton_context_t *ud)
log_debug2("ctx %p: exit schedule\n", ctx);
}
+struct triton_context_t __export *triton_context_self(void)
+{
+ return this_ctx;
+}
+
void triton_context_print(void)
{
struct _triton_context_t *ctx;
@@ -522,6 +555,18 @@ int __export triton_load_modules(const char *mod_sect)
return 0;
}
+void __export triton_conf_reload(void (*notify)(int))
+{
+ spin_lock(&threads_lock);
+ need_config_reload = 1;
+ config_reload_notify = notify;
+ if (triton_stat.thread_active == 0) {
+ spin_unlock(&threads_lock);
+ __config_reload(notify);
+ } else
+ spin_unlock(&threads_lock);
+}
+
void __export triton_run()
{
struct _triton_thread_t *t;
diff --git a/accel-pptpd/triton/triton.h b/accel-pptpd/triton/triton.h
index a4664ff..2c3871e 100644
--- a/accel-pptpd/triton/triton.h
+++ b/accel-pptpd/triton/triton.h
@@ -72,10 +72,11 @@ extern struct triton_stat_t triton_stat;
int triton_context_register(struct triton_context_t *, void *arg);
void triton_context_unregister(struct triton_context_t *);
void triton_context_set_priority(struct triton_context_t *, int);
-void triton_context_schedule(struct triton_context_t *);
+void triton_context_schedule(void);
int triton_context_wakeup(struct triton_context_t *);
int triton_context_call(struct triton_context_t *, void (*func)(void *), void *arg);
void triton_cancel_call(struct triton_context_t *, void (*func)(void *));
+struct triton_context_t *triton_context_self(void);
#define MD_MODE_READ 1
#define MD_MODE_WRITE 2
@@ -99,10 +100,12 @@ void triton_event_fire(int ev_id, void *arg);
struct conf_sect_t *conf_get_section(const char *name);
char *conf_get_opt(const char *sect, const char *name);
+void triton_conf_reload(void (*notify)(int));
void triton_collect_cpu_usage(void);
void triton_stop_collect_cpu_usage(void);
+
#define TRITON_OK 0
#define TRITON_ERR_NOCOMP -1
#define TRITON_ERR_NOSUPP -2
diff --git a/accel-pptpd/triton/triton_p.h b/accel-pptpd/triton/triton_p.h
index 2bc265c..5804007 100644
--- a/accel-pptpd/triton/triton_p.h
+++ b/accel-pptpd/triton/triton_p.h
@@ -99,6 +99,7 @@ extern struct triton_context_t default_ctx;
int triton_queue_ctx(struct _triton_context_t*);
void triton_thread_wakeup(struct _triton_thread_t*);
int conf_load(const char *fname);
+int conf_reload(const char *fname);
void triton_log_error(const char *fmt,...);
void triton_log_debug(const char *fmt,...);
int load_modules(const char *name);