Mailing List Archive

using libpcap in C plugin
Hello,



I wrote a C plugin which used libpcap APIs. To compile it, I copy a
makefile from an existing C plugin and change a little on it.



My problems are:



1. When executing 'make', it complained that 'struct pcap_if' not
found. It should be defined in 'pcap.h'. I looked around and found that
the head file included in library-nessus is really missing this
structure from original head file. So I copied this file from system
include directory, and the compile passed. So, is the libpcap included
with nessus an old version?
2. When launched this .nes file, nessus daemon prompted in the log
file that it can' find ref for function pcap_next_ex. So I changed the
makefile - nessus.tmpl from "-lpcap-nessus" to "-lpcap". Then the plugin
can be launched as normal. But when I run the plugin, it caused
segmentation fault in the function call "pcap_next_ex". Finally, I
changed this function to "pcap_next" and everything works fine now. So
where's the problem?



Any suggestion would be appreciated! Thanks!!



Jingyu
Re: using libpcap in C plugin [ In reply to ]
On Tue, Aug 09, 2005 at 11:56:46AM -0400, Jingyu Dong wrote:

> I wrote a C plugin which used libpcap APIs.

Perhaps Renaud or Michel can give a more authoritative answer, but I
suspect NASL is the preferred method for writing plugins these days.

> 1. When executing ‘make’, it complained that ‘struct pcap_if’ not
> found. It should be defined in ‘pcap.h’.

Are you using it in your plugin code? By default, Nessus comes with and
uses an older version of libpcap (libpcap-nessus) so I would expect
issues if your plugin uses, or tries to use, a different version.


George
--
theall@tenablesecurity.com
Re: using libpcap in C plugin [ In reply to ]
On Tue Aug 09 2005 at 17:56, Jingyu Dong wrote:

> include directory, and the compile passed. So, is the libpcap included
> with nessus an old version?

Yes

> where's the problem?

Library conflict I suppose.

Do you really need to write a C plugin?