mirror of
https://github.com/outbackdingo/firezone.git
synced 2026-01-27 10:18:54 +00:00
chore(connlib): don't panic on invalid IP packet from smoltcp (#7267)
`smoltcp` should never emit a buffer that isn't a valid IP packet but in case it does, we shouldn't panic as a result and instead just discard the packet.
This commit is contained in:
@@ -73,7 +73,10 @@ impl<'a> smoltcp::phy::TxToken for SmolTxToken<'a> {
|
||||
let mut ip_packet_buf = IpPacketBuf::new();
|
||||
let result = f(ip_packet_buf.buf());
|
||||
|
||||
let mut ip_packet = IpPacket::new(ip_packet_buf, len).unwrap();
|
||||
let Some(mut ip_packet) = IpPacket::new(ip_packet_buf, len) else {
|
||||
tracing::warn!("Received invalid IP packet");
|
||||
return result;
|
||||
};
|
||||
ip_packet.update_checksum();
|
||||
self.outbound_packets.push_back(ip_packet);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user