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}
diff --git a/AUTHORS b/AUTHORS
index 9394364..8e7e183 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -68,6 +68,7 @@
BroadSoft Inc. <*@broadsoft.com>
Facebook Inc. <*@fb.com>
Google Inc. <*@google.com>
+HyperConnect Inc. <*@hpcnt.com>
Life On Air Inc. <*@lifeonair.com>
Intel Corporation <*@intel.com>
MIPS Technologies <*@mips.com>
diff --git a/rtc_base/ifaddrs-android.cc b/rtc_base/ifaddrs-android.cc
index 85a4497..b713c02 100644
--- a/rtc_base/ifaddrs-android.cc
+++ b/rtc_base/ifaddrs-android.cc
@@ -174,24 +174,24 @@
rtattr* rta = IFA_RTA(address_msg);
ssize_t payload_len = IFA_PAYLOAD(header);
while (RTA_OK(rta, payload_len)) {
- if (rta->rta_type == IFA_ADDRESS) {
- int family = address_msg->ifa_family;
- if (family == AF_INET || family == AF_INET6) {
- ifaddrs* newest = new ifaddrs;
- memset(newest, 0, sizeof(ifaddrs));
- if (current) {
- current->ifa_next = newest;
- } else {
- start = newest;
- }
- if (populate_ifaddrs(newest, address_msg, RTA_DATA(rta),
- RTA_PAYLOAD(rta)) != 0) {
- freeifaddrs(start);
- *result = nullptr;
- return -1;
- }
- current = newest;
+ if ((address_msg->ifa_family == AF_INET &&
+ rta->rta_type == IFA_LOCAL) ||
+ (address_msg->ifa_family == AF_INET6 &&
+ rta->rta_type == IFA_ADDRESS)) {
+ ifaddrs* newest = new ifaddrs;
+ memset(newest, 0, sizeof(ifaddrs));
+ if (current) {
+ current->ifa_next = newest;
+ } else {
+ start = newest;
}
+ if (populate_ifaddrs(newest, address_msg, RTA_DATA(rta),
+ RTA_PAYLOAD(rta)) != 0) {
+ freeifaddrs(start);
+ *result = nullptr;
+ return -1;
+ }
+ current = newest;
}
rta = RTA_NEXT(rta, payload_len);
}