summaryrefslogtreecommitdiff
path: root/accel-pptpd
diff options
context:
space:
mode:
Diffstat (limited to 'accel-pptpd')
-rw-r--r--accel-pptpd/accel-pptpd.conf18
-rw-r--r--accel-pptpd/logs/log_file.c2
-rw-r--r--accel-pptpd/ppp/ppp.c8
-rw-r--r--accel-pptpd/ppp/ppp.h1
-rw-r--r--accel-pptpd/radius/radius.c22
-rw-r--r--accel-pptpd/radius/radius_p.h2
-rw-r--r--accel-pptpd/triton/loader.c44
7 files changed, 68 insertions, 29 deletions
diff --git a/accel-pptpd/accel-pptpd.conf b/accel-pptpd/accel-pptpd.conf
index bc74c2c..e3f0eaa 100644
--- a/accel-pptpd/accel-pptpd.conf
+++ b/accel-pptpd/accel-pptpd.conf
@@ -1,13 +1,13 @@
[modules]
-./liblog_file.so
-#./liblog_pgsql.so
-./libpptp.so
-./libauth_pap.so
-./libauth_chap_md5.so
-./libauth_mschap_v1.so
-./libauth_mschap_v2.so
-./libradius.so
-./libpppd_compat.so
+log_file
+#log_pgsql
+pptp
+auth_pap
+auth_chap_md5
+auth_mschap_v1
+auth_mschap_v2
+libradius.so
+pppd_compat
[core]
log-error=/dev/stderr
diff --git a/accel-pptpd/logs/log_file.c b/accel-pptpd/logs/log_file.c
index 26ec3f9..1c1538c 100644
--- a/accel-pptpd/logs/log_file.c
+++ b/accel-pptpd/logs/log_file.c
@@ -72,7 +72,7 @@ static LIST_HEAD(lf_queue);
static spinlock_t lf_queue_lock = SPINLOCK_INITIALIZER;
static int lf_queue_sleeping = 1;
-static uint64_t temp_seq;
+static unsigned long temp_seq;
static void send_next_chunk();
diff --git a/accel-pptpd/ppp/ppp.c b/accel-pptpd/ppp/ppp.c
index f8da005..03a8db0 100644
--- a/accel-pptpd/ppp/ppp.c
+++ b/accel-pptpd/ppp/ppp.c
@@ -351,15 +351,15 @@ void __export ppp_layer_started(struct ppp_t *ppp, struct ppp_layer_data_t *d)
void __export ppp_layer_finished(struct ppp_t *ppp, struct ppp_layer_data_t *d)
{
struct layer_node_t *n=d->node;
-
- d->starting=0;
- d->started=0;
+
+ d->finished = 1;
+ d->starting = 0;
list_for_each_entry(n,&ppp->layers,entry)
{
list_for_each_entry(d,&n->items,entry)
{
- if (d->starting)
+ if (!d->finished)
return;
}
}
diff --git a/accel-pptpd/ppp/ppp.h b/accel-pptpd/ppp/ppp.h
index 5769f8c..32615c2 100644
--- a/accel-pptpd/ppp/ppp.h
+++ b/accel-pptpd/ppp/ppp.h
@@ -112,6 +112,7 @@ struct ppp_layer_data_t
struct layer_node_t *node;
int starting:1;
int started:1;
+ int finished:1;
};
struct ppp_layer_t
diff --git a/accel-pptpd/radius/radius.c b/accel-pptpd/radius/radius.c
index 38ace95..42b39a5 100644
--- a/accel-pptpd/radius/radius.c
+++ b/accel-pptpd/radius/radius.c
@@ -59,6 +59,8 @@ void rad_proc_attrs(struct rad_req_t *req)
}
} else if (!strcmp(attr->attr->name, "Acct-Interim-Interval"))
req->rpd->acct_interim_interval = attr->val.integer;
+ else if (!strcmp(attr->attr->name, "Session-Timeout"))
+ req->rpd->session_timeout.expire_tv.tv_sec = attr->val.integer;
}
}
@@ -105,6 +107,14 @@ static struct ipdb_item_t *get_ip(struct ppp_t *ppp)
return NULL;
}
+static void session_timeout(struct triton_timer_t *t)
+{
+ struct radius_pd_t *rpd = container_of(t, typeof(*rpd), session_timeout);
+
+ log_ppp_msg("radius: session timed out\n");
+ ppp_terminate(rpd->ppp, 0);
+}
+
static void ppp_starting(struct ppp_t *ppp)
{
struct radius_pd_t *rpd = mempool_alloc(rpd_pool);
@@ -126,6 +136,11 @@ static void ppp_started(struct ppp_t *ppp)
if (rad_acct_start(rpd))
ppp_terminate(rpd->ppp, 0);
+
+ if (rpd->session_timeout.expire_tv.tv_sec) {
+ rpd->session_timeout.expire = session_timeout;
+ triton_timer_add(ppp->ctrl->ctx, &rpd->session_timeout, 0);
+ }
}
static void ppp_finishing(struct ppp_t *ppp)
{
@@ -149,6 +164,9 @@ static void ppp_finished(struct ppp_t *ppp)
if (rpd->dm_coa_req)
rad_packet_free(rpd->dm_coa_req);
+ if (rpd->session_timeout.tpd)
+ triton_timer_del(&rpd->session_timeout);
+
list_del(&rpd->pd.entry);
mempool_free(rpd);
@@ -302,6 +320,10 @@ static void __init radius_init(void)
if (opt)
conf_nas_ip_address = opt;
+ opt = conf_get_opt("radius", "nas-identifier");
+ if (opt)
+ conf_nas_identifier = opt;
+
opt = conf_get_opt("radius", "gw-ip-address");
if (opt)
conf_gw_ip_address = opt;
diff --git a/accel-pptpd/radius/radius_p.h b/accel-pptpd/radius/radius_p.h
index ae44223..9537641 100644
--- a/accel-pptpd/radius/radius_p.h
+++ b/accel-pptpd/radius/radius_p.h
@@ -23,6 +23,8 @@ struct radius_pd_t
uint32_t acct_input_gigawords;
uint32_t acct_output_gigawords;
+ struct triton_timer_t session_timeout;
+
struct rad_packet_t *dm_coa_req;
struct sockaddr_in dm_coa_addr;
diff --git a/accel-pptpd/triton/loader.c b/accel-pptpd/triton/loader.c
index a8b9c50..0fef03d 100644
--- a/accel-pptpd/triton/loader.c
+++ b/accel-pptpd/triton/loader.c
@@ -4,6 +4,7 @@
#include <stdio.h>
#include <errno.h>
#include <dlfcn.h>
+#include <limits.h>
#include "triton_p.h"
@@ -13,6 +14,8 @@ int load_modules(const char *name)
{
struct conf_sect_t *sect;
struct conf_option_t *opt;
+ char *fname;
+ char *path=".";
sect = conf_get_section(name);
if (!sect) {
@@ -20,29 +23,40 @@ int load_modules(const char *name)
return -1;
}
- char *cwd = getcwd(NULL,0);
+ fname = _malloc(PATH_MAX);
list_for_each_entry(opt, &sect->items, entry) {
if (!strcmp(opt->name,"path") && opt->val) {
- if (chdir(opt->val)) {
- fprintf(stderr,"loader: chdir '%s': %s\n", opt->val, strerror(errno));
- goto out_err;
- }
+ path = opt->val;
continue;
}
- if (!dlopen(opt->name, RTLD_NOW | RTLD_GLOBAL)) {
- fprintf(stderr,"loader: failed to load module '%s': %s\n",opt->name, dlerror());
- goto out_err;
+
+ strcpy(fname, path);
+ strcat(fname, "/");
+ strcat(fname, opt->name);
+ if (access(fname, F_OK)) {
+ strcpy(fname, path);
+ strcat(fname, "/lib");
+ strcat(fname, opt->name);
+ strcat(fname, ".so");
+ if (access(fname, F_OK)) {
+ strcpy(fname, opt->name);
+ if (access(opt->name, F_OK)) {
+ triton_log_error("loader: '%s' not found\n", opt->name);
+ continue;
+ }
+ }
+ }
+
+ if (!dlopen(fname, RTLD_NOW | RTLD_GLOBAL)) {
+ triton_log_error("loader: failed to load '%s': %s\n", opt->name, dlerror());
+ _free(fname);
+ return -1;
}
}
- chdir(cwd);
- free(cwd);
- return 0;
+ _free(fname);
-out_err:
- chdir(cwd);
- _free(cwd);
- return -1;
+ return 0;
}