Skip to content

Commit 1510360

Browse files
committed
Do not reset TCP connections when using a raw socket
1 parent e000f15 commit 1510360

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/iface/interface/tcp.rs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use super::*;
22

3-
use crate::socket::tcp::Socket;
3+
use crate::{socket::raw::Socket as RawSocket, socket::tcp::Socket};
44

55
impl InterfaceInner {
66
pub(crate) fn process_tcp<'frame>(
@@ -29,6 +29,18 @@ impl InterfaceInner {
2929
}
3030
}
3131

32+
#[cfg(feature = "socket-raw")]
33+
for raw_socket in sockets
34+
.items_mut()
35+
.filter_map(|i| RawSocket::downcast_mut(&mut i.socket))
36+
{
37+
// Stop if we find a raw socket accepting TCP.
38+
if raw_socket.accepts(&ip_repr) {
39+
// Payload will be processed by raw socket separately.
40+
return None;
41+
}
42+
}
43+
3244
if tcp_repr.control == TcpControl::Rst
3345
|| ip_repr.dst_addr().is_unspecified()
3446
|| ip_repr.src_addr().is_unspecified()

0 commit comments

Comments
 (0)