Fix "IsLoopbackIp" to cover all loopback addresses; not just 127.0.0.1.

The loopback range is 127.0.0.0/8, which is everything from 127.0.0.0 to
127.255.255.255.

BUG=chromium:649118

Review-Url: https://codereview.webrtc.org/2445933003
Cr-Commit-Position: refs/heads/master@{#14807}
This commit is contained in:
deadbeef
2016-10-27 18:30:23 -07:00
committed by Commit bot
parent 6be0a657c5
commit 9922016ee4
3 changed files with 7 additions and 2 deletions

View File

@ -294,7 +294,7 @@ bool IPIsAny(const IPAddress& ip) {
bool IPIsLoopback(const IPAddress& ip) {
switch (ip.family()) {
case AF_INET: {
return ip == IPAddress(INADDR_LOOPBACK);
return (ip.v4AddressAsHostOrderInteger() >> 24) == 127;
}
case AF_INET6: {
return ip == IPAddress(in6addr_loopback);