Skip to content

Commit

Permalink
fix: make quinn ignore unmapped destinations
Browse files Browse the repository at this point in the history
  • Loading branch information
Frando committed Oct 18, 2023
1 parent 819ae19 commit 0374438
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions iroh-net/src/magicsock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -555,13 +555,19 @@ impl Inner {
match self.peer_map.get_quic_mapped_addr_for_ip_port(meta.addr) {
None => {
warn!(src = ?meta.addr, count = %quic_packets_count, len = meta.len, "recv packets: no peer state found, skipping");
// if we have no peer state for the from addr, set len to 0 to make quinn skip the buf completely.
meta.len = 0;
}
Some(quic_mapped_addr) => {
trace!(src = ?meta.addr, count = %quic_packets_count, len = meta.len, "recv packets: peer state found");
quic_packets_total += quic_packets_count;
meta.addr = quic_mapped_addr.0;
}
}
} else {
// if there is no non-stun,non-disco packet in the chunk, set len to zero to make
// quinn skip the buf completely.
meta.len = 0;
}
// Normalize local_ip
meta.dst_ip = dst_ip;
Expand Down

0 comments on commit 0374438

Please sign in to comment.