From dfade8e07d2753a840c78fd0498605dc56391b61 Mon Sep 17 00:00:00 2001 From: Gianni Tedesco <gtedesco@rapid7.com> Date: Thu, 27 Jun 2024 11:36:56 +0700 Subject: [PATCH] Account for rx_dropped packets in linux ifdropped Many Linux drivers are not reporting anything into rx_missed_errors or rx_fifo_errors. They, instead, report dropped packets into rx_dropped. Withtout including rx_dropped into ps_ifdrop, we can get a wildly optimistic view of performance. This particularly affects vmxnet3, enic, ena, cxgb, and cxgb4 drivers. --- pcap-linux.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pcap-linux.c b/pcap-linux.c index a220f0504c..977c88b2e9 100644 --- a/pcap-linux.c +++ b/pcap-linux.c @@ -771,9 +771,10 @@ linux_get_stat(const char * if_name, const char * stat) { static long long int linux_if_drops(const char * if_name) { + long long int dropped = linux_get_stat(if_name, "rx_dropped"); long long int missed = linux_get_stat(if_name, "rx_missed_errors"); long long int fifo = linux_get_stat(if_name, "rx_fifo_errors"); - return missed + fifo; + return dropped + missed + fifo; }