tcpdump mailing list archives

Re: bpf_dump.c


From: Guy Harris <gharris () sonic net>
Date: Wed, 12 Feb 2025 23:05:50 -0800

On Feb 12, 2025, at 1:54 PM, Francois-Xavier Le Bail via tcpdump-workers <tcpdump-workers () lists tcpdump org> wrote:

They are also different:

$ diff bpf_dump.c ../libpcap/bpf_dump.c                                         
24,25c24
< #include "netdissect-stdinc.h"
< 
---
#include <pcap.h>

That's because the first one is part of tcpdump and the second one is part of libpcap.

28,29c27
< #include "netdissect.h"
< #include "interface.h"
---
#include "optimize.h"

Ditto.

34c32
<       struct bpf_insn *insn;
---
     const struct bpf_insn *insn;

It should be const, as it's not modifying the bpf_insn, just printing it.

55,56c53,56
<               extern int bids[];
<               printf(bids[i] > 0 ? "[%02d]" : " -- ", bids[i] - 1);
---
             if (i < NBIDS && bids[i] > 0)
                     printf("[%02d]", bids[i] - 1);
             else
                     printf(" -- ");

The "extern int bids[]" and the lack of "i < NBIDS" are due to libpcap not exporting the internal bids[] array and not 
exporting its size.

The rest is just different ways of saying the same thing.

Given that BDEBUG is a libpcap definition that affects a lot more things, my inclination would be to, if we keep 
tcpdump's bpf_dump.c, remove the BDEBUG stuff, as it's there only for doing libpcap debugging, in which case you're 
dealing with *our* libpcap, not with some other libpcap.
_______________________________________________
tcpdump-workers mailing list -- tcpdump-workers () lists tcpdump org
To unsubscribe send an email to tcpdump-workers-leave () lists tcpdump org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s


Current thread: