diff options
author | Martin Willi <martin@strongswan.org> | 2007-03-30 09:21:48 +0000 |
---|---|---|
committer | Martin Willi <martin@strongswan.org> | 2007-03-30 09:21:48 +0000 |
commit | 3374c8b1c8396310cee571e195ec7915aa6c400e (patch) | |
tree | cb7327014a311b6015eafcf48daa9f3620803332 | |
parent | b9e363f86ff1ece278a8e8daeff711a645e8678a (diff) | |
download | strongswan-3374c8b1c8396310cee571e195ec7915aa6c400e.tar.bz2 strongswan-3374c8b1c8396310cee571e195ec7915aa6c400e.tar.xz |
using IFA_LOCAL for interface enumeration to support ppp links
-rw-r--r-- | src/charon/threads/kernel_interface.c | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/src/charon/threads/kernel_interface.c b/src/charon/threads/kernel_interface.c index f8456abbb..e674e18b2 100644 --- a/src/charon/threads/kernel_interface.c +++ b/src/charon/threads/kernel_interface.c @@ -729,24 +729,39 @@ static linked_list_t *create_address_list(private_kernel_interface_t *this) size_t rtasize = IFA_PAYLOAD (hdr); host_t *host = NULL; char *name = NULL; - chunk_t chunk; + chunk_t local = chunk_empty, address = chunk_empty; while(RTA_OK(rta, rtasize)) { switch (rta->rta_type) { + case IFA_LOCAL: + local.ptr = RTA_DATA(rta); + local.len = RTA_PAYLOAD(rta); + break; case IFA_ADDRESS: - chunk.ptr = RTA_DATA(rta); - chunk.len = RTA_PAYLOAD(rta); - host = host_create_from_chunk(msg->ifa_family, - chunk, 0); + address.ptr = RTA_DATA(rta); + address.len = RTA_PAYLOAD(rta); break; case IFA_LABEL: name = RTA_DATA(rta); + break; } 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) { address_entry_t *entry; |