671a834be6d345a7df01ba19407dd1c96509c785 |
|
29-Oct-2013 |
Narayan Kamath <narayan@google.com> |
Make getInetAddress generate less garbage. This function is now on the critical path for URLConnection since OkHttp calls it to figure out what the MTU for the NetworkInterface is. This function performs poorly when there are a large number of interfaces available. - Read /proc/net/if_inet6 exactly once, instead of once per interface. - List the contents of /sys/class/net exactly once, and not once per interface. Also adds a couple of tests for if_inet6 parsing. TODO: Add a "zero copy" version of UnsafeByteSequence and then move readIntFile over to that version. (Cherry picked from ab6d858336e6db8b5117b78837fee2a9f35fdf2c) Bug: b/11411129 Change-Id: Ieb1d5f0beaf462721f897a5f6376a4587f3aebaf
|
a37e971343883bb582a93ffbd9f0ba84f10e55ba |
|
21-Apr-2011 |
Elliott Hughes <enh@google.com> |
Rewrite NetworkInterface. This is part of the POSIX work, but also fixes a bug that asked for down interfaces to be returned. Additionally, I found a few bugs while rewriting this code. Most notably, we used to return a bogus broadcast address for the loopback interface. The only difference I notice between us and the RI when running on the host is that the RI claims that 127.0.0.1 has a prefix length of 0 rather than 8. I believe that we are correct on this issue. Bug: 4082343, 3107501 Change-Id: I677e0698e3a86676b4332b5d56fe514a99c3ddc0
|
3a9a00ad1f166a8e5ea810099b057522f9aecb48 |
|
08-Jan-2011 |
Elliott Hughes <enh@google.com> |
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
|