* Made sure is_empty_address() also detects AF_UNSPEC addresses as empty.
* The is_empty_address() function of AF_UNIX did not deal correctly with empty addresses. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37804 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
d72a2493e6
commit
4d41aff0ac
@ -100,7 +100,8 @@ ipv4_mask_address(const sockaddr *address, const sockaddr *mask,
|
||||
static bool
|
||||
ipv4_is_empty_address(const sockaddr *address, bool checkPort)
|
||||
{
|
||||
if (address == NULL || address->sa_len == 0)
|
||||
if (address == NULL || address->sa_len == 0
|
||||
|| address->sa_family == AF_UNSPEC)
|
||||
return true;
|
||||
|
||||
return ((sockaddr_in *)address)->sin_addr.s_addr == 0
|
||||
|
@ -113,7 +113,8 @@ ipv6_mask_address(const sockaddr *address, const sockaddr *mask,
|
||||
static bool
|
||||
ipv6_is_empty_address(const sockaddr *_address, bool checkPort)
|
||||
{
|
||||
if (_address == NULL || _address->sa_len == 0)
|
||||
if (_address == NULL || _address->sa_len == 0
|
||||
|| _address->sa_family == AF_UNSPEC)
|
||||
return true;
|
||||
|
||||
const sockaddr_in6 *address = (const sockaddr_in6 *)_address;
|
||||
|
@ -90,7 +90,8 @@ l2cap_mask_address(const sockaddr *address, const sockaddr *mask,
|
||||
static bool
|
||||
l2cap_is_empty_address(const sockaddr *address, bool checkPort)
|
||||
{
|
||||
if (address == NULL || address->sa_len == 0)
|
||||
if (address == NULL || address->sa_len == 0
|
||||
|| address->sa_family == AF_UNSPEC)
|
||||
return true;
|
||||
|
||||
return ((bdaddrUtils::Compare(
|
||||
|
@ -108,10 +108,13 @@ unix_equal_masked_addresses(const sockaddr *a, const sockaddr *b,
|
||||
static bool
|
||||
unix_is_empty_address(const sockaddr *address, bool checkPort)
|
||||
{
|
||||
return address->sa_len >= kEmptyAddress.sun_len
|
||||
&& memcmp(address, &kEmptyAddress, kEmptyAddress.sun_len) == 0;
|
||||
return address == NULL || address->sa_len == 0
|
||||
|| address->sa_family == AF_UNSPEC)
|
||||
|| (address->sa_len >= kEmptyAddress.sun_len
|
||||
&& memcmp(address, &kEmptyAddress, kEmptyAddress.sun_len) == 0);
|
||||
}
|
||||
|
||||
|
||||
static bool
|
||||
unix_is_same_family(const sockaddr *address)
|
||||
{
|
||||
@ -121,6 +124,7 @@ unix_is_same_family(const sockaddr *address)
|
||||
return address->sa_family == AF_UNIX;
|
||||
}
|
||||
|
||||
|
||||
static int32
|
||||
unix_first_mask_bit(const sockaddr *mask)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user