commit | 56e968a3b455c712d724453c347dc72e7d9f0d18 | [log] [tgz] |
---|---|---|
author | Elliott Hughes <enh@google.com> | Fri Jan 07 18:01:17 2011 -0800 |
committer | Elliott Hughes <enh@google.com> | Fri Jan 07 18:34:43 2011 -0800 |
tree | 4b825dc642cb6eb9a060e54bf8d69288fbee4904 | |
parent | 1fb800ed0fcbd65cea9a9ad7623e247a7c2a7190 [diff] |
Fix getifaddrs(3). Originally, we pulled out the IFA_ADDRESS messages and used them. That didn't work with sholes' ppp interface, where we'd report the *destination* address rather than the local address. We switched to the logical-sounding IFA_LOCAL messages instead: for IPv4 you always get both IFA_ADDRESS and IFA_LOCAL, and they're either the same, or you want IFA_LOCAL. It turns out that you don't get IFA_LOCAL addresses for IPv6 unless they differ from the corresponding IFA_ADDRESS. So what we have to do is use the IFA_ADDRESS but let IFA_LOCAL override it, if it appears. This code was getting way too large, so I've ripped the implementation out of the header file and given it its own file. I've also switched to UniquePtr now it exists, and removed a few unnecessary #includes of "LocalArray.h". I've also added a unit test to help guard against breaking this again. Bug: http://code.google.com/p/android/issues/detail?id=13784 Change-Id: I5a7d29b8e9bf652160eca043802363feb91421a2
This tree is empty.