diff options
author | Kozlov Dmitry <xeb@mail.ru> | 2012-07-13 12:38:38 +0400 |
---|---|---|
committer | Kozlov Dmitry <xeb@mail.ru> | 2012-07-13 12:38:38 +0400 |
commit | 00e44c01c236a0e805add33dc983c270315dd7c7 (patch) | |
tree | 3cd4102fb6a0a52e31faa93978c011f36c406b2d | |
parent | bd15694dbb3c455b49c095e3d697bedece309cc5 (diff) | |
parent | 178b27b0b6d60afdc5039dc3d995f4ad000b5486 (diff) | |
download | accel-ppp-00e44c01c236a0e805add33dc983c270315dd7c7.tar.gz accel-ppp-00e44c01c236a0e805add33dc983c270315dd7c7.zip |
Merge commit '178b27b0b6d60afdc5039dc3d995f4ad000b5486'
* commit '178b27b0b6d60afdc5039dc3d995f4ad000b5486':
radius: update Class attribute by CoA request
-rw-r--r-- | accel-pppd/radius/dm_coa.c | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/accel-pppd/radius/dm_coa.c b/accel-pppd/radius/dm_coa.c index a2757362..68ec0dcf 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 = { .ses = rpd->ses, .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); |