* Also create a new address for B_SOCKET_SET_ALIAS if the index is -1 - this

now has an almost equivalent logic to the old setters like SIOCSIFADDR.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38054 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2010-08-12 13:27:50 +00:00
parent 910ffb32fe
commit a271028e37
1 changed files with 13 additions and 0 deletions

View File

@ -724,6 +724,19 @@ Interface::Control(net_domain* domain, int32 option, ifreq& request,
// Find first address for family
address = FirstForFamily(domain->family);
}
if (address == NULL) {
// Create new on the fly
address = new(std::nothrow) InterfaceAddress(this, domain);
if (address == NULL)
return B_NO_MEMORY;
status_t status = AddAddress(address);
if (status != B_OK)
return status;
// Note, even if setting the address failed, the empty
// address added here will still be added to the interface.
}
} else
address = AddressAt(aliasRequest.ifra_index);