From 3f36be64af3ce545259bdb9695cd9bedb60a5751 Mon Sep 17 00:00:00 2001 From: Benjamin Saunders Date: Sat, 16 Nov 2019 16:57:19 -0800 Subject: [PATCH] Drop truncated UDP packets These would fail decryption anyway, so this saves us some CPU. --- quinn/src/platform/unix.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/quinn/src/platform/unix.rs b/quinn/src/platform/unix.rs index 8400346c3..09065e838 100644 --- a/quinn/src/platform/unix.rs +++ b/quinn/src/platform/unix.rs @@ -151,6 +151,9 @@ impl super::UdpExt for UdpSocket { } return Err(e); } + if hdr.msg_flags & libc::MSG_TRUNC != 0 { + continue; + } break n; }; let name = unsafe { name.assume_init() };