summaryrefslogtreecommitdiff
path: root/accel-pppd/extra
diff options
context:
space:
mode:
authorDmitry Kozlov <xeb@mail.ru>2019-05-15 17:57:26 +0300
committerDmitry Kozlov <xeb@mail.ru>2019-05-15 17:57:26 +0300
commit27614ed5f76827d34e76af6848336c4f425972d1 (patch)
treef6181798926bdd1e717eb4da150cc27874f175ed /accel-pppd/extra
parentaa7ac3a3c580a0840573e628dc03396b9521d0e5 (diff)
downloadaccel-ppp-27614ed5f76827d34e76af6848336c4f425972d1.tar.gz
accel-ppp-27614ed5f76827d34e76af6848336c4f425972d1.zip
pppd_compat: write human readable values of IPv6 address to radattr file
Diffstat (limited to 'accel-pppd/extra')
-rw-r--r--accel-pppd/extra/pppd_compat.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/accel-pppd/extra/pppd_compat.c b/accel-pppd/extra/pppd_compat.c
index 6761e5b..421c598 100644
--- a/accel-pppd/extra/pppd_compat.c
+++ b/accel-pppd/extra/pppd_compat.c
@@ -517,6 +517,7 @@ static void write_radattr(struct pppd_compat_pd *pd, struct rad_packet_t *pack)
char fname1[PATH_MAX], fname2[PATH_MAX];
int fd, i;
in_addr_t addr;
+ char ip_str[50];
if (ses->state == AP_STATE_ACTIVE) {
sprintf(fname1, "%s.%s", conf_radattr_prefix, ses->ifname);
@@ -563,6 +564,14 @@ static void write_radattr(struct pppd_compat_pd *pd, struct rad_packet_t *pack)
case ATTR_TYPE_DATE:
fprintf(f, "%lu\n", (unsigned long) attr->val.date);
break;
+ case ATTR_TYPE_IPV6PREFIX:
+ inet_ntop(AF_INET6, &attr->val.ipv6prefix.prefix, ip_str, sizeof(ip_str));
+ fprintf(f, "%s/%i\n", ip_str, attr->val.ipv6prefix.len);
+ break;
+ case ATTR_TYPE_IPV6ADDR:
+ inet_ntop(AF_INET6, &attr->val.ipv6addr, ip_str, sizeof(ip_str));
+ fprintf(f, "%s\n", ip_str);
+ break;
}
}
fclose(f);