summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Kozlov <xeb@mail.ru>2017-03-19 17:00:45 +0300
committerDmitry Kozlov <xeb@mail.ru>2017-03-19 17:00:45 +0300
commit98274bdf7a1f7c0ec250de263298cc6954645e22 (patch)
tree98f819f7f4dc56e27b99a4ffc277fbcf177a5373
parent3bb4fe7b2648d2814370aee5580c420e8cfb22ac (diff)
downloadaccel-ppp-98274bdf7a1f7c0ec250de263298cc6954645e22.tar.gz
accel-ppp-98274bdf7a1f7c0ec250de263298cc6954645e22.zip
radius: introduced radius_plugin_t:send_accounting_update function (called each time when accounting interim update is about to send)
-rw-r--r--accel-pppd/radius/acct.c14
-rw-r--r--accel-pppd/radius/radius.h2
2 files changed, 16 insertions, 0 deletions
diff --git a/accel-pppd/radius/acct.c b/accel-pppd/radius/acct.c
index 9292fda..c58a2b9 100644
--- a/accel-pppd/radius/acct.c
+++ b/accel-pppd/radius/acct.c
@@ -150,6 +150,7 @@ static void rad_acct_interim_update(struct triton_timer_t *t)
struct ap_session *ses = rpd->ses;
struct timespec ts;
int force = 0;
+ struct rad_plugin_t *plugin;
if (rpd->acct_req->entry.next || rpd->acct_req->timeout.tpd)
return;
@@ -171,6 +172,11 @@ static void rad_acct_interim_update(struct triton_timer_t *t)
force = 1;
}
+ list_for_each_entry(plugin, &rpd->plugin_list, entry) {
+ if (plugin->send_accounting_update)
+ plugin->send_accounting_update(plugin, rpd->acct_req->pack);
+ }
+
if (!rpd->acct_interim_interval && !force)
return;
@@ -430,6 +436,7 @@ int rad_acct_stop(struct radius_pd_t *rpd)
{
struct rad_req_t *req = rpd->acct_req;
struct timespec ts;
+ struct rad_plugin_t *plugin;
if (rpd->acct_interim_timer.tpd)
triton_timer_del(&rpd->acct_interim_timer);
@@ -486,7 +493,14 @@ int rad_acct_stop(struct radius_pd_t *rpd)
}
rad_packet_change_val(req->pack, NULL, "Acct-Status-Type", "Stop");
+
req_set_stat(req, rpd->ses);
+
+ list_for_each_entry(plugin, &rpd->plugin_list, entry) {
+ if (plugin->send_accounting_update)
+ plugin->send_accounting_update(plugin, rpd->acct_req->pack);
+ }
+
req_set_RA(req, req->serv->secret);
req->recv = rad_acct_stop_recv;
diff --git a/accel-pppd/radius/radius.h b/accel-pppd/radius/radius.h
index ad27b89..aaa6269 100644
--- a/accel-pppd/radius/radius.h
+++ b/accel-pppd/radius/radius.h
@@ -100,6 +100,7 @@ struct rad_plugin_t
struct list_head entry;
int (*send_access_request)(struct rad_plugin_t *, struct rad_packet_t *pack);
int (*send_accounting_request)(struct rad_plugin_t *, struct rad_packet_t *pack);
+ int (*send_accounting_update)(struct rad_plugin_t *, struct rad_packet_t *pack);
};
struct ap_session;
@@ -122,6 +123,7 @@ int rad_packet_add_octets(struct rad_packet_t *pack, const char *vendor, const c
int rad_packet_change_int(struct rad_packet_t *pack, const char *vendor, const char *name, int val);
int rad_packet_change_val(struct rad_packet_t *pack, const char *vendor, const char *name, const char *val);
int rad_packet_change_octets(struct rad_packet_t *pack, const char *vendor, const char *name, const uint8_t *val, int len);
+int rad_packet_change_str(struct rad_packet_t *pack, const char *vendor_name, const char *name, const char *val, int len);
int rad_packet_add_ipaddr(struct rad_packet_t *pack, const char *vendor, const char *name, in_addr_t ipaddr);
int rad_packet_add_ifid(struct rad_packet_t *pack, const char *vendor, const char *name, uint64_t ifid);
int rad_packet_add_ipv6prefix(struct rad_packet_t *pack, const char *vendor, const char *name, struct in6_addr *prefix, int len);