No longer crashes when deleting "certain" interfaces (couldn't reproduce the
crash in Qemu for some reason). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20397 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -539,7 +539,6 @@ interface_protocol_down(net_datalink_protocol *_protocol)
|
|||||||
interface_protocol *protocol = (interface_protocol *)_protocol;
|
interface_protocol *protocol = (interface_protocol *)_protocol;
|
||||||
net_device_interface *deviceInterface =
|
net_device_interface *deviceInterface =
|
||||||
((net_interface_private *)protocol->interface)->device_interface;
|
((net_interface_private *)protocol->interface)->device_interface;
|
||||||
net_device *device = protocol->device;
|
|
||||||
|
|
||||||
// TODO: locking!
|
// TODO: locking!
|
||||||
if (deviceInterface->up_count == 0)
|
if (deviceInterface->up_count == 0)
|
||||||
@@ -550,12 +549,7 @@ interface_protocol_down(net_datalink_protocol *_protocol)
|
|||||||
if (deviceInterface->up_count > 0)
|
if (deviceInterface->up_count > 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
device->flags &= ~IFF_UP;
|
down_device_interface(deviceInterface);
|
||||||
protocol->device_module->down(protocol->device);
|
|
||||||
|
|
||||||
// make sure the reader thread is gone before shutting down the interface
|
|
||||||
status_t status;
|
|
||||||
wait_for_thread(deviceInterface->reader_thread, &status);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -160,7 +160,7 @@ delete_interface(net_interface_private *interface)
|
|||||||
if ((interface->flags & IFF_UP) != 0) {
|
if ((interface->flags & IFF_UP) != 0) {
|
||||||
// the interface is still up - we need to change that before deleting it
|
// the interface is still up - we need to change that before deleting it
|
||||||
interface->flags &= ~IFF_UP;
|
interface->flags &= ~IFF_UP;
|
||||||
interface->device_interface->module->down(interface->device_interface->device);
|
down_device_interface(interface->device_interface);
|
||||||
}
|
}
|
||||||
|
|
||||||
put_device_interface(interface->device_interface);
|
put_device_interface(interface->device_interface);
|
||||||
@@ -398,6 +398,20 @@ get_device_interface(const char *name)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
down_device_interface(net_device_interface *interface)
|
||||||
|
{
|
||||||
|
net_device *device = interface->device;
|
||||||
|
|
||||||
|
device->flags &= ~IFF_UP;
|
||||||
|
interface->module->down(device);
|
||||||
|
|
||||||
|
// make sure the reader thread is gone before shutting down the interface
|
||||||
|
status_t status;
|
||||||
|
wait_for_thread(interface->reader_thread, &status);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// #pragma mark - devices
|
// #pragma mark - devices
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -76,6 +76,7 @@ status_t list_device_interfaces(void *buffer, size_t size);
|
|||||||
void put_device_interface(struct net_device_interface *interface);
|
void put_device_interface(struct net_device_interface *interface);
|
||||||
struct net_device_interface *get_device_interface(uint32 index);
|
struct net_device_interface *get_device_interface(uint32 index);
|
||||||
struct net_device_interface *get_device_interface(const char *name);
|
struct net_device_interface *get_device_interface(const char *name);
|
||||||
|
void down_device_interface(net_device_interface *interface);
|
||||||
|
|
||||||
// devices
|
// devices
|
||||||
status_t unregister_device_deframer(net_device *device);
|
status_t unregister_device_deframer(net_device *device);
|
||||||
|
|||||||
Reference in New Issue
Block a user