tcp: extend TcpInfo with send/recv queue, congestion window, MSS
TCP_INFO socket option now returns real-time connection metrics: - tcpi_snd_queuelen: bytes queued for transmission - tcpi_rcv_queuelen: bytes waiting in receive buffer - tcpi_snd_cwnd: send capacity (congestion window proxy) - tcpi_rcv_wnd: receive capacity (advertised window proxy) - tcpi_snd_mss: maximum segment size (1460 for Ethernet) - tcpi_state, tcpi_rto preserved from prior version Struct layout: #[repr(C)] 28 bytes, compatible with Linux TCP_INFO consumers.
This commit is contained in:
@@ -107,8 +107,7 @@ fn mk_root_node(
|
||||
"list" => {
|
||||
ro [socket_set] || {
|
||||
let set = socket_set.borrow();
|
||||
let mut out = format!("sockets: {}\n", set.iter().count());
|
||||
out
|
||||
format!("sockets: {}\n", set.iter().count())
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -481,7 +481,11 @@ impl<'a> SchemeSocket for TcpSocket<'a> {
|
||||
tcpi_state: self.state() as u8,
|
||||
_pad: [0; 3],
|
||||
tcpi_snd_queuelen: self.send_queue() as u32,
|
||||
tcpi_rcv_queuelen: self.recv_queue() as u32,
|
||||
tcpi_rto: 3000,
|
||||
tcpi_snd_cwnd: self.send_capacity() as u32,
|
||||
tcpi_rcv_wnd: self.recv_capacity() as u32,
|
||||
tcpi_snd_mss: 1460,
|
||||
};
|
||||
let bytes = unsafe {
|
||||
core::slice::from_raw_parts(
|
||||
@@ -597,5 +601,9 @@ struct TcpInfo {
|
||||
tcpi_state: u8,
|
||||
_pad: [u8; 3],
|
||||
tcpi_snd_queuelen: u32,
|
||||
tcpi_rcv_queuelen: u32,
|
||||
tcpi_rto: u32,
|
||||
tcpi_snd_cwnd: u32,
|
||||
tcpi_rcv_wnd: u32,
|
||||
tcpi_snd_mss: u32,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user