|
@@ -139,7 +139,7 @@ struct totemudpu_instance {
|
|
|
|
|
|
|
|
void *udpu_context;
|
|
void *udpu_context;
|
|
|
|
|
|
|
|
- char iov_buffer[UDP_RECEIVE_FRAME_SIZE_MAX];
|
|
|
|
|
|
|
+ char iov_buffer[UDP_RECEIVE_FRAME_SIZE_MAX + 1];
|
|
|
|
|
|
|
|
struct iovec totemudpu_iov_recv;
|
|
struct iovec totemudpu_iov_recv;
|
|
|
|
|
|
|
@@ -214,7 +214,7 @@ static void totemudpu_instance_initialize (struct totemudpu_instance *instance)
|
|
|
|
|
|
|
|
instance->totemudpu_iov_recv.iov_base = instance->iov_buffer;
|
|
instance->totemudpu_iov_recv.iov_base = instance->iov_buffer;
|
|
|
|
|
|
|
|
- instance->totemudpu_iov_recv.iov_len = UDP_RECEIVE_FRAME_SIZE_MAX; //sizeof (instance->iov_buffer);
|
|
|
|
|
|
|
+ instance->totemudpu_iov_recv.iov_len = UDP_RECEIVE_FRAME_SIZE_MAX + 1; //sizeof (instance->iov_buffer) + 1;
|
|
|
|
|
|
|
|
/*
|
|
/*
|
|
|
* There is always atleast 1 processor
|
|
* There is always atleast 1 processor
|
|
@@ -480,7 +480,6 @@ static int net_deliver_fn (
|
|
|
struct iovec *iovec;
|
|
struct iovec *iovec;
|
|
|
struct sockaddr_storage system_from;
|
|
struct sockaddr_storage system_from;
|
|
|
int bytes_received;
|
|
int bytes_received;
|
|
|
- int truncated_packet;
|
|
|
|
|
|
|
|
|
|
iovec = &instance->totemudpu_iov_recv;
|
|
iovec = &instance->totemudpu_iov_recv;
|
|
|
|
|
|
|
@@ -514,26 +513,15 @@ static int net_deliver_fn (
|
|
|
instance->stats_recv += bytes_received;
|
|
instance->stats_recv += bytes_received;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- truncated_packet = 0;
|
|
|
|
|
-
|
|
|
|
|
-#ifdef HAVE_MSGHDR_FLAGS
|
|
|
|
|
- if (msg_recv.msg_flags & MSG_TRUNC) {
|
|
|
|
|
- truncated_packet = 1;
|
|
|
|
|
- }
|
|
|
|
|
-#else
|
|
|
|
|
- /*
|
|
|
|
|
- * We don't have MSGHDR_FLAGS, but we can (hopefully) safely make assumption that
|
|
|
|
|
- * if bytes_received == UDP_RECEIVE_FRAME_SIZE_MAX then packet is truncated
|
|
|
|
|
- */
|
|
|
|
|
- if (bytes_received == UDP_RECEIVE_FRAME_SIZE_MAX) {
|
|
|
|
|
- truncated_packet = 1;
|
|
|
|
|
- }
|
|
|
|
|
-#endif
|
|
|
|
|
-
|
|
|
|
|
- if (truncated_packet) {
|
|
|
|
|
|
|
+ if (bytes_received >= UDP_RECEIVE_FRAME_SIZE_MAX + 1) {
|
|
|
|
|
+ /*
|
|
|
|
|
+ * Maximum packet size should be UDP_RECEIVE_FRAME_SIZE_MAX.
|
|
|
|
|
+ * If received packet is UDP_RECEIVE_FRAME_SIZE_MAX + 1 it means packet was truncated
|
|
|
|
|
+ * (iov_buffer size and iov_len are intentionally set to UDP_RECEIVE_FRAME_SIZE_MAX + 1).
|
|
|
|
|
+ */
|
|
|
log_printf (instance->totemudpu_log_level_error,
|
|
log_printf (instance->totemudpu_log_level_error,
|
|
|
- "Received too big message. This may be because something bad is happening"
|
|
|
|
|
- "on the network (attack?), or you tried join more nodes than corosync is"
|
|
|
|
|
|
|
+ "Received too big message. This may be because something bad is happening "
|
|
|
|
|
+ "on the network (attack?), or you tried join more nodes than corosync is "
|
|
|
"compiled with (%u) or bug in the code (bad estimation of "
|
|
"compiled with (%u) or bug in the code (bad estimation of "
|
|
|
"the UDP_RECEIVE_FRAME_SIZE_MAX). Dropping packet.", PROCESSOR_COUNT_MAX);
|
|
"the UDP_RECEIVE_FRAME_SIZE_MAX). Dropping packet.", PROCESSOR_COUNT_MAX);
|
|
|
return (0);
|
|
return (0);
|
|
@@ -559,7 +547,7 @@ static int net_deliver_fn (
|
|
|
iovec->iov_len,
|
|
iovec->iov_len,
|
|
|
&system_from);
|
|
&system_from);
|
|
|
|
|
|
|
|
- iovec->iov_len = UDP_RECEIVE_FRAME_SIZE_MAX;
|
|
|
|
|
|
|
+ iovec->iov_len = UDP_RECEIVE_FRAME_SIZE_MAX + 1;
|
|
|
return (0);
|
|
return (0);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -1009,7 +997,7 @@ int totemudpu_initialize (
|
|
|
* Initialize local variables for totemudpu
|
|
* Initialize local variables for totemudpu
|
|
|
*/
|
|
*/
|
|
|
instance->totem_interface = &totem_config->interfaces[0];
|
|
instance->totem_interface = &totem_config->interfaces[0];
|
|
|
- memset (instance->iov_buffer, 0, UDP_RECEIVE_FRAME_SIZE_MAX);
|
|
|
|
|
|
|
+ memset (instance->iov_buffer, 0, UDP_RECEIVE_FRAME_SIZE_MAX + 1);
|
|
|
|
|
|
|
|
instance->totemudpu_poll_handle = poll_handle;
|
|
instance->totemudpu_poll_handle = poll_handle;
|
|
|
|
|
|