it's said libpcap will yield IP packets directly, without encapsulating PPP packets, when sniffing a PPP interface.

blindly adding handling code for that...
This commit is contained in:
Arnout Engelen
2006-11-04 16:59:44 +00:00
parent 4a866021fc
commit 7fbbe70e0c
3 changed files with 11 additions and 0 deletions

View File

@@ -209,6 +209,10 @@ void dp_pcap_callback (u_char * u_handle, const struct pcap_pkthdr * header, con
case (DLT_PPP): case (DLT_PPP):
dp_parse_ppp (handle, header, packet); dp_parse_ppp (handle, header, packet);
break; break;
case (DLT_RAW):
case (DLT_NULL):
// just a guess
dp_parse_ip (handle, header, packet);
default: default:
// TODO maybe error? or 'other' callback? // TODO maybe error? or 'other' callback?
break; break;

View File

@@ -55,3 +55,5 @@ int dp_dispatch (struct dp_handle * handler, int count, u_char *user, int size);
int dp_datalink(struct dp_handle * handle); int dp_datalink(struct dp_handle * handle);
int dp_setnonblock (struct dp_handle * handle, int i, char * errbuf); int dp_setnonblock (struct dp_handle * handle, int i, char * errbuf);

View File

@@ -237,6 +237,11 @@ static void help(void)
//std::cerr << " -f : format of packets on interface, default is eth.\n"; //std::cerr << " -f : format of packets on interface, default is eth.\n";
std::cerr << " -p : sniff in promiscious mode (not recommended).\n"; std::cerr << " -p : sniff in promiscious mode (not recommended).\n";
std::cerr << " device : device(s) to monitor. default is eth0\n"; std::cerr << " device : device(s) to monitor. default is eth0\n";
std::cerr << std::endl;
std::cerr << "When nethogs is running, press:\n";
std::cerr << " q: quit\n";
std::cerr << " m: switch between total and kb/s mode\n";
} }
class device { class device {