dect
/
libpcap
Archived
13
0
Fork 0

Merge branch 'master' of git://bpf.tcpdump.org/libpcap

Conflicts:
	pcap/bpf.h

Signed-off-by: Patrick McHardy <kaber@trash.net>
This commit is contained in:
Patrick McHardy 2011-01-10 14:44:29 +01:00
commit 481ab2d4a6
17 changed files with 675 additions and 230 deletions

276
CREDITS
View File

@ -1,148 +1,148 @@
This file lists people who have contributed to libpcap: This file lists people who have contributed to libpcap:
The current maintainers: The current maintainers:
Bill Fenner <fenner at research dot att dot com> Bill Fenner <fenner at research dot att dot com>
Fulvio Risso <risso at polito dot it> Fulvio Risso <risso at polito dot it>
Guy Harris <guy at alum dot mit dot edu> Guy Harris <guy at alum dot mit dot edu>
Hannes Gredler <hannes at juniper dot net> Hannes Gredler <hannes at juniper dot net>
Michael Richardson <mcr at sandelman dot ottawa dot on dot ca> Michael Richardson <mcr at sandelman dot ottawa dot on dot ca>
Additional people who have contributed patches: Additional people who have contributed patches:
Alan Bawden <Alan at LCS dot MIT dot EDU> Alan Bawden <Alan at LCS dot MIT dot EDU>
Albert Chin <china at thewrittenword dot com> Albert Chin <china at thewrittenword dot com>
Alexander 'Leo' Bergolth <Leo dot Bergolth at wu-wien dot ac dot at> Alexander 'Leo' Bergolth <Leo dot Bergolth at wu-wien dot ac dot at>
Alexey Kuznetsov <kuznet at ms2 dot inr dot ac dot ru> Alexey Kuznetsov <kuznet at ms2 dot inr dot ac dot ru>
Alon Bar-Lev <alonbl at sourceforge dot net> Alon Bar-Lev <alonbl at sourceforge dot net>
Andrew Brown <atatat at atatdot dot net> Andrew Brown <atatat at atatdot dot net>
<andy-1 at sourceforge dot net> <andy-1 at sourceforge dot net>
Antti Kantee <pooka at netbsd dot org> Antti Kantee <pooka at netbsd dot org>
Arien Vijn <arienvijn at sourceforge dot net> Arien Vijn <arienvijn at sourceforge dot net>
Arkadiusz Miskiewicz <misiek at pld dot org dot pl> Arkadiusz Miskiewicz <misiek at pld dot org dot pl>
Armando L. Caro Jr. <acaro at mail dot eecis dot udel dot edu> Armando L. Caro Jr. <acaro at mail dot eecis dot udel dot edu>
Assar Westerlund <assar at sics dot se> Assar Westerlund <assar at sics dot se>
Brian Ginsbach <ginsbach at cray dot com> Brian Ginsbach <ginsbach at cray dot com>
Charles M. Hannum <mycroft at netbsd dot org> Charles M. Hannum <mycroft at netbsd dot org>
Chris G. Demetriou <cgd at netbsd dot org> Chris G. Demetriou <cgd at netbsd dot org>
Chris Lightfoot <cwrl at users dot sourceforge dot net> Chris Lightfoot <cwrl at users dot sourceforge dot net>
Chris Maynard <Chris dot Maynard at gtech dot com> Chris Maynard <Chris dot Maynard at gtech dot com>
Chris Pepper <pepper at mail dot reppep dot com> Chris Pepper <pepper at mail dot reppep dot com>
Christian Bell <csbell at myri dot com> Christian Bell <csbell at myri dot com>
Christian Peron <csjp at freebsd dot org> Christian Peron <csjp at freebsd dot org>
Daniele Orlandi <daniele at orlandi dot com> Daniele Orlandi <daniele at orlandi dot com>
Darren Reed <darrenr at sun dot com> Darren Reed <darrenr at sun dot com>
David Kaelbling <drk at sgi dot com> David Kaelbling <drk at sgi dot com>
David Young <dyoung at ojctech dot com> David Young <dyoung at ojctech dot com>
Dean Gaudet <dean at arctic dot org> Dean Gaudet <dean at arctic dot org>
Don Ebright <Don dot Ebright at compuware dot com> Don Ebright <Don dot Ebright at compuware dot com>
Dug Song <dugsong at monkey dot org> Dug Song <dugsong at monkey dot org>
Dustin Spicuzza <dustin at virtualroadside dot com> Dustin Spicuzza <dustin at virtualroadside dot com>
Eric Anderson <anderse at hpl dot hp dot com> Eric Anderson <anderse at hpl dot hp dot com>
Erik de Castro Lopo <erik dot de dot castro dot lopo at sensorynetworks dot com> Erik de Castro Lopo <erik dot de dot castro dot lopo at sensorynetworks dot com>
Felix Obenhuber <felix at obenhuber dot de> Felix Obenhuber <felix at obenhuber dot de>
Florent Drouin <Florent dot Drouin at alcatel-lucent dot fr> Florent Drouin <Florent dot Drouin at alcatel-lucent dot fr>
Franz Schaefer <schaefer at mond dot at> Franz Schaefer <schaefer at mond dot at>
Fulko Hew <fulko dot hew at gmail dot com> Fulko Hew <fulko dot hew at gmail dot com>
Fumiyuki Shimizu <fumifumi at abacustech dot jp> Fumiyuki Shimizu <fumifumi at abacustech dot jp>
Gianluca Varenni <varenni at netgroup-serv dot polito dot it> Gianluca Varenni <varenni at netgroup-serv dot polito dot it>
Gilbert Hoyek <gil_hoyek at hotmail dot com> Gilbert Hoyek <gil_hoyek at hotmail dot com>
Gisle Vanem <gvanem at broadpark dot no> Gisle Vanem <gvanem at broadpark dot no>
Graeme Hewson <ghewson at cix dot compulink dot co dot uk> Graeme Hewson <ghewson at cix dot compulink dot co dot uk>
Greg Stark <gsstark at mit dot edu> Greg Stark <gsstark at mit dot edu>
Greg Troxel <gdt at ir dot bbn dot com> Greg Troxel <gdt at ir dot bbn dot com>
Gregor Maier <gregor at net dot in dot tum dot de> Gregor Maier <gregor at net dot in dot tum dot de>
Guillaume Pelat <endymion_ at users dot sourceforge dot net> Guillaume Pelat <endymion_ at users dot sourceforge dot net>
Hagen Paul Pfeifer <hagen at jauu dot net> Hagen Paul Pfeifer <hagen at jauu dot net>
Hyung Sik Yoon <hsyn at kr dot ibm dot com> Hyung Sik Yoon <hsyn at kr dot ibm dot com>
Igor Khristophorov <igor at atdot dot org> Igor Khristophorov <igor at atdot dot org>
Jan-Philip Velders <jpv at veldersjes dot net> Jan-Philip Velders <jpv at veldersjes dot net>
Jason R. Thorpe <thorpej at netbsd dot org> Jason R. Thorpe <thorpej at netbsd dot org>
Javier Achirica <achirica at ttd dot net> Javier Achirica <achirica at ttd dot net>
Jean Tourrilhes <jt at hpl dot hp dot com> Jean Tourrilhes <jt at hpl dot hp dot com>
Jean-Louis Charton <Jean-Louis.CHARTON at oikialog dot com> Jean-Louis Charton <Jean-Louis.CHARTON at oikialog dot com>
Jefferson Ogata <jogata at nodc dot noaa dot gov> Jefferson Ogata <jogata at nodc dot noaa dot gov>
Jesper Peterson <jesper at endace dot com> Jesper Peterson <jesper at endace dot com>
Joerg Mayer <jmayer at loplof dot de> Joerg Mayer <jmayer at loplof dot de>
John Bankier <jbankier at rainfinity dot com> John Bankier <jbankier at rainfinity dot com>
Jon Lindgren <jonl at yubyub dot net> Jon Lindgren <jonl at yubyub dot net>
Jon Smirl <jonsmirl at gmail dot com> Jon Smirl <jonsmirl at gmail dot com>
Juergen Schoenwaelder <schoenw at ibr dot cs dot tu-bs dot de> Juergen Schoenwaelder <schoenw at ibr dot cs dot tu-bs dot de>
Jung-uk Kim <jkim at FreeBSD dot org> Jung-uk Kim <jkim at FreeBSD dot org>
Kazushi Sugyo <sugyo at pb dot jp dot nec dot com> Kazushi Sugyo <sugyo at pb dot jp dot nec dot com>
Klaus Klein <kleink at netbsd dot org> Klaus Klein <kleink at netbsd dot org>
Koryn Grant <koryn at endace dot com> Koryn Grant <koryn at endace dot com>
Kris Katterjohn <katterjohn at gmail dot com> Kris Katterjohn <katterjohn at gmail dot com>
Krzysztof Halasa <khc at pm dot waw dot pl> Krzysztof Halasa <khc at pm dot waw dot pl>
Lorenzo Cavallaro <sullivan at sikurezza dot org> Lorenzo Cavallaro <sullivan at sikurezza dot org>
Loris Degioanni <loris at netgroup-serv dot polito dot it> Loris Degioanni <loris at netgroup-serv dot polito dot it>
Love Hörnquist-Åstrand <lha at stacken dot kth dot se> Love Hörnquist-Åstrand <lha at stacken dot kth dot se>
Luis Martin Garcia <luis dot mgarc at gmail dot com> Luis MartinGarcia <luis dot mgarc at gmail dot com>
Maciej W. Rozycki <macro at ds2 dot pg dot gda dot pl> Maciej W. Rozycki <macro at ds2 dot pg dot gda dot pl>
Marcus Felipe Pereira <marcus at task dot com dot br> Marcus Felipe Pereira <marcus at task dot com dot br>
Mark C. Brown <mbrown at hp dot com> Mark C. Brown <mbrown at hp dot com>
Mark Pizzolato <List-tcpdump-workers at subscriptions dot pizzolato dot net> Mark Pizzolato <List-tcpdump-workers at subscriptions dot pizzolato dot net>
Markus Mayer <markus_mayer at sourceforge dot net> Markus Mayer <markus_mayer at sourceforge dot net>
Martin Husemann <martin at netbsd dot org> Martin Husemann <martin at netbsd dot org>
Márton Németh <nm127 at freemail dot hu> Márton Németh <nm127 at freemail dot hu>
Matthew Luckie <mjl at luckie dot org dot nz> Matthew Luckie <mjl at luckie dot org dot nz>
Max Laier <max at love2party dot net> Max Laier <max at love2party dot net>
Mike Frysinger <vapier at gmail dot com> Mike Frysinger <vapier at gmail dot com>
Mike Kershaw <dragorn at kismetwireless dot net> Mike Kershaw <dragorn at kismetwireless dot net>
Mike Wiacek <mike at iroot dot net> Mike Wiacek <mike at iroot dot net>
Monroe Williams <monroe at pobox dot com> Monroe Williams <monroe at pobox dot com>
<nvercamm at sourceforge dot net> <nvercamm at sourceforge dot net>
N. Leiten <nleiten at sourceforge dot net> N. Leiten <nleiten at sourceforge dot net>
Nicolas Dade <ndade at nsd dot dyndns dot org> Nicolas Dade <ndade at nsd dot dyndns dot org>
Octavian Cerna <tavy at ylabs dot com> Octavian Cerna <tavy at ylabs dot com>
Olaf Kirch <okir at caldera dot de> Olaf Kirch <okir at caldera dot de>
Ollie Wild <aaw at users dot sourceforge dot net> Ollie Wild <aaw at users dot sourceforge dot net>
Onno van der Linden <onno at simplex dot nl> Onno van der Linden <onno at simplex dot nl>
Paolo Abeni <paolo dot abeni at email dot it> Paolo Abeni <paolo dot abeni at email dot it>
Patrick Marie <mycroft at virgaria dot org> Patrick Marie <mycroft at virgaria dot org>
Patrick McHardy <kaber at trash not net> Patrick McHardy <kaber at trash not net>
Paul Mundt <lethal at linux-sh dot org> Paul Mundt <lethal at linux-sh dot org>
Pavel Kankovsky <kan at dcit dot cz> Pavel Kankovsky <kan at dcit dot cz>
Pawel Pokrywka <publicpp at gmail dot com> Pawel Pokrywka <publicpp at gmail dot com>
Peter Fales <peter at fales-lorenz dot net> Peter Fales <peter at fales-lorenz dot net>
Peter Jeremy <peter dot jeremy at alcatel dot com dot au> Peter Jeremy <peter dot jeremy at alcatel dot com dot au>
Peter Volkov <pva at gentoo dot org> Peter Volkov <pva at gentoo dot org>
Phil Wood <cpw at lanl dot gov> Phil Wood <cpw at lanl dot gov>
Rafal Maszkowski <rzm at icm dot edu dot pl> Rafal Maszkowski <rzm at icm dot edu dot pl>
<rcb-isis at users dot sourceforge dot net> <rcb-isis at users dot sourceforge dot net>
Richard Stearn <richard at rns-stearn dot demon dot co dot uk> Richard Stearn <richard at rns-stearn dot demon dot co dot uk>
Rick Jones <raj at cup dot hp dot com> Rick Jones <raj at cup dot hp dot com>
Robert Edmonds <stu-42 at sourceforge dot net> Robert Edmonds <stu-42 at sourceforge dot net>
Roberto Mariani <jelot-tcpdump at jelot dot it> Roberto Mariani <jelot-tcpdump at jelot dot it>
Romain Francoise <rfrancoise at debian dot org> Romain Francoise <rfrancoise at debian dot org>
Sagun Shakya <sagun dot shakya at sun dot com> Sagun Shakya <sagun dot shakya at sun dot com>
Scott Barron <sb125499 at ohiou dot edu> Scott Barron <sb125499 at ohiou dot edu>
Scott Gifford <sgifford at tir dot com> Scott Gifford <sgifford at tir dot com>
Scott Mcmillan <scott.a.mcmillan at intel dot com> Scott Mcmillan <scott.a.mcmillan at intel dot com>
Sebastian Krahmer <krahmer at cs dot uni-potsdam dot de> Sebastian Krahmer <krahmer at cs dot uni-potsdam dot de>
Sebastien Roy <Sebastien dot Roy at Sun dot COM> Sebastien Roy <Sebastien dot Roy at Sun dot COM>
Sepherosa Ziehau <sepherosa at gmail dot com> Sepherosa Ziehau <sepherosa at gmail dot com>
Shaun Clowes <delius at progsoc dot uts dot edu dot au> Shaun Clowes <delius at progsoc dot uts dot edu dot au>
Solomon Peachy <pizza at shaftnet dot org> Solomon Peachy <pizza at shaftnet dot org>
Stefan Hudson <hudson at mbay dot net> Stefan Hudson <hudson at mbay dot net>
Stephen Donnelly <stephen at endace dot com> Stephen Donnelly <stephen at endace dot com>
Takashi Yamamoto <yamt at mwd dot biglobe dot ne dot jp> Takashi Yamamoto <yamt at mwd dot biglobe dot ne dot jp>
Tanaka Shin-ya <zstanaka at archer dot livedoor dot com> Tanaka Shin-ya <zstanaka at archer dot livedoor dot com>
Tobias Poschwatta <posch at sourceforge dot net> Tobias Poschwatta <posch at sourceforge dot net>
Tony Li <tli at procket dot com> Tony Li <tli at procket dot com>
Torsten Landschoff <torsten at debian dot org> Torsten Landschoff <torsten at debian dot org>
Uns Lider <unslider at miranda dot org> Uns Lider <unslider at miranda dot org>
Uwe Girlich <Uwe dot Girlich at philosys dot de> Uwe Girlich <Uwe dot Girlich at philosys dot de>
Wesley Shields <wxs at FreeBSD dot org> Wesley Shields <wxs at FreeBSD dot org>
Xianjie Zhang <xzhang at cup dot hp dot com> Xianjie Zhang <xzhang at cup dot hp dot com>
Xin Li <delphij at FreeBSD dot org> Xin Li <delphij at FreeBSD dot org>
Yen Yen Lim Yen Yen Lim
Yvan Vanhullebus <vanhu at sourceforge dot net> Yvan Vanhullebus <vanhu at sourceforge dot net>
Yoann Vandoorselaere <yoann at prelude-ids dot org> Yoann Vandoorselaere <yoann at prelude-ids dot org>
The original LBL crew: The original LBL crew:
Steve McCanne Steve McCanne
Craig Leres Craig Leres
Van Jacobson Van Jacobson
Past maintainers: Past maintainers:
Jun-ichiro itojun Hagino <itojun at iijlab dot net> Jun-ichiro itojun Hagino <itojun at iijlab dot net>

