mirror of
https://github.com/outbackdingo/firezone.git
synced 2026-01-27 18:18:55 +00:00
chore(connlib): discard packets from smoltcp if > MTU (#7262)
This should really never happen but is a defense in depth measure to ensure we never attempt to send packets through the tunnel that are larger than our interface MTU. Raising a warning will alert us through Sentry in case this does happen. --------- Signed-off-by: Thomas Eizinger <thomas@eizinger.io>
This commit is contained in:
@@ -61,6 +61,15 @@ impl<'a> smoltcp::phy::TxToken for SmolTxToken<'a> {
|
||||
where
|
||||
F: FnOnce(&mut [u8]) -> R,
|
||||
{
|
||||
let max_len = ip_packet::PACKET_SIZE;
|
||||
|
||||
if len > max_len {
|
||||
tracing::warn!("Packets larger than {max_len} are not supported; len={len}");
|
||||
|
||||
let mut buf = Vec::with_capacity(len);
|
||||
return f(&mut buf);
|
||||
}
|
||||
|
||||
let mut ip_packet_buf = IpPacketBuf::new();
|
||||
let result = f(ip_packet_buf.buf());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user