* Applied the B_SOCKET_SET_ALIAS address retrieval logic to B_SOCKET_GET_ALIAS

as well (of course, no address is created automatically here).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38058 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2010-08-12 13:38:52 +00:00
parent 530f548320
commit 14d0b44b79

View File

@ -775,8 +775,21 @@ interface_protocol_control(net_datalink_protocol* _protocol, int32 option,
if (user_memcpy(&request, argument, sizeof(ifaliasreq)) != B_OK)
return B_BAD_ADDRESS;
InterfaceAddress* address
= interface->AddressAt(request.ifra_index);
InterfaceAddress* address = NULL;
if (request.ifra_index < 0) {
if (!protocol->domain->address_module->is_empty_address(
(const sockaddr*)&request.ifra_addr, false)) {
// Find first address that matches the local address
address = interface->AddressForLocal(protocol->domain,
(const sockaddr*)&request.ifra_addr);
}
if (address == NULL) {
// Find first address for family
address = interface->FirstForFamily(
protocol->domain->family);
}
} else
address = interface->AddressAt(request.ifra_index);
if (address == NULL)
return B_BAD_VALUE;