Skip to content

Commit

Permalink
[inetstack] Bug Fix: Remove ack queue
Browse files Browse the repository at this point in the history
  • Loading branch information
iyzhang committed Nov 1, 2024
1 parent ffeda7a commit 3c81ce2
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 22 deletions.
4 changes: 0 additions & 4 deletions src/rust/inetstack/protocols/layer4/tcp/active_open.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ pub struct ActiveOpenSocket {
runtime: SharedDemiRuntime,
layer3_endpoint: SharedLayer3Endpoint,
recv_queue: SharedAsyncQueue<(Ipv4Addr, TcpHeader, DemiBuffer)>,
ack_queue: SharedAsyncQueue<usize>,
tcp_config: TcpConfig,
socket_options: TcpSocketOptions,
dead_socket_tx: mpsc::UnboundedSender<QDesc>,
Expand All @@ -76,7 +75,6 @@ impl SharedActiveOpenSocket {
runtime: SharedDemiRuntime,
layer3_endpoint: SharedLayer3Endpoint,
recv_queue: SharedAsyncQueue<(Ipv4Addr, TcpHeader, DemiBuffer)>,
ack_queue: SharedAsyncQueue<usize>,
tcp_config: TcpConfig,
default_socket_options: TcpSocketOptions,
dead_socket_tx: mpsc::UnboundedSender<QDesc>,
Expand All @@ -90,7 +88,6 @@ impl SharedActiveOpenSocket {
runtime: runtime.clone(),
layer3_endpoint,
recv_queue,
ack_queue,
tcp_config,
socket_options: default_socket_options,
dead_socket_tx,
Expand Down Expand Up @@ -204,7 +201,6 @@ impl SharedActiveOpenSocket {
self.runtime.clone(),
self.layer3_endpoint.clone(),
self.recv_queue.clone(),
self.ack_queue.clone(),
self.tcp_config.clone(),
self.socket_options,
remote_seq_num,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,10 +243,6 @@ pub struct ControlBlock {
// TODO: Consider switching this to a static implementation to avoid V-table call overhead.
congestion_control_algorithm: Box<dyn congestion_control::CongestionControl>,

// This data structure stores the number of bytes acked for each outgoing frame.
// TODO: Change this to a single number for SND.UNA
receive_ack_queue_frame_bytes: SharedAsyncQueue<usize>,

// This queue notifies the parent passive socket that created the socket that the socket is closing. This is /
// necessary because routing for this socket goes through the parent socket if the connection set up is still
// inflight (but also after the connection is established for some reason).
Expand Down Expand Up @@ -278,7 +274,6 @@ impl SharedControlBlock {
congestion_control_algorithm_constructor: CongestionControlConstructor,
congestion_control_options: Option<congestion_control::Options>,
recv_queue: SharedAsyncQueue<(Ipv4Addr, TcpHeader, DemiBuffer)>,
receive_ack_queue_frame_bytes: SharedAsyncQueue<usize>,
parent_passive_socket_close_queue: Option<SharedAsyncQueue<SocketAddrV4>>,
) -> Self {
let sender: Sender = Sender::new(
Expand Down Expand Up @@ -308,7 +303,6 @@ impl SharedControlBlock {
congestion_control_options,
),
recv_queue,
receive_ack_queue_frame_bytes,
parent_passive_socket_close_queue,
}))
}
Expand Down Expand Up @@ -667,8 +661,6 @@ impl SharedControlBlock {
// processing and now without a call to advance_clock.
let now: Instant = self.get_now();
self.sender.process_ack(header, now);
let nbytes: usize = Into::<u32>::into(header.ack_num - send_unacknowledged) as usize;
self.receive_ack_queue_frame_bytes.push(nbytes)
} else {
// This segment acknowledges data we have yet to send!? Send an ACK and drop the segment.
// TODO: See RFC 5961, this could be a Blind Data Injection Attack.
Expand Down
2 changes: 0 additions & 2 deletions src/rust/inetstack/protocols/layer4/tcp/established/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ impl EstablishedSocket {
mut runtime: SharedDemiRuntime,
layer3_endpoint: SharedLayer3Endpoint,
recv_queue: SharedAsyncQueue<(Ipv4Addr, TcpHeader, DemiBuffer)>,
ack_queue: SharedAsyncQueue<usize>,
tcp_config: TcpConfig,
default_socket_options: TcpSocketOptions,
receiver_seq_no: SeqNumber,
Expand Down Expand Up @@ -85,7 +84,6 @@ impl EstablishedSocket {
cc_constructor,
congestion_control_options,
recv_queue.clone(),
ack_queue.clone(),
socket_queue,
);
let qt: QToken = runtime.insert_background_coroutine(
Expand Down
7 changes: 1 addition & 6 deletions src/rust/inetstack/protocols/layer4/tcp/passive_open.rs
Original file line number Diff line number Diff line change
Expand Up @@ -219,10 +219,9 @@ impl SharedPassiveSocket {
// Allocate a new coroutine to send the SYN+ACK and retry if necessary.
let recv_queue: SharedAsyncQueue<(Ipv4Addr, TcpHeader, DemiBuffer)> =
SharedAsyncQueue::<(Ipv4Addr, TcpHeader, DemiBuffer)>::default();
let ack_queue: SharedAsyncQueue<usize> = SharedAsyncQueue::<usize>::default();
let future = self
.clone()
.send_syn_ack_and_wait_for_ack(remote, remote_isn, local_isn, tcp_hdr, recv_queue.clone(), ack_queue)
.send_syn_ack_and_wait_for_ack(remote, remote_isn, local_isn, tcp_hdr, recv_queue.clone())
.fuse();
match self
.runtime
Expand Down Expand Up @@ -291,7 +290,6 @@ impl SharedPassiveSocket {
local_isn: SeqNumber,
tcp_hdr: TcpHeader,
recv_queue: SharedAsyncQueue<(Ipv4Addr, TcpHeader, DemiBuffer)>,
ack_queue: SharedAsyncQueue<usize>,
) {
// Set up new inflight accept connection.
let mut remote_window_scale = None;
Expand Down Expand Up @@ -325,7 +323,6 @@ impl SharedPassiveSocket {
// Wait for ACK in response.
let ack = self.clone().wait_for_ack(
recv_queue.clone(),
ack_queue.clone(),
remote,
local_isn,
remote_isn,
Expand Down Expand Up @@ -395,7 +392,6 @@ impl SharedPassiveSocket {
async fn wait_for_ack(
self,
mut recv_queue: SharedAsyncQueue<(Ipv4Addr, TcpHeader, DemiBuffer)>,
ack_queue: SharedAsyncQueue<usize>,
remote: SocketAddrV4,
local_isn: SeqNumber,
remote_isn: SeqNumber,
Expand Down Expand Up @@ -460,7 +456,6 @@ impl SharedPassiveSocket {
self.runtime.clone(),
self.layer3_endpoint.clone(),
recv_queue.clone(),
ack_queue,
self.tcp_config.clone(),
self.socket_options,
remote_isn + SeqNumber::from(1),
Expand Down
2 changes: 0 additions & 2 deletions src/rust/inetstack/protocols/layer4/tcp/socket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,6 @@ impl SharedTcpSocket {
) -> Result<(), Fail> {
let recv_queue: SharedAsyncQueue<(Ipv4Addr, TcpHeader, DemiBuffer)> =
SharedAsyncQueue::<(Ipv4Addr, TcpHeader, DemiBuffer)>::default();
let ack_queue: SharedAsyncQueue<usize> = SharedAsyncQueue::<usize>::default();
// Create active socket.
let socket: SharedActiveOpenSocket = SharedActiveOpenSocket::new(
local_isn,
Expand All @@ -208,7 +207,6 @@ impl SharedTcpSocket {
self.runtime.clone(),
self.layer3_endpoint.clone(),
recv_queue.clone(),
ack_queue,
self.tcp_config.clone(),
self.socket_options.clone(),
self.dead_socket_tx.clone(),
Expand Down

0 comments on commit 3c81ce2

Please sign in to comment.