View File

@ -492,11 +492,7 @@ bpf_filter.o: bpf_filter.c
# #
pcap-config: $(srcdir)/pcap-config.in pcap-config: $(srcdir)/pcap-config.in
@rm -f $@ $@.tmp @rm -f $@ $@.tmp
sed -e 's|@includedir[@]|$(includedir)|g' \ ./config.status --file=$@.tmp:$<
-e 's|@libdir[@]|$(libdir)|g' \
-e 's|@LIBS[@]|$(LIBS)|g' \
-e 's|@V_RPATH_OPT[@]|$(V_RPATH_OPT)|g' \
$(srcdir)/pcap-config.in >$@.tmp
mv $@.tmp $@ mv $@.tmp $@
chmod a+x $@ chmod a+x $@

View File

@ -45,6 +45,12 @@
* in ai_flags? * in ai_flags?
*/ */
/*
* Mingw64 has its own implementation of getaddrinfo, mingw32 no
*/
#ifndef __MINGW64__
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include <config.h> #include <config.h>
#endif #endif
@ -85,7 +91,7 @@ static const char rcsid[] _U_ =
#ifdef NEED_ADDRINFO_H #ifdef NEED_ADDRINFO_H
#include "addrinfo.h" #include "addrinfo.h"
#ifdef WIN32 #ifdef WIN32
#include "IP6_misc.h" #include "ip6_misc.h"
#endif #endif
#endif #endif
@ -1118,3 +1124,6 @@ find_afd(af)
} }
return NULL; return NULL;
} }
#endif /*__MING64__*/

