send buffer size is irrelevant for UDP, instead check if the fed buffer is larger than the maximum payload UDP supported. Do the same in IPV4.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20590 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Hugo Santos 2007-04-05 19:19:38 +00:00
parent 9e084902c1
commit 4168e54af8
2 changed files with 4 additions and 4 deletions

View File

@ -977,6 +977,9 @@ ipv4_send_routed_data(net_protocol *_protocol, struct net_route *route,
bufferHeader.Detach();
}
if (buffer->size > 0xffff)
return EMSGSIZE;
TRACE(("header chksum: %ld, buffer checksum: %ld\n",
gBufferModule->checksum(buffer, 0, sizeof(ipv4_header), true),
gBufferModule->checksum(buffer, 0, buffer->size, true)));

View File

@ -764,7 +764,7 @@ UdpEndpoint::_Deactivate()
status_t
UdpEndpoint::SendData(net_buffer *buffer, net_route *route)
{
if (buffer->size > socket->send.buffer_size)
if (buffer->size > 0xffff)
return EMSGSIZE;
buffer->protocol = IPPROTO_UDP;
@ -856,9 +856,6 @@ net_protocol *
udp_init_protocol(net_socket *socket)
{
socket->protocol = IPPROTO_UDP;
socket->send.buffer_size = 65535 - 20 - 8;
// subtract lengths of IP and UDP headers (NOTE: IP headers could be
// larger if IP options are used, but we do not currently care for that)
UdpEndpoint *endpoint = new (std::nothrow) UdpEndpoint(socket);
TRACE(("udp_init_protocol(%p) created endpoint %p\n", socket, endpoint));