Nulldef | 1 Nov 2008 22:31
Picon

Critical bug I found in libpcap

Hey all,
few months ago i found that bug, and reported it to your tracer system:
http://sourceforge.net/tracker2/?func=detail&aid=1969699&group_id=53067&atid=469577

since it was not replied there and not solved in libpcap 1.0.0, i decided to
raise it here too, hopefully it will get the required attention.

thanks a lot, and keep doing your great work! :-)

stephen | 2 Nov 2008 22:27
Favicon

print location

Hi,

I'm trying to find where in the code tcpdump prints the packet info like source and destination IP
addresses.  I need to insert some code to make a custom version of tcpdump that will send a message to another
program every time tcpdump prints a line, and I also need to know if those source and destination IP
addresses are stored in a variable somewhere and if not, how can I access them.

Any help or direction is greatly appreciated.

Thanks,
Stephen

Max Laier | 2 Nov 2008 22:42

Re: print location

On Sunday 02 November 2008 22:27:22 stephen <at> stephengarrett.net wrote:
> Hi,
>
> I'm trying to find where in the code tcpdump prints the packet info like
> source and destination IP addresses.  I need to insert some code to make a
> custom version of tcpdump that will send a message to another program every
> time tcpdump prints a line, and I also need to know if those source and
> destination IP addresses are stored in a variable somewhere and if not, how
> can I access them.
>
> Any help or direction is greatly appreciated.

Search for "ip->ip_{src,dst}" in combination with "ipaddr_string" in
print-ip.c.  But note, that some protocols (TCP, UDP, DCCP, SCTP) like to 
print their own representation of IP addresses (with port numbers added) and 
you have to look at the respective print-{tcp,udp,sctp,dccp}.c.  All that 
considered you are probably better off by simply using libpcap directly.

--

-- 
/"\  Best regards,                      | mlaier <at> freebsd.org
\ /  Max Laier                          | ICQ #67774661
 X   http://pf4freebsd.love2party.net/  | mlaier <at> EFnet
/ \  ASCII Ribbon Campaign              | Against HTML Mail and News
Peter Volkov | 4 Nov 2008 19:49
Picon
Favicon

libpcap: make bluetooth optional

Hello.

Currently if there are bluetooth.h headers installed in the system
libpcap will be built with bluetooth support and it's impossible to
disable it. Attached patch adds --{en,dis}able-bluetooth switches.

Also this patch makes use of AS_HELP_STRING to let autoconf manage
output layout.

-- 
Peter.
Hello.

Currently if there are bluetooth.h headers installed in the system
libpcap will be built with bluetooth support and it's impossible to
disable it. Attached patch adds --{en,dis}able-bluetooth switches.

Also this patch makes use of AS_HELP_STRING to let autoconf manage
output layout.

--

-- 
Peter.
Peter Volkov | 4 Nov 2008 19:58
Picon
Favicon

libpcap: install optional headers

Hello.

Currently make install in libpcap never installs pcap/{vlan,bluetooth}.h
headers. Attached patch makes it install them in case support was built
in into libpcap.

-- 
Peter.
Hello.

Currently make install in libpcap never installs pcap/{vlan,bluetooth}.h
headers. Attached patch makes it install them in case support was built
in into libpcap.

--

-- 
Peter.
Peter Volkov | 4 Nov 2008 18:54
Picon
Favicon

libpcap-1.0.0 sita configure check

Hello.

Currently SITA will be defined and sita code will be tried to build even
if --without-sita is passed to ./configure. Patch in attachment fixes
this issue.

With best regards,
-- 
Peter.
Attachment (libpcap-1.0.0-sita.patch): text/x-patch, 517 bytes
Hello.

Currently SITA will be defined and sita code will be tried to build even
if --without-sita is passed to ./configure. Patch in attachment fixes
this issue.

With best regards,
--

-- 
Peter.
Peter Volkov | 4 Nov 2008 19:14
Picon
Favicon

libpcap-1.0.0 make install fails

Hello.

make DESTIDR=/tmp/libpcap install 

fails with the following error:

/usr/bin/install -c pcap-config /tmp/test/home/pva/work/local/bin/pcap-config
/usr/bin/install: cannot create regular file `/tmp/test/home/pva/work/local/bin/pcap-config': No
such file or directory
make: *** [install] Error 1

patch in attachment fixes this issue.

--

-- 
Peter.
Hello.

make DESTIDR=/tmp/libpcap install 

fails with the following error:

/usr/bin/install -c pcap-config /tmp/test/home/pva/work/local/bin/pcap-config
/usr/bin/install: cannot create regular file `/tmp/test/home/pva/work/local/bin/pcap-config': No
such file or directory
make: *** [install] Error 1

patch in attachment fixes this issue.
(Continue reading)

Michael Richardson | 6 Nov 2008 05:45
Picon

git repo


okay. I did a:
      git-cvsimport 

on both libpcap and tcpdump. 
(I suggest that we might want to leave htdocs in CVS. Or whatever
majority wishes)

You can clone it from:
    git clone git://bpf.tcpdump.org/tcpdump
    git clone git://bpf.tcpdump.org/libpcap

I also pushed it to github:
  http://github.com/mcr/tcpdump/tree/master
  http://github.com/mcr/libpcap/tree/master

git-cvsimport did a very good job of dealing with all the branches.

Note: building libpcap, I got:

gcc -O2 -fPIC -I.  -DHAVE_CONFIG_H  -D_U_="__attribute__((unused))" -c ./pcap-usb-linux.c
./pcap-usb-linux.c:46:22: error: pcap/usb.h: No such file or directory

It might be that I'm missing some pieces/branches.

--

-- 
]       ON HUMILITY: to err is human. To moo, bovine.           |  firewalls  [
]   Michael Richardson, Sandelman Software Works, Ottawa, ON    |net architect[
] mcr <at> sandelman.ottawa.on.ca http://www.sandelman.ottawa.on.ca/ |device driver[
] panic("Just another Debian GNU/Linux using, kernel hacking, security guy"); [
(Continue reading)

Michael Richardson | 6 Nov 2008 07:29
Picon

Re: libpcap-1.0.0 sita configure check


>>>>> "Peter" == Peter Volkov <pva <at> gentoo.org> writes:
    Peter> Hello.

    Peter> Currently SITA will be defined and sita code will be tried to
    Peter> build even if --without-sita is passed to ./configure. Patch
    Peter> in attachment fixes this issue.

  Applied to new git tree.

--

-- 
]       ON HUMILITY: to err is human. To moo, bovine.           |  firewalls  [
]   Michael Richardson, Sandelman Software Works, Ottawa, ON    |net architect[
] mcr <at> sandelman.ottawa.on.ca http://www.sandelman.ottawa.on.ca/ |device driver[
] panic("Just another Debian GNU/Linux using, kernel hacking, security guy"); [

Guy Harris | 6 Nov 2008 09:23
Picon
Favicon

Re: libpcap-1.0.0 sita configure check


On Nov 5, 2008, at 10:29 PM, Michael Richardson wrote:

>  Applied to new git tree.

So the official tree is now in git (i.e., all changes should be  
checked into git)?

Gmane