using IFA_LOCAL for interface enumeration to support ppp links
This commit is contained in:
@@ -729,24 +729,39 @@ static linked_list_t *create_address_list(private_kernel_interface_t *this)
|
|||||||
size_t rtasize = IFA_PAYLOAD (hdr);
|
size_t rtasize = IFA_PAYLOAD (hdr);
|
||||||
host_t *host = NULL;
|
host_t *host = NULL;
|
||||||
char *name = NULL;
|
char *name = NULL;
|
||||||
chunk_t chunk;
|
chunk_t local = chunk_empty, address = chunk_empty;
|
||||||
|
|
||||||
while(RTA_OK(rta, rtasize))
|
while(RTA_OK(rta, rtasize))
|
||||||
{
|
{
|
||||||
switch (rta->rta_type)
|
switch (rta->rta_type)
|
||||||
{
|
{
|
||||||
|
case IFA_LOCAL:
|
||||||
|
local.ptr = RTA_DATA(rta);
|
||||||
|
local.len = RTA_PAYLOAD(rta);
|
||||||
|
break;
|
||||||
case IFA_ADDRESS:
|
case IFA_ADDRESS:
|
||||||
chunk.ptr = RTA_DATA(rta);
|
address.ptr = RTA_DATA(rta);
|
||||||
chunk.len = RTA_PAYLOAD(rta);
|
address.len = RTA_PAYLOAD(rta);
|
||||||
host = host_create_from_chunk(msg->ifa_family,
|
|
||||||
chunk, 0);
|
|
||||||
break;
|
break;
|
||||||
case IFA_LABEL:
|
case IFA_LABEL:
|
||||||
name = RTA_DATA(rta);
|
name = RTA_DATA(rta);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
rta = RTA_NEXT(rta, rtasize);
|
rta = RTA_NEXT(rta, rtasize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* For PPP interfaces, we need the IFA_LOCAL address,
|
||||||
|
* IFA_ADDRESS is the peers address. But IFA_LOCAL is
|
||||||
|
* not included in all cases, so fallback to IFA_ADDRESS. */
|
||||||
|
if (local.ptr)
|
||||||
|
{
|
||||||
|
host = host_create_from_chunk(msg->ifa_family, local, 0);
|
||||||
|
}
|
||||||
|
else if (address.ptr)
|
||||||
|
{
|
||||||
|
host = host_create_from_chunk(msg->ifa_family, address, 0);
|
||||||
|
}
|
||||||
|
|
||||||
if (host)
|
if (host)
|
||||||
{
|
{
|
||||||
address_entry_t *entry;
|
address_entry_t *entry;
|
||||||
|
|||||||
Reference in New Issue
Block a user