Encode IPv6 virtual IPs in a Framed-IPv6-Prefix attribute
This commit is contained in:
@@ -146,16 +146,24 @@ static void add_ike_sa_parameters(radius_message_t *message, ike_sa_t *ike_sa)
|
|||||||
{
|
{
|
||||||
host_t *vip;
|
host_t *vip;
|
||||||
char buf[64];
|
char buf[64];
|
||||||
|
chunk_t data;
|
||||||
|
|
||||||
snprintf(buf, sizeof(buf), "%Y", ike_sa->get_other_eap_id(ike_sa));
|
snprintf(buf, sizeof(buf), "%Y", ike_sa->get_other_eap_id(ike_sa));
|
||||||
message->add(message, RAT_USER_NAME, chunk_create(buf, strlen(buf)));
|
message->add(message, RAT_USER_NAME, chunk_create(buf, strlen(buf)));
|
||||||
snprintf(buf, sizeof(buf), "%#H", ike_sa->get_other_host(ike_sa));
|
snprintf(buf, sizeof(buf), "%#H", ike_sa->get_other_host(ike_sa));
|
||||||
message->add(message, RAT_CALLING_STATION_ID, chunk_create(buf, strlen(buf)));
|
message->add(message, RAT_CALLING_STATION_ID, chunk_create(buf, strlen(buf)));
|
||||||
vip = ike_sa->get_virtual_ip(ike_sa, FALSE);
|
vip = ike_sa->get_virtual_ip(ike_sa, FALSE);
|
||||||
if (vip)
|
if (vip && vip->get_family(vip) == AF_INET)
|
||||||
{
|
{
|
||||||
message->add(message, RAT_FRAMED_IP_ADDRESS, vip->get_address(vip));
|
message->add(message, RAT_FRAMED_IP_ADDRESS, vip->get_address(vip));
|
||||||
}
|
}
|
||||||
|
if (vip && vip->get_family(vip) == AF_INET6)
|
||||||
|
{
|
||||||
|
/* we currently assign /128 prefixes, only (reserved, length) */
|
||||||
|
data = chunk_from_chars(0, 128);
|
||||||
|
data = chunk_cata("cc", data, vip->get_address(vip));
|
||||||
|
message->add(message, RAT_FRAMED_IPV6_PREFIX, data);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user