]> gitweb.fperrin.net Git - iftop.git/blobdiff - iftop.c
Keep track of lost packets as reported by pcap_stats
[iftop.git] / iftop.c
diff --git a/iftop.c b/iftop.c
index 1640b11ffbb67aaaa0f4db48d1b16cbe31d5825f..562a45bd33b719b9a5b77e85fa3001748c2c558a 100644 (file)
--- a/iftop.c
+++ b/iftop.c
@@ -109,6 +109,8 @@ history_type* history_create() {
 
 void history_rotate() {
     hash_node_type* n = NULL;
+    struct pcap_stat ps;
+
     history_pos = (history_pos + 1) % HISTORY_LENGTH;
     hash_next_item(history, &n);
     while(n != NULL) {
@@ -134,6 +136,9 @@ void history_rotate() {
     if(history_len < HISTORY_LENGTH) {
         history_len++;
     }
+
+    pcap_stats(pd, &ps);
+    history_totals.lost_packets = ps.ps_drop + ps.ps_ifdrop;
 }