summaryrefslogtreecommitdiff
path: root/accel-pppd/radius/req.c
diff options
context:
space:
mode:
authorKozlov Dmitry <xeb@mail.ru>2012-07-10 18:58:53 +0400
committerKozlov Dmitry <xeb@mail.ru>2012-07-10 18:58:53 +0400
commit80c32d237e01b1c05663ccfa34003d2f49aa7eee (patch)
treea49da21b5219e4bc89d9794918f054f3620cb140 /accel-pppd/radius/req.c
parent64b5b693764c4f36870fd988ccbb53bcb188e74d (diff)
downloadaccel-ppp-80c32d237e01b1c05663ccfa34003d2f49aa7eee.tar.gz
accel-ppp-80c32d237e01b1c05663ccfa34003d2f49aa7eee.zip
initial session backup implementation
Diffstat (limited to 'accel-pppd/radius/req.c')
-rw-r--r--accel-pppd/radius/req.c29
1 files changed, 27 insertions, 2 deletions
diff --git a/accel-pppd/radius/req.c b/accel-pppd/radius/req.c
index f452c425..cd9a170b 100644
--- a/accel-pppd/radius/req.c
+++ b/accel-pppd/radius/req.c
@@ -16,8 +16,9 @@
static int rad_req_read(struct triton_md_handler_t *h);
static void rad_req_timeout(struct triton_timer_t *t);
+static int make_socket(struct rad_req_t *req);
-struct rad_req_t *rad_req_alloc(struct radius_pd_t *rpd, int code, const char *username)
+static struct rad_req_t *__rad_req_alloc(struct radius_pd_t *rpd, int code, const char *username, in_addr_t addr, int port)
{
struct rad_plugin_t *plugin;
struct ppp_t *ppp = NULL;
@@ -38,7 +39,11 @@ struct rad_req_t *rad_req_alloc(struct radius_pd_t *rpd, int code, const char *u
req->type = code == CODE_ACCESS_REQUEST ? RAD_SERV_AUTH : RAD_SERV_ACCT;
- req->serv = rad_server_get(req->type);
+ if (addr)
+ req->serv = rad_server_get2(req->type, addr, port);
+ else
+ req->serv = rad_server_get(req->type);
+
if (!req->serv)
goto out_err;
@@ -120,6 +125,26 @@ out_err:
return NULL;
}
+struct rad_req_t *rad_req_alloc(struct radius_pd_t *rpd, int code, const char *username)
+{
+ return __rad_req_alloc(rpd, code, username, 0, 0);
+}
+
+struct rad_req_t *rad_req_alloc2(struct radius_pd_t *rpd, int code, const char *username, in_addr_t addr, int port)
+{
+ struct rad_req_t *req = __rad_req_alloc(rpd, code, username, addr, port);
+
+ if (!req)
+ return NULL;
+
+ if (code == CODE_ACCOUNTING_REQUEST)
+ req->server_port = req->serv->acct_port;
+
+ make_socket(req);
+
+ return req;
+}
+
int rad_req_acct_fill(struct rad_req_t *req)
{
struct ipv6db_addr_t *a;