|
@@ -261,6 +261,9 @@ RadiusHostDataSource::getAll(const Host::IdentifierType& identifier_type,
|
|
|
VALUE_PAIR *vp = received;
|
|
|
char name[128];
|
|
|
char value[128];
|
|
|
+ HostPtr host(new Host(identifier_begin, identifier_len,
|
|
|
+ identifier_type, SubnetID(),
|
|
|
+ SubnetID(), asiolink::IOAddress::IPV4_ZERO_ADDRESS()));
|
|
|
|
|
|
fprintf(stderr, "\"%s\" RADIUS Authentication OK\n", identifier_hex);
|
|
|
|
|
@@ -268,14 +271,22 @@ RadiusHostDataSource::getAll(const Host::IdentifierType& identifier_type,
|
|
|
while(vp != NULL) {
|
|
|
if (rc_avpair_tostr(rh, vp, name, sizeof(name), value, sizeof(value)) == 0) {
|
|
|
if (std::string(name) == "Framed-IP-Address") {
|
|
|
- host.reset(new Host(identifier_begin, identifier_len,
|
|
|
- identifier_type, SubnetID(),
|
|
|
- SubnetID(), asiolink::IOAddress(value)));
|
|
|
- result.push_back(host);
|
|
|
+ host->setIPv4Reservation(asiolink::IOAddress(value));
|
|
|
+ }
|
|
|
+ if (std::string(name) == "Framed-IPv6-Address") {
|
|
|
+ IPv6Resrv ipv6_addr(IPv6Resrv::TYPE_NA, asiolink::IOAddress(value), 128);
|
|
|
+ host->addReservation(ipv6_addr);
|
|
|
+ }
|
|
|
+ if (std::string(name) == "Delegated-IPv6-Prefix") {
|
|
|
+ fprintf(stderr, "Delegated-IPv6-Prefix: %s", value);
|
|
|
+ /* TODO: parse prefix length. */
|
|
|
+ IPv6Resrv ipv6_prefix(IPv6Resrv::TYPE_PD, asiolink::IOAddress(value), 42);
|
|
|
+ host->addReservation(ipv6_prefix);
|
|
|
}
|
|
|
}
|
|
|
vp = vp->next;
|
|
|
}
|
|
|
+ result.push_back(host);
|
|
|
} else {
|
|
|
fprintf(stderr, "\"%s\" RADIUS Authentication failure (RC=%i)\n", identifier_hex, res);
|
|
|
}
|