Skip to content

Commit

Permalink
Discard incoming segments that contain an RST, when state is CLOSED
Browse files Browse the repository at this point in the history
  • Loading branch information
SajjadPourali committed Apr 16, 2024
1 parent 79510f4 commit 2cadc16
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ udp-stream = { version = "0.0", default-features = false }
criterion = { version = "0.5" }

#tun2.rs example
tun2 = { version = "1.2", features = ["async"] }
tun2 = { version = "1.3", features = ["async"] }

#tun_wintun.rs example
[target.'cfg(any(target_os = "linux", target_os = "macos"))'.dev-dependencies]
Expand Down
4 changes: 3 additions & 1 deletion src/stream/tcp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,9 @@ impl IpStackTcpStream {
write_notify: None,
};
if !tcp.inner().syn {
_ = pkt_sender.send(stream.create_rev_packet(RST | ACK, TTL, None, Vec::new())?);
if !tcp.inner().rst {
_ = pkt_sender.send(stream.create_rev_packet(RST | ACK, TTL, None, Vec::new())?);
}
Err(IpStackError::InvalidTcpPacket)
} else {
Ok(stream)
Expand Down

0 comments on commit 2cadc16

Please sign in to comment.