Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
From: Dan Frasnelli <dfrasnel@alphalinux.org>
To: axp-list@redhat.com
Cc: vern@aciri.org
Subject: Debugging libpcap under Linux/axp
Date: Tue, 9 Nov 1999 07:53:52 -0800 (PST)	[thread overview]
Message-ID: <Pine.LNX.4.10.9911090737150.23015-200000@arsenic.theshell.com> (raw)

[-- Attachment #1: Type: TEXT/PLAIN, Size: 808 bytes --]

Not sure if anyone else has noticed this problem, but tcpdump 
under Linux/axp will not correctly read pcap captures gathered
on Linux/x86, FreeBSD, or Solaris (and probably others):
tcpdump: pcap_loop: bogus savefile header
If the captures are collected under Linux/axp, tcpdump will read 
them back without complaint.  

When I contacted Vern earlier this year, I mistakenly thought 
tcpdump was the source of the problems.  Breaking out the 
debugger, it is apparent that the fault lay with libpcap.  

I have attached a simple debugging session showing where the
error occurs; if anyone wants to help attack this, please let me
know.  Better still, pass along patches if you've already fixed this.
Surely I am not the only person here that uses tcpdump ;-)    

Thanks,
--
Dan Frasnelli
Security analyst

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: TEXT/PLAIN; charset=X-UNKNOWN; name=libpcap-debugging, Size: 2647 bytes --]

(gdb) set args -n -r ../liar.dat
(gdb) run
Starting program: ./tcpdump -n -r test.dat
tcpdump: pcap_loop: bogus savefile header

Program exited with code 01.
(gdb) break pcap_loop
Breakpoint 1 at 0x12001b888: file ./pcap.c, line 64.
(gdb) run
Starting program: ./tcpdump -n -r ./test.dat

Breakpoint 1, pcap_loop (p=0x1200091e0, cnt=536880064, callback=0, 
    user=0x1201366e0 "à $ \001") at ./pcap.c:64
64      {
pcap_loop (p=0x1202420e0, cnt=-1, callback=0x1200091e0 <fddi_if_print>, 
    user=0x0) at ./pcap.c:68
68                      if (p->sf.rfile != NULL)
(gdb) step
69                              n = pcap_offline_read(p, cnt, callback, user);
(gdb) step
pcap_offline_read (p=0x1202420e0, cnt=538142676, callback=0x12013661c <tflag>, 
    user=0x0) at ./savefile.c:281
281     {
(gdb) step
pcap_offline_read (p=0x1202420e0, cnt=538142676, callback=0x12013661c <tflag>, 
    user=0x0) at ./savefile.c:284
284             int n = 0;
(gdb) step
281     {
(gdb) step
282             struct bpf_insn *fcode = p->fcode.bf_insns;
(gdb) step
289                     status = sf_next_packet(p, &h, p->buffer, p->bufsize);
(gdb) step
sf_next_packet (p=0x0, hdr=0xffffffffffffffff, buf=0x0, buflen=536908256)
    at ./savefile.c:196
196     {
(gdb) step
sf_next_packet (p=0x1202420e0, hdr=0x11ffff970, buf=0x0, buflen=8192)
    at ./savefile.c:200
200             if (fread((char *)hdr, sizeof(struct pcap_pkthdr), 1, fp) != 1) {
(gdb) step
196     {
(gdb) step
200             if (fread((char *)hdr, sizeof(struct pcap_pkthdr), 1, fp) != 1) {
(gdb) step
196     {
(gdb) step
197             FILE *fp = p->sf.rfile;
(gdb) step
196     {
(gdb) step
200             if (fread((char *)hdr, sizeof(struct pcap_pkthdr), 1, fp) != 1) {
(gdb) step
_IO_fread (buf=0x120241960, size=4834206368, count=18446744073709551615, 
    fp=0x11ffff970) at iofread.c:34
iofread.c:34: No such file or directory.
(gdb) back
#0  _IO_fread (buf=0x120241960, size=4834206368, count=18446744073709551615, 
    fp=0x11ffff970) at iofread.c:34
#1  0x120023464 in pcap_offline_read (p=0x1202420e0, cnt=-1, callback=0x2000, 
    user=0x0) at ./savefile.c:289
warning: Hit heuristic-fence-post without finding
warning: enclosing function for address 0x1202420e0
This warning occurs if you are debugging a function without any symbols
(for example, in a stripped executable).  In that case, you may wish to
increase the size of the search with the `set heuristic-fence-post' command.

Otherwise, you told GDB there was a function where there isn't one, or
(more likely) you have encountered a bug in GDB.


                 reply	other threads:[~1999-11-09 15:54 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox