Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/actions/spelling/allow.txt
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,7 @@ netcat
netdata
Netflix
netlify
netlink
Neue
neuronull
Nextbook
Expand Down
3 changes: 3 additions & 0 deletions changelog.d/22487_tcp_netlink_parsing.fix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Fixed a `host_metrics` source issue that caused tcp metrics collection to fail with "Could not parse netlink response: invalid netlink buffer" errors on Linux systems.

authors: mushrowan
6 changes: 4 additions & 2 deletions src/sources/host_metrics/tcp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -241,10 +241,12 @@ async fn fetch_netlink_inet_headers(addr_family: u8) -> Result<Vec<InetResponseH
.await
.context(NetlinkSendSnafu)?;

let mut receive_buffer = vec![0; 4096];
let mut inet_resp_hdrs = Vec::with_capacity(32); // Pre-allocate with an estimate

while let Ok(()) = socket.recv(&mut &mut receive_buffer[..]).await {
while let Ok((receive_buffer, _addr)) = socket.recv_from_full().await {
if receive_buffer.is_empty() {
break;
}
let done = parse_netlink_messages(&receive_buffer, &mut inet_resp_hdrs)?;
if done {
break;
Expand Down
Loading