diff options
author | Dmitry Kozlov <xeb@mail.ru> | 2018-04-06 21:04:36 +0300 |
---|---|---|
committer | Dmitry Kozlov <xeb@mail.ru> | 2018-04-06 21:04:36 +0300 |
commit | b9c3e454c13baba224cab6644827fa2f11edddbe (patch) | |
tree | 908e4ec522ee1b9e7061a03f073065329acde668 /accel-pppd/radius | |
parent | 812de98ddd34825d7103dad51c07642e99362e1a (diff) | |
download | accel-ppp-b9c3e454c13baba224cab6644827fa2f11edddbe.tar.gz accel-ppp-b9c3e454c13baba224cab6644827fa2f11edddbe.zip |
radius: allow CoA/DM by single username attribute
Diffstat (limited to 'accel-pppd/radius')
-rw-r--r-- | accel-pppd/radius/packet.c | 13 | ||||
-rw-r--r-- | accel-pppd/radius/radius.c | 3 |
2 files changed, 12 insertions, 4 deletions
diff --git a/accel-pppd/radius/packet.c b/accel-pppd/radius/packet.c index f507ab2b..f6971dc5 100644 --- a/accel-pppd/radius/packet.c +++ b/accel-pppd/radius/packet.c @@ -294,6 +294,13 @@ void rad_packet_free(struct rad_packet_t *pack) mempool_free(pack); } +static void print_octets(uint8_t *raw, int len, void (*print)(const char *fmt, ...)) +{ + print(" 0x"); + while (len--) + print("%02x", *raw++); +} + void rad_packet_print(struct rad_packet_t *pack, struct rad_server_t *s, void (*print)(const char *fmt, ...)) { struct rad_attr_t *attr; @@ -356,7 +363,9 @@ void rad_packet_print(struct rad_packet_t *pack, struct rad_server_t *s, void (* list_for_each_entry(attr, &pack->attrs, entry) { print(" <%s", attr->attr->name); - if (!attr->attr->array) { + if (attr->attr->array) + print_octets(attr->raw, attr->len, print); + else { switch (attr->attr->type) { case ATTR_TYPE_INTEGER: val = rad_dict_find_val(attr->attr, attr->val); @@ -384,6 +393,8 @@ void rad_packet_print(struct rad_packet_t *pack, struct rad_server_t *s, void (* inet_ntop(AF_INET6, &attr->val.ipv6prefix.prefix, ip_str, sizeof(ip_str)); print(" %s/%i", ip_str, attr->val.ipv6prefix.len); break; + default: + print_octets(attr->raw, attr->len, print); } } diff --git a/accel-pppd/radius/radius.c b/accel-pppd/radius/radius.c index 5c650b28..6c3c8ee8 100644 --- a/accel-pppd/radius/radius.c +++ b/accel-pppd/radius/radius.c @@ -660,9 +660,6 @@ struct radius_pd_t *rad_find_session_pack(struct rad_packet_t *pack) if (!sessionid && !username && !port_id && port == -1 && ipaddr == 0 && !csid) return NULL; - if (username && !sessionid && port == -1 && ipaddr == 0 && !port_id) - return NULL; - return rad_find_session(sessionid, username, port_id, port, ipaddr, csid); } |