----- Original Message -----
From: Guy Harris <guy@xxxxxxxxxxxx>
To: Lanfranco Salinari <lanfranco.salinari@xxxxxxxxxxxxx>
Cc: Greg Morris <gmorris@xxxxxxxxxx>; <ethereal-dev@xxxxxxxxxxxx>
Sent: Wednesday, September 03, 2003 8:07 PM
Subject: Re: [Ethereal-dev] [PATCH] Wish list item 17 (packet generator)
>
> On Wednesday, September 3, 2003, at 12:58 PM, Lanfranco Salinari wrote:
>
> > Thank you very much for your interest, Greg.
> > I understand that this code can run only on Linux, but I think that
> > the dependency is due only to the network functions.
>
> It's due to the current lack of a "send packet" routine in libpcap.
>
> Eventually, I plan to add one (the biggest problem at this point is
> that there should be a new routine for opening a capture device to
> specify whether to open it read-only or read/write - on some OSes, you
> could use standard UNIX permission mechanisms to let some users capture
> but not send, and other users capture and send, and I'd prefer to let
> that work; WinPcap has such an API, which is also used for opening
> remote capture devices, and that will probably end up in libpcap at
> some point.)
>
> What Ethereal should do is:
>
> use that API if and when it becomes available;
>
> otherwise:
>
> if libnet is available:
>
> http://www.packetfactory.net/projects/libnet/
>
> use its routines to send packets;
>
> if you're using WinPcap, use its "pcap_sendpacket()" routine:
>
> http://winpcap.polito.it/docs/man/html/group__wpcap__fn.html#a34
>
> (that will probably become one of the APIs offered by libpcap);
>
> if you're running on a sufficiently recent version of OpenBSD, use
> its "pcap_inject()" routine:
>
> http://www.freebsd.org/cgi/man.cgi?
> query=pcap&apropos=0&sektion=0&manpath=OpenBSD+3.3&format=html
>
> (that will probably become one of the other APIs offered by libpcap -
> it'll offer both, but probably choose one as the "recommended" one);
>
> otherwise, do the sending work itself, perhaps.
>
Hello,
thank you for your suggestions, Guy. I knew that the problem was the lack of
a
function to send packets in libpcap, but I didn't know how to bypass this.
I send you another patch against 0.9.14, that tries to implement packet
sending
as described by you.
The send_packet() function behaves differently according to the availability
of
libnet, packet socket, winpcap,etc...
I did not try to use pcap_inject(), however, and I was not able to test the
Winpcap routine,because I have not an environment to compile under Windows.
I think, however that the "packet socket" and the "libnet" versions work on
Linux (I only tested them on the loopback interface, however).
The HAVE_LIBNET define is not put in the config.h by configure. I define it
in the top of the file for testing purposes, because I do not know how to
change
configure.ac and related files. I also added -lnet to LIBS directly in the
makefile
for the same reason. I apologize for that, perhaps with some suggestions I
can
learn how to do it.
Thank you in advance if you have some time to try this code, even if it is
far
from being complete, also because I have not so much to dedicate to it (I
wrote it at home in my spare time, it is not part of my paid work).
Best regards,
Lanfranco
Attachment:
packetgen.patch
Description: Binary data