File tree Expand file tree Collapse file tree 2 files changed +15
-5
lines changed
Expand file tree Collapse file tree 2 files changed +15
-5
lines changed Original file line number Diff line number Diff line change 1+ fixed tcp metrics collection in ` host_metrics ` source failing with "Could not parse netlink response: invalid netlink buffer" errors on Linux systems.
2+
3+ authors: mushrowan
Original file line number Diff line number Diff line change @@ -241,13 +241,20 @@ async fn fetch_netlink_inet_headers(addr_family: u8) -> Result<Vec<InetResponseH
241241 . await
242242 . context ( NetlinkSendSnafu ) ?;
243243
244- let mut receive_buffer = vec ! [ 0 ; 4096 ] ;
245244 let mut inet_resp_hdrs = Vec :: with_capacity ( 32 ) ; // Pre-allocate with an estimate
246245
247- while let Ok ( ( ) ) = socket. recv ( & mut & mut receive_buffer[ ..] ) . await {
248- let done = parse_netlink_messages ( & receive_buffer, & mut inet_resp_hdrs) ?;
249- if done {
250- break ;
246+ loop {
247+ match socket. recv_from_full ( ) . await {
248+ Ok ( ( receive_buffer, _addr) ) => {
249+ if receive_buffer. is_empty ( ) {
250+ break ;
251+ }
252+ let done = parse_netlink_messages ( & receive_buffer, & mut inet_resp_hdrs) ?;
253+ if done {
254+ break ;
255+ }
256+ }
257+ Err ( _) => break ,
251258 }
252259 }
253260
You can’t perform that action at this time.
0 commit comments