only deliver frames to IPv4 raw sockets of the specified protocol.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20675 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -60,6 +60,8 @@ public:
|
|||||||
|
|
||||||
void WakeAll();
|
void WakeAll();
|
||||||
|
|
||||||
|
net_socket *Socket() const { return fSocket; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
status_t _Enqueue(net_buffer *buffer);
|
status_t _Enqueue(net_buffer *buffer);
|
||||||
status_t _EnqueueClone(net_buffer *buffer);
|
status_t _EnqueueClone(net_buffer *buffer);
|
||||||
|
|||||||
@@ -585,8 +585,12 @@ raw_receive_data(net_buffer *buffer)
|
|||||||
|
|
||||||
RawSocketList::Iterator iterator = sRawSockets.GetIterator();
|
RawSocketList::Iterator iterator = sRawSockets.GetIterator();
|
||||||
|
|
||||||
while (iterator.HasNext())
|
while (iterator.HasNext()) {
|
||||||
iterator.Next()->EnqueueClone(buffer);
|
RawSocket *raw = iterator.Next();
|
||||||
|
|
||||||
|
if (raw->Socket()->protocol == buffer->protocol)
|
||||||
|
raw->EnqueueClone(buffer);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -909,7 +913,7 @@ ipv4_send_routed_data(net_protocol *_protocol, struct net_route *route,
|
|||||||
gBufferModule->checksum(buffer, 0, buffer->size, true)));
|
gBufferModule->checksum(buffer, 0, buffer->size, true)));
|
||||||
|
|
||||||
TRACE(("destination-IP: buffer=%p addr=%p %08lx\n", buffer, &buffer->destination,
|
TRACE(("destination-IP: buffer=%p addr=%p %08lx\n", buffer, &buffer->destination,
|
||||||
ntohl(destination->sin_addr.s_addr)));
|
ntohl(destination.sin_addr.s_addr)));
|
||||||
|
|
||||||
uint32 mtu = route->mtu ? route->mtu : interface->mtu;
|
uint32 mtu = route->mtu ? route->mtu : interface->mtu;
|
||||||
if (buffer->size > mtu) {
|
if (buffer->size > mtu) {
|
||||||
@@ -1074,10 +1078,7 @@ ipv4_receive_data(net_buffer *buffer)
|
|||||||
// we must no longer access bufferHeader or header anymore after
|
// we must no longer access bufferHeader or header anymore after
|
||||||
// this point
|
// this point
|
||||||
|
|
||||||
if (protocol != IPPROTO_TCP && protocol != IPPROTO_UDP) {
|
raw_receive_data(buffer);
|
||||||
// SOCK_RAW doesn't get all packets
|
|
||||||
raw_receive_data(buffer);
|
|
||||||
}
|
|
||||||
|
|
||||||
gBufferModule->remove_header(buffer, headerLength);
|
gBufferModule->remove_header(buffer, headerLength);
|
||||||
// the header is of variable size and may include IP options
|
// the header is of variable size and may include IP options
|
||||||
|
|||||||
Reference in New Issue
Block a user