* 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:
parent
dac5d7fe4f
commit
7aa2819c12
|
@ -246,14 +246,14 @@ datalink_control(net_domain* _domain, int32 option, void* value,
|
||||||
if (interface == NULL)
|
if (interface == NULL)
|
||||||
return B_BAD_VALUE;
|
return B_BAD_VALUE;
|
||||||
|
|
||||||
status_t status;
|
status_t status = B_OK;
|
||||||
|
|
||||||
if (request.ifr_addr.sa_family != AF_UNSPEC
|
if (request.ifr_addr.sa_family != AF_UNSPEC
|
||||||
&& request.ifr_addr.sa_len != 0) {
|
&& request.ifr_addr.sa_len != 0) {
|
||||||
status = interface->Control(domain, SIOCDIFADDR, request,
|
status = interface->Control(domain, SIOCDIFADDR, request,
|
||||||
(ifreq*)value, *_length);
|
(ifreq*)value, *_length);
|
||||||
} else
|
} else
|
||||||
status = remove_interface(interface);
|
remove_interface(interface);
|
||||||
|
|
||||||
interface->ReleaseReference();
|
interface->ReleaseReference();
|
||||||
|
|
||||||
|
|
|
@ -754,12 +754,8 @@ device_removed(net_device* device)
|
||||||
return B_DEVICE_NOT_FOUND;
|
return B_DEVICE_NOT_FOUND;
|
||||||
|
|
||||||
// Propagate the loss of the device throughout the stack.
|
// 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);
|
notify_device_monitors(interface, B_DEVICE_BEING_REMOVED);
|
||||||
|
|
||||||
// By now all of the monitors must have removed themselves. If they
|
// By now all of the monitors must have removed themselves. If they
|
||||||
|
|
|
@ -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.
|
/*! Removes the interface from the list, and puts the stack's reference to it.
|
||||||
*/
|
*/
|
||||||
status_t
|
void
|
||||||
remove_interface(Interface* interface)
|
remove_interface(Interface* interface)
|
||||||
{
|
{
|
||||||
interface->SetDown();
|
interface->SetDown();
|
||||||
|
@ -1071,7 +1071,20 @@ remove_interface(Interface* interface)
|
||||||
notify_interface_removed(interface);
|
notify_interface_removed(interface);
|
||||||
|
|
||||||
interface->ReleaseReference();
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -175,8 +175,8 @@ status_t uninit_interfaces();
|
||||||
// interfaces
|
// interfaces
|
||||||
status_t add_interface(const char* name, net_domain_private* domain,
|
status_t add_interface(const char* name, net_domain_private* domain,
|
||||||
const ifaliasreq& request, net_device_interface* deviceInterface);
|
const ifaliasreq& request, net_device_interface* deviceInterface);
|
||||||
status_t remove_interface(Interface* interface);
|
void remove_interface(Interface* interface);
|
||||||
void interface_went_down(Interface* interface);
|
void interface_removed_device_interface(net_device_interface* deviceInterface);
|
||||||
|
|
||||||
status_t add_interface_address(Interface* interface, net_domain_private* domain,
|
status_t add_interface_address(Interface* interface, net_domain_private* domain,
|
||||||
const ifaliasreq& request);
|
const ifaliasreq& request);
|
||||||
|
|
Loading…
Reference in New Issue