Commit 8ccb2c17 authored by Olivier Crête's avatar Olivier Crête

pseudotcp: Separate default and maximum MTU

Accept packets much beyond the default MTU, but
set a reasonable default MTU for sending of 1400
parent cb644b2b
...@@ -118,7 +118,9 @@ const guint16 PACKET_MAXIMUMS[] = { ...@@ -118,7 +118,9 @@ const guint16 PACKET_MAXIMUMS[] = {
0, // End of list marker 0, // End of list marker
}; };
#define MAX_PACKET 65535 // FIXME: This is a reasonable MTU, but we should get it from the lower layer
#define DEF_MTU 1400
#define MAX_PACKET 65532
// Note: we removed lowest level because packet overhead was larger! // Note: we removed lowest level because packet overhead was larger!
#define MIN_PACKET 296 #define MIN_PACKET 296
...@@ -829,7 +831,7 @@ pseudo_tcp_socket_init (PseudoTcpSocket *obj) ...@@ -829,7 +831,7 @@ pseudo_tcp_socket_init (PseudoTcpSocket *obj)
priv->msslevel = 0; priv->msslevel = 0;
priv->largest = 0; priv->largest = 0;
priv->mss = MIN_PACKET - PACKET_OVERHEAD; priv->mss = MIN_PACKET - PACKET_OVERHEAD;
priv->mtu_advise = MAX_PACKET; priv->mtu_advise = DEF_MTU;
priv->rto_base = 0; priv->rto_base = 0;
...@@ -1032,9 +1034,11 @@ pseudo_tcp_socket_notify_packet(PseudoTcpSocket *self, ...@@ -1032,9 +1034,11 @@ pseudo_tcp_socket_notify_packet(PseudoTcpSocket *self,
if (len > MAX_PACKET) { if (len > MAX_PACKET) {
//LOG_F(WARNING) << "packet too large"; //LOG_F(WARNING) << "packet too large";
self->priv->error = EMSGSIZE;
return FALSE; return FALSE;
} else if (len < HEADER_SIZE) { } else if (len < HEADER_SIZE) {
//LOG_F(WARNING) << "packet too small"; //LOG_F(WARNING) << "packet too small";
self->priv->error = EINVAL;
return FALSE; return FALSE;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment