* Removed the call to net_stack_module::register_domain_device_handler(), as

it's not needed for locally received buffers. This fixes a doubled
  initialization for a single device when there is more than a single domain
  involved. Reported by Atis.
* Fixed missing call to unregister_device_deframer() in case there was not
  enough memory to allocate the loopback_frame_protocol object.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38002 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2010-08-10 10:46:27 +00:00
parent 1ebd87f4e7
commit 28bbeaca96
@@ -46,7 +46,7 @@ status_t
loopback_frame_init(struct net_interface*interface, net_domain* domain,
net_datalink_protocol** _protocol)
{
// We currently only support a single family and type!
// We only support a single type!
if (interface->device->type != IFT_LOOP)
return B_BAD_TYPE;
@@ -62,17 +62,16 @@ loopback_frame_init(struct net_interface*interface, net_domain* domain,
if (status != B_OK)
goto err1;
// We also register the domain as a handler for our packets
status = stack->register_domain_device_handler(interface->device, 0,
domain);
if (status != B_OK)
goto err2;
put_module(NET_STACK_MODULE_NAME);
// Locally received buffers don't need a domain device handler, as the
// buffer reception is handled internally.
protocol = new(std::nothrow) loopback_frame_protocol;
if (protocol == NULL)
return B_NO_MEMORY;
if (protocol == NULL) {
status = B_NO_MEMORY;
goto err2;
}
put_module(NET_STACK_MODULE_NAME);
*_protocol = protocol;
return B_OK;