From 384581c9a9caf5f754542872067ec58392fe5c45 Mon Sep 17 00:00:00 2001 From: Arnout Engelen Date: Sun, 8 Jun 2008 21:24:30 +0000 Subject: [PATCH] Some fixes thanks to Bart Mertens (nethogs Debian maintainer) --- Changelog | 1 + cui.cpp | 1 + nethogs.cpp | 13 +++++++++---- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/Changelog b/Changelog index 84cc25a..a4dc213 100644 --- a/Changelog +++ b/Changelog @@ -6,6 +6,7 @@ Changelog strings 'const' - set view mode to 'kbps' by default, instead of the 'grand total' number of bytes +- some fixes thanks to Bart Martens 27/08/05 (Arnout) - giving all unknown connections their own diff --git a/cui.cpp b/cui.cpp index 26eb7d8..2bd21e7 100644 --- a/cui.cpp +++ b/cui.cpp @@ -2,6 +2,7 @@ #include #include #include +#include #include #include "nethogs.h" diff --git a/nethogs.cpp b/nethogs.cpp index 256d3c4..13084a1 100644 --- a/nethogs.cpp +++ b/nethogs.cpp @@ -338,12 +338,13 @@ int main (int argc, char** argv) } dp_handle * newhandle = dp_open_live(current_dev->name, BUFSIZ, promisc, 100, errbuf); - dp_addcb (newhandle, dp_packet_ip, process_ip); - dp_addcb (newhandle, dp_packet_ip6, process_ip6); - dp_addcb (newhandle, dp_packet_tcp, process_tcp); - dp_addcb (newhandle, dp_packet_udp, process_udp); if (newhandle != NULL) { + dp_addcb (newhandle, dp_packet_ip, process_ip); + dp_addcb (newhandle, dp_packet_ip6, process_ip6); + dp_addcb (newhandle, dp_packet_tcp, process_tcp); + dp_addcb (newhandle, dp_packet_udp, process_udp); + /* The following code solves sf.net bug 1019381, but is only available * in newer versions (from 0.8 it seems) of libpcap * @@ -356,6 +357,10 @@ int main (int argc, char** argv) } handles = new handle (newhandle, current_dev->name, handles); } + else + { + fprintf(stderr, "Error opening handler for device %s\n", current_dev->name); + } current_dev = current_dev->next; }