Skip to content

Commit

Permalink
Merge pull request #1038 from Easyoakland/ipv6-drop-fragment
Browse files Browse the repository at this point in the history
log and drop ipv6 packets requiring fragmentation
  • Loading branch information
whitequark authored Jan 29, 2025
2 parents 49cc60a + bef9b05 commit 3e3afb6
Showing 1 changed file with 17 additions and 9 deletions.
26 changes: 17 additions & 9 deletions src/iface/interface/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1299,16 +1299,24 @@ impl InterfaceInner {
}
// We don't support IPv6 fragmentation yet.
#[cfg(feature = "proto-ipv6")]
IpRepr::Ipv6(_) => tx_token.consume(total_len, |mut tx_buffer| {
#[cfg(feature = "medium-ethernet")]
if matches!(self.caps.medium, Medium::Ethernet) {
emit_ethernet(&ip_repr, tx_buffer)?;
tx_buffer = &mut tx_buffer[EthernetFrame::<&[u8]>::header_len()..];
}
IpRepr::Ipv6(_) => {
// Check if we need to fragment it.
if total_ip_len > self.caps.ip_mtu() {
net_debug!("IPv6 fragmentation support is unimplemented. Dropping.");
Ok(())
} else {
tx_token.consume(total_len, |mut tx_buffer| {
#[cfg(feature = "medium-ethernet")]
if matches!(self.caps.medium, Medium::Ethernet) {
emit_ethernet(&ip_repr, tx_buffer)?;
tx_buffer = &mut tx_buffer[EthernetFrame::<&[u8]>::header_len()..];
}

emit_ip(&ip_repr, tx_buffer);
Ok(())
}),
emit_ip(&ip_repr, tx_buffer);
Ok(())
})
}
}
}
}
}
Expand Down

0 comments on commit 3e3afb6

Please sign in to comment.