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:
parent
9e084902c1
commit
4168e54af8
@ -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)));
|
||||
|
@ -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));
|
||||
|
Loading…
Reference in New Issue
Block a user