retrieve the incoming interface on the domain_receive_adapter(). This should fix potential issues with packets addressed to the IP broadcast address, such as in with some DHCP implementations.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20767 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
40844fe526
commit
8a819b17e4
|
@ -35,7 +35,8 @@ struct net_timer {
|
|||
};
|
||||
|
||||
typedef int32 (*net_deframe_func)(struct net_device *device, struct net_buffer *buffer);
|
||||
typedef status_t (*net_receive_func)(void *cookie, struct net_buffer *buffer);
|
||||
typedef status_t (*net_receive_func)(void *cookie, struct net_device *,
|
||||
struct net_buffer *buffer);
|
||||
|
||||
enum {
|
||||
B_DEVICE_GOING_UP = 1,
|
||||
|
|
|
@ -401,7 +401,7 @@ handle_arp_reply(net_buffer *buffer, arp_header &header)
|
|||
|
||||
|
||||
static status_t
|
||||
arp_receive(void *cookie, net_buffer *buffer)
|
||||
arp_receive(void *cookie, net_device *device, net_buffer *buffer)
|
||||
{
|
||||
TRACE(("ARP receive\n"));
|
||||
|
||||
|
|
|
@ -1487,12 +1487,8 @@ ipv4_receive_data(net_buffer *buffer)
|
|||
|
||||
if (header.destination == INADDR_BROADCAST) {
|
||||
buffer->flags |= MSG_BCAST;
|
||||
// TODO set incoming interface. we should have some notion from which
|
||||
// device interface this buffer is coming from.
|
||||
buffer->interface = NULL;
|
||||
} else if (IN_MULTICAST(header.destination)) {
|
||||
buffer->flags |= MSG_MCAST;
|
||||
buffer->interface = NULL;
|
||||
} else {
|
||||
uint32 matchedAddressType = 0;
|
||||
// test if the packet is really for us
|
||||
|
|
|
@ -74,7 +74,7 @@ device_reader_thread(void *_interface)
|
|||
net_device_handler *handler = iterator.Next();
|
||||
|
||||
if (handler->type == type) {
|
||||
status = handler->func(handler->cookie, buffer);
|
||||
status = handler->func(handler->cookie, device, buffer);
|
||||
if (status == B_OK)
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -56,9 +56,11 @@ find_device_interface(const char *name)
|
|||
|
||||
|
||||
static status_t
|
||||
domain_receive_adapter(void *cookie, net_buffer *buffer)
|
||||
domain_receive_adapter(void *cookie, net_device *device, net_buffer *buffer)
|
||||
{
|
||||
net_domain_private *domain = (net_domain_private *)cookie;
|
||||
|
||||
buffer->interface = find_interface(domain, device->index);
|
||||
return domain->module->receive_data(buffer);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue