Improved how NAT-T keepalives are handled in sockets/receiver.
This commit is contained in:
@@ -48,9 +48,6 @@
|
||||
/* Maximum size of a packet */
|
||||
#define MAX_PACKET 10000
|
||||
|
||||
/* length of non-esp marker */
|
||||
#define MARKER_LEN sizeof(u_int32_t)
|
||||
|
||||
/* these are not defined on some platforms */
|
||||
#ifndef SOL_IP
|
||||
#define SOL_IP IPPROTO_IP
|
||||
@@ -207,13 +204,6 @@ METHOD(socket_t, receiver, status_t,
|
||||
}
|
||||
DBG3(DBG_NET, "received packet %b", buffer, bytes_read);
|
||||
|
||||
if (bytes_read < MARKER_LEN)
|
||||
{
|
||||
DBG3(DBG_NET, "received packet too short (%d bytes)",
|
||||
bytes_read);
|
||||
return FAILED;
|
||||
}
|
||||
|
||||
/* read ancillary data to get destination address */
|
||||
for (cmsgptr = CMSG_FIRSTHDR(&msg); cmsgptr != NULL;
|
||||
cmsgptr = CMSG_NXTHDR(&msg, cmsgptr))
|
||||
|
||||
@@ -45,9 +45,6 @@
|
||||
/* Maximum size of a packet */
|
||||
#define MAX_PACKET 10000
|
||||
|
||||
/* length of non-esp marker */
|
||||
#define MARKER_LEN sizeof(u_int32_t)
|
||||
|
||||
/* these are not defined on some platforms */
|
||||
#ifndef SOL_IP
|
||||
#define SOL_IP IPPROTO_IP
|
||||
@@ -225,12 +222,6 @@ static packet_t *receive_packet(private_socket_dynamic_socket_t *this,
|
||||
}
|
||||
DBG3(DBG_NET, "received packet %b", buffer, (u_int)len);
|
||||
|
||||
if (len < MARKER_LEN)
|
||||
{
|
||||
DBG3(DBG_NET, "received packet too short (%d bytes)", len);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* read ancillary data to get destination address */
|
||||
for (cmsgptr = CMSG_FIRSTHDR(&msg); cmsgptr != NULL;
|
||||
cmsgptr = CMSG_NXTHDR(&msg, cmsgptr))
|
||||
|
||||
@@ -172,7 +172,7 @@ METHOD(socket_t, receiver, status_t,
|
||||
DBG3(DBG_NET, "received IPv4 packet %b", buffer, bytes_read);
|
||||
|
||||
/* read source/dest from raw IP/UDP header */
|
||||
if (bytes_read < IP_LEN + UDP_LEN + MARKER_LEN)
|
||||
if (bytes_read < IP_LEN + UDP_LEN)
|
||||
{
|
||||
DBG1(DBG_NET, "received IPv4 packet too short (%d bytes)",
|
||||
bytes_read);
|
||||
@@ -226,7 +226,7 @@ METHOD(socket_t, receiver, status_t,
|
||||
}
|
||||
DBG3(DBG_NET, "received IPv6 packet %b", buffer, bytes_read);
|
||||
|
||||
if (bytes_read < IP_LEN + UDP_LEN + MARKER_LEN)
|
||||
if (bytes_read < IP_LEN + UDP_LEN)
|
||||
{
|
||||
DBG3(DBG_NET, "received IPv6 packet too short (%d bytes)",
|
||||
bytes_read);
|
||||
|
||||
Reference in New Issue
Block a user