* Enabled removing the interface on device removal again.

* Made the return type of remove_interface() void, as it cannot fail.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37884 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2010-08-03 19:33:05 +00:00
parent dac5d7fe4f
commit 7aa2819c12
4 changed files with 20 additions and 11 deletions

View File

@ -246,14 +246,14 @@ datalink_control(net_domain* _domain, int32 option, void* value,
if (interface == NULL)
return B_BAD_VALUE;
status_t status;
status_t status = B_OK;
if (request.ifr_addr.sa_family != AF_UNSPEC
&& request.ifr_addr.sa_len != 0) {
status = interface->Control(domain, SIOCDIFADDR, request,
(ifreq*)value, *_length);
} else
status = remove_interface(interface);
remove_interface(interface);
interface->ReleaseReference();

View File

@ -754,12 +754,8 @@ device_removed(net_device* device)
return B_DEVICE_NOT_FOUND;
// Propagate the loss of the device throughout the stack.
// This is very complex, refer to remove_interface() for
// further details.
// TODO!
//domain_removed_device_interface(interface);
interface_removed_device_interface(interface);
notify_device_monitors(interface, B_DEVICE_BEING_REMOVED);
// By now all of the monitors must have removed themselves. If they

View File

@ -1058,7 +1058,7 @@ add_interface(const char* name, net_domain_private* domain,
/*! Removes the interface from the list, and puts the stack's reference to it.
*/
status_t
void
remove_interface(Interface* interface)
{
interface->SetDown();
@ -1071,7 +1071,20 @@ remove_interface(Interface* interface)
notify_interface_removed(interface);
interface->ReleaseReference();
return B_OK;
}
/*! This is called whenever a device interface is being removed. We will get
the corresponding Interface, and remove it.
*/
void
interface_removed_device_interface(net_device_interface* deviceInterface)
{
MutexLocker locker(sLock);
Interface* interface = find_interface(deviceInterface->device->name);
if (interface != NULL)
remove_interface(interface);
}

View File

@ -175,8 +175,8 @@ status_t uninit_interfaces();
// interfaces
status_t add_interface(const char* name, net_domain_private* domain,
const ifaliasreq& request, net_device_interface* deviceInterface);
status_t remove_interface(Interface* interface);
void interface_went_down(Interface* interface);
void remove_interface(Interface* interface);
void interface_removed_device_interface(net_device_interface* deviceInterface);
status_t add_interface_address(Interface* interface, net_domain_private* domain,
const ifaliasreq& request);