]> gitweb.fperrin.net Git - iftop.git/blobdiff - iftop.c
gitignore
[iftop.git] / iftop.c
diff --git a/iftop.c b/iftop.c
index 1640b11ffbb67aaaa0f4db48d1b16cbe31d5825f..59857a5dde8c7921ac2814421f046b6abc23d0ae 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;
 }
 
 
@@ -701,7 +706,6 @@ char *set_filter_code(const char *filter) {
 void packet_init() {
     char errbuf[PCAP_ERRBUF_SIZE];
     char *m;
-    int i;
     int dlt;
     int result;
 
@@ -732,10 +736,7 @@ void packet_init() {
     }
 
     if(have_hw_addr) {
-      fprintf(stderr, "MAC address is:");
-      for (i = 0; i < 6; ++i)
-       fprintf(stderr, "%c%02x", i ? ':' : ' ', (unsigned int)if_hw_addr[i]);
-      fprintf(stderr, "\n");
+      fprintf(stderr, "MAC address is: %s\n", ether_ntoa(if_hw_addr));
     }
     
     //    exit(0);