--- Begin Message ---
Hello,

As a follow-up to https://github.com/the-tcpdump-group/tcpdump/issues/919, here 
is a way to help finding eventual inconsistent outputs.

1) Get libpcap and tcpdump from the-tcpdump-group:master branches in the same 
directory.
   git clone https://github.com/the-tcpdump-group/libpcap.git
   git clone https://github.com/the-tcpdump-group/tcpdump.git
2) Build libpcap (./configure && make -s clean all).
3) Build tcpdump with clang (CC=clang ./configure && make -s clean all). Rename 
tcpdump to tcpdump_clang.
4) Build tcpdump with gcc (CC=gcc ./configure && make -s clean all). Rename 
tcpdump to tcpdump_gcc.
5) Run the following script on all the pcap(ng) files you have access.
   (Update PCAP_DIRS...)
6) Report any output giving the OS, clang and gcc versions.
Notes: 
a) The script may need some update (TMPDIR for some systems).
b) It also could be updated to use compilers different from clang/gcc...

------------------------------------------------------------------------------------
#!/bin/bash

PCAP_DIRS='dir1 dir2 ...'

TMPDIR=/dev/shm/diff_2_compilers_$$
mkdir -p $TMPDIR

TCPDUMP_1=tcpdump_clang
TCPDUMP_2=tcpdump_gcc

while read -r p; do
        rm -f $TMPDIR/*
        file -b "$p" | grep capture >/dev/null || continue
        ./$TCPDUMP_1 -#Henvvvvvvvvvvvv -r "$p" >$TMPDIR/out1 2>$TMPDIR/err1
        ./$TCPDUMP_2 -#Henvvvvvvvvvvvv -r "$p" >$TMPDIR/out2 2>$TMPDIR/err2
        cmp $TMPDIR/out1 $TMPDIR/out2 >/dev/null
        [ $? = 1 ] && echo "$p" && diff $TMPDIR/out1 $TMPDIR/out2 && echo
        sed -i "s/$TCPDUMP_1/$TCPDUMP_2/" $TMPDIR/err1
        cmp $TMPDIR/err1 $TMPDIR/err2 >/dev/null
        [ $? = 1 ] && echo "$p" && diff $TMPDIR/err1 $TMPDIR/err2 && echo
done < <(find $PCAP_DIRS -type f -not -path '*/\.git/*' -not -path 
'*/\.svn/*'|sort)
------------------------------------------------------------------------------------

Greetings,

-- 
Francois-Xavier

--- End Message ---
_______________________________________________
tcpdump-workers mailing list
tcpdump-workers@lists.tcpdump.org
https://lists.sandelman.ca/mailman/listinfo/tcpdump-workers
  • [tcpdump-workers] [tcpdump] Fi... Francois-Xavier Le Bail via tcpdump-workers

Reply via email to