summaryrefslogtreecommitdiff
path: root/accel-pppd/radius/dm_coa.c
diff options
context:
space:
mode:
Diffstat (limited to 'accel-pppd/radius/dm_coa.c')
-rw-r--r--accel-pppd/radius/dm_coa.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/accel-pppd/radius/dm_coa.c b/accel-pppd/radius/dm_coa.c
index f6197e7c..b96f3e0c 100644
--- a/accel-pppd/radius/dm_coa.c
+++ b/accel-pppd/radius/dm_coa.c
@@ -145,6 +145,8 @@ static void disconnect_request(struct radius_pd_t *rpd)
static void coa_request(struct radius_pd_t *rpd)
{
+ struct rad_attr_t *class;
+ void *prev_class;
struct ev_radius_t ev = {
.ppp = rpd->ppp,
.request = rpd->dm_coa_req,
@@ -159,8 +161,30 @@ static void coa_request(struct radius_pd_t *rpd)
if (ev.res)
dm_coa_send_nak(serv.hnd.fd, rpd->dm_coa_req, &rpd->dm_coa_addr, 0);
- else
+ else {
+ class = rad_packet_find_attr(rpd->dm_coa_req, NULL, "Class");
+ if (class) {
+ prev_class = rpd->attr_class;
+
+ if (rpd->attr_class_len < class->len) {
+ if (rpd->attr_class)
+ _free(rpd->attr_class);
+ rpd->attr_class = _malloc(class->len);
+ }
+
+ memcpy(rpd->attr_class, class->val.octets, class->len);
+ rpd->attr_class_len = class->len;
+ }
+
+ if (rpd->acct_req && rpd->acct_req->pack) {
+ if (prev_class)
+ rad_packet_change_octets(rpd->acct_req->pack, NULL, "Class", rpd->attr_class, rpd->attr_class_len);
+ else
+ rad_packet_add_octets(rpd->acct_req->pack, NULL, "Class", rpd->attr_class, rpd->attr_class_len);
+ }
+
dm_coa_send_ack(serv.hnd.fd, rpd->dm_coa_req, &rpd->dm_coa_addr);
+ }
rad_packet_free(rpd->dm_coa_req);