View File

@ -52,9 +52,15 @@
/* if libnl exists */ /* if libnl exists */
#undef HAVE_LIBNL #undef HAVE_LIBNL
/* if libnl exists and is version 2.x */
#undef HAVE_LIBNL_2_x
/* Define to 1 if you have the <limits.h> header file. */ /* Define to 1 if you have the <limits.h> header file. */
#undef HAVE_LIMITS_H #undef HAVE_LIMITS_H
/* Define to 1 if you have the <linux/compiler.h> header file. */
#undef HAVE_LINUX_COMPILER_H
/* Define to 1 if you have the <linux/net_tstamp.h> header file. */ /* Define to 1 if you have the <linux/net_tstamp.h> header file. */
#undef HAVE_LINUX_NET_TSTAMP_H #undef HAVE_LINUX_NET_TSTAMP_H

319
configure vendored
View File

@ -7347,7 +7347,93 @@ fi
if test x$with_libnl != xno ; then if test x$with_libnl != xno ; then
{ echo "$as_me:$LINENO: checking for nl_handle_alloc in -lnl" >&5 #
# Try libnl 2.x first.
#
{ echo "$as_me:$LINENO: checking for nl_socket_alloc in -lnl" >&5
echo $ECHO_N "checking for nl_socket_alloc in -lnl... $ECHO_C" >&6; }
if test "${ac_cv_lib_nl_nl_socket_alloc+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lnl $LIBS"
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char nl_socket_alloc ();
int
main ()
{
return nl_socket_alloc ();
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (ac_try="$ac_link"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
(eval "$ac_link") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } && {
test -z "$ac_c_werror_flag" ||
test ! -s conftest.err
} && test -s conftest$ac_exeext &&
$as_test_x conftest$ac_exeext; then
ac_cv_lib_nl_nl_socket_alloc=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_cv_lib_nl_nl_socket_alloc=no
fi
rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ echo "$as_me:$LINENO: result: $ac_cv_lib_nl_nl_socket_alloc" >&5
echo "${ECHO_T}$ac_cv_lib_nl_nl_socket_alloc" >&6; }
if test $ac_cv_lib_nl_nl_socket_alloc = yes; then
#
# Yes, we have libnl 2.x.
#
LIBS="-lnl-genl -lnl $LIBS"
cat >>confdefs.h <<\_ACEOF
#define HAVE_LIBNL 1
_ACEOF
cat >>confdefs.h <<\_ACEOF
#define HAVE_LIBNL_2_x 1
_ACEOF
else
#
# No, we don't; do we have libnl 1.x?
#
{ echo "$as_me:$LINENO: checking for nl_handle_alloc in -lnl" >&5
echo $ECHO_N "checking for nl_handle_alloc in -lnl... $ECHO_C" >&6; } echo $ECHO_N "checking for nl_handle_alloc in -lnl... $ECHO_C" >&6; }
if test "${ac_cv_lib_nl_nl_handle_alloc+set}" = set; then if test "${ac_cv_lib_nl_nl_handle_alloc+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6 echo $ECHO_N "(cached) $ECHO_C" >&6
@ -7409,18 +7495,30 @@ fi
{ echo "$as_me:$LINENO: result: $ac_cv_lib_nl_nl_handle_alloc" >&5 { echo "$as_me:$LINENO: result: $ac_cv_lib_nl_nl_handle_alloc" >&5
echo "${ECHO_T}$ac_cv_lib_nl_nl_handle_alloc" >&6; } echo "${ECHO_T}$ac_cv_lib_nl_nl_handle_alloc" >&6; }
if test $ac_cv_lib_nl_nl_handle_alloc = yes; then if test $ac_cv_lib_nl_nl_handle_alloc = yes; then
LIBS="-lnl $LIBS"
#
# Yes.
#
LIBS="-lnl $LIBS"
cat >>confdefs.h <<\_ACEOF cat >>confdefs.h <<\_ACEOF
#define HAVE_LIBNL 1 #define HAVE_LIBNL 1
_ACEOF _ACEOF
else else
if test x$with_libnl = xyes ; then
{ { echo "$as_me:$LINENO: error: libnl support requested but libnl not found" >&5 #
# No, we don't have libnl at all.
#
if test x$with_libnl = xyes ; then
{ { echo "$as_me:$LINENO: error: libnl support requested but libnl not found" >&5
echo "$as_me: error: libnl support requested but libnl not found" >&2;} echo "$as_me: error: libnl support requested but libnl not found" >&2;}
{ (exit 1); exit 1; }; } { (exit 1); exit 1; }; }
fi fi
fi
fi fi
@ -10329,6 +10427,213 @@ _ACEOF
{ echo "$as_me:$LINENO: Device for USB sniffing is /dev/$ac_usb_dev_name" >&5 { echo "$as_me:$LINENO: Device for USB sniffing is /dev/$ac_usb_dev_name" >&5
echo "$as_me: Device for USB sniffing is /dev/$ac_usb_dev_name" >&6;} echo "$as_me: Device for USB sniffing is /dev/$ac_usb_dev_name" >&6;}
#
# Do we have a version of <linux/compiler.h> available?
# If so, we might need it for <linux/usbdevice_fs.h>.
#
for ac_header in linux/compiler.h
do
as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
{ echo "$as_me:$LINENO: checking for $ac_header" >&5
echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
echo $ECHO_N "(cached) $ECHO_C" >&6
fi
ac_res=`eval echo '${'$as_ac_Header'}'`
{ echo "$as_me:$LINENO: result: $ac_res" >&5
echo "${ECHO_T}$ac_res" >&6; }
else
# Is the header compilable?
{ echo "$as_me:$LINENO: checking $ac_header usability" >&5
echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; }
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
$ac_includes_default
#include <$ac_header>
_ACEOF
rm -f conftest.$ac_objext
if { (ac_try="$ac_compile"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
(eval "$ac_compile") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } && {
test -z "$ac_c_werror_flag" ||
test ! -s conftest.err
} && test -s conftest.$ac_objext; then
ac_header_compiler=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_header_compiler=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
echo "${ECHO_T}$ac_header_compiler" >&6; }
# Is the header present?
{ echo "$as_me:$LINENO: checking $ac_header presence" >&5
echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; }
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <$ac_header>
_ACEOF
if { (ac_try="$ac_cpp conftest.$ac_ext"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
(eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } >/dev/null && {
test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
test ! -s conftest.err
}; then
ac_header_preproc=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_header_preproc=no
fi
rm -f conftest.err conftest.$ac_ext
{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
echo "${ECHO_T}$ac_header_preproc" >&6; }
# So? What about this header?
case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
yes:no: )
{ echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
{ echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
ac_header_preproc=yes
;;
no:yes:* )
{ echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
{ echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
{ echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
{ echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
{ echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
{ echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
;;
esac
{ echo "$as_me:$LINENO: checking for $ac_header" >&5
echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
eval "$as_ac_Header=\$ac_header_preproc"
fi
ac_res=`eval echo '${'$as_ac_Header'}'`
{ echo "$as_me:$LINENO: result: $ac_res" >&5
echo "${ECHO_T}$ac_res" >&6; }
fi
if test `eval echo '${'$as_ac_Header'}'` = yes; then
cat >>confdefs.h <<_ACEOF
#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
_ACEOF
fi
done
if test "$ac_cv_header_linux_compiler_h" = yes; then
#
# Yes - include it when testing for <linux/usbdevice_fs.h>.
#
for ac_header in linux/usbdevice_fs.h
do
as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
{ echo "$as_me:$LINENO: checking for $ac_header" >&5
echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <linux/compiler.h>
#include <$ac_header>
_ACEOF
rm -f conftest.$ac_objext
if { (ac_try="$ac_compile"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
(eval "$ac_compile") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } && {
test -z "$ac_c_werror_flag" ||
test ! -s conftest.err
} && test -s conftest.$ac_objext; then
eval "$as_ac_Header=yes"
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
eval "$as_ac_Header=no"
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
ac_res=`eval echo '${'$as_ac_Header'}'`
{ echo "$as_me:$LINENO: result: $ac_res" >&5
echo "${ECHO_T}$ac_res" >&6; }
if test `eval echo '${'$as_ac_Header'}'` = yes; then
cat >>confdefs.h <<_ACEOF
#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
_ACEOF
fi
done
else
for ac_header in linux/usbdevice_fs.h for ac_header in linux/usbdevice_fs.h
do do
@ -10469,6 +10774,7 @@ fi
done done
fi
if test "$ac_cv_header_linux_usbdevice_fs_h" = yes; then if test "$ac_cv_header_linux_usbdevice_fs_h" = yes; then
# #
# OK, does it define bRequestType? Older versions of the kernel # OK, does it define bRequestType? Older versions of the kernel
@ -10492,6 +10798,9 @@ $ac_includes_default
#ifdef HAVE_SYS_BITYPES_H #ifdef HAVE_SYS_BITYPES_H
#include <sys/bitypes.h> #include <sys/bitypes.h>
#endif #endif
#ifdef HAVE_LINUX_COMPILER_H
#include <linux/compiler.h>
#endif
# include <linux/usbdevice_fs.h> # include <linux/usbdevice_fs.h>
int int
main () main ()

View File

@ -445,13 +445,39 @@ linux)
with_libnl=$withval,,) with_libnl=$withval,,)
if test x$with_libnl != xno ; then if test x$with_libnl != xno ; then
AC_CHECK_LIB(nl, nl_handle_alloc, #
LIBS="-lnl $LIBS" # Try libnl 2.x first.
AC_DEFINE(HAVE_LIBNL,1,[if libnl exists]), #
if test x$with_libnl = xyes ; then AC_CHECK_LIB(nl, nl_socket_alloc,
AC_MSG_ERROR([libnl support requested but libnl not found]) [
fi #
) # Yes, we have libnl 2.x.
#
LIBS="-lnl-genl -lnl $LIBS"
AC_DEFINE(HAVE_LIBNL,1,[if libnl exists])
AC_DEFINE(HAVE_LIBNL_2_x,1,[if libnl exists and is version 2.x])
],
[
#
# No, we don't; do we have libnl 1.x?
#
AC_CHECK_LIB(nl, nl_handle_alloc,
[
#
# Yes.
#
LIBS="-lnl $LIBS"
AC_DEFINE(HAVE_LIBNL,1,[if libnl exists])
],
[
#
# No, we don't have libnl at all.
#
if test x$with_libnl = xyes ; then
AC_MSG_ERROR([libnl support requested but libnl not found])
fi
])
])
fi fi
AC_LBL_TPACKET_STATS AC_LBL_TPACKET_STATS
@ -1365,7 +1391,19 @@ linux*)
fi fi
AC_DEFINE_UNQUOTED(LINUX_USB_MON_DEV, "/dev/$ac_usb_dev_name", [path for device for USB sniffing]) AC_DEFINE_UNQUOTED(LINUX_USB_MON_DEV, "/dev/$ac_usb_dev_name", [path for device for USB sniffing])
AC_MSG_NOTICE(Device for USB sniffing is /dev/$ac_usb_dev_name) AC_MSG_NOTICE(Device for USB sniffing is /dev/$ac_usb_dev_name)
AC_CHECK_HEADERS(linux/usbdevice_fs.h) #
# Do we have a version of <linux/compiler.h> available?
# If so, we might need it for <linux/usbdevice_fs.h>.
#
AC_CHECK_HEADERS(linux/compiler.h)
if test "$ac_cv_header_linux_compiler_h" = yes; then
#
# Yes - include it when testing for <linux/usbdevice_fs.h>.
#
AC_CHECK_HEADERS(linux/usbdevice_fs.h,,,[#include <linux/compiler.h>])
else
AC_CHECK_HEADERS(linux/usbdevice_fs.h)
fi
if test "$ac_cv_header_linux_usbdevice_fs_h" = yes; then if test "$ac_cv_header_linux_usbdevice_fs_h" = yes; then
# #
# OK, does it define bRequestType? Older versions of the kernel # OK, does it define bRequestType? Older versions of the kernel
@ -1380,6 +1418,9 @@ AC_INCLUDES_DEFAULT
#ifdef HAVE_SYS_BITYPES_H #ifdef HAVE_SYS_BITYPES_H
#include <sys/bitypes.h> #include <sys/bitypes.h>
#endif #endif
#ifdef HAVE_LINUX_COMPILER_H
#include <linux/compiler.h>
#endif
# include <linux/usbdevice_fs.h>], # include <linux/usbdevice_fs.h>],
[u_int i = sizeof(((struct usbdevfs_ctrltransfer *)0)->bRequestType)], [u_int i = sizeof(((struct usbdevfs_ctrltransfer *)0)->bRequestType)],
ac_cv_usbdevfs_ctrltransfer_has_bRequestType=yes, ac_cv_usbdevfs_ctrltransfer_has_bRequestType=yes,

View File

@ -47,7 +47,7 @@ static const char rcsid[] _U_ =
* XXX - why was this included even on UNIX? * XXX - why was this included even on UNIX?
*/ */
#ifdef __MINGW32__ #ifdef __MINGW32__
#include "IP6_misc.h" #include "ip6_misc.h"
#endif #endif
#ifndef WIN32 #ifndef WIN32

6
inet.c
View File

@ -881,8 +881,10 @@ pcap_lookupdev(errbuf)
*/ */
while(NAdapts--) while(NAdapts--)
{ {
strcpy((char*)tUstr, tAstr); char* tmp = (char*)tUstr;
(char*)tUstr += strlen(tAstr) + 1;; strcpy(tmp, tAstr);
tmp += strlen(tAstr) + 1;
tUstr = (WCHAR*)tmp;
tAstr += strlen(tAstr) + 1; tAstr += strlen(tAstr) + 1;
} }

View File

@ -735,6 +735,24 @@ static const char rcsid[] _U_ =
*/ */
#define LINKTYPE_IEEE802_15_4_NOFCS 230 #define LINKTYPE_IEEE802_15_4_NOFCS 230
/*
* Raw D-Bus:
*
* http://www.freedesktop.org/wiki/Software/dbus
*
* messages:
*
* http://dbus.freedesktop.org/doc/dbus-specification.html#message-protocol-messages
*
* starting with the endianness flag, followed by the message type, etc.,
* but without the authentication handshake before the message sequence:
*
* http://dbus.freedesktop.org/doc/dbus-specification.html#auth-protocol
*
* Requested by Martin Vidner <martin@vidner.net>.
*/
#define LINKTYPE_DBUS 231
static struct linktype_map { static struct linktype_map {
int dlt; int dlt;
@ -1084,6 +1102,9 @@ static struct linktype_map {
/* IEEE 802.15.4 exactly as it appears in the spec, without FCS */ /* IEEE 802.15.4 exactly as it appears in the spec, without FCS */
{ DLT_IEEE802_15_4_NOFCS, LINKTYPE_IEEE802_15_4_NOFCS }, { DLT_IEEE802_15_4_NOFCS, LINKTYPE_IEEE802_15_4_NOFCS },
/* D-Bus messages */
{ DLT_DBUS, LINKTYPE_DBUS },
{ -1, -1 } { -1, -1 }
}; };

View File

@ -4,6 +4,13 @@
# Script to give the appropriate compiler flags and linker flags # Script to give the appropriate compiler flags and linker flags
# to use when building code that uses libpcap. # to use when building code that uses libpcap.
# #
prefix="@prefix@"
exec_prefix="@exec_prefix@"
includedir="@includedir@"
libdir="@libdir@"
V_RPATH_OPT="@V_RPATH_OPT@"
LIBS="@LIBS@"
static=0 static=0
show_cflags=0 show_cflags=0
show_libs=0 show_libs=0
@ -29,14 +36,14 @@ do
esac esac
shift shift
done done
if [ "@V_RPATH_OPT@" != "" ] if [ "$V_RPATH_OPT" != "" ]
then then
# #
# If libdir isn't /usr/lib, add it to the run-time linker path. # If libdir isn't /usr/lib, add it to the run-time linker path.
# #
if [ "@libdir@" != "/usr/lib" ] if [ "$libdir" != "/usr/lib" ]
then then
RPATH=@V_RPATH_OPT@@libdir@ RPATH=$V_RPATH_OPT$libdir
fi fi
fi fi
if [ "$static" = 1 ] if [ "$static" = 1 ]
@ -47,19 +54,19 @@ then
# #
if [ "$show_cflags" = 1 -a "$show_libs" = 1 ] if [ "$show_cflags" = 1 -a "$show_libs" = 1 ]
then then
echo "-I@includedir@ -L@libdir@ -lpcap @LIBS@" echo "-I$includedir -L$libdir -lpcap $LIBS"
elif [ "$show_cflags" = 1 -a "$show_additional_libs" = 1 ] elif [ "$show_cflags" = 1 -a "$show_additional_libs" = 1 ]
then then
echo "-I@includedir@ -L@libdir@ @LIBS@" echo "-I$includedir -L$libdir $LIBS"
elif [ "$show_cflags" = 1 ] elif [ "$show_cflags" = 1 ]
then then
echo "-I@includedir@" echo "-I$includedir"
elif [ "$show_libs" = 1 ] elif [ "$show_libs" = 1 ]
then then
echo "-L@libdir@ -lpcap @LIBS@" echo "-L$libdir -lpcap $LIBS"
elif [ "$show_additional_libs" = 1 ] elif [ "$show_additional_libs" = 1 ]
then then
echo "@LIBS@" echo "$LIBS"
fi fi
else else
# #
@ -68,15 +75,15 @@ else
# #
if [ "$show_cflags" = 1 -a "$show_libs" = 1 ] if [ "$show_cflags" = 1 -a "$show_libs" = 1 ]
then then
echo "-I@includedir@ -L@libdir@ $RPATH -lpcap" echo "-I$includedir -L$libdir $RPATH -lpcap"
elif [ "$show_cflags" = 1 -a "$show_additional_libs" = 1 ] elif [ "$show_cflags" = 1 -a "$show_additional_libs" = 1 ]
then then
echo "-I@includedir@" echo "-I$includedir"
elif [ "$show_cflags" = 1 ] elif [ "$show_cflags" = 1 ]
then then
echo "-I@includedir@" echo "-I$includedir"
elif [ "$show_libs" = 1 ] elif [ "$show_libs" = 1 ]
then then
echo "-L@libdir@ $RPATH -lpcap" echo "-L$libdir $RPATH -lpcap"
fi fi
fi fi

View File

@ -537,8 +537,41 @@ get_mac80211_phydev(pcap_t *handle, const char *device, char *phydev_path,
return 1; return 1;
} }
#ifdef HAVE_LIBNL_2_x
#define get_nl_errmsg nl_geterror
#else
/* libnl 2.x compatibility code */
#define nl_sock nl_handle
static inline struct nl_handle *
nl_socket_alloc(void)
{
return nl_handle_alloc();
}
static inline void
nl_socket_free(struct nl_handle *h)
{
nl_handle_destroy(h);
}
#define get_nl_errmsg strerror
static inline int
__genl_ctrl_alloc_cache(struct nl_handle *h, struct nl_cache **cache)
{
struct nl_cache *tmp = genl_ctrl_alloc_cache(h);
if (!tmp)
return -ENOMEM;
*cache = tmp;
return 0;
}
#define genl_ctrl_alloc_cache __genl_ctrl_alloc_cache
#endif /* !HAVE_LIBNL_2_x */
struct nl80211_state { struct nl80211_state {
struct nl_handle *nl_handle; struct nl_sock *nl_sock;
struct nl_cache *nl_cache; struct nl_cache *nl_cache;
struct genl_family *nl80211; struct genl_family *nl80211;
}; };
@ -546,23 +579,26 @@ struct nl80211_state {
static int static int
nl80211_init(pcap_t *handle, struct nl80211_state *state, const char *device) nl80211_init(pcap_t *handle, struct nl80211_state *state, const char *device)
{ {
state->nl_handle = nl_handle_alloc(); int err;
if (!state->nl_handle) {
state->nl_sock = nl_socket_alloc();
if (!state->nl_sock) {
snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
"%s: failed to allocate netlink handle", device); "%s: failed to allocate netlink handle", device);
return PCAP_ERROR; return PCAP_ERROR;
} }
if (genl_connect(state->nl_handle)) { if (genl_connect(state->nl_sock)) {
snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
"%s: failed to connect to generic netlink", device); "%s: failed to connect to generic netlink", device);
goto out_handle_destroy; goto out_handle_destroy;
} }
state->nl_cache = genl_ctrl_alloc_cache(state->nl_handle); err = genl_ctrl_alloc_cache(state->nl_sock, &state->nl_cache);
if (!state->nl_cache) { if (err < 0) {
snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
"%s: failed to allocate generic netlink cache", device); "%s: failed to allocate generic netlink cache: %s",
device, get_nl_errmsg(-err));
goto out_handle_destroy; goto out_handle_destroy;
} }
@ -578,7 +614,7 @@ nl80211_init(pcap_t *handle, struct nl80211_state *state, const char *device)
out_cache_free: out_cache_free:
nl_cache_free(state->nl_cache); nl_cache_free(state->nl_cache);
out_handle_destroy: out_handle_destroy:
nl_handle_destroy(state->nl_handle); nl_socket_free(state->nl_sock);
return PCAP_ERROR; return PCAP_ERROR;
} }
@ -587,7 +623,7 @@ nl80211_cleanup(struct nl80211_state *state)
{ {
genl_family_put(state->nl80211); genl_family_put(state->nl80211);
nl_cache_free(state->nl_cache); nl_cache_free(state->nl_cache);
nl_handle_destroy(state->nl_handle); nl_socket_free(state->nl_sock);
} }
static int static int
@ -615,12 +651,19 @@ add_mon_if(pcap_t *handle, int sock_fd, struct nl80211_state *state,
NLA_PUT_STRING(msg, NL80211_ATTR_IFNAME, mondevice); NLA_PUT_STRING(msg, NL80211_ATTR_IFNAME, mondevice);
NLA_PUT_U32(msg, NL80211_ATTR_IFTYPE, NL80211_IFTYPE_MONITOR); NLA_PUT_U32(msg, NL80211_ATTR_IFTYPE, NL80211_IFTYPE_MONITOR);
err = nl_send_auto_complete(state->nl_handle, msg); err = nl_send_auto_complete(state->nl_sock, msg);
if (err < 0) { if (err < 0) {
#ifdef HAVE_LIBNL_2_x
if (err == -NLE_FAILURE) {
#else
if (err == -ENFILE) { if (err == -ENFILE) {
#endif
/* /*
* Device not available; our caller should just * Device not available; our caller should just
* keep trying. * keep trying. (libnl 2.x maps ENFILE to
* NLE_FAILURE; it can also map other errors
* to that, but there's not much we can do
* about that.)
*/ */
nlmsg_free(msg); nlmsg_free(msg);
return 0; return 0;
@ -631,17 +674,24 @@ add_mon_if(pcap_t *handle, int sock_fd, struct nl80211_state *state,
*/ */
snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
"%s: nl_send_auto_complete failed adding %s interface: %s", "%s: nl_send_auto_complete failed adding %s interface: %s",
device, mondevice, strerror(-err)); device, mondevice, get_nl_errmsg(-err));
nlmsg_free(msg); nlmsg_free(msg);
return PCAP_ERROR; return PCAP_ERROR;
} }
} }
err = nl_wait_for_ack(state->nl_handle); err = nl_wait_for_ack(state->nl_sock);
if (err < 0) { if (err < 0) {
#ifdef HAVE_LIBNL_2_x
if (err == -NLE_FAILURE) {
#else
if (err == -ENFILE) { if (err == -ENFILE) {
#endif
/* /*
* Device not available; our caller should just * Device not available; our caller should just
* keep trying. * keep trying. (libnl 2.x maps ENFILE to
* NLE_FAILURE; it can also map other errors
* to that, but there's not much we can do
* about that.)
*/ */
nlmsg_free(msg); nlmsg_free(msg);
return 0; return 0;
@ -652,7 +702,7 @@ add_mon_if(pcap_t *handle, int sock_fd, struct nl80211_state *state,
*/ */
snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
"%s: nl_wait_for_ack failed adding %s interface: %s", "%s: nl_wait_for_ack failed adding %s interface: %s",
device, mondevice, strerror(-err)); device, mondevice, get_nl_errmsg(-err));
nlmsg_free(msg); nlmsg_free(msg);
return PCAP_ERROR; return PCAP_ERROR;
} }
@ -695,47 +745,21 @@ del_mon_if(pcap_t *handle, int sock_fd, struct nl80211_state *state,
0, NL80211_CMD_DEL_INTERFACE, 0); 0, NL80211_CMD_DEL_INTERFACE, 0);
NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, ifindex); NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, ifindex);
err = nl_send_auto_complete(state->nl_handle, msg); err = nl_send_auto_complete(state->nl_sock, msg);
if (err < 0) { if (err < 0) {
if (err == -ENFILE) { snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
/* "%s: nl_send_auto_complete failed deleting %s interface: %s",
* Device not available; our caller should just device, mondevice, get_nl_errmsg(-err));
* keep trying. nlmsg_free(msg);
*/ return PCAP_ERROR;
nlmsg_free(msg);
return 0;
} else {
/*
* Real failure, not just "that device is not
* available.
*/
snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
"%s: nl_send_auto_complete failed deleting %s interface: %s",
device, mondevice, strerror(-err));
nlmsg_free(msg);
return PCAP_ERROR;
}
} }
err = nl_wait_for_ack(state->nl_handle); err = nl_wait_for_ack(state->nl_sock);
if (err < 0) { if (err < 0) {
if (err == -ENFILE) { snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
/* "%s: nl_wait_for_ack failed adding %s interface: %s",
* Device not available; our caller should just device, mondevice, get_nl_errmsg(-err));
* keep trying. nlmsg_free(msg);
*/ return PCAP_ERROR;
nlmsg_free(msg);
return 0;
} else {
/*
* Real failure, not just "that device is not
* available.
*/
snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
"%s: nl_wait_for_ack failed adding %s interface: %s",
device, mondevice, strerror(-err));
nlmsg_free(msg);
return PCAP_ERROR;
}
} }
/* /*

View File

@ -61,8 +61,15 @@ static const char rcsid[] _U_ =
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include <sys/mman.h> #include <sys/mman.h>
#ifdef HAVE_LINUX_USBDEVICE_FS_H #ifdef HAVE_LINUX_USBDEVICE_FS_H
/*
* We might need <linux/compiler.h> to define __user for
* <linux/usbdevice_fs.h>.
*/
#ifdef HAVE_LINUX_COMPILER_H
#include <linux/compiler.h>
#endif /* HAVE_LINUX_COMPILER_H */
#include <linux/usbdevice_fs.h> #include <linux/usbdevice_fs.h>
#endif #endif /* HAVE_LINUX_USBDEVICE_FS_H */
#define USB_IFACE "usbmon" #define USB_IFACE "usbmon"
#define USB_TEXT_DIR_OLD "/sys/kernel/debug/usbmon" #define USB_TEXT_DIR_OLD "/sys/kernel/debug/usbmon"

View File

@ -39,7 +39,12 @@ static const char rcsid[] _U_ =
#include <pcap-int.h> #include <pcap-int.h>
#include <Packet32.h> #include <Packet32.h>
#ifdef __MINGW32__ #ifdef __MINGW32__
#ifdef __MINGW64__
#include <ntddndis.h>
#else /*__MINGW64__*/
#include <ddk/ntddndis.h>
#include <ddk/ndis.h> #include <ddk/ndis.h>
#endif /*__MINGW64__*/
#else /*__MINGW32__*/ #else /*__MINGW32__*/
#include <ntddndis.h> #include <ntddndis.h>
#endif /*__MINGW32__*/ #endif /*__MINGW32__*/

2
pcap.c
View File

@ -57,7 +57,7 @@ static const char rcsid[] _U_ =
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#if !defined(_MSC_VER) && !defined(__BORLANDC__) #if !defined(_MSC_VER) && !defined(__BORLANDC__) && !defined(__MINGW32__)
#include <unistd.h> #include <unistd.h>
#endif #endif
#include <fcntl.h> #include <fcntl.h>

View File

@ -969,10 +969,28 @@ struct bpf_version {
*/ */
#define DLT_IEEE802_15_4_NOFCS 230 #define DLT_IEEE802_15_4_NOFCS 230
/*
* Raw D-Bus:
*
* http://www.freedesktop.org/wiki/Software/dbus
*
* messages:
*
* http://dbus.freedesktop.org/doc/dbus-specification.html#message-protocol-messages
*
* starting with the endianness flag, followed by the message type, etc.,
* but without the authentication handshake before the message sequence:
*
* http://dbus.freedesktop.org/doc/dbus-specification.html#auth-protocol
*
* Requested by Martin Vidner <martin@vidner.net>.
*/
#define DLT_DBUS 231
/* /*
* DECT * DECT
*/ */
#define DLT_DECT_LINUX 231 #define DLT_DECT_LINUX 232
/* /*
* DLT and savefile link type values are split into a class and * DLT and savefile link type values are split into a class and

View File

@ -54,7 +54,7 @@ static const char rcsid[] _U_ =
#include <pcap-stdinc.h> #include <pcap-stdinc.h>
#ifdef __MINGW32__ #ifdef __MINGW32__
#include "IP6_misc.h" #include "ip6_misc.h"
#endif #endif
#else /* WIN32 */ #else /* WIN32 */
#include <sys/socket.h> /* for "struct sockaddr" in "struct addrinfo" */ #include <sys/socket.h> /* for "struct sockaddr" in "struct addrinfo" */

View File

@ -1053,7 +1053,7 @@ found:
/* /*
* Is the interface ID an interface we know? * Is the interface ID an interface we know?
*/ */
if (interface_id > p->sf.ifcount) { if (interface_id >= p->sf.ifcount) {
/* /*
* Yes. Fail. * Yes. Fail.
*/ */