diff options
author | Guy Harris <guy@alum.mit.edu> | 2018-07-26 18:05:11 -0700 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2018-07-26 18:05:11 -0700 |
commit | e7eb3c769d1dfe88e3a0d3ba714d5098ee091d8e (patch) | |
tree | d2381edb53d299bbcd94c351977529e1d6b96eb4 /pcap-linux.c | |
parent | b744c80a94eae86abd37a118fb1d49f10a388d13 (diff) |
Put some system information into the sanity-check message.
If there's a kernel-dependent or ISA-dependent issue, this may provide
some helpful information.
Diffstat (limited to 'pcap-linux.c')
-rw-r--r-- | pcap-linux.c | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/pcap-linux.c b/pcap-linux.c index 5b4c9771..79bd0ac2 100644 --- a/pcap-linux.c +++ b/pcap-linux.c @@ -5018,13 +5018,27 @@ static int pcap_handle_packet_mmap( struct sockaddr_ll *sll; struct pcap_pkthdr pcaphdr; unsigned int snaplen = tp_snaplen; + struct utsname utsname; /* perform sanity check on internal offset. */ if (tp_mac + tp_snaplen > handle->bufsize) { - pcap_snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, - "corrupted frame on kernel ring mac " - "offset %u + caplen %u > frame len %d", - tp_mac, tp_snaplen, handle->bufsize); + /* + * Report some system information as a debugging aid. + */ + if (uname(&utsname) != -1) { + pcap_snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, + "corrupted frame on kernel ring mac " + "offset %u + caplen %u > frame len %d " + "(kernel %s version %s, machine %s)", + tp_mac, tp_snaplen, handle->bufsize, + utsname.release, utsname.version, + utsname.machine); + } else { + pcap_snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, + "corrupted frame on kernel ring mac " + "offset %u + caplen %u > frame len %d", + tp_mac, tp_snaplen, handle->bufsize); + } return -1; } |