Nessus-libraries system PCAP patch with side benefit of fixing Fedora Core 4 segfaults

"Brian Costello" <[email protected]> Mon, 14 Nov 2005 14:34:06 -0800
Newsgroups gmane.comp.security.nessus.devel
Message-ID <[email protected]>
This is a multi-part message in MIME format.

--===============0189978706==
content-class: urn:content-classes:message
Content-Type: multipart/alternative;
	boundary="----_=_NextPart_001_01C5E96B.8597CF32"

This is a multi-part message in MIME format.

------_=_NextPart_001_01C5E96B.8597CF32
Content-Type: text/plain;
	charset="US-ASCII"
Content-Transfer-Encoding: quoted-printable

Hi,

=20

Recently, I tried to build Nessus 2.2.5 & 2.2.6 on a few Fedora Core 4
(ia32) systems with gcc 4.0.1-5, but the resulting code always had the
same problem - when running any plugin that called the built-in libpcap,
the script/plugin would segfault.  Although Nessus recovered admirably
from these problems, it still obviously skewed the results
significantly, especially when using synscan as the only portscanner.  I
was able to track the segfault to the opt_init() function in
nessus-libraries/libpcap-nessus/optimize.c, but I was unable to track
down the actual problem - opt_init() was called from bpf_optimize(), it
completed, and then the segfault occurred before returning to
bpf_optimize().  That seems to imply a stack problem, but I couldn't
tell where the stack was corrupted.  I tried removing all rlimits, just
in case, but that made no difference.  I should also say that I didn't
build any of the Nessus code with any of the string overflow protection
definitions that's built into Fedora Core 4.

=20

To see if you have this same problem, grep your nessusd.messages for the
string "SIGSEGV".  If this occurs, check to see which plugins caused the
segfault - if you have the same problem as I did, each of the plugins
that crashed use libpcap (like ping_host.nasl, synscan.nes, etc).

=20

To fix this problem, I tried to switch to using the system libpcap
(0.8.3) using the -disable-nessuspcap configure argument, but since
Linux has no read timeout, and since Nessus wasn't calling the libpcap
nonblocking/select functions, that option wasn't viable either (the
calls to bpf_next_tv would block until a packet meeting its filter
criteria was read).

=20

So, I patched libnessus to use the system libpcap in the timeout
workaround way - that is, to make the pcap file descriptor nonblocking,
request the "selectable" file descriptor from libpcap, and then to use
the timeval passed to bpf_next_tv() as the select timeout.

=20

There are a few benefits with this approach - most obviously, it doesn't
crash the Nessus plugins on Fedora Core 4.  Whatever was causing that
problem is apparently not a problem with the system libpcap.  Second,
the newer libpcap takes advantage of some modern Linux's kernel features
- it uses the newer PF_PACKET sockets for packet capture, and it takes
advantage of kernel socket filtering (if it's enabled in the kernel),
both of which provide performance improvements.

=20

In my patch, I set the code to attempt this approach only if the system
didn't have a native BPF device - this is because read timeouts already
work on BSD systems, and also BSDs will return a valid socket with the
pcap_get_selectable_fd() call, but this socket isn't usable in the same
way it is on other OS'.  I haven't tested the code on any non-Linux
systems, so I can't say if it will work on non-Linux Fedora-based
systems.=20

=20

Still, I think the patch has a lot of merit - even if the segfault
problem encountered by me is a quirk of the gcc I'm using, or a small
bug in the built-in libpcap code, I still think the added benefits of
using a modern pcap on Linux make this patch useful as more than just a
workaround.

=20

I did my best to test this patch against all of the plugins I could,
focusing on the plugins that use pcap functionality.  In all cases, the
tests worked as expected.  I only tested this on Fedora Core 2
(gcc-3.3.3) and Fedora Core 4 (gcc-4.0.1-5), both with libpcap-0.8.3.

=20

Here is the patch - it patches configure.in, configure, config.h.in and
bpf_share.c, all in nessus-libraries.  To use it, apply this patch to a
new nessus-libraries, and build Nessus as usual, but make sure you add
--disable-nessuspcap to your nessus-libraries' configure commandline.

=20

=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D/ =
BEGIN PATCH =
/=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D

=20

diff -r -C 5 nessus-libraries/configure
nessus-libraries-pcap-patch/configure

*** nessus-libraries/configure       2005-10-27 09:29:18.000000000 -0400

--- nessus-libraries-pcap-patch/configure  2005-11-09 05:05:09.000000000
-0500

***************

*** 8333,8342 ****

--- 8333,8385 ----

   pcap_dir=3D""

   unset pcap_install

   unset pcap_make

   unset pcap_clean

   unset pcap_distclean

+   echo $ac_n "checking for pcap_get_selectable_fd in -lpcap""...
$ac_c" 1>&6

+ echo "configure:8340: checking for pcap_get_selectable_fd in -lpcap"
>&5

+ ac_lib_var=3D`echo pcap'_'pcap_get_selectable_fd | sed 'y%./+-%__p_%'`

+ if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" =3D set";
then

+   echo $ac_n "(cached) $ac_c" 1>&6

+ else

+   ac_save_LIBS=3D"$LIBS"

+ LIBS=3D"-lpcap  $LIBS"

+ cat > conftest.$ac_ext <<EOF

+ #line 8348 "configure"

+ #include "confdefs.h"

+ /* Override any gcc2 internal prototype to avoid an error.  */

+ /* We use char because int might match the return type of a gcc2

+     builtin and then its argument prototype would still apply.  */

+ char pcap_get_selectable_fd();

+=20

+ int main() {

+ pcap_get_selectable_fd()

+ ; return 0; }

+ EOF

+ if { (eval echo configure:8359: \"$ac_link\") 1>&5; (eval $ac_link)
2>&5; } && test -s conftest${ac_exeext}; then

+   rm -rf conftest*

+   eval "ac_cv_lib_$ac_lib_var=3Dyes"

+ else

+   echo "configure: failed program was:" >&5

+   cat conftest.$ac_ext >&5

+   rm -rf conftest*

+   eval "ac_cv_lib_$ac_lib_var=3Dno"

+ fi

+ rm -f conftest*

+ LIBS=3D"$ac_save_LIBS"

+=20

+ fi

+ if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" =3D yes"; then

+   echo "$ac_t""yes" 1>&6

+   cat >> confdefs.h <<\EOF

+ #define HAVE_PCAP_GET_SELECTABLE_FD 1

+ EOF

+=20

+ else

+   echo "$ac_t""no" 1>&6

+ fi

+=20

  else

   syspcap=3D""

   pcap_flag=3D"-lpcap-nessus"

   pcap_install=3D"pcap-install"

   pcap_make=3D"pcap-make"

diff -r -C 5 nessus-libraries/configure.in
nessus-libraries-pcap-patch/configure.in

*** nessus-libraries/configure.in   2005-10-27 09:29:18.000000000 -0400

--- nessus-libraries-pcap-patch/configure.in           2005-11-09
05:05:09.000000000 -0500

***************

*** 463,472 ****

--- 463,473 ----

   pcap_dir=3D""

   unset pcap_install

   unset pcap_make

   unset pcap_clean

   unset pcap_distclean

+
AC_CHECK_LIB(pcap,pcap_get_selectable_fd,AC_DEFINE(HAVE_PCAP_GET_SELECTA
BLE_FD))

  else

   syspcap=3D""

   pcap_flag=3D"-lpcap-nessus"

   pcap_install=3D"pcap-install"

   pcap_make=3D"pcap-make"

diff -r -C 5 nessus-libraries/include/config.h.in
nessus-libraries-pcap-patch/include/config.h.in

*** nessus-libraries/include/config.h.in      2005-04-19
07:04:58.000000000 -0400

--- nessus-libraries-pcap-patch/include/config.h.in 2005-11-09
05:06:04.000000000 -0500

***************

*** 323,327 ****

--- 323,329 ----

 =20

  #undef HAVE_ACCRIGHTS_IN_MSGHDR

  #undef HAVE_CONTROL_IN_MSGHDR

 =20

  #undef DEBUG_STORE

+=20

+ #undef HAVE_PCAP_GET_SELECTABLE_FD

diff -r -C 5 nessus-libraries/libnessus/bpf_share.c
nessus-libraries-pcap-patch/libnessus/bpf_share.c

*** nessus-libraries/libnessus/bpf_share.c            2005-07-06
16:48:10.000000000 -0400

--- nessus-libraries-pcap-patch/libnessus/bpf_share.c        2005-11-09
05:05:09.000000000 -0500

***************

*** 942,951 ****

--- 942,960 ----

   {

      printf("%s\n", errbuf);           =20

    return -1;

   }

 =20

+ #ifdef HAVE_PCAP_GET_SELECTABLE_FD

+  if (pcap_setnonblock(ret, 1, errbuf) < 0)

+  {

+     printf("pcap_setnonblock() failed\n");

+     pcap_close(ret);

+     return -1;

+  }

+ #endif

+=20

   if(pcap_lookupnet(iface, &network, &netmask, 0) < 0)

   {=20

     printf("pcap_lookupnet failed\n");

     pcap_close(ret);

     return -1;

***************

*** 968,987 ****

--- 977,1053 ----

   return i;

  }

 =20

 =20

 =20

+ #ifdef HAVE_PCAP_GET_SELECTABLE_FD

+ /*

+  * bpf_next_tv() - Modified version to use the tcpdump.org's libpcap
0.7.1+=20

+  *                 non-blockable / selectable functionality to
simulate BPF

+  *                 timeouts

+  *

+  */

+ u_char* bpf_next_tv(int bpf, int * caplen, struct timeval * tv)

+ {

+   u_char * p =3D NULL;

+   struct pcap_pkthdr *head;

+   int sock;

+   u_char read=3D0;

+   fd_set rfds;

+   int rv;

+  =20

+   if ((sock=3Dpcap_get_selectable_fd(pcaps[bpf])) < 0)

+   {

+      printf("Failed to get the selectable fd!\n");

+      return NULL;

+   }

+  =20

+    while (!read)

+    {

+       FD_ZERO(&rfds);

+       FD_SET(sock, &rfds);

+      =20

+       if ((rv =3D select(sock + 1, &rfds, NULL, NULL, tv)) < 0)

+       {

+          if (errno =3D=3D EAGAIN)

+             continue;

+            =20

+          printf("Select() failed in bpf_next_tv()\n");

+          return NULL;

+       }

+      =20

+       read++;

+      =20

+       if (rv =3D=3D 0)

+          return NULL;

+      =20

+       if (rv > 0 && FD_ISSET(sock, &rfds))

+       {

+          if ((rv =3D pcap_next_ex(pcaps[bpf], (struct pcap_pkthdr
**)&head, &p)) < 0)

+          {

+             printf("pcap_next_ex() failed\n");

+             bpf_close(bpf);

+             return NULL;

+          }

+       }

+    }

+=20

+    *caplen  =3D head->caplen;

+    return p;

+ }

+ #else

  u_char* bpf_next_tv(int bpf, int * caplen, struct timeval * tv)

  {

    u_char * p =3D NULL;

    struct pcap_pkthdr head;

 =20

   =20

   p =3D (u_char*)pcap_next(pcaps[bpf], &head);

   *caplen  =3D head.caplen;

   return p;

  }

+ #endif

 =20

 =20

  u_char* bpf_next(int bpf, int * caplen)

  {

   struct timeval tv =3D {0, 100000};

=20

=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D/ =
END PATCH =
/=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D

=20

Hopefully this code is helpful to some of you.

=20

The code could be improved if the configure check for
pcap_get_selectable_fd() would also verify that it didn't get -1 back,
but that's a bit beyond what I know how to do with configure.  If
anyone's gotten Nessus 2.2.[56] to run successfully under Fedora Core 4,
I'd be interested in hearing how you did it (I'm especially curious to
know if gcc4 had something to do with the problem.

=20

Brian Costello

=20


------_=_NextPart_001_01C5E96B.8597CF32
Content-Type: text/html;
	charset="US-ASCII"
Content-Transfer-Encoding: quoted-printable

<html xmlns:o=3D"urn:schemas-microsoft-com:office:office" =
xmlns:w=3D"urn:schemas-microsoft-com:office:word" =
xmlns=3D"http://www.w3.org/TR/REC-html40">

<head>
<meta http-equiv=3DContent-Type content=3D"text/html; =
charset=3Dus-ascii">
<meta name=3DGenerator content=3D"Microsoft Word 11 (filtered medium)">
<style>
<!--
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
	{margin:0in;
	margin-bottom:.0001pt;
	font-size:12.0pt;
	font-family:"Times New Roman";}
a:link, span.MsoHyperlink
	{color:blue;
	text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
	{color:purple;
	text-decoration:underline;}
span.EmailStyle17
	{mso-style-type:personal-compose;
	font-family:Arial;
	color:windowtext;}
@page Section1
	{size:8.5in 11.0in;
	margin:1.0in 1.25in 1.0in 1.25in;}
div.Section1
	{page:Section1;}
-->
</style>

</head>

<body lang=3DEN-US link=3Dblue vlink=3Dpurple>

<div class=3DSection1>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>Hi,<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>Recently, I tried to build Nessus 2.2.5 &amp; 2.2.6 =
on a few
Fedora Core 4 (ia32) systems with gcc 4.0.1-5, but the resulting code =
always
had the same problem &#8211; when running any plugin that called the =
built-in
libpcap, the script/plugin would segfault.&nbsp; Although Nessus =
recovered admirably
from these problems, it still obviously skewed the results =
significantly,
especially when using synscan as the only portscanner.&nbsp; I was able =
to
track the segfault to the opt_init() function in =
nessus-libraries/libpcap-nessus/optimize.c,
but I was unable to track down the actual problem &#8211; opt_init() was =
called
from bpf_optimize(), it completed, and then the segfault occurred before
returning to bpf_optimize().&nbsp; That seems to imply a stack problem, =
but I
couldn&#8217;t tell where the stack was corrupted.&nbsp; I tried =
removing all rlimits,
just in case, but that made no difference.&nbsp; I should also say that =
I didn&#8217;t
build any of the Nessus code with any of the string overflow protection =
definitions
that&#8217;s built into Fedora Core 4.<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>To see if you have this same problem, grep your
nessusd.messages for the string &#8220;SIGSEGV&#8221;.&nbsp; If this =
occurs,
check to see which plugins caused the segfault &#8211; if you have the =
same
problem as I did, each of the plugins that crashed use libpcap (like
ping_host.nasl, synscan.nes, etc).<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>To fix this problem, I tried to switch to using the =
system
libpcap (0.8.3) using the &#8211;disable-nessuspcap configure argument, =
but since
Linux has no read timeout, and since Nessus wasn&#8217;t calling the =
libpcap
nonblocking/select functions, that option wasn&#8217;t viable either =
(the calls
to bpf_next_tv would block until a packet meeting its filter criteria =
was
read).<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>So, I patched libnessus to use the system libpcap in =
the timeout
workaround way &#8211; that is, to make the pcap file descriptor =
nonblocking, request
the &#8220;selectable&#8221; file descriptor from libpcap, and then to =
use the
timeval passed to bpf_next_tv() as the select =
timeout.<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>There are a few benefits with this approach &#8211; =
most
obviously, it doesn&#8217;t crash the Nessus plugins on Fedora Core =
4.&nbsp;
Whatever was causing that problem is apparently not a problem with the =
system libpcap.&nbsp;
Second, the newer libpcap takes advantage of some modern Linux&#8217;s =
kernel
features &#8211; it uses the newer PF_PACKET sockets for packet capture, =
and it
takes advantage of kernel socket filtering (if it&#8217;s enabled in the =
kernel),
both of which provide performance =
improvements.<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>In my patch, I set the code to attempt this approach =
only if
the system didn&#8217;t have a native BPF device &#8211; this is because =
read timeouts
already work on BSD systems, and also BSDs will return a valid socket =
with the
pcap_get_selectable_fd() call, but this socket isn&#8217;t usable in the =
same
way it is on other OS&#8217;.&nbsp; I haven&#8217;t tested the code on =
any
non-Linux systems, so I can&#8217;t say if it will work on non-Linux =
Fedora-based
systems. <o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>Still, I think the patch has a lot of merit &#8211; =
even if
the segfault problem encountered by me is a quirk of the gcc I&#8217;m =
using,
or a small bug in the built-in libpcap code, I still think the added =
benefits
of using a modern pcap on Linux make this patch useful as more than just =
a workaround.<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>I did my best to test this patch against all of the =
plugins
I could, focusing on the plugins that use pcap functionality.&nbsp; In =
all
cases, the tests worked as expected.&nbsp; I only tested this on Fedora =
Core 2
(gcc-3.3.3) and Fedora Core 4 (gcc-4.0.1-5), both with =
libpcap-0.8.3.<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>Here is the patch &#8211; it patches configure.in,
configure, config.h.in and bpf_share.c, all in nessus-libraries.&nbsp; =
To use
it, apply this patch to a new nessus-libraries, and build Nessus as =
usual, but
make sure you add --disable-nessuspcap to your nessus-libraries&#8217; =
configure
commandline.<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D/ BEGIN PATCH =
/=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D<o:p><=
/o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>diff -r -C 5 nessus-libraries/configure
nessus-libraries-pcap-patch/configure<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>*** =
nessus-libraries/configure&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
2005-10-27
09:29:18.000000000 -0400<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>--- nessus-libraries-pcap-patch/configure&nbsp; =
2005-11-09
05:05:09.000000000 -0500<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>***************<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>*** 8333,8342 ****<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>--- 8333,8385 ----<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>&nbsp;&nbsp; =
pcap_dir=3D&quot;&quot;<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>&nbsp;&nbsp; unset =
pcap_install<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>&nbsp;&nbsp; unset =
pcap_make<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>&nbsp;&nbsp; unset =
pcap_clean<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>&nbsp;&nbsp; unset =
pcap_distclean<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>+&nbsp;&nbsp; echo $ac_n &quot;checking for
pcap_get_selectable_fd in -lpcap&quot;&quot;... $ac_c&quot; =
1&gt;&amp;6<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>+ echo &quot;configure:8340: checking for =
pcap_get_selectable_fd
in -lpcap&quot; &gt;&amp;5<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>+ ac_lib_var=3D`echo pcap'_'pcap_get_selectable_fd | =
sed
'y%./+-%__p_%'`<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>+ if eval &quot;test \&quot;`echo
'$''{'ac_cv_lib_$ac_lib_var'+set}'`\&quot; =3D set&quot;; =
then<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>+&nbsp;&nbsp; echo $ac_n &quot;(cached) $ac_c&quot;
1&gt;&amp;6<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>+ else<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>+&nbsp;&nbsp; =
ac_save_LIBS=3D&quot;$LIBS&quot;<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>+ LIBS=3D&quot;-lpcap&nbsp; =
$LIBS&quot;<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>+ cat &gt; conftest.$ac_ext =
&lt;&lt;EOF<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>+ #line 8348 =
&quot;configure&quot;<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>+ #include =
&quot;confdefs.h&quot;<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>+ /* Override any gcc2 internal prototype to avoid an
error.&nbsp; */<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>+ /* We use char because int might match the return =
type of
a gcc2<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>+&nbsp;&nbsp;&nbsp;&nbsp; builtin and then its =
argument
prototype would still apply.&nbsp; */<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>+ char =
pcap_get_selectable_fd();<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>+ <o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>+ int main() {<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>+ =
pcap_get_selectable_fd()<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>+ ; return 0; }<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>+ EOF<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>+ if { (eval echo configure:8359: =
\&quot;$ac_link\&quot;)
1&gt;&amp;5; (eval $ac_link) 2&gt;&amp;5; } &amp;&amp; test -s
conftest${ac_exeext}; then<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>+&nbsp;&nbsp; rm -rf =
conftest*<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>+&nbsp;&nbsp; eval =
&quot;ac_cv_lib_$ac_lib_var=3Dyes&quot;<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>+ else<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>+&nbsp;&nbsp; echo &quot;configure: failed program
was:&quot; &gt;&amp;5<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>+&nbsp;&nbsp; cat conftest.$ac_ext =
&gt;&amp;5<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>+&nbsp;&nbsp; rm -rf =
conftest*<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>+&nbsp;&nbsp; eval =
&quot;ac_cv_lib_$ac_lib_var=3Dno&quot;<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>+ fi<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>+ rm -f conftest*<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>+ =
LIBS=3D&quot;$ac_save_LIBS&quot;<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>+ <o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>+ fi<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>+ if eval &quot;test \&quot;`echo
'$ac_cv_lib_'$ac_lib_var`\&quot; =3D yes&quot;; =
then<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>+&nbsp;&nbsp; echo &quot;$ac_t&quot;&quot;yes&quot;
1&gt;&amp;6<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>+&nbsp;&nbsp; cat &gt;&gt; confdefs.h =
&lt;&lt;\EOF<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>+ #define HAVE_PCAP_GET_SELECTABLE_FD =
1<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>+ EOF<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>+ <o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>+ else<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>+&nbsp;&nbsp; echo &quot;$ac_t&quot;&quot;no&quot;
1&gt;&amp;6<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>+ fi<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>+ <o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>&nbsp; else<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>&nbsp;&nbsp; =
syspcap=3D&quot;&quot;<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>&nbsp;&nbsp; =
pcap_flag=3D&quot;-lpcap-nessus&quot;<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>&nbsp;&nbsp; =
pcap_install=3D&quot;pcap-install&quot;<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>&nbsp;&nbsp; =
pcap_make=3D&quot;pcap-make&quot;<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>diff -r -C 5 nessus-libraries/configure.in
nessus-libraries-pcap-patch/configure.in<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>*** nessus-libraries/configure.in&nbsp;&nbsp; =
2005-10-27
09:29:18.000000000 -0400<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>--- =
nessus-libraries-pcap-patch/configure.in&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp; 2005-11-09
05:05:09.000000000 -0500<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>***************<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>*** 463,472 ****<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>--- 463,473 ----<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>&nbsp;&nbsp; =
pcap_dir=3D&quot;&quot;<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>&nbsp;&nbsp; unset =
pcap_install<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>&nbsp;&nbsp; unset =
pcap_make<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>&nbsp;&nbsp; unset =
pcap_clean<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>&nbsp;&nbsp; unset =
pcap_distclean<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>+&nbsp;&nbsp; =
AC_CHECK_LIB(pcap,pcap_get_selectable_fd,AC_DEFINE(HAVE_PCAP_GET_SELECTAB=
LE_FD))<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>&nbsp; else<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>&nbsp;&nbsp; =
syspcap=3D&quot;&quot;<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>&nbsp;&nbsp; =
pcap_flag=3D&quot;-lpcap-nessus&quot;<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>&nbsp;&nbsp; =
pcap_install=3D&quot;pcap-install&quot;<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>&nbsp;&nbsp; =
pcap_make=3D&quot;pcap-make&quot;<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>diff -r -C 5 nessus-libraries/include/config.h.in
nessus-libraries-pcap-patch/include/config.h.in<o:p></o:p></span></font><=
/p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>*** =
nessus-libraries/include/config.h.in&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
2005-04-19
07:04:58.000000000 -0400<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>--- nessus-libraries-pcap-patch/include/config.h.in =
2005-11-09
05:06:04.000000000 -0500<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>***************<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>*** 323,327 ****<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>--- 323,329 ----<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>&nbsp; <o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>&nbsp; #undef =
HAVE_ACCRIGHTS_IN_MSGHDR<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>&nbsp; #undef =
HAVE_CONTROL_IN_MSGHDR<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>&nbsp; <o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>&nbsp; #undef =
DEBUG_STORE<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>+ <o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>+ #undef =
HAVE_PCAP_GET_SELECTABLE_FD<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>diff -r -C 5 nessus-libraries/libnessus/bpf_share.c
nessus-libraries-pcap-patch/libnessus/bpf_share.c<o:p></o:p></span></font=
></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>*** =
nessus-libraries/libnessus/bpf_share.c&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2005-07-06
16:48:10.000000000 -0400<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>--- =
nessus-libraries-pcap-patch/libnessus/bpf_share.c&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp; 2005-11-09
05:05:09.000000000 -0500<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>***************<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>*** 942,951 ****<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>--- 942,960 ----<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>&nbsp;&nbsp; {<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
printf(&quot;%s\n&quot;,
errbuf);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;  <o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>&nbsp;&nbsp;&nbsp; return =
-1;<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>&nbsp;&nbsp; }<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>&nbsp; <o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>+ #ifdef =
HAVE_PCAP_GET_SELECTABLE_FD<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>+ &nbsp;if (pcap_setnonblock(ret, 1, errbuf) &lt; =
0)<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>+&nbsp; {<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>+&nbsp;&nbsp;&nbsp;&nbsp; =
printf(&quot;pcap_setnonblock()
failed\n&quot;);<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>+&nbsp;&nbsp;&nbsp;&nbsp; =
pcap_close(ret);<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>+&nbsp;&nbsp;&nbsp;&nbsp; return =
-1;<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>+&nbsp; }<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>+ #endif<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>+ <o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>&nbsp;&nbsp; if(pcap_lookupnet(iface, &amp;network,
&amp;netmask, 0) &lt; 0)<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>&nbsp;&nbsp; { <o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>&nbsp;&nbsp;&nbsp;&nbsp; printf(&quot;pcap_lookupnet
failed\n&quot;);<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>&nbsp;&nbsp;&nbsp;&nbsp; =
pcap_close(ret);<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>&nbsp;&nbsp;&nbsp;&nbsp; return =
-1;<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>***************<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>*** 968,987 ****<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>--- 977,1053 ----<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>&nbsp;&nbsp; return i;<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>&nbsp; }<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>&nbsp; <o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>&nbsp; <o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>&nbsp; <o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>+ #ifdef =
HAVE_PCAP_GET_SELECTABLE_FD<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>+ /*<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>+&nbsp; * bpf_next_tv() - Modified version to use the
tcpdump.org's libpcap 0.7.1+ <o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>+&nbsp;
*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;
&nbsp;non-blockable / selectable functionality to simulate =
BPF<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>+&nbsp;
*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;
timeouts<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>+&nbsp; *<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>+&nbsp; */<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>+ u_char* bpf_next_tv(int bpf, int * caplen, struct =
timeval
* tv)<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>+ {<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>+&nbsp;&nbsp; u_char * p =3D =
NULL;<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>+&nbsp;&nbsp; struct pcap_pkthdr =
*head;<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>+&nbsp;&nbsp; int sock;<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>+&nbsp;&nbsp; u_char =
read=3D0;<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>+&nbsp;&nbsp; fd_set =
rfds;<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>+&nbsp;&nbsp; int rv;<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>+&nbsp;&nbsp; <o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>+&nbsp;&nbsp; if =
((sock=3Dpcap_get_selectable_fd(pcaps[bpf]))
&lt; 0)<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>+&nbsp;&nbsp; {<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printf(&quot;Failed =
to get
the selectable fd!\n&quot;);<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return =
NULL;<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>+&nbsp;&nbsp; }<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>+&nbsp;&nbsp; <o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>+&nbsp;&nbsp;&nbsp; while =
(!read)<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>+&nbsp;&nbsp;&nbsp; {<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
FD_ZERO(&amp;rfds);<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FD_SET(sock,
&amp;rfds);<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if ((rv =3D =
select(sock
+ 1, &amp;rfds, NULL, NULL, tv)) &lt; 0)<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
{<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
; if
(errno =3D=3D EAGAIN)<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;
continue;<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;
<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;
printf(&quot;Select() failed in =
bpf_next_tv()\n&quot;);<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;
return NULL;<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
}<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
read++;<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (rv =3D=3D =
0)<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;
return NULL;<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (rv &gt; 0
&amp;&amp; FD_ISSET(sock, &amp;rfds))<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
{<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
; if
((rv =3D pcap_next_ex(pcaps[bpf], (struct pcap_pkthdr **)&amp;head, =
&amp;p)) &lt;
0)<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
; {<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;
printf(&quot;pcap_next_ex() =
failed\n&quot;);<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;
bpf_close(bpf);<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;
return NULL;<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
; }<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
}<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>+&nbsp;&nbsp;&nbsp; }<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>+ <o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>+&nbsp;&nbsp;&nbsp; *caplen&nbsp; =3D =
head-&gt;caplen;<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>+&nbsp;&nbsp;&nbsp; return =
p;<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>+ }<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>+ #else<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>&nbsp; u_char* bpf_next_tv(int bpf, int * caplen, =
struct
timeval * tv)<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>&nbsp; {<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>&nbsp;&nbsp;&nbsp; u_char * p =3D =
NULL;<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>&nbsp;&nbsp;&nbsp; struct pcap_pkthdr =
head;<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>&nbsp; <o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>&nbsp;&nbsp;&nbsp; <o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>&nbsp;&nbsp; p =3D (u_char*)pcap_next(pcaps[bpf], =
&amp;head);<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>&nbsp;&nbsp; *caplen&nbsp; =3D =
head.caplen;<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>&nbsp;&nbsp; return p;<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>&nbsp; }<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>+ #endif<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>&nbsp; <o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>&nbsp; <o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>&nbsp; u_char* bpf_next(int bpf, int * =
caplen)<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>&nbsp; {<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>&nbsp;&nbsp; struct timeval tv =3D {0, =
100000};<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D/ END PATCH =
/=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D<o:=
p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>Hopefully this code is helpful to some of =
you.<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>The code could be improved if the configure check for
pcap_get_selectable_fd() would also verify that it didn&#8217;t get -1 =
back,
but that&#8217;s a bit beyond what I know how to do with =
configure.&nbsp; If
anyone&#8217;s gotten Nessus 2.2.[56] to run successfully under Fedora =
Core 4, I&#8217;d
be interested in hearing how you did it (I&#8217;m especially curious to =
know
if gcc4 had something to do with the =
problem.<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>Brian Costello<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>&nbsp;<o:p></o:p></span></font></p>

</div>

</body>

</html>

------_=_NextPart_001_01C5E96B.8597CF32--

--===============0189978706==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Nessus-devel mailing list
[email protected]
http://mail.nessus.org/mailman/listinfo/nessus-devel
--===============0189978706==--