Use IFA_LOCAL instead of IFA_ADDRESS over IPv4 network on ANDROID

IFA_ADDRESS gives DESTINATION address in case of point-to-point
connection, which is not able to create ports for candidate gathering.
Use IFA_LOCAL to avoid this problem.

Bug: webrtc:9189
Change-Id: Ifcb1955b1b4011dc69c93d99b4e223b370dc16eb
Reviewed-on: https://webrtc-review.googlesource.com/69620
Commit-Queue: Tommi <tommi@webrtc.org>
Reviewed-by: Tommi <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23055}
This commit is contained in:
Yongje Lee 2018-04-27 09:47:07 +09:00 committed by Commit Bot
parent ad3971f40f
commit ebd9abc1a2
2 changed files with 18 additions and 17 deletions

View file

@ -68,6 +68,7 @@ ARM Holdings <*@arm.com>
BroadSoft Inc. <*@broadsoft.com> BroadSoft Inc. <*@broadsoft.com>
Facebook Inc. <*@fb.com> Facebook Inc. <*@fb.com>
Google Inc. <*@google.com> Google Inc. <*@google.com>
HyperConnect Inc. <*@hpcnt.com>
Life On Air Inc. <*@lifeonair.com> Life On Air Inc. <*@lifeonair.com>
Intel Corporation <*@intel.com> Intel Corporation <*@intel.com>
MIPS Technologies <*@mips.com> MIPS Technologies <*@mips.com>

View file

@ -174,9 +174,10 @@ int getifaddrs(struct ifaddrs** result) {
rtattr* rta = IFA_RTA(address_msg); rtattr* rta = IFA_RTA(address_msg);
ssize_t payload_len = IFA_PAYLOAD(header); ssize_t payload_len = IFA_PAYLOAD(header);
while (RTA_OK(rta, payload_len)) { while (RTA_OK(rta, payload_len)) {
if (rta->rta_type == IFA_ADDRESS) { if ((address_msg->ifa_family == AF_INET &&
int family = address_msg->ifa_family; rta->rta_type == IFA_LOCAL) ||
if (family == AF_INET || family == AF_INET6) { (address_msg->ifa_family == AF_INET6 &&
rta->rta_type == IFA_ADDRESS)) {
ifaddrs* newest = new ifaddrs; ifaddrs* newest = new ifaddrs;
memset(newest, 0, sizeof(ifaddrs)); memset(newest, 0, sizeof(ifaddrs));
if (current) { if (current) {
@ -192,7 +193,6 @@ int getifaddrs(struct ifaddrs** result) {
} }
current = newest; current = newest;
} }
}
rta = RTA_NEXT(rta, payload_len); rta = RTA_NEXT(rta, payload_len);
} }
break; break;