mirror of
https://github.com/outbackdingo/firezone.git
synced 2026-01-27 18:18:55 +00:00
chore(connlib): add logs and error handling on bad stride (#7339)
In order to narrow down #7332, we are now checking the stride length and report oddities such as `string > len` as an error to the event-loop.
This commit is contained in:
@@ -236,6 +236,24 @@ impl UdpSocket {
|
||||
continue;
|
||||
};
|
||||
|
||||
match meta.stride.cmp(&meta.len) {
|
||||
std::cmp::Ordering::Equal => {}
|
||||
std::cmp::Ordering::Less => {
|
||||
let num_packets = meta.len / meta.stride;
|
||||
|
||||
tracing::trace!(%num_packets, size = %meta.stride, "Read packets using GRO");
|
||||
}
|
||||
std::cmp::Ordering::Greater => {
|
||||
return Poll::Ready(Err(io::Error::new(
|
||||
io::ErrorKind::InvalidData,
|
||||
format!(
|
||||
"stride ({}) is larger than buffer len ({})",
|
||||
meta.stride, meta.len
|
||||
),
|
||||
)))
|
||||
}
|
||||
}
|
||||
|
||||
let local = SocketAddr::new(local_ip, *port);
|
||||
|
||||
let iter = buffer[..meta.len]
|
||||
|
||||
Reference in New Issue
Block